Skip to content

Commit

Permalink
Use correct cancel value for gpio_matrix_out on esp32c3
Browse files Browse the repository at this point in the history
The documentation for gpio_matrix_out on esp32c3 is incorrect
(espressif/esp-idf#11737), and 0x80
needs to be used instead of 0x100.  Add an #ifdef for all of
the supported platforms and use the value listed in the TRM
for each.  The TRM for esp32h2 lists the GPIO Matrix documentation
as "to be added later", so assume the previously used 0x100 value
is correct for that platform.

Fixes FastLED#1498
  • Loading branch information
colincross committed Jun 24, 2023
1 parent 23c67b7 commit 5825abf
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/platforms/esp/32/clockless_rmt_esp32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,21 @@ void IRAM_ATTR ESP32RMTController::doneOnChannel(rmt_channel_t channel, void * a
ESP32RMTController * pController = gOnChannel[channel];

// -- Turn off output on the pin
// SZG: Do I really need to do this?
// Otherwise the pin will stay connected to the RMT controller,
// and if the same RMT controller is used for another output
// pin the RMT output will be routed to both pins.
// Warning: the documentation for gpio_matrix_out is wrong on some
// platforms (https://github.com/espressif/esp-idf/issues/11737),
// and the value to reset the pin to be a GPIO is sometimes different
// than 0x100. Check the TRM for the GPIO_FUNCn_OUT_SEL field to
// find the right value.
#if CONFIG_IDF_TARGET_ESP32C3
gpio_matrix_out(pController->mPin, 0x80, 0, 0);
#elif CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
gpio_matrix_out(pController->mPin, 0x100, 0, 0);
#else
#error Not yet implemented for unknown ESP32 target
#endif

// -- Turn off the interrupts
// rmt_set_tx_intr_en(channel, false);
Expand Down

0 comments on commit 5825abf

Please sign in to comment.