优化了上电事件发送不成功时,仍然发送其他事件的情况
This commit is contained in:
parent
c86894972d
commit
78cd967c48
|
@ -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
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#endif
|
||||
|
||||
// 不然就是用 timer 实现按键扫描处理
|
||||
// #define BUTTON_USE_THREAD
|
||||
#define BUTTON_USE_THREAD
|
||||
|
||||
#ifdef BUTTON_USE_THREAD
|
||||
#define BUTTON_THREAD_PRIORITY 5 // 优先级拉高,这时按键响应快点
|
||||
|
|
|
@ -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!");
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue