rmt: support setting loop count at runtime

This commit is contained in:
morris 2020-09-09 15:28:14 +08:00
parent 19d92ef6b2
commit 467d44970e
2 changed files with 24 additions and 0 deletions

View File

@ -859,6 +859,19 @@ esp_err_t rmt_add_channel_to_group(rmt_channel_t channel);
esp_err_t rmt_remove_channel_from_group(rmt_channel_t channel);
#endif
#if SOC_RMT_SUPPORT_TX_LOOP_COUNT
/**
* @brief Set loop count for RMT TX channel
*
* @param channel RMT channel
* @param count loop count
* @return
* - ESP_ERR_INVALID_ARG Parameter error
* - ESP_OK Success
*/
esp_err_t rmt_set_tx_loop_count(rmt_channel_t channel, uint32_t count);
#endif
/**
* @brief Reset RMT TX/RX memory index.
*

View File

@ -1365,3 +1365,14 @@ esp_err_t rmt_memory_rw_rst(rmt_channel_t channel)
return ESP_OK;
}
#endif
#if SOC_RMT_SUPPORT_TX_LOOP_COUNT
esp_err_t rmt_set_tx_loop_count(rmt_channel_t channel, uint32_t count)
{
RMT_CHECK(RMT_IS_TX_CHANNEL(channel), RMT_CHANNEL_ERROR_STR, ESP_ERR_INVALID_ARG);
RMT_ENTER_CRITICAL();
rmt_ll_tx_set_loop_count(rmt_contex.hal.regs, channel, count);
RMT_EXIT_CRITICAL();
return ESP_OK;
}
#endif