This commit is contained in:
j3d1 2023-01-19 18:11:13 +01:00
parent 9de089083c
commit 1acaf657f0
6 changed files with 160 additions and 50 deletions

View file

@ -12,19 +12,21 @@ namespace fiatlux {
FIRMWARE_CHECK,
VOLTAGE_INFO,
SYSTEM_INFO,
LIGHTS,
count
};
const char* id_to_string(id val){
static const char* lookup[] = {
"NONE",
"RESTART",
"CLEAR_CONFIG",
"FIRMWARE_FRAME",
"FIRMWARE_CHECK",
"VOLTAGE_INFO",
"SYSTEM_INFO",
"out of range"
const char *id_to_string(id val) {
static const char *lookup[] = {
"NONE",
"RESTART",
"CLEAR_CONFIG",
"FIRMWARE_FRAME",
"FIRMWARE_CHECK",
"VOLTAGE_INFO",
"SYSTEM_INFO",
"LIGHTS",
"out of range"
};
if(val < id::count)
return lookup[val];
@ -32,7 +34,7 @@ namespace fiatlux {
return lookup[id::count];
}
template <typename T>
template<typename T>
struct frame {
id cmd;
T msg;
@ -61,6 +63,9 @@ namespace fiatlux {
uint32_t chipid;
uint32_t flashid;
uint32_t flashsize;
uint16_t version;
uint16_t peripheral_version;
/*
" \"hostname\" : \"%s\""
"}"
@ -72,5 +77,11 @@ namespace fiatlux {
uint8_t ret;
uint16_t val;
} __attribute__((packed));
struct lights {
uint32_t top_color;
uint32_t bottom_color;
uint16_t white_brightness;
} __attribute__((packed));
}
}