forked from achamaikin/CCSModuleSW30Web
Mutable status palette over serial; Unknown uses HSV saturation pulse instead of dim-red/fade-to-black. Co-authored-by: Cursor <cursoragent@cursor.com>
48 lines
828 B
C
Executable File
48 lines
828 B
C
Executable File
#pragma once
|
|
|
|
#include "main.h"
|
|
#include "serial_control.h"
|
|
|
|
#pragma pack(push, 1)
|
|
|
|
typedef struct{
|
|
uint8_t R;
|
|
uint8_t G;
|
|
uint8_t B;
|
|
|
|
}RGB_t;
|
|
|
|
typedef struct{
|
|
RGB_t Color1;
|
|
uint8_t Tr; //20ms/step, 5.1s max
|
|
uint8_t Th; //20ms/step, 5.1s max
|
|
uint8_t Tf; //20ms/step, 5.1s max
|
|
uint8_t Tl; //20ms/step, 5.1s max
|
|
RGB_t Color2;
|
|
//uint8_t rsvd[6]; // 6 bytes reserved
|
|
}RGB_Cycle_t;
|
|
|
|
#pragma pack(pop)
|
|
|
|
typedef enum{
|
|
LED_RISING,
|
|
LED_HIGH,
|
|
LED_FALLING,
|
|
LED_LOW,
|
|
}RGB_Phase_t;
|
|
|
|
typedef struct{
|
|
uint8_t state; // 0 1 2 3
|
|
uint16_t tick;
|
|
RGB_t color;
|
|
uint8_t phasesync;
|
|
}RGB_State_t;
|
|
|
|
void LED_Task();
|
|
void LED_Write();
|
|
void LED_Init();
|
|
void LED_SetColor(const RGB_Cycle_t *color);
|
|
void RGB_SetColor(RGB_t *color);
|
|
void WS2812_SetColor(RGB_t *color);
|
|
uint8_t LED_ApplyLightingConfig(const LightingConfigPacket_t *config);
|