修复button release可能不上报的问题 878/1 878/head
authorSnickerSun <snickersun@163.com>
Thu, 5 Sep 2024 07:34:59 +0000 (15:34 +0800)
committerSnickerSun <snickersun@163.com>
Thu, 5 Sep 2024 07:34:59 +0000 (15:34 +0800)
code/sdk/drivers/peripheral/button/button.c

index 2a65e79..e038cd5 100644 (file)
@@ -55,6 +55,7 @@ timer_handle_t g_button_timer = {0};
 timer_handle_t g_gpio_button_timer = {0};
 button_info_t g_button_info = {0};
 bool g_timer_is_running = false;
+bool g_button_timer_is_running = false;
 msg_send_callback_t g_msg_send_cb = NULL;
 
 static const char* g_state_str[PRESSED_MAX] = {
@@ -121,8 +122,8 @@ static void button_timer_start(void)
 static void button_timer_start_check_released(void)
 {
     bool start = false;
-    if (!g_timer_is_running) {
-        g_timer_is_running = true;
+    if (!g_button_timer_is_running) {
+        g_button_timer_is_running = true;
         start = true;
     }
 
@@ -235,7 +236,7 @@ static void button_check_released_timer_callback(uint32_t data)
 {
     unused(data);
 
-    g_timer_is_running = false;
+    g_button_timer_is_running = false;
 
     button_peripheral_api *button_api = button_port_get_api();
     button_press_state_t press_state;