修改message queue 只有创建queue后才能wirte进去,解决 gsensor 和 cat1 中断 造成的系统不休眠问题。(特定中断开机会执行queue错误... 163/1
authorSnickerSun <snickersun@163.com>
Sat, 11 May 2024 07:19:08 +0000 (15:19 +0800)
committerSnickerSun <snickersun@163.com>
Sat, 11 May 2024 07:19:08 +0000 (15:19 +0800)
code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h
code/sdk/drivers/peripheral/cywee/service/cywee_service.c
code/sdk/drivers/peripheral/utils/custom_cmd_service.c

index 81a6405..9a5ca7c 100755 (executable)
@@ -292,14 +292,15 @@ const hal_gpio_config_t g_gpio_function_config[PIN_MAX_NUMBER] = {
 #ifdef ENABLE_CYWEE
     /**G sensor G_INT1 S_AGPIO_L11 G_INT2 S_AGPIO_L19*/
     //{   S_AGPIO_L11, HAL_GPIO_DIRECTION_INPUT, HAL_GPIO_LEVEL_LOW, GPIO_INTERRUPT_RISING_EDGE, cywee_int_callback },
-    {   S_AGPIO_L19, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_DEDGE, cywee_int_callback },
-    // {   S_AGPIO_L19, HAL_GPIO_DIRECTION_INPUT, HAL_GPIO_LEVEL_LOW, 0, NULL },
+    // {   S_AGPIO_L19, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_DEDGE, cywee_int_callback },
+    {   S_AGPIO_L19, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_RISING_EDGE, cywee_int_callback },
 #endif   
     /**S_AGPIO_R1 GPO alipay默认resetpin*/
     {   S_AGPIO_R1, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL },
 #ifdef SUPPORT_CAT1_SERVICE
     /**cat1 ring input key*/
-    {   S_AGPIO_L31, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_DEDGE,  cat1_ring_isr_callback},
+    // {   S_AGPIO_L31, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_DEDGE,  cat1_ring_isr_callback},
+    {   S_AGPIO_L31, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_RISING_EDGE,  cat1_ring_isr_callback},
 #endif
 };
 /**
index 1ac1f72..e57c9e8 100644 (file)
@@ -53,7 +53,6 @@ osTimerId_t g_cywee_service_timer = NULL;
 static bool g_batter_service_initialled = false;
 
 static bool g_bat_timer_is_running = false;
-static unsigned long g_cywee_queue;
 
 static bool cywee_service_running_stat = false;
 static void cywee_service_check_timer_callback(void *data);
@@ -227,10 +226,14 @@ void uapi_cywee_service_deinit(void)
     g_cywee_service_timer = NULL;
     g_bat_timer_is_running = false;
 }
-
+static unsigned long g_cywee_queue = 0xFFFFFFFF;
+static uint8_t g_cywee_queue_created = 0;
 void do_cywee_service_check_msg(int cmd, int data[2])
 {
     int ret;
+    
+    // PRINT("do_cywee_service_check_msg g_cywee_queue %d g_cywee_queue_created %d MSG 0x%02X \r\n",g_cywee_queue,g_cywee_queue_created, cmd);
+    if( g_cywee_queue_created == 0) return ;
 
     cywee_cmd_t mail = {0};
     mail.cmd = cmd;
@@ -393,7 +396,11 @@ void create_cywee_queue(void)
                               0, sizeof(cywee_cmd_t)) != ERRCODE_SUCC)
     {
         printf("[cywee][service] app create mail fail\n");
+        g_cywee_queue_created = 0;
+    }else{
+        g_cywee_queue_created = 1;
     }
+
 }
 errcode_t uapi_cywee_service_init(void)
 {
index b708dc6..16d489b 100644 (file)
@@ -42,13 +42,14 @@ typedef struct
 
 static bool g_bat_timer_is_running = false;
 static unsigned long g_custom_cmd_queue;
-
+static bool g_custom_cmd_queue_created = 0;
 static bool custom_cmd_service_running_stat = false;
 
 void do_custom_cmd_service_check_msg(int cmd, void *params, int paramlen)
 {
     int ret;
 
+    if (g_custom_cmd_queue_created == 0 ) return ;
     // 检查参数长度是否合法
     if (paramlen > sizeof(custom_cmd_cmd_t) - sizeof(uint8_t))
     {
@@ -140,6 +141,9 @@ void create_custom_cmd_queue(void)
                               0, sizeof(custom_cmd_cmd_t)) != ERRCODE_SUCC)
     {
         printf("[custom_cmd][service] app create mail fail\n");
+        g_custom_cmd_queue_created = 0;
+    }else{
+        g_custom_cmd_queue_created = 1;
     }
 }
 errcode_t uapi_custom_cmd_service_init(void)