mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
fix(rmt): treat loop once as no loop
This commit is contained in:
committed by
Chen Ji Chang
parent
e10d4a82c2
commit
5aad83f90f
@@ -475,7 +475,7 @@ esp_err_t rmt_transmit(rmt_channel_handle_t channel, rmt_encoder_t *encoder, con
|
||||
ESP_RETURN_ON_FALSE(channel && encoder && payload && payload_bytes && config, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||
ESP_RETURN_ON_FALSE(channel->direction == RMT_CHANNEL_DIRECTION_TX, ESP_ERR_INVALID_ARG, TAG, "invalid channel direction");
|
||||
#if !SOC_RMT_SUPPORT_TX_LOOP_COUNT
|
||||
ESP_RETURN_ON_FALSE(config->loop_count <= 0, ESP_ERR_NOT_SUPPORTED, TAG, "loop count is not supported");
|
||||
ESP_RETURN_ON_FALSE(config->loop_count <= 1, ESP_ERR_NOT_SUPPORTED, TAG, "loop count is not supported");
|
||||
#endif // !SOC_RMT_SUPPORT_TX_LOOP_COUNT
|
||||
#if CONFIG_RMT_ISR_IRAM_SAFE
|
||||
// payload is retrieved by the encoder, we should make sure it's still accessible even when the cache is disabled
|
||||
@@ -500,7 +500,8 @@ esp_err_t rmt_transmit(rmt_channel_handle_t channel, rmt_encoder_t *encoder, con
|
||||
t->encoder = encoder;
|
||||
t->payload = payload;
|
||||
t->payload_bytes = payload_bytes;
|
||||
t->loop_count = config->loop_count;
|
||||
// treat loop_count == 1 as no loop
|
||||
t->loop_count = config->loop_count == 1 ? 0 : config->loop_count;
|
||||
t->remain_loop_count = t->loop_count;
|
||||
t->flags.eot_level = config->flags.eot_level;
|
||||
|
||||
@@ -603,7 +604,7 @@ static size_t IRAM_ATTR rmt_encode_check_result(rmt_tx_channel_t *tx_chan, rmt_t
|
||||
// for loop transaction, the memory block should accommodate all encoded RMT symbols and an extra EOF symbol
|
||||
if (t->loop_count != 0) {
|
||||
size_t limit_symbols = tx_chan->base.mem_block_num * SOC_RMT_MEM_WORDS_PER_CHANNEL;
|
||||
if (unlikely(encoded_symbols > limit_symbols)) {
|
||||
if (unlikely(encoded_symbols > limit_symbols || (encoded_symbols == limit_symbols && is_mem_full))) {
|
||||
ESP_DRAM_LOGE(TAG, "encoding artifacts can't exceed hw memory block for loop transmission");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user