summaryrefslogtreecommitdiff
path: root/ports/esp32/esp32_rmt.c
diff options
context:
space:
mode:
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"));
}