11 #if defined(ARDUINO) && ARDUINO >= 100 17 #if defined ( ESP8266 ) 20 #include <avr/pgmspace.h> 32 #define FADE_LED_PWM_BITS 8 42 #if FADE_LED_PWM_BITS <= 8 54 #ifndef FADE_LED_MAX_LED 55 #define FADE_LED_MAX_LED 6 67 #ifndef FADE_LED_RESOLUTION 68 #define FADE_LED_RESOLUTION ((1 <<FADE_LED_PWM_BITS) -1) 71 #include "FadeLedGamma.h" 215 void setTime(
unsigned long time,
bool constTime =
false);
400 #if FADE_LED_PWM_BITS <= 8 flvar_t getCurrent()
Returns the current brightness.
Definition: FadeLed.cpp:87
bool falling()
Returns if the LED is still fading down.
Definition: FadeLed.cpp:117
void updateThis()
Updates fading of this object only.
Definition: FadeLed.cpp:154
flvar_t _biggestStep
The biggest input step possible.
Definition: FadeLed.h:357
Main class of the FadeLed-library.
Definition: FadeLed.h:80
FadeLed(byte pin)
Constructor of a FadeLed object.
Definition: FadeLed.cpp:9
void on()
Fade to max brightness.
Definition: FadeLed.cpp:95
byte flvar_t
Sets the variable type used for the brightness.
Definition: FadeLed.h:43
unsigned long _count
The number of _interval's passed.
Definition: FadeLed.h:355
static void setInterval(unsigned int interval)
Sets the interval at which to update the fading.
Definition: FadeLed.cpp:224
flvar_t getBiggestStep()
Get the biggest brightness step.
Definition: FadeLed.cpp:150
flvar_t _curVal
Current brightness.
Definition: FadeLed.h:352
#define FADE_LED_MAX_LED
Maximum number of FadeLed objects.
Definition: FadeLed.h:55
void noGammaTable()
Use no gamma correction for full range.
Definition: FadeLed.cpp:139
void off()
Fade to off.
Definition: FadeLed.cpp:99
void setTime(unsigned long time, bool constTime=false)
Set the time a (full) fade will take.
Definition: FadeLed.cpp:107
flvar_t _setVal
The brightness to which last set to fade to.
Definition: FadeLed.h:350
const flvar_t * _gammaLookup
Pointer to the Gamma table in PROGMEM.
Definition: FadeLed.h:356
flvar_t getGammaValue(flvar_t step)
Get gamma corrected value.
Definition: FadeLed.cpp:143
void begin(flvar_t val)
Set a direct begin value to start at without fade.
Definition: FadeLed.cpp:22
static unsigned int _interval
Interval (in ms) between updates.
Definition: FadeLed.h:391
static FadeLed * _ledList[FADE_LED_MAX_LED]
array of pointers to all FadeLed objects
Definition: FadeLed.h:389
static unsigned int _millisLast
Last time all FadeLed objects where updated.
Definition: FadeLed.h:392
flvar_t _startVal
The brightness at which the new fade needs to start.
Definition: FadeLed.h:351
byte _pin
PWM pin to control.
Definition: FadeLed.h:349
bool _constTime
Constant time fade or just constant speed fade.
Definition: FadeLed.h:353
unsigned long _countMax
The number of _interval's a fade should take.
Definition: FadeLed.h:354
flvar_t getGamma(flvar_t step)
Definition: FadeLed.h:395
static byte _ledCount
Next number of FadeLed object.
Definition: FadeLed.h:390
bool done()
Returns if the LED is done fading.
Definition: FadeLed.cpp:91
bool rising()
Returns if the LED is still fading up.
Definition: FadeLed.cpp:113
void stop()
Stops the current fading.
Definition: FadeLed.cpp:121
static void update()
Updates all FadeLed objects.
Definition: FadeLed.cpp:228
void setGammaTable(const flvar_t *table, flvar_t biggestStep=100)
Sets a gamma table to use.
Definition: FadeLed.cpp:125
void beginOn()
Sets the start brightness directly to full.
Definition: FadeLed.cpp:103