mirror of
https://gitee.com/dlmu-cone/bf_original_balance_chassis
synced 2026-07-24 11:37:45 +08:00
init commit
This commit is contained in:
21
bsp/bsp_led.c
Normal file
21
bsp/bsp_led.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "bsp_led.h"
|
||||
#include "main.h"
|
||||
|
||||
extern TIM_HandleTypeDef htim5;
|
||||
|
||||
void aRGB_led_show(uint32_t aRGB)
|
||||
{
|
||||
static uint8_t alpha;
|
||||
static uint16_t red,green,blue;
|
||||
|
||||
alpha = (aRGB & 0xFF000000) >> 24;
|
||||
red = ((aRGB & 0x00FF0000) >> 16) * alpha;
|
||||
green = ((aRGB & 0x0000FF00) >> 8) * alpha;
|
||||
blue = ((aRGB & 0x000000FF) >> 0) * alpha;
|
||||
|
||||
__HAL_TIM_SetCompare(&htim5, TIM_CHANNEL_1, blue);
|
||||
__HAL_TIM_SetCompare(&htim5, TIM_CHANNEL_2, green);
|
||||
__HAL_TIM_SetCompare(&htim5, TIM_CHANNEL_3, red);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user