EasyManua.ls Logo

Espressif ESP32-S2 - Page 354

Espressif ESP32-S2
1695 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
• The RMT transmitter has finished transmitting the signal - rmt_set_tx_intr_en()
• The number of events the transmitter has sent matches a threshold value rmt_set_tx_thr_intr_en()
• Ownership to the RMT memory block has been violated - rmt_set_err_intr_en()
Setting or clearing an interrupt enable mask for specific channels and events may be also done by calling
rmt_set_intr_enable_mask() or rmt_clr_intr_enable_mask().
When servicing an interrupt within an ISR, the interrupt need to explicitly cleared. To do so, set spe-
cific bits described as RMT.int_clr.val.chN_event_name and defined as a volatile struct in
soc/esp32s2/include/soc/rmt_struct.h, where N is the RMT channel number [0, n] and the event_name is one
of four events described above.
If you do not need an ISR anymore, you can deregister it by calling a function rmt_isr_deregister().
Warning: It’s not recommended for users to register an interrupt handler in their applications. RMT driver is
highly dependent on interrupt, especially when doing transaction in a ping-pong way, so the driver itself has regis-
tered a default handler called rmt_driver_isr_default. Instead, if what you want is to get a notification
when transaction is done, go ahead with rmt_register_tx_end_callback().
Uninstall Driver
If the RMT driver has been installed with rmt_driver_install() for some specific period of time and then
not required, the driver may be removed to free allocated resources by calling rmt_driver_uninstall().
Application Examples
• Using RMT to send morse code: peripherals/rmt/morse_code.
• Using RMT to drive RGB LED strip: peripherals/rmt/led_strip.
• NEC remote control TX and RX example: peripherals/rmt/ir_protocols.
• Musical buzzer example: peripherals/rmt/musical_buzzer.
API Reference
Header File
• components/driver/include/driver/rmt.h
Functions
esp_err_t rmt_set_clk_div(rmt_channel_t channel, uint8_t div_cnt)
Set RMT clock divider, channel clock is divided from source clock.
Return
• ESP_ERR_INVALID_ARG Parameter error
• ESP_OK Success
Parameters
• channel: RMT channel
• div_cnt: RMT counter clock divider
esp_err_t rmt_get_clk_div
(
rmt_channel_t channel
, uint8_t *
div_cnt
)
Get RMT clock divider, channel clock is divided from source clock.
Return
• ESP_ERR_INVALID_ARG Parameter error
• ESP_OK Success
Parameters
• channel: RMT channel
• div_cnt: pointer to accept RMT counter divider
Espressif Systems 343
Submit Document Feedback
Release v4.4

Table of Contents