feat(rmt): allow to set init level before any tx transmission

Closes https://github.com/espressif/esp-idf/issues/16068
This commit is contained in:
Chen Jichang
2025-06-12 18:18:30 +08:00
parent ccf13b9732
commit 6a17241f1f
2 changed files with 2 additions and 1 deletions

View File

@@ -46,6 +46,7 @@ typedef struct {
uint32_t io_od_mode: 1; /*!< Configure the GPIO as open-drain mode */
uint32_t allow_pd: 1; /*!< If set, driver allows the power domain to be powered off when system enters sleep mode.
This can save power, but at the expense of more RAM being consumed to save register context. */
uint32_t init_level: 1; /*!< Set the initial level of the RMT channel signal */
} flags; /*!< TX channel config flags */
} rmt_tx_channel_config_t;

View File

@@ -344,7 +344,7 @@ esp_err_t rmt_new_tx_channel(const rmt_tx_channel_config_t *config, rmt_channel_
// disable carrier modulation by default, can re-enable by `rmt_apply_carrier()`
rmt_ll_tx_enable_carrier_modulation(hal->regs, channel_id, false);
// idle level is determined by register value
rmt_ll_tx_fix_idle_level(hal->regs, channel_id, 0, true);
rmt_ll_tx_fix_idle_level(hal->regs, channel_id, config->flags.init_level, true);
// always enable tx wrap, both DMA mode and ping-pong mode rely this feature
rmt_ll_tx_enable_wrap(hal->regs, channel_id, true);