From 26206a5d97395d34a448b02865d18c678a14cda8 Mon Sep 17 00:00:00 2001 From: SnickerSun Date: Sat, 11 May 2024 15:19:08 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9message=20queue=20=E5=8F=AA?= =?utf8?q?=E6=9C=89=E5=88=9B=E5=BB=BAqueue=E5=90=8E=E6=89=8D=E8=83=BDwirte?= =?utf8?q?=E8=BF=9B=E5=8E=BB=EF=BC=8C=E8=A7=A3=E5=86=B3=20gsensor=20?= =?utf8?q?=E5=92=8C=20cat1=20=E4=B8=AD=E6=96=AD=20=E9=80=A0=E6=88=90?= =?utf8?q?=E7=9A=84=E7=B3=BB=E7=BB=9F=E4=B8=8D=E4=BC=91=E7=9C=A0=E9=97=AE?= =?utf8?q?=E9=A2=98=E3=80=82=EF=BC=88=E7=89=B9=E5=AE=9A=E4=B8=AD=E6=96=AD?= =?utf8?q?=E5=BC=80=E6=9C=BA=E4=BC=9A=E6=89=A7=E8=A1=8Cqueue=E9=94=99?= =?utf8?q?=E8=AF=AF=E5=86=99=E5=85=A5=EF=BC=8C=E4=BB=8E=E8=80=8C=E9=80=A0?= =?utf8?q?=E6=88=90nvwritetask=20=E6=97=A0=E7=BA=BF=E5=BE=AA=E7=8E=AF?= =?utf8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../boards/brandy_evb/board_config/board_evb.h | 7 ++++--- .../drivers/peripheral/cywee/service/cywee_service.c | 11 +++++++++-- .../sdk/drivers/peripheral/utils/custom_cmd_service.c | 6 +++++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h b/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h index 81a6405d5..9a5ca7c32 100755 --- a/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h +++ b/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h @@ -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 }; /** diff --git a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c index 1ac1f7235..e57c9e8d8 100644 --- a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c +++ b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c @@ -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) { diff --git a/code/sdk/drivers/peripheral/utils/custom_cmd_service.c b/code/sdk/drivers/peripheral/utils/custom_cmd_service.c index b708dc612..16d489b8d 100644 --- a/code/sdk/drivers/peripheral/utils/custom_cmd_service.c +++ b/code/sdk/drivers/peripheral/utils/custom_cmd_service.c @@ -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) -- 2.17.1