Library rmt

To use this library in your code:

import rmt
Support for the ESP32 Remote Control (RMT).
A Channel corresponds to a channel in the ESP32 RMT controller.
Signals represent a collection of signals to be sent by the RMT controller.
Hardware differences
The ESP32 has 8 RMT channels, each of which can be configured for input or output.
The ESP32C3 and ESP32C6 each have 2 TX and 2 RX channels.
The ESP32P4, ESP32S2 and ESP32S3 each have 4 TX and 4 RX channels.
The number of bytes per memory block is 256 on the ESP32 and ESP32S2. It is 192 on the ESP32C3, ESP32C6, ESP32P4, and ESP32S3.
RMT DMA is available on the ESP32P4 and ESP32S3. DMA-capable channels consume an internal DMA channel and internal RAM, so DMA is disabled by default.
Examples
Pulse
Emits a precisely timed pulse of 50us on pin 18.

import rmt

main:
  // Create an output channel on pin 18 with a resolution of 1MHz.
  channel := rmt.Out 18 --resolution=1_000_000
  pulse := rmt.Signals 2
  pulse.set 0 --level=1 --period=50  // In ticks of the specified resolution.
  pulse.set 1 --level=1 --period=50
  channel.write pulse --done-level=0
  channel.close

Classes

An RMT channel.

A bidirectional RMT setup that drives a single pin with both an In and an Out channel.

An encoder for the RMT controller.

An RMT input channel.

An RMT channel.

A collection of signals to be written or read with the RMT controller.

Synchronizes the output of multiple Out channels.

Globals

The number of bytes per memory block.
On the ESP32 and ESP32S2 it is 256.
On the ESP32C3, ESP32C6, ESP32P4, and ESP32S3 it is 192.

Whether this ESP32 variant supports RMT channels backed by DMA.