void cliHandler(char **tokens, byte numtokens) { switch (tokens[0][0]) { case 'v': { if (numtokens < 2) return; verbosity = atoi(tokens[1]); DEBUG2_VALUELN("Set verbose:", verbosity); break; } case 'p': { if (numtokens < 2) return; output_period = atoi(tokens[1]); DEBUG2_VALUELN("Set output period:", output_period); break; } case 'm': { DEBUG2_VALUELN("millis:", millis()); break; } case 'n': { DEBUG2_PRINTLN("Set output mode: none"); output_mode = OUTPUT_MODE_NONE; break; } case 't': { DEBUG2_PRINTLN("Set output mode: text"); output_mode = OUTPUT_MODE_TEXT; break; } case 'b': { DEBUG2_PRINTLN("Set output mode: binary"); output_mode = OUTPUT_MODE_BINARY; break; } case '?': case 'h': { print_usage(); } } }
void PixelUtil::init(const uint16_t _numPixels, const uint8_t dataPin, const uint8_t clockPin, const uint8_t order) { if (initialized) { DEBUG_ERR("PixelUtil::init already initialized"); DEBUG_ERR_STATE(DEBUG_ERR_REINIT); } else { num_pixels = _numPixels; leds = new CRGB[num_pixels]; /* * Since the FastLED library uses templates each pin combo needs to be * specified here. * * NOTE: The appropriate #def needs to be set manually here or from the * platformio build script. */ #ifdef PIXELS_WS2812B_3 if (dataPin == 3) { FastLED.addLeds<WS2812B, 3, RGB>(leds, num_pixels); } else #endif #ifdef PIXELS_5_7 // This is for the 1284P based module using hardware SPI if ((dataPin == 5) && (clockPin == 7)) { FastLED.addLeds<WS2801, 5, 7, RGB>(leds, num_pixels); } else #endif #ifdef PIXELS_19_20 if ((dataPin == 19) && (clockPin == 20)) { FastLED.addLeds<WS2801, 19, 20, RGB>(leds, num_pixels); } else #endif #if !defined(PIXELS_WS2812B_3) && !defined(PIXELS_5_7) && !defined(PIXELS_19_20) // Default pin configuration and LEDs if ((dataPin == 12) && (clockPin == 8)) { FastLED.addLeds<WS2801, 12, 8, RGB>(leds, num_pixels); } else #endif { DEBUG_ERR("Invalid Pixel pin configuration"); DEBUG_ERR_STATE(DEBUG_ERR_BADPINS); } setAllRGB(0, 0, 0); FastLED.show(); // XXX: Should this be zero'd first? or skipped? } initialized = true; DEBUG2_PRINTLN("PixelUtil::init"); }