Class In

An RMT input channel.

Class summary


constructor pin/any --resolution/int --memory-blocks/int= --dma/bool=
Constructs an input channel on the given pin.

Constructors

constructor pin/any --resolution/int --memory-blocks/int=1 --dma/bool=false
Constructs an input channel on the given pin.
The pin is the GPIO number the channel reads from. The channel reserves the pin and releases it again when the channel is closed.
The resolution is the frequency of the clock that the RMT controller uses to sample the input signal. It ranges from 312500Hz (312.5KHz) to 80000000Hz (80MHz).
The memory-blocks parameter specifies the receive capacity in units of RMT memory blocks. Each unit has BYTES-PER-MEMORY-BLOCK bytes. Since each signal is 2 bytes long, the number of signals that can be received is memory-blocks * BYTES-PER-MEMORY-BLOCK / 2.
If dma is false, these are dedicated hardware memory blocks and only a small number are available. If dma is true, memory-blocks instead sizes an internal-RAM DMA buffer and can be much larger. DMA is only supported on some chips, including the ESP32P4 and ESP32S3.
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

apply-carrier frequency-hz/int --duty-factor/float --active-low/bool=false --always-on/bool=false -> none
Applies a carrier signal to the channel.
If active-low is true, the carrier is applied when the signal is low. Otherwise (the default) the carrier is applied when the signal is high.
The always-on parameter indicates whether the carrier is always applied, or only when signals are being sent. In other words, whether the carrier is also applied to the idle level. The ESP32 RMT controller *always* applies the carrier to the idle level, even if this parameter is set to false. This is a limitation of the hardware.

close -> none
Closes the channel.

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).

read --min-ns/int=0 --max-ns/int --max-signal-count/int=null -> Signals
Receives signals.
This is a convenience function that calls start-reading and wait-for-data.

reset -> none

start-reading --min-ns/int=0 --max-ns/int --max-signal-count/int=null -> none
Starts receiving signals for this channel.
The min-ns and max-ns parameters specify the minimum and maximum duration of the signals to be received. Any signal that is shorter than min-ns is ignored. If the level of the line stays the same for longer than the max-ns, the reception is stopped and the received signals are returned.
The min-ns is intended for glitch filtering and is limited to very small values (3200ns).
The max-signal-count parameter specifies the maximum number of signals that can be received. If not specified, uses the maximum number of signals that can fit into the memory blocks that were specified during construction.
The min-ns and max-ns parameters specify the minimum and maximum duration of a signal in nanoseconds. The max-signal-count parameter specifies the maximum number of signals that can be received. If it is not specified, it defaults to the number of signals that can be received in the memory blocks.

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.

Reads the signals that have been received.
Requires a call to start-reading.

Fields

Whether this channel uses DMA.

The resolution of this channel.
The frequency of the clock that the RMT controller uses to sample the input signal.