Skip to content

Commit f820335

Browse files
committed
esp32: Do not build rmt code for ESP32C2.
Signed-off-by: Rick Sorensen <[email protected]>
1 parent b2d1f67 commit f820335

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

ports/esp32/esp32_rmt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#include "modesp32.h"
3333

3434
#include "esp_task.h"
35+
36+
#if SOC_RMT_SUPPORTED
3537
#include "driver/rmt_tx.h"
3638
#include "driver/rmt_encoder.h"
3739

@@ -420,3 +422,5 @@ MP_DEFINE_CONST_OBJ_TYPE(
420422
locals_dict, &esp32_rmt_locals_dict,
421423
protocol, &esp32_rmt_stream_p
422424
);
425+
426+
#endif // SOC_RMT_SUPPORTED

ports/esp32/machine_bitstream.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ static void IRAM_ATTR machine_bitstream_high_low_bitbang(mp_hal_pin_obj_t pin, u
9090
mp_hal_quiet_timing_exit(irq_state);
9191
}
9292

93+
#if SOC_RMT_SUPPORTED
9394
/******************************************************************************/
9495
// RMT implementation
9596

@@ -166,16 +167,17 @@ static void machine_bitstream_high_low_rmt(mp_hal_pin_obj_t pin, uint32_t *timin
166167
esp_rom_gpio_connect_out_signal(pin, SIG_GPIO_OUT_IDX, false, false);
167168
}
168169

170+
#endif
169171
/******************************************************************************/
170172
// Interface to machine.bitstream
171173

172174
void machine_bitstream_high_low(mp_hal_pin_obj_t pin, uint32_t *timing_ns, const uint8_t *buf, size_t len) {
173-
if (false) {
174-
// TODO test whether channel creation was successful?
175-
machine_bitstream_high_low_bitbang(pin, timing_ns, buf, len);
176-
} else {
177-
machine_bitstream_high_low_rmt(pin, timing_ns, buf, len);
178-
}
175+
#if SOC_RMT_SUPPORTED
176+
machine_bitstream_high_low_rmt(pin, timing_ns, buf, len);
177+
#else
178+
// TODO test whether channel creation was successful?
179+
machine_bitstream_high_low_bitbang(pin, timing_ns, buf, len);
180+
#endif
179181
}
180182

181183
#endif // MICROPY_PY_MACHINE_BITSTREAM

0 commit comments

Comments
 (0)