Chapter 2. API Reference
Finalize Configuration
invoked with
rmt_config()
The last configuration step is installation of the driver in memory by calling rmt_driver_install(). If
rx_buf_size parameter of this function is > 0, then a ring buffer for incoming data will be allocated. A de-
fault ISR handler will be installed, see a note in
Now, depending on how the channel is configured, we are ready to either
described in next two sections.
Transmit Data
Before being able to transmit some RMT pulses, we need to define the pulse pattern. The minimum pattern recognized
by the RMT controller, later called an 'item', is provided in a structure rmt_item32_t. Each item consists of
two pairs of two values. The first value in a pair describes the signal duration in ticks and is 15 bits long, the second
provides the signal level (high or low) and is contained in a single bit. A block of couple of items and the structure
of an item is presented below.
For a simple example how to define a block of items see peripherals/rmt/morse_code.
The items are provided to the RMT controller by calling function rmt_write_items(). This function also
automatically triggers start of transmission. It may be called to wait for transmission completion or exit just after
transmission start. In such case you can wait for the transmission end by calling rmt_wait_tx_done(). This
function does not limit the number of data items to transmit. It is using an interrupt to successively copy the new data
chunks to RMT's internal memory as previously provided data are sent out.
Another way to provide data for transmission is by calling rmt_fill_tx_items(). In this case transmission
is not started automatically. To control the transmission process use
The number of items to sent is restricted by the size of memory blocks allocated in the RMT controller's internal
memory, see rmt_set_mem_block_num().
Receive Data
Before starting the receiver we need some storage for incoming items. The RMT controller has 256 x 32-bits of
internal RAM shared between all four channels.
In typical scenarios it is not enough as an ultimate storage for all incoming (and outgoing) items. Therefore this
API supports retrieval of incoming items on the fly to save them in a ring buffer of a size defined by the user. The
Espressif Systems
Once the
rmt_config_t
to make the configuration effective.
Use
Interrupts.
Fig. 10: Structure of RMT items (L - signal level)
Submit Document Feedback
structure is populated with parameters, it should be then
Transmit Data
rmt_tx_start()
341
or
Receive
Data. This is
and rmt_tx_stop().
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?