1st version with c implementation of state engine
This commit is contained in:
47
src/LEDState.h
Normal file
47
src/LEDState.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* 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 numberOfLeds;
|
||||
LEDState ledState[MAX_LEDS];
|
||||
char *comment;
|
||||
} LEDStateEngine;
|
||||
|
||||
/* LEDStateEngine */
|
||||
extern void LEDStateEngine_init(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);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user