forked from bbulkow/FastLED-idf
I notice the example code uses the default constructor, which
seems to also set a few different optional parameters. Let's use that default constructor, it seems to make the code more stable.
This commit is contained in:
@@ -186,6 +186,33 @@ static xSemaphoreHandle gTX_sem = NULL;
|
|||||||
|
|
||||||
static bool gInitialized = false;
|
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 <int DATA_PIN, int T1, int T2, int T3, EOrder RGB_ORDER = RGB, int XTRA0 = 0, bool FLIP = false, int WAIT_TIME = 5>
|
template <int DATA_PIN, int T1, int T2, int T3, EOrder RGB_ORDER = RGB, int XTRA0 = 0, bool FLIP = false, int WAIT_TIME = 5>
|
||||||
class ClocklessController : public CPixelLEDController<RGB_ORDER>
|
class ClocklessController : public CPixelLEDController<RGB_ORDER>
|
||||||
{
|
{
|
||||||
@@ -253,15 +280,13 @@ protected:
|
|||||||
gOnChannel[i] = NULL;
|
gOnChannel[i] = NULL;
|
||||||
|
|
||||||
// -- RMT configuration for transmission
|
// -- RMT configuration for transmission
|
||||||
rmt_config_t rmt_tx;
|
rmt_config_t rmt_tx = RMT_DEFAULT_CONFIG_TX(mPin, fastled_get_rmt_channel(i) );
|
||||||
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_tx.clk_div = DIVIDER;
|
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.loop_en = false;
|
||||||
rmt_tx.tx_config.carrier_level = RMT_CARRIER_LEVEL_LOW;
|
|
||||||
rmt_tx.tx_config.carrier_en = false;
|
rmt_tx.tx_config.carrier_en = false;
|
||||||
|
|
||||||
rmt_tx.tx_config.idle_level = RMT_IDLE_LEVEL_LOW;
|
rmt_tx.tx_config.idle_level = RMT_IDLE_LEVEL_LOW;
|
||||||
rmt_tx.tx_config.idle_output_en = true;
|
rmt_tx.tx_config.idle_output_en = true;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user