/* LEDState.h */ #ifndef LEDState_loaded #define LEDState_loaded #include "LEDDefinition.h" typedef struct LEDState_t { uint8_t index; LEDDefinition *ledDefinition; uint32_t currentTick; uint32_t nextTick; uint8_t rampTickDelta; LEDMode mode; uint8_t currentLEDCtrlIndex; // ??????????? uint16_t currentAnimationStep; uint8_t modeStep; // sub-state within a mode uint8_t clockEndHours; uint8_t clockEndMinutes; LEDColor currentColor; LEDColor onColor; // for target of on-mode LEDColor targetColor; } LEDState; typedef struct LEDStateEngine_t { uint8_t pin; uint8_t numberOfLeds; LEDState ledState[MAX_LEDS]; char *comment; } LEDStateEngine; extern int getTicks(void); /* LEDStateEngine */ extern void LEDStateEngine_init(int ledPin, int numberOfLeds); extern void LEDStateEngine_addComment(char *comment); extern LEDState *LEDStateEngine_getLedState(int n); extern void LEDStateEngine_tick(); extern uint16_t LEDStateEngine_getNumberOfLeds(); /* LEDState */ extern void LEDState_init(int n, LEDDefinition *ledDefinition); extern void LEDState_initDefault(int n, LEDMode defaultMode); extern void LEDState_tick(int ledNum); extern int LEDState_getLedRed(int ledNum); extern int LEDState_getLedGreen(int ledNum); extern int LEDState_getLedBlue(int ledNum); extern char * LEDState_getLedColorName(int ledNum); extern int LEDState_getCurrentTick(int ledNum); extern int LEDState_getNextTick(int ledNum); #endif