summaryrefslogtreecommitdiff
path: root/ports/esp32/esp32_rmt.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2021-11-11 23:36:27 +1100
committerDamien George <damien@micropython.org>2021-12-22 12:04:13 +1100
commit599b61c08687ca077e3b0e115d5b76affcc673ca (patch)
tree199a3309fb92ae915cff29b9d664ea686151c823 /ports/esp32/esp32_rmt.c
parent09fe80d0912b2418fb704cf8e80db1712fb7523f (diff)
esp32/machine_bitstream: Replace bit-bang code with RMT-based driver.
This aims to solve glitching issues on long neopixel strips. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'ports/esp32/esp32_rmt.c')
-rw-r--r--ports/esp32/esp32_rmt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ports/esp32/esp32_rmt.c b/ports/esp32/esp32_rmt.c
index 37ecef324..1a7e77b9d 100644
--- a/ports/esp32/esp32_rmt.c
+++ b/ports/esp32/esp32_rmt.c
@@ -29,6 +29,8 @@
#include "mphalport.h"
#include "driver/rmt.h"
+#include "modesp32.h"
+
// This exposes the ESP32's RMT module to MicroPython. RMT is provided by the Espressif ESP-IDF:
//
// https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/rmt.html
@@ -73,6 +75,10 @@ STATIC mp_obj_t esp32_rmt_make_new(const mp_obj_type_t *type, size_t n_args, siz
mp_uint_t idle_level = args[3].u_bool;
mp_obj_t tx_carrier_obj = args[4].u_obj;
+ if (channel_id == MICROPY_HW_ESP32_RMT_CHANNEL_BITSTREAM) {
+ mp_raise_ValueError(MP_ERROR_TEXT("reserved channel id"));
+ }
+
if (clock_div < 1 || clock_div > 255) {
mp_raise_ValueError(MP_ERROR_TEXT("clock_div must be between 1 and 255"));
}