diff --git a/components/FastLED-idf/platforms/esp/32/clockless_rmt_esp32.h b/components/FastLED-idf/platforms/esp/32/clockless_rmt_esp32.h index 0ceec21..9039b49 100644 --- a/components/FastLED-idf/platforms/esp/32/clockless_rmt_esp32.h +++ b/components/FastLED-idf/platforms/esp/32/clockless_rmt_esp32.h @@ -186,6 +186,33 @@ static xSemaphoreHandle gTX_sem = NULL; static bool gInitialized = false; +// convert an integer channel into their enums. +// +static rmt_channel_t fastled_get_rmt_channel(int ch) { + assert((ch >= 0) && (ch < 8)); + switch (ch) { + case 0: + return(RMT_CHANNEL_0); + case 1: + return(RMT_CHANNEL_1); + case 2: + return(RMT_CHANNEL_2); + case 3: + return(RMT_CHANNEL_3); + case 4: + return(RMT_CHANNEL_4); + case 5: + return(RMT_CHANNEL_5); + case 6: + return(RMT_CHANNEL_6); + case 7: + return(RMT_CHANNEL_7); + } + return(RMT_CHANNEL_0); +} + + + template class ClocklessController : public CPixelLEDController { @@ -253,15 +280,13 @@ protected: gOnChannel[i] = NULL; // -- RMT configuration for transmission - rmt_config_t rmt_tx; - rmt_tx.channel = rmt_channel_t(i); - rmt_tx.rmt_mode = RMT_MODE_TX; - rmt_tx.gpio_num = mPin; // The particular pin will be assigned later - rmt_tx.mem_block_num = 1; + rmt_config_t rmt_tx = RMT_DEFAULT_CONFIG_TX(mPin, fastled_get_rmt_channel(i) ); + rmt_tx.clk_div = DIVIDER; + // don't wish to have a carrier applied. Therefore carrier_en is false and the extra parameters don't matter. rmt_tx.tx_config.loop_en = false; - rmt_tx.tx_config.carrier_level = RMT_CARRIER_LEVEL_LOW; rmt_tx.tx_config.carrier_en = false; + rmt_tx.tx_config.idle_level = RMT_IDLE_LEVEL_LOW; rmt_tx.tx_config.idle_output_en = true;