forked from achamaikin/CCSModuleSW30Web
54 lines
782 B
C
Executable File
54 lines
782 B
C
Executable File
/*
|
|
* rgb_handler.h
|
|
*
|
|
* Created on: Jul 25, 2024
|
|
* Author: colorbass
|
|
*/
|
|
|
|
#ifndef INC_RGB_CONTROLLER_H_
|
|
#define INC_RGB_CONTROLLER_H_
|
|
|
|
#include "main.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();
|
|
|
|
|
|
#endif /* INC_RGB_CONTROLLER_H_ */
|