diff --git a/Core/Inc/main.h b/Core/Inc/main.h index 53bc1f6..772ea49 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -352,9 +352,9 @@ void Error_Handler(void); /* * STM32WL55, STM32WLE5 Clock=48Mhz 48,000,000/800khz = 60 */ -#define STS_LAMP_BAR_PWM_TIM_PERIOD (240 - 1) +#define STS_LAMP_BAR_PWM_TIM_PERIOD (60 - 1) #define STS_LAMP_BAR_HTIM htim1 -//#define STS_LAMP_BAR_LED_NUM (14) //60 for 46CM length LED strip +#define STS_LAMP_BAR_LED_NUM (18) //60 for 46CM length LED strip #define WSDATA_PORT_PIN_PA8 //#define WSDATA_PORT_PIN_PA9 diff --git a/Core/Src/sts_lamp_bar.c b/Core/Src/sts_lamp_bar.c index 54d0525..0a5e7a5 100644 --- a/Core/Src/sts_lamp_bar.c +++ b/Core/Src/sts_lamp_bar.c @@ -30,23 +30,23 @@ #define ONE_PULSE (24) //36 #define ZERO_PULSE (12) -#define STS_LAMP_BAR_LED_NUM (27) //60 for 46CM length LED strip +//#define STS_LAMP_BAR_LED_NUM (27) //60 for 46CM length LED strip #define LED_DATA_LEN 24 #define WS2812B_DATA_LEN (LED_DATA_LEN * (STS_LAMP_BAR_LED_NUM)) #define RESET_PULSE (16) //(80) TO FIX DARK_COLOR AND SM2 typedef struct ws2812b_e { - //uint16_t head[3]; - uint16_t GRB[WS2812B_DATA_LEN+RESET_PULSE]; - uint16_t tail[RESET_PULSE]; + uint8_t head[3]; + uint8_t GRB[WS2812B_DATA_LEN+RESET_PULSE]; + uint8_t tail[RESET_PULSE]; } WS2812B_FrameTypeDef; volatile WS2812B_FrameTypeDef rgb_buf = { -// .head[0] = 10, -// .head[1] = 10, -// .head[2] = 10, - //.tail = 00 + .head[0] = 0, + .head[1] = 0, + .head[2] = 0, + .tail = {00} }; uint8_t color_rgb[8][3] = { //STS_COLOR R G B MAPPING TABLE @@ -101,7 +101,7 @@ void STS_WS2812B_Refresh(void) { HAL_TIM_PWM_Start_DMA(&STS_LAMP_BAR_HTIM, STS_LAMP_BAR_TIM_CHANNEL, (uint32_t *)&rgb_buf, (WS2812B_DATA_LEN+RESET_PULSE)); - HAL_TIM_PWM_Start_IT(&STS_LAMP_BAR_HTIM, STS_LAMP_BAR_TIM_CHANNEL); + //HAL_TIM_PWM_Start_IT(&STS_LAMP_BAR_HTIM, STS_LAMP_BAR_TIM_CHANNEL); } void STS_Lamp_Bar_Init(void) @@ -127,7 +127,7 @@ void STS_Lamp_Bar_Scoller(uint8_t color, uint8_t lum_level) for(uint8_t i = 0; i