Skip to content

Commit 6c3d275

Browse files
committed
fix(rmt): treat loop once as no loop
1 parent 4e03f8d commit 6c3d275

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

components/esp_driver_rmt/src/rmt_tx.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ esp_err_t rmt_transmit(rmt_channel_handle_t channel, rmt_encoder_t *encoder, con
521521
ESP_RETURN_ON_FALSE(channel && encoder && payload && payload_bytes && config, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
522522
ESP_RETURN_ON_FALSE(channel->direction == RMT_CHANNEL_DIRECTION_TX, ESP_ERR_INVALID_ARG, TAG, "invalid channel direction");
523523
#if !SOC_RMT_SUPPORT_TX_LOOP_COUNT
524-
ESP_RETURN_ON_FALSE(config->loop_count <= 0, ESP_ERR_NOT_SUPPORTED, TAG, "loop count is not supported");
524+
ESP_RETURN_ON_FALSE(config->loop_count <= 1, ESP_ERR_NOT_SUPPORTED, TAG, "loop count is not supported");
525525
#endif // !SOC_RMT_SUPPORT_TX_LOOP_COUNT
526526
#if CONFIG_RMT_TX_ISR_CACHE_SAFE
527527
// payload is retrieved by the encoder, we should make sure it's still accessible even when the cache is disabled
@@ -546,7 +546,8 @@ esp_err_t rmt_transmit(rmt_channel_handle_t channel, rmt_encoder_t *encoder, con
546546
t->encoder = encoder;
547547
t->payload = payload;
548548
t->payload_bytes = payload_bytes;
549-
t->loop_count = config->loop_count;
549+
// treat loop_count == 1 as no loop
550+
t->loop_count = config->loop_count == 1 ? 0 : config->loop_count;
550551
t->remain_loop_count = t->loop_count;
551552
t->flags.eot_level = config->flags.eot_level;
552553

0 commit comments

Comments
 (0)