From 79ae7098cab1eb464ef046cfcbdc9d512bd835dc Mon Sep 17 00:00:00 2001 From: Simon Baatz Date: Sun, 2 Jan 2022 00:30:37 +0100 Subject: [PATCH] esp32/machine_bitstream: Fix signal duplication on output pins. After changing the bitstream implementation to use the RMT driver in commit 72d86158121e32bbabaeade08f449d507bf40f9a ("esp32/machine_bitstream.c: Replace with RMT-based driver."), using multiple `Neopixel` instances shows signal duplication between the instances (i.e. a `write()` on one instance is written to all instances). On invocation, the rmt driver configures the GPIO matrix to route the output signal to the respective GPIO pin. When called for a different `NeoPixel` instance using a different pin, the new route is established, but the old route still exists. Now, the RMT output signal is sent to both pins. Fix this by setting the standard GPIO output function for the current pin after uninstalling the RMT driver. Signed-off-by: Simon Baatz --- ports/esp32/machine_bitstream.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/esp32/machine_bitstream.c b/ports/esp32/machine_bitstream.c index 9854b83434..4ba05e8895 100644 --- a/ports/esp32/machine_bitstream.c +++ b/ports/esp32/machine_bitstream.c @@ -133,6 +133,9 @@ void machine_bitstream_high_low(mp_hal_pin_obj_t pin, uint32_t *timing_ns, const // Uninstall the driver. check_esp_err(rmt_driver_uninstall(config.channel)); + + // Cancel RMT output to GPIO pin. + gpio_matrix_out(pin, SIG_GPIO_OUT_IDX, false, false); } #endif // MICROPY_PY_MACHINE_BITSTREAM