嗨
我修改SDK5.0.4 \ DA1458x_SDK \ 5.0.4 \ target_apps \ ble_examples \ \项目prox_reporter项目。
I set const static sleep_state_t app_default_sleep_mode = ARCH_SLEEP_OFF;
我们使用acc传感器来唤醒设备,app_acc_wakeup_cb()和app_accInt_snifftocwake_cb()被回调,这似乎是正常的。但有时在app_accInt_snifftocwake_cb()函数的app_timer_set(APP_ALG_PERIOD_TASK_TIMER, TASK_APP, 100);异常时,APP_ALG_PERIOD_TASK_TIMER不工作,经过长时间(约5分钟),APP_ALG_PERIOD_TASK_TIMER开始工作。
请给我一些建议!< / p > < p > < / p > < pre > <代码类=“language-cpp”>静态常量struct ke_msg_handler app_custs1_process_handlers [] = {{APP_ALG_PERIOD_TASK_TIMER, (ke_msg_func_t) app_alg_period_task_timer_handler}, {CUSTS1_CREATE_DB_CFM, (ke_msg_func_t) app_custs1_create_db_cfm_handler}, {CUSTS1_DISABLE_IND, (ke_msg_func_t) app_custs1_disable_ind_handler}};Static int app_alg_period_task_timer_handler(ke_msg_id_t const msgid, void const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id) {Static int i=0;app_timer_set (APP_ALG_PERIOD_TASK_TIMER dest_id 100);我+ +; arch_printf("i=%d\r\n",i); test_ble_send_data_function(); return (KE_MSG_CONSUMED); } void set_device_to_sleep(void) { arch_printf("set_device_to_sleep\r\n"); if(ke_timer_active(APP_ALG_PERIOD_TASK_TIMER,TASK_APP)){ ke_timer_clear(APP_ALG_PERIOD_TASK_TIMER,TASK_APP); } if(ke_state_get(TASK_APP)==APP_CONNECTED){ disconnect_no_adv_flag = 1; app_easy_gap_disconnect(save_connection_idx); } app_easy_gap_advertise_stop(); hsppad042a_standby(); hsactd_set_to_sniff(); arch_ble_ext_wakeup_on(); app_accInt_wakeup_enable(); arch_set_extended_sleep(); } static void app_acc_wakeup_cb(void) { disconnect_no_adv_flag = 0; default_advertise_operation(); arch_printf("app_acc_wakeup_cb"); } static void app_accInt_snifftocwake_cb(void) { if (GetBits16(SYS_STAT_REG, PER_IS_DOWN)) { periph_init(); } if (arch_ble_ext_wakeup_get()) { arch_disable_sleep(); arch_ble_force_wakeup(); arch_ble_ext_wakeup_off(); app_easy_wakeup(); } hsactd003a_readsteate_clear_pending(); arch_printf("app_accInt_snifftocwake_cb\r\n"); app_timer_set(APP_ALG_PERIOD_TASK_TIMER, TASK_APP, 100); app_accInt_wakeup_enable(); } void app_accInt_wakeup_enable(void) { app_easy_wakeup_set(app_acc_wakeup_cb); wkupct_register_callback(app_accInt_snifftocwake_cb); // if (!GPIO_GetPinStatus(GPIO_ACCINT_PORT, GPIO_ACCINT_PIN)) { wkupct_enable_irq(WKUPCT_PIN_SELECT(GPIO_ACCINT_PORT, GPIO_ACCINT_PIN), // select pin WKUPCT_PIN_POLARITY(GPIO_ACCINT_PORT, GPIO_ACCINT_PIN, WKUPCT_PIN_POLARITY_HIGH), 1, // 1 event 3); // debouncing time = 0 } }