Class ChannelInOut

extends Object
A bidirectional RMT setup that drives a single pin with both an In and an Out channel.
Single-wire, open-drain protocols (such as 1-Wire or DHTxx) need to both read from and write to the same pin. Each In or Out reserves the pin on its own, so two of them can't be created on the same GPIO independently. A ChannelInOut reserves the pin once, creates both channels on it, and releases everything again when close is called.
The in channel is created before the out channel, which is required for open-drain output to work.

Class summary


constructor pin/any --resolution/int --in-memory-blocks/int= --out-memory-blocks/int= --open-drain/bool= --pull-up/bool=
Constructs a bidirectional RMT setup on the given pin (a GPIO number).

Constructors

constructor pin/any --resolution/int --in-memory-blocks/int=1 --out-memory-blocks/int=1 --open-drain/bool=false --pull-up/bool=false
Constructs a bidirectional RMT setup on the given pin (a GPIO number).
The resolution, in-memory-blocks and out-memory-blocks are forwarded to the underlying In and Out channels. See In.constructor and Out.constructor.
If open-drain is set and pull-up is true, the pin's internal pull-up resistor is enabled.
Passing a gpio.Pin as pin is deprecated; provide the integer GPIO number instead. The gpio.Pin form will be removed in a future release.

Methods

close -> none
Closes both channels, and the pin if this object created it.

operator == other/any -> bool
Whether this object is equal to the other.
By default, identical is used for equality.
Inheritance
Classes overwrite this operator to get an equality specific to their needs. Equality operators often compare the type and field contents. For example:

class Pin:
  number/int

  constructor .number:

  operator == other:
    if other is not Pin: return false
    return number == other.number
A class doesn't have to follow the above format, but it must keep the operator in sync with any hash-code method. That is, if a class has a hash-code member, then the equality and hash-code must agree. If two instances are equal (a == b), then their hash codes must also be equal (a.hash-code == b.hash-code).

Stringifies this object.
Inheritance
Objects that need a human-friendly string representation should overwrite this method. The default string is based on the internal class-ID.

Fields

in / In
The input channel.

The output channel.

The shared pin both channels drive.