11 #if defined(ARDUINO) && ARDUINO >= 100 17 #if defined ( ESP8266 ) 20 #include <avr/pgmspace.h> 32 #if defined ( ESP8266 ) 34 #define FADE_LED_PWM_BITS 10 37 #define FADE_LED_PWM_BITS 8 49 #if FADE_LED_PWM_BITS <= 8 61 #ifndef FADE_LED_MAX_LED 62 #define FADE_LED_MAX_LED 6 74 #ifndef FADE_LED_RESOLUTION 75 #define FADE_LED_RESOLUTION ((1 <<FADE_LED_PWM_BITS) -1) 78 #include "FadeLedGamma.h" 144 FadeLed(byte pin,
bool hasGammaTable);
269 void setTime(
unsigned long time,
bool constTime =
false);
454 #if FADE_LED_PWM_BITS <= 8 flvar_t getCurrent()
Returns the current brightness.
Definition: FadeLed.cpp:123
bool falling()
Returns if the LED is still fading down.
Definition: FadeLed.cpp:153
void updateThis()
Updates fading of this object only.
Definition: FadeLed.cpp:190
flvar_t _biggestStep
The biggest input step possible.
Definition: FadeLed.h:411
Main class of the FadeLed-library.
Definition: FadeLed.h:87
FadeLed(byte pin)
Simple constructor of a FadeLed object with gamma correction.
Definition: FadeLed.cpp:9
void on()
Fade to max brightness.
Definition: FadeLed.cpp:131
unsigned long _count
The number of _interval's passed.
Definition: FadeLed.h:409
const byte _pin
PWM pin to control.
Definition: FadeLed.h:403
static void setInterval(unsigned int interval)
Sets the interval at which to update the fading.
Definition: FadeLed.cpp:260
flvar_t getBiggestStep()
Get the biggest brightness step.
Definition: FadeLed.cpp:186
flvar_t _curVal
Current brightness.
Definition: FadeLed.h:406
#define FADE_LED_MAX_LED
Maximum number of FadeLed objects.
Definition: FadeLed.h:62
void noGammaTable()
Use no gamma correction for full range.
Definition: FadeLed.cpp:175
void off()
Fade to off.
Definition: FadeLed.cpp:135
void setTime(unsigned long time, bool constTime=false)
Set the time a (full) fade will take.
Definition: FadeLed.cpp:143
flvar_t _setVal
The brightness to which last set to fade to.
Definition: FadeLed.h:404
const flvar_t * _gammaLookup
Pointer to the Gamma table in PROGMEM.
Definition: FadeLed.h:410
flvar_t getGammaValue(flvar_t step)
Get gamma corrected value.
Definition: FadeLed.cpp:179
void begin(flvar_t val)
Set a direct begin value to start at without fade.
Definition: FadeLed.cpp:58
static unsigned int _interval
Interval (in ms) between updates.
Definition: FadeLed.h:445
static FadeLed * _ledList[FADE_LED_MAX_LED]
array of pointers to all FadeLed objects
Definition: FadeLed.h:443
static unsigned int _millisLast
Last time all FadeLed objects where updated.
Definition: FadeLed.h:446
flvar_t _startVal
The brightness at which the new fade needs to start.
Definition: FadeLed.h:405
bool _constTime
Constant time fade or just constant speed fade.
Definition: FadeLed.h:407
unsigned long _countMax
The number of _interval's a fade should take.
Definition: FadeLed.h:408
flvar_t getGamma(flvar_t step)
Definition: FadeLed.h:449
static byte _ledCount
Next number of FadeLed object.
Definition: FadeLed.h:444
bool done()
Returns if the LED is done fading.
Definition: FadeLed.cpp:127
bool rising()
Returns if the LED is still fading up.
Definition: FadeLed.cpp:149
void stop()
Stops the current fading.
Definition: FadeLed.cpp:157
~FadeLed()
Simple destructor of a FadeLed object.
Definition: FadeLed.cpp:39
static void update()
Updates all FadeLed objects.
Definition: FadeLed.cpp:264
void setGammaTable(const flvar_t *table, flvar_t biggestStep=100)
Sets a gamma table to use.
Definition: FadeLed.cpp:161
uint8_t flvar_t
Sets the variable type used for the brightness.
Definition: FadeLed.h:50
void beginOn()
Sets the start brightness directly to full.
Definition: FadeLed.cpp:139