2017-11-25 22:58:24 +00:00
|
|
|
/* 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 {
|
2017-12-07 09:33:14 +00:00
|
|
|
uint8_t pin;
|
2017-11-25 22:58:24 +00:00
|
|
|
uint8_t numberOfLeds;
|
|
|
|
LEDState ledState[MAX_LEDS];
|
|
|
|
char *comment;
|
|
|
|
} LEDStateEngine;
|
|
|
|
|
2017-11-27 05:47:27 +00:00
|
|
|
extern int getTicks(void);
|
|
|
|
|
2017-11-25 22:58:24 +00:00
|
|
|
/* LEDStateEngine */
|
2017-12-07 09:33:14 +00:00
|
|
|
extern void LEDStateEngine_init(int ledPin, int numberOfLeds);
|
2017-11-25 22:58:24 +00:00
|
|
|
extern void LEDStateEngine_addComment(char *comment);
|
|
|
|
|
|
|
|
extern LEDState *LEDStateEngine_getLedState(int n);
|
|
|
|
extern void LEDStateEngine_tick();
|
|
|
|
extern uint16_t LEDStateEngine_getNumberOfLeds();
|
2017-12-07 14:45:35 +00:00
|
|
|
extern double LEDStateEngine_getMinTickTime();
|
|
|
|
extern double LEDStateEngine_getMaxTickTime();
|
|
|
|
|
2017-11-25 22:58:24 +00:00
|
|
|
|
|
|
|
/* LEDState */
|
2017-11-27 05:47:27 +00:00
|
|
|
extern void LEDState_init(int n, LEDDefinition *ledDefinition);
|
|
|
|
extern void LEDState_initDefault(int n, LEDMode defaultMode);
|
2017-11-25 22:58:24 +00:00
|
|
|
extern void LEDState_tick(int ledNum);
|
|
|
|
extern int LEDState_getLedRed(int ledNum);
|
|
|
|
extern int LEDState_getLedGreen(int ledNum);
|
|
|
|
extern int LEDState_getLedBlue(int ledNum);
|
2017-11-27 05:47:27 +00:00
|
|
|
extern char * LEDState_getLedColorName(int ledNum);
|
|
|
|
extern int LEDState_getCurrentTick(int ledNum);
|
|
|
|
extern int LEDState_getNextTick(int ledNum);
|
2017-11-25 22:58:24 +00:00
|
|
|
|
|
|
|
#endif
|