2#ifndef __INC_FASTSPI_LED2_H
3#define __INC_FASTSPI_LED2_H
10#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
11#define FASTLED_HAS_PRAGMA_MESSAGE
19#define FASTLED_VERSION 3009007
20#ifndef FASTLED_INTERNAL
21# ifdef FASTLED_SHOW_VERSION
22# ifdef FASTLED_HAS_PRAGMA_MESSAGE
23# pragma message "FastLED version 3.009.007"
25# warning FastLED version 3.009.007 (Not really a warning, just telling you here.)
30#ifndef __PROG_TYPES_COMPAT__
34#define __PROG_TYPES_COMPAT__
38#include <SmartMatrix.h>
50#include <OctoWS2811.h>
55#include "fl/force_inline.h"
85#include "fl/engine_events.h"
91uint16_t cled_contoller_size();
116enum OWS2811 { OCTOWS2811,OCTOWS2811_400, OCTOWS2813};
124template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
class PIXIE :
public PixieController<DATA_PIN, RGB_ORDER> {};
127#ifdef FASTLED_HAS_CLOCKLESS
139template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
144template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
149template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
154template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
159template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
164template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
169template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
174template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
179template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
184template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
189template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
193template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
198template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
203template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
208template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
213template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
218template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
223template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
228template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
233template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
238template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
243template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
248template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
253template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
258template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
263template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
268template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
273template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
277template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
280#if defined(DmxSimple_h) || defined(FASTLED_DOXYGEN)
284#if defined(DmxSerial_h) || defined(FASTLED_DOXYGEN)
295#ifdef PORTA_FIRST_PIN
302#ifdef PORTB_FIRST_PIN
309#ifdef PORTC_FIRST_PIN
316#ifdef PORTD_FIRST_PIN
332#if defined(LIB8_ATTINY)
333#define NUM_CONTROLLERS 2
337#define NUM_CONTROLLERS 8
358 uint32_t m_nMinMicros;
359 uint32_t m_nPowerData;
405 template<ESPIChipsets CHIPSET, u
int8_t DATA_PIN, u
int8_t CLOCK_PIN>
408 static const bool IS_VALID =
false;
413 #define _FL_MAP_CLOCKED_CHIPSET(CHIPSET_ENUM, CONTROLLER_CLASS) \
414 template<uint8_t DATA_PIN, uint8_t CLOCK_PIN> \
415 struct ClockedChipsetHelper<CHIPSET_ENUM, DATA_PIN, CLOCK_PIN> { \
416 static const bool IS_VALID = true; \
417 typedef CONTROLLER_CLASS<DATA_PIN, CLOCK_PIN> ControllerType; \
419 template<EOrder RGB_ORDER> \
420 struct CONTROLLER_CLASS_WITH_ORDER { \
421 typedef CONTROLLER_CLASS<DATA_PIN, CLOCK_PIN, RGB_ORDER> ControllerType; \
424 template<EOrder RGB_ORDER, uint32_t FREQ> \
425 struct CONTROLLER_CLASS_WITH_ORDER_AND_FREQ { \
426 typedef CONTROLLER_CLASS<DATA_PIN, CLOCK_PIN, RGB_ORDER, FREQ> ControllerType; \
454 typedef typename CHIP::template CONTROLLER_CLASS_WITH_ORDER_AND_FREQ<RGB_ORDER, SPI_DATA_RATE>::ControllerType ControllerTypeWithFreq;
455 static_assert(CHIP::IS_VALID,
"Unsupported chipset");
456 static ControllerTypeWithFreq c;
457 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
461 template<ESPIChipsets CHIPSET, u
int8_t DATA_PIN, u
int8_t CLOCK_PIN >
static CLEDController &
addLeds(
struct CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
463 typedef typename CHIP::ControllerType ControllerType;
464 static_assert(CHIP::IS_VALID,
"Unsupported chipset");
465 static ControllerType c;
466 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
471 template<ESPIChipsets CHIPSET, u
int8_t DATA_PIN, u
int8_t CLOCK_PIN, EOrder RGB_ORDER>
473 typedef ClockedChipsetHelper<CHIPSET, DATA_PIN, CLOCK_PIN> CHIP;
474 static_assert(CHIP::IS_VALID,
"Unsupported chipset");
475 typedef typename CHIP::template CONTROLLER_CLASS_WITH_ORDER<RGB_ORDER>::ControllerType ControllerTypeWithOrder;
476 static ControllerTypeWithOrder c;
477 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
482 template<ESPIChipsets CHIPSET>
static CLEDController &
addLeds(
struct CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
486 template<ESPIChipsets CHIPSET, EOrder RGB_ORDER>
static CLEDController &
addLeds(
struct CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
490 template<ESPIChipsets CHIPSET, EOrder RGB_ORDER, u
int32_t SPI_DATA_RATE>
static CLEDController &
addLeds(
struct CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
497#ifdef FASTLED_HAS_CLOCKLESS
520 template<
template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
class CHIPSET, uint8_t DATA_PIN,
EOrder RGB_ORDER>
522 static CHIPSET<DATA_PIN, RGB_ORDER> c;
523 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
527 template<
template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
class CHIPSET, uint8_t DATA_PIN>
529 static CHIPSET<DATA_PIN, RGB> c;
530 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
534 template<
template<u
int8_t DATA_PIN>
class CHIPSET, uint8_t DATA_PIN>
536 static CHIPSET<DATA_PIN> c;
537 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
540#if defined(__FASTLED_HAS_FIBCC) && (__FASTLED_HAS_FIBCC == 1)
541 template<u
int8_t NUM_LANES,
template<u
int8_t DATA_PIN, EOrder RGB_ORDER>
class CHIPSET, uint8_t DATA_PIN,
EOrder RGB_ORDER=
RGB>
543 static __FIBCC<CHIPSET, DATA_PIN, NUM_LANES, RGB_ORDER> c;
544 return addLeds(&c, data, nLeds);
548 #ifdef FASTSPI_USE_DMX_SIMPLE
549 template<EClocklessChipsets CHIPSET, u
int8_t DATA_PIN, EOrder RGB_ORDER=RGB>
553 case DMX: {
static DMXController<DATA_PIN> controller;
return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
582 template<
template<EOrder RGB_ORDER>
class CHIPSET,
EOrder RGB_ORDER>
584 static CHIPSET<RGB_ORDER> c;
585 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
589 template<
template<EOrder RGB_ORDER>
class CHIPSET>
591 static CHIPSET<RGB> c;
592 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
599 template<OWS2811 CHIPSET, EOrder RGB_ORDER>
603 case OCTOWS2811: {
static COctoWS2811Controller<RGB_ORDER,WS2811_800kHz> controller;
return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
604 case OCTOWS2811_400: {
static COctoWS2811Controller<RGB_ORDER,WS2811_400kHz> controller;
return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
606 case OCTOWS2813: {
static COctoWS2811Controller<RGB_ORDER,WS2813_800kHz> controller;
return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
614 template<OWS2811 CHIPSET>
622#ifdef USE_WS2812SERIAL
626 template<SWS2812 CHIPSET,
int DATA_PIN, EOrder RGB_ORDER>
629 static CWS2812SerialController<DATA_PIN,RGB_ORDER> controller;
630 return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset);
637 template<ESM CHIPSET>
641 case SMART_MATRIX: {
static CSmartMatrixController controller;
return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
648#ifdef FASTLED_HAS_BLOCKLESS
672 template<EBlockChipsets CHIPSET,
int NUM_LANES, EOrder RGB_ORDER>
675 #ifdef PORTA_FIRST_PIN
676 case WS2811_PORTA:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN,
NS(320),
NS(320),
NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
677 case WS2811_400_PORTA:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN,
NS(800),
NS(800),
NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
678 case WS2813_PORTA:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN,
NS(320),
NS(320),
NS(640), RGB_ORDER, 0,
false, 300>(), data, nLedsOrOffset, nLedsIfOffset);
679 case TM1803_PORTA:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN,
NS(700),
NS(1100),
NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
680 case UCS1903_PORTA:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN,
NS(500),
NS(1500),
NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
682 #ifdef PORTB_FIRST_PIN
683 case WS2811_PORTB:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN,
NS(320),
NS(320),
NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
684 case WS2811_400_PORTB:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN,
NS(800),
NS(800),
NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
685 case WS2813_PORTB:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN,
NS(320),
NS(320),
NS(640), RGB_ORDER, 0,
false, 300>(), data, nLedsOrOffset, nLedsIfOffset);
686 case TM1803_PORTB:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN,
NS(700),
NS(1100),
NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
687 case UCS1903_PORTB:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN,
NS(500),
NS(1500),
NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
689 #ifdef PORTC_FIRST_PIN
690 case WS2811_PORTC:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN,
NS(320),
NS(320),
NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
691 case WS2811_400_PORTC:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN,
NS(800),
NS(800),
NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
692 case WS2813_PORTC:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN,
NS(320),
NS(320),
NS(640), RGB_ORDER, 0,
false, 300>(), data, nLedsOrOffset, nLedsIfOffset);
693 case TM1803_PORTC:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN,
NS(700),
NS(1100),
NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
694 case UCS1903_PORTC:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN,
NS(500),
NS(1500),
NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
696 #ifdef PORTD_FIRST_PIN
697 case WS2811_PORTD:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN,
NS(320),
NS(320),
NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
698 case WS2811_400_PORTD:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN,
NS(800),
NS(800),
NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
699 case WS2813_PORTD:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN,
NS(320),
NS(320),
NS(640), RGB_ORDER, 0,
false, 300>(), data, nLedsOrOffset, nLedsIfOffset);
700 case TM1803_PORTD:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN,
NS(700),
NS(1100),
NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
701 case UCS1903_PORTD:
return addLeds(
new InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN,
NS(500),
NS(1500),
NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
704 case WS2811_PORTDC:
return addLeds(
new SixteenWayInlineBlockClocklessController<NUM_LANES,
NS(320),
NS(320),
NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
705 case WS2811_400_PORTDC:
return addLeds(
new SixteenWayInlineBlockClocklessController<NUM_LANES,
NS(800),
NS(800),
NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
706 case WS2813_PORTDC:
return addLeds(
new SixteenWayInlineBlockClocklessController<NUM_LANES,
NS(320),
NS(320),
NS(640), RGB_ORDER, 0,
false, 300>(), data, nLedsOrOffset, nLedsIfOffset);
707 case TM1803_PORTDC:
return addLeds(
new SixteenWayInlineBlockClocklessController<NUM_LANES,
NS(700),
NS(1100),
NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
708 case UCS1903_PORTDC:
return addLeds(
new SixteenWayInlineBlockClocklessController<NUM_LANES,
NS(500),
NS(1500),
NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
714 template<EBlockChipsets CHIPSET,
int NUM_LANES>
740 void show(uint8_t scale);
748 void clear(
bool writeData =
false);
766 void delay(
unsigned long ms);
820#define FastSPI_LED FastLED
822#define FastSPI_LED2 FastLED
834#ifndef HAS_HARDWARE_PIN_SUPPORT
835#warning "No pin/port mappings found, pin access will be slightly slower. See fastpin.h for info."
836#define NO_HARDWARE_PIN_SUPPORT
851#define FASTLED_TITLE(text) fl::Title g_title(text)
852#define FASTLED_DESCRIPTION(text) fl::Description g_description(text)
SWS2812
WS2812Serial Library controller type.
OWS2811
Octo WS2811 LED Library controller types.
CFastLED FastLED
Global LED strip management instance.
uint8_t(* power_func)(uint8_t scale, uint32_t data)
Typedef for a power consumption calculation function.
ESPIChipsets
LED chipsets with SPI interface.
@ APA102HD
APA102 LED chipset with 5-bit gamma correction.
@ P9813
P9813 LED chipset.
@ SK9822HD
SK9822 LED chipset with 5-bit gamma correction.
@ SK9822
SK9822 LED chipset.
@ WS2803
WS2803 LED chipset.
@ WS2801
WS2801 LED chipset.
@ DOTSTAR
APA102 LED chipset alias.
@ APA102
APA102 LED chipset.
@ LPD8806
LPD8806 LED chipset.
@ LPD6803
LPD6803 LED chipset.
@ DOTSTARHD
APA102HD LED chipset alias.
@ SM16716
SM16716 LED chipset.
ESM
Smart Matrix Library controller type.
EBlockChipsets
Blockless output port enum.
Functions for doing a rotation of bits/bytes used by parallel output.
Contains the bulk of the definitions for the various LED chipsets supported.
APA102 high definition controller class.
High level controller interface for FastLED.
int size()
Get the number of leds in the first controller.
void setMaxRefreshRate(uint16_t refresh, bool constrain=false)
Set the maximum refresh rate.
CRGB * leds()
Get a pointer to led data for the first controller.
void setTemperature(const struct CRGB &temp)
Set a global color temperature.
static CLEDController & addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add an SPI based CLEDController instance to the world.
void show()
Update all our controllers with the current led colors.
void showColor(const struct CRGB &color)
Set all leds on all controllers to the given color.
void countFPS(int nFrames=25)
For debugging, this will keep track of time between calls to countFPS().
CLEDController & operator[](int x)
Get a reference to a registered controller.
void delay(unsigned long ms)
Delay for the given number of milliseconds.
void setBrightness(uint8_t scale)
Set the global brightness scaling.
void showColor(const struct CRGB &color, uint8_t scale)
Set all leds on all controllers to the given color/scale.
void setDither(uint8_t ditherMode=BINARY_DITHER)
Set the dithering mode.
void setMaxPowerInVoltsAndMilliamps(uint8_t volts, uint32_t milliamps)
Set the maximum power to be used, given in volts and milliamps.
uint16_t getFPS()
Get the number of frames/second being written out.
void setMaxPowerInMilliWatts(uint32_t milliwatts)
Set the maximum power to be used, given in milliwatts.
uint8_t getBrightness()
Get the current global brightness setting.
void clearData()
Clear out the local data array.
void setCorrection(const struct CRGB &correction)
Set a global color correction.
int count()
Get how many controllers have been registered.
static CLEDController & addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a 3rd party library based CLEDController instance to the world.
void clear(bool writeData=false)
Clear the leds, wiping the local array of data.
static CLEDController & addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a clockless based CLEDController instance to the world.
static CLEDController & addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
Base definition for an LED controller.
DMX512 based LED controller class, using the DMXSerial library.
DMX512 based LED controller class, using the DmxSimple library.
DMX512 based LED controller class, using the DMXSerial library.
DMX512 based LED controller class, using the DmxSimple library.
GW6205_400 controller class.
GW6205 controller class @ 400 KHz.
UCS1904 controller class @ 800 KHz.
LPD1886_8BIT controller class.
LPD1886 controller class.
LPD1886 controller class.
LPD1886 controller class.
LPD6803 controller class (LPD1101).
LPD8806 controller class.
LED controller for WS2812 LEDs with GRB color order.
SM16703 controller class.
SM16703 controller class.
SM16716 controller class.
UCS1903B controller class.
UCS1903B controller class.
UCS1903 controller class @ 400 KHz.
UCS1903 controller class.
UCS1904 controller class.
UCS1904 controller class.
UCS1912 controller class.
UCS2903 controller class.
UCS2903 controller class.
WS2811_400 controller class.
WS2811 controller class @ 400 KHz.
WS2811 controller class @ 800 KHz.
WS2812B controller class.
WS2812 controller class @ 800 KHz.
WS2815 controller class @ 400 KHz.
Declarations for the predefined color palettes supplied by FastLED.
Utility functions for color fill, palettes, blending, and more.
deprecated: base definitions used by led controllers for writing out led data
Compatibility functions based on C++ version.
#define BINARY_DITHER
Enable dithering using binary dithering (only option)
Defines the DMX512-based LED controllers.
EOrder
RGB color channel orderings, used when instantiating controllers to determine what order the controll...
@ RGB
Red, Green, Blue (0012)
Contains definitions that can be used to configure FastLED at compile time.
Utility functions and classes for managing delay cycles.
#define NS(_NS)
Convert from nanoseconds to number of clock cycles.
Wrapper definitions to allow seamless use of PROGMEM in environments that have it.
Class base definitions for defining fast pin access.
Serial peripheral interface (SPI) definitions per platform.
Data types and constants used by SPI interfaces.
uint8_t calculate_max_brightness_for_power_mW(const CRGB *ledbuffer, uint16_t numLeds, uint8_t target_brightness, uint32_t max_power_mW)
Determines the highest brightness level you can use and still stay under the specified power budget f...
Functions to convert from the HSV colorspace to the RGB colorspace.
Determines which platform system definitions to include.
Fast, efficient 8-bit math functions specifically designed for high-performance LED programming.
#define FASTLED_NAMESPACE_END
End of the FastLED namespace.
#define FASTLED_NAMESPACE_BEGIN
Start of the FastLED namespace.
Functions to generate and fill arrays with noise.
Declares classes for managing logical groups of LEDs.
Includes defintions for RGB and HSV pixels.
Functions to limit the power used by FastLED.
Representation of an RGB pixel (Red, Green, Blue)