dlite/src/LEDDefinition.h

47 lines
1.3 KiB
C

/* LEDDefinition.h */
#ifndef LEDDefinition_included
#define LEDDefinition_included
#include <stdio.h>
#include "fw/src/mgos.h"
#include "mjs.h"
#include "mongoose/mongoose.h"
#include "common/cs_dbg.h"
#define MAX_LEDS 100
typedef enum LEDMode_e { LEDMode_on, LEDMode_off, LEDMode_blink, LEDMode_tv, LEDMode_fire } LEDMode;
typedef struct LEDColor_t {
char *name;
uint8_t red;
uint8_t green;
uint8_t blue;
} LEDColor;
extern LEDColor offColor, dimmedRedColor;
extern void LEDColor_init(bool loadDefaultData);
extern LEDColor *LEDColor_get(char *name);
extern void LEDColor_add(char *name, uint8_t red, uint8_t green, uint8_t blue);
typedef struct LEDDefinition_t {
char *level;
char *room;
char *id;
LEDColor onColor;
} LEDDefinition;
extern LEDDefinition ledDefinition[MAX_LEDS];
extern LEDDefinition *LEDDefinition_get(int ledNum);
extern void LEDDefinition_init(int numberOfLeds, bool loadDefaultData);
extern void LEDDefinition_add(char *level, char *room, char *id, uint8_t red, uint8_t green, uint8_t blue);
extern char *LEDDefinition_getLevel(int ledNum);
extern char *LEDDefinition_getRoom(int ledNum);
extern char *LEDDefinition_getId(int ledNum);
extern int LEDDefinition_getOnColorRed(int ledNum);
extern int LEDDefinition_getOnColorGreen(int ledNum);
extern int LEDDefinition_getOnColorBlue(int ledNum);
#endif