static void button_1_press_handle(GPIO_IO_Type pin_level) { if (pin_level == GPIO_IO_LOW) { LOG_INFO("button pressed\r\n"); if (os_timer_is_running(&g_reset_prov_timer)) { if (WM_SUCCESS != os_timer_deactivate(&g_reset_prov_timer)) { LOG_ERROR("deactivating reset provision timer failed\r\n"); } } if(WM_SUCCESS != os_timer_activate(&g_reset_prov_timer)) { LOG_ERROR("activating reset provision timer failed\r\n"); } } else { LOG_INFO("button released\r\n"); os_semaphore_put(&btn_pressed_sem); if (os_timer_is_running(&g_reset_prov_timer)) { if (WM_SUCCESS != os_timer_deactivate(&g_reset_prov_timer)) { LOG_ERROR("deactivating reset provision timer failed\r\n"); } } } }
VOID start_active_gateway(VOID) { set_gw_status(ACTIVE_RD); if(os_timer_is_active(&gw_actv_timer) != WM_SUCCESS) { os_timer_activate(&gw_actv_timer); } }
static void led_cb(os_timer_arg_t handle) { int tid = (int) os_timer_get_context(&handle); if (tid >= LED_COUNT) { return; } if (led_data[tid].curr_state == LED_ON) { board_led_off(led_data[tid].led_no); led_data[tid].curr_state = LED_OFF; os_timer_change(&led_data[tid].timer, led_data[tid].off_duty_cycle, -1); os_timer_activate(&led_data[tid].timer); } else { board_led_on(led_data[tid].led_no); led_data[tid].curr_state = LED_ON; os_timer_change(&led_data[tid].timer, led_data[tid].on_duty_cycle, -1); os_timer_activate(&led_data[tid].timer); } }
/*********************************************************** * Function: check_dev_need_update * Input: * Output: * Return: * Note: user need to fill the content in the function before call it ***********************************************************/ VOID check_dev_need_update(IN CONST DEV_CNTL_N_S *dev_cntl) { if(NULL == dev_cntl) { PR_ERR("invalid param"); return; } if((get_gw_status() > UN_ACTIVE) && \ ((dev_cntl->dev_if.sync && dev_cntl->dev_if.bind) || \ (!dev_cntl->dev_if.bind))) { // 启动信息更新操作 if(os_timer_is_active(&dev_ul_timer) != WM_SUCCESS) { int ret = os_timer_activate(&dev_ul_timer); if(WM_SUCCESS != ret) { PR_ERR("activeate timer error"); } } } }