添加提示状态灯
This commit is contained in:
@@ -11,6 +11,8 @@ uint16_t toggle_cycle = 1000;
|
||||
bool toggle_flag = true;
|
||||
static uint8_t rgb_color_index = RGB_COLOR_RAD;
|
||||
|
||||
static uint8_t color_lat = 0, cyle_lat = 0;
|
||||
|
||||
rgb_color_t rgb_color_rad = {0,255,0,0,0,1,0};
|
||||
rgb_color_t rgb_color_orange = {0,255,80,0,0,1,0};
|
||||
rgb_color_t rgb_color_green = {0,0,255,0,0,1,0};
|
||||
@@ -205,4 +207,26 @@ void rgb_toggle(rgb_color_t* rgb_color)
|
||||
void rgb_color_change(uint8_t index, uint8_t color)
|
||||
{
|
||||
rgb_color_index = color;
|
||||
}
|
||||
|
||||
void rgb_Indicator_light_on(uint8_t index, uint8_t color, uint16_t cyle)
|
||||
{
|
||||
if(color_lat != rgb_color_index && rgb_color_index != color)
|
||||
{
|
||||
color_lat = rgb_color_index;
|
||||
rgb_color_change(index, color);
|
||||
}
|
||||
if(cyle_lat != cyle && toggle_cycle != cyle)
|
||||
{
|
||||
cyle_lat = toggle_cycle;
|
||||
rgb_update_cyle(cyle);
|
||||
}
|
||||
|
||||
}
|
||||
void rgb_Indicator_light_off(uint8_t index)
|
||||
{
|
||||
rgb_color_change(index, color_lat);
|
||||
rgb_update_cyle(cyle_lat);
|
||||
color_lat = 0;
|
||||
cyle_lat = 0;
|
||||
}
|
||||
@@ -37,7 +37,8 @@ typedef struct rgb_color_s
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RGB_COLOR_RAD = 0,
|
||||
RGB_COLOR_NONE = 0,
|
||||
RGB_COLOR_RAD,
|
||||
RGB_COLOR_ORANGE,
|
||||
RGB_COLOR_GREEN,
|
||||
RGB_COLOR_WHITE,
|
||||
@@ -54,4 +55,6 @@ void work_rgb_led_start(void);
|
||||
void _work_rgb_led(void *arg);
|
||||
void rgb_update_cyle(uint16_t cyle);
|
||||
void rgb_toggle(rgb_color_t* rgb_color);
|
||||
void rgb_color_change(uint8_t index, uint8_t color);
|
||||
void rgb_color_change(uint8_t index, uint8_t color);
|
||||
void rgb_Indicator_light_on(uint8_t index, uint8_t color, uint16_t cyle);
|
||||
void rgb_Indicator_light_off(uint8_t index);
|
||||
Reference in New Issue
Block a user