From b78dd56686eb867869a1936d76a75030905bac91 Mon Sep 17 00:00:00 2001 From: IcedRooibos <47491349+IcedRooibos@users.noreply.github.com> Date: Thu, 13 Apr 2023 21:28:48 +0800 Subject: [PATCH] Fix looping behavior for RMT --- ports/esp32/esp32_rmt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ports/esp32/esp32_rmt.c b/ports/esp32/esp32_rmt.c index 78c8c8aceeffb..a74d41d03e761 100644 --- a/ports/esp32/esp32_rmt.c +++ b/ports/esp32/esp32_rmt.c @@ -325,14 +325,16 @@ STATIC mp_obj_t esp32_rmt_write_pulses(size_t n_args, const mp_obj_t *args) { } check_esp_err(rmt_wait_tx_done(self->channel_id, portMAX_DELAY)); } - - check_esp_err(rmt_write_items(self->channel_id, self->items, num_items, false)); - + if (self->loop_en) { check_esp_err(rmt_set_tx_intr_en(self->channel_id, false)); check_esp_err(rmt_set_tx_loop_mode(self->channel_id, true)); } + check_esp_err(rmt_write_items(self->channel_id, self->items, num_items, false)); + + + return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_rmt_write_pulses_obj, 2, 3, esp32_rmt_write_pulses);