diff --git a/bsp/src/bsp_led.c b/bsp/src/bsp_led.c index 143ee94..20c1bd4 100644 --- a/bsp/src/bsp_led.c +++ b/bsp/src/bsp_led.c @@ -1,15 +1,14 @@ #include "bsp_led.h" #include "rtthread.h" #include "pin.h" -#include "bsp_nt26k.h" +#include "bsp_nt26k.h" #include "user_sys.h" - #define LOG_TAG "bsp.led" #define LOG_LVL LOG_LVL_DBG #include -//用到了atoi +// 用到了atoi #include agile_led_t *led_r = RT_NULL; @@ -20,49 +19,22 @@ ALIGN(4) static char user_led_thread_stack[512]; static struct rt_thread user_led_thread; - static void BSP_Led_thread_entry(void *param) { while (1) - { + { if (SysControl.status == kNormalDetectionEvents) { - if ((nt26k_conncet_tcp_flag == 1) && nt26k_connect_sever_flag == 1) - { - LED_G_NORMAL; - } - else - { - LED_STOP(r); - LED_STOP(g); - LED_STOP(y); - rt_pin_write(LED_G_PIN, PIN_HIGH); - rt_thread_mdelay(500); - rt_pin_write(LED_G_PIN, PIN_LOW); - rt_thread_mdelay(500); - } - } - else if (SysControl.status == KMuteEvent) - { - if (SysControl.last_status == kNormalDetectionEvents) + if (nt26k_connect_sever_flag) { - if ((nt26k_conncet_tcp_flag == 1) && nt26k_connect_sever_flag == 1) - { - LED_G_NORMAL; - } - else - { - LED_STOP(r); - LED_STOP(g); - LED_STOP(y); - rt_pin_write(LED_G_PIN, PIN_HIGH); - rt_thread_mdelay(500); - rt_pin_write(LED_G_PIN, PIN_LOW); - rt_thread_mdelay(500); - } + LED_G_NORMAL; + } + else + { + LED_G_INTERNET; } } - rt_thread_mdelay(1); + rt_thread_mdelay(1000); } } int BSP_LED_Init(void) @@ -71,7 +43,7 @@ int BSP_LED_Init(void) led_g = agile_led_create(LED_G_PIN, PIN_HIGH, "100,0", 0); led_y = agile_led_create(LED_Y_PIN, PIN_HIGH, "100,0", 0); - rt_err_t ret = rt_thread_init(&user_led_thread, + rt_err_t ret = rt_thread_init(&user_led_thread, "user_led_thread", BSP_Led_thread_entry, RT_NULL,