diff --git a/applications/user_sys.h b/applications/user_sys.h index d45319b..5a582a8 100644 --- a/applications/user_sys.h +++ b/applications/user_sys.h @@ -35,7 +35,7 @@ // 定义宏来打印编译时间和日期 #define COMPILE_TIME \ do { \ - rt_kprintf("Compiled on: %s at %s\n", __DATE__, __TIME__); \ + rt_kprintf("Compiled at: %s\n", __TIMESTAMP__); \ } while (0) typedef enum diff --git a/bsp/inc/bsp_button.h b/bsp/inc/bsp_button.h index 1864172..b24bdb7 100644 --- a/bsp/inc/bsp_button.h +++ b/bsp/inc/bsp_button.h @@ -9,7 +9,7 @@ #endif // 不然就是用 timer 实现按键扫描处理 -// #define BUTTON_USE_THREAD +#define BUTTON_USE_THREAD #ifdef BUTTON_USE_THREAD #define BUTTON_THREAD_PRIORITY 5 // 优先级拉高,这时按键响应快点 diff --git a/bsp/src/bsp_button.c b/bsp/src/bsp_button.c index a47fd8a..b9f2a59 100644 --- a/bsp/src/bsp_button.c +++ b/bsp/src/bsp_button.c @@ -105,44 +105,31 @@ int BSP_BUTTON_Init(void) flex_button_register(&user_button[i]); } #ifdef BUTTON_USE_THREAD - // ret = rt_thread_init(&button_thread, - // "button_thread", - // _BUTTON_Process, - // RT_NULL, - // &button_thread_stack[0], - // sizeof(button_thread_stack), - // BUTTON_THREAD_PRIORITY, - // BUTTON_THREAD_TICKS); + ret = rt_thread_init(&button_thread, + "button_thread", + _BUTTON_Process, + RT_NULL, + &button_thread_stack[0], + sizeof(button_thread_stack), + BUTTON_THREAD_PRIORITY, + BUTTON_THREAD_TICKS); - // if (ret == RT_EOK) - // { - // rt_thread_startup(&button_thread); - // return RT_EOK; - // } - // else - // { - // LOG_E("button_thread create failed"); - // return -RT_ERROR; - // } + if (ret == RT_EOK) + { + rt_thread_startup(&button_thread); + return RT_EOK; + } + else + { + LOG_E("button_thread create failed"); + return -RT_ERROR; + } #else // TODO:这里改的静态 rt_timer_init(&button_timer1, "button_timer", _BUTTON_Process, RT_NULL, 20, RT_TIMER_FLAG_PERIODIC); rt_timer_start(&button_timer1); - - // button_timer = rt_timer_create("button_timer", _BUTTON_Process, - // RT_NULL, 20, - // RT_TIMER_FLAG_PERIODIC); - // if (button_timer != RT_NULL) - // { - // rt_timer_start(button_timer); - // } - // else - // { - // LOG_E("create button_timer fail"); - // return -RT_ERROR; - // } #endif // !BUTTON_USE_THREAD LOG_I("BSP_BUTTON_Init!"); diff --git a/bsp/src/bsp_nt26k.c b/bsp/src/bsp_nt26k.c index a36e083..ec4efaa 100644 --- a/bsp/src/bsp_nt26k.c +++ b/bsp/src/bsp_nt26k.c @@ -171,7 +171,13 @@ void Nt26k_Send_Event(Nt26kEvent event_type) nt26k_event_index.current_event = event_type; if (nt26k_event_initialized == RT_TRUE) { - rt_event_send(&at_device_event, Nt26k_Get_Event_Flag(event_type)); + if (nt26k_event_index.current_event != kNt26kPowerOnEvent) + { + if(power_on_send_flag) + { + rt_event_send(&at_device_event, Nt26k_Get_Event_Flag(event_type)); + } + } } else {