2023-02-14 11:05:41 +08:00
|
|
|
#include "led.h"
|
|
|
|
#include "stdlib.h"
|
2023-02-16 15:46:04 +08:00
|
|
|
#include "memory.h"
|
2023-02-14 11:05:41 +08:00
|
|
|
#include "user_lib.h"
|
|
|
|
|
|
|
|
static uint8_t idx;
|
2023-02-16 15:46:04 +08:00
|
|
|
static LEDInstance *bsp_led_ins[LED_MAX_NUM] = {NULL};
|
2023-02-14 11:05:41 +08:00
|
|
|
|
|
|
|
LEDInstance *LEDRegister(LED_Init_Config_s *led_config)
|
|
|
|
{
|
|
|
|
LEDInstance *led_ins = (LEDInstance *)zero_malloc(sizeof(LEDInstance));
|
|
|
|
// 剩下的值暂时都被置零
|
2023-03-23 19:40:36 +08:00
|
|
|
led_ins->led_pwm = PWMRegister(&led_config->pwm_config);
|
2023-02-16 15:46:04 +08:00
|
|
|
led_ins->led_switch = led_config->init_swtich;
|
|
|
|
|
2023-02-14 11:05:41 +08:00
|
|
|
bsp_led_ins[idx++] = led_ins;
|
|
|
|
return led_ins;
|
|
|
|
}
|
|
|
|
|
2023-02-16 15:46:04 +08:00
|
|
|
void LEDSet(LEDInstance *_led, uint8_t alpha, uint8_t color_value, uint8_t brightness)
|
2023-02-14 11:05:41 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-02-16 15:46:04 +08:00
|
|
|
void LEDSwitch(LEDInstance *_led, uint8_t led_switch)
|
2023-02-14 11:05:41 +08:00
|
|
|
{
|
2023-02-16 15:46:04 +08:00
|
|
|
if (led_switch == 1)
|
2023-02-14 11:05:41 +08:00
|
|
|
{
|
2023-02-16 15:46:04 +08:00
|
|
|
_led->led_switch = 1;
|
2023-02-14 11:05:41 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-02-16 15:46:04 +08:00
|
|
|
_led->led_switch = 0;
|
2023-02-14 11:05:41 +08:00
|
|
|
// PWMSetPeriod(_led,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void LEDShow()
|
|
|
|
{
|
|
|
|
}
|