From b6a0cc926e74d245335589210129692dfd5dbb18 Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Mon, 21 Jul 2025 19:05:43 +0800 Subject: [PATCH] wip for fade-in lamp bar --- Core/Src/sts_lamp_bar.c | 68 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/Core/Src/sts_lamp_bar.c b/Core/Src/sts_lamp_bar.c index 0da9c61..5e17359 100644 --- a/Core/Src/sts_lamp_bar.c +++ b/Core/Src/sts_lamp_bar.c @@ -170,11 +170,79 @@ void STS_Lamp_Bar_Set_RGB_Color(uint8_t red, uint8_t green, uint8_t blue ) STS_WS2812B_Refresh(); } +void STS_Lamp_Bar_Set_RGB_Color_HalfTone(uint8_t red, uint8_t green, uint8_t blue, uint8_t fade_length, uint8_t fade_direction ) +{ + uint8_t i =0, k=0; + UTIL_MEM_set_8((void*)rgb_buf.GRB,0x00,(WS2812B_DATA_LEN+RESET_PULSE)); + + uint8_t fade_len = min(fade_length, STS_LAM_BAR_LED_NUM); //ensure it's not over length + uint8_t cc_red=red, cc_green= green, cc_blue=blue; + + do + { + for (uint8_t j = 0; j < 8; j ++) + { + rgb_buf.GRB[i*24+j] = (uint16_t)(((cc_green<