1#define FASTLED_INTERNAL
4#include "engine_events.h"
9#ifndef MAX_CLED_CONTROLLERS
11#define MAX_CLED_CONTROLLERS 8
13#define MAX_CLED_CONTROLLERS 64
17#if defined(__SAM3X8E__)
18volatile uint32_t fuckit;
21FASTLED_NAMESPACE_BEGIN
23uint16_t cled_contoller_size() {
27uint8_t get_brightness();
37static uint32_t lastshow = 0;
55 m_nPowerData = 0xFFFFFFFF;
60 return (*
this)[0].size();
64 return (*
this)[0].leds();
69 int nLedsOrOffset,
int nLedsIfOffset) {
70 int nOffset = (nLedsIfOffset > 0) ? nLedsOrOffset : 0;
71 int nLeds = (nLedsIfOffset > 0) ? nLedsIfOffset : nLedsOrOffset;
74 pLed->
setLeds(data + nOffset, nLeds);
76 EngineEvents::onStripAdded(pLed, nLedsOrOffset - nOffset);
80static void* gControllersData[MAX_CLED_CONTROLLERS];
83 EngineEvents::onBeginFrame();
84 while(m_nMinMicros && ((micros()-lastshow) < m_nMinMicros));
89 scale = (*m_pPowerFunc)(scale, m_nPowerData);
96 while(pCur && length < MAX_CLED_CONTROLLERS) {
97 gControllersData[length++] = pCur->beginShowLeds();
105 while(pCur && length < MAX_CLED_CONTROLLERS) {
106 pCur->endShowLeds(gControllersData[length++]);
110 EngineEvents::onEndShowLeds();
111 EngineEvents::onEndFrame();
137 while(m_nMinMicros && ((micros()-lastshow) < m_nMinMicros));
142 scale = (*m_pPowerFunc)(scale, m_nPowerData);
147 while(pCur && length < MAX_CLED_CONTROLLERS) {
148 gControllersData[length++] = pCur->beginShowLeds();
156 while(pCur && length < MAX_CLED_CONTROLLERS) {
157 pCur->endShowLeds(gControllersData[length++]);
179 unsigned long start = millis();
181#ifndef FASTLED_ACCURATE_CLOCK
189 while((millis()-start) < ms);
269 static uint32_t lastframe = 0;
271 if(br++ >= nFrames) {
272 uint32_t now = millis();
277 m_nFPS = (br * 1000) / now;
279 lastframe = millis();
288 m_nMinMicros = ((1000000 / refresh) > m_nMinMicros) ? (1000000 / refresh) : m_nMinMicros;
290 }
else if(refresh > 0) {
291 m_nMinMicros = 1000000 / refresh;
298uint8_t get_brightness() {
305extern "C" __attribute__((weak))
int atexit(
void (* )()) {
return 0; }
306extern "C" __attribute__((weak))
void yield(
void) { }
311 #if !defined(ESP8266) && !defined(ESP32)
312 extern "C" void __cxa_pure_virtual (
void) {}
318 __extension__
typedef int __guard __attribute__((mode(__DI__)));
320 extern "C" int __cxa_guard_acquire (__guard *) __attribute__((weak));
321 extern "C" void __cxa_guard_release (__guard *) __attribute__((weak));
322 extern "C" void __cxa_guard_abort (__guard *) __attribute__((weak));
324 extern "C" int __cxa_guard_acquire (__guard *g)
326 return !*(
char *)(g);
329 extern "C" void __cxa_guard_release (__guard *g)
334 extern "C" void __cxa_guard_abort (__guard *)
uint32_t _retry_cnt
Global frame retry counter, used for debugging ESP implementations.
void * pSmartMatrix
Pointer to the matrix object when using the Smart Matrix Library.
int atexit(void(*)())
Called at program exit when run in a desktop environment.
CFastLED FastLED
Global LED strip management instance.
int noise_max
Unused value.
uint32_t _frame_cnt
Global frame counter, used for debugging ESP implementations.
int noise_min
Unused value.
central include file for FastLED, defines the CFastLED class/object
CFastLED FastLED
Global LED strip management instance.
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.
void show()
Update all our controllers with the current led colors.
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 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.
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.
void clear(bool writeData=false)
Clear the leds, wiping the local array of data.
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.
CLEDController * next()
Get the next controller in the linked list after this one.
CLEDController & setDither(uint8_t ditherMode=BINARY_DITHER)
Set the dithering mode for this controller to use.
virtual uint16_t getMaxRefreshRate() const
Gets the maximum possible refresh rate of the strip.
CLEDController & setLeds(CRGB *data, int nLeds)
Set the default array of LEDs to be used by this controller.
CLEDController & setCorrection(CRGB correction)
The color corrction to use for this controller, expressed as a CRGB object.
static CLEDController * head()
Get the first LED controller in the linked list of controllers.
CLEDController & setTemperature(CRGB temperature)
Set the color temperature, aka white point, for this controller.
static CLEDController * m_pTail
pointer to the last LED controller in the linked list
void showColorInternal(const struct CRGB &data, int nLeds, uint8_t brightness)
void showLedsInternal(uint8_t brightness)
Write the data to the LEDs managed by this controller.
void clearLedDataInternal(int nLeds=-1)
Zero out the LED data managed by this controller.
virtual void init()=0
Initialize the LED controller.
static CLEDController * m_pHead
pointer to the first LED controller in the linked list
Representation of an RGB pixel (Red, Green, Blue)