Files
hc32f460_boot/App/app_led.c
T
2026-04-23 13:49:53 +08:00

47 lines
877 B
C

#include "main.h"
#include "pt_ext.h"
#include "pt_task.h"
#include "hdl_led.h"
#include "app_led.h"
static volatile uint8_t led_status;
void app_led_set_status(app_led_status_t status)
{
led_status = status;
}
int app_led_entry(struct pt *pt)
{
PT_BEGIN(pt);
hdl_led_init();
hdl_led_off(HDL_LED_ID_0);
while (1){
PT_YIELD(pt);
if(led_status == APP_LED_STATUS_UPDATE_RDY){
hdl_led_on(HDL_LED_ID_0);
PT_DELAY_MS(pt,20);
hdl_led_off(HDL_LED_ID_0);
PT_DELAY_MS(pt,500);
}
if(led_status == APP_LED_STATUS_UPDATE_ING){
hdl_led_on(HDL_LED_ID_0);
PT_DELAY_MS(pt,50);
hdl_led_off(HDL_LED_ID_0);
PT_DELAY_MS(pt,50);
}
}
PT_END(pt);
}
PT_TASK_APP_REG(app_led_entry);