uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context) { uint32_t timeout_periodic; timer_node_t * p_node = (timer_node_t*)timer_id; // Check state and parameters if (mp_users == NULL) { return NRF_ERROR_INVALID_STATE; } if (timer_id == 0) { return NRF_ERROR_INVALID_STATE; } if (timeout_ticks < APP_TIMER_MIN_TIMEOUT_TICKS) { return NRF_ERROR_INVALID_PARAM; } if (p_node->p_timeout_handler == NULL) { return NRF_ERROR_INVALID_STATE; } // Schedule timer start operation timeout_periodic = (p_node->mode == APP_TIMER_MODE_REPEATED) ? timeout_ticks : 0; return timer_start_op_schedule(user_id_get(), p_node, timeout_ticks, timeout_periodic, p_context); }
uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context) { uint32_t timeout_periodic; // Check state and parameters if (mp_nodes == NULL) { return NRF_ERROR_INVALID_STATE; } if ((timer_id >= m_node_array_size) || (timeout_ticks < APP_TIMER_MIN_TIMEOUT_TICKS)) { return NRF_ERROR_INVALID_PARAM; } if (mp_nodes[timer_id].state != STATE_ALLOCATED) { return NRF_ERROR_INVALID_STATE; } // Schedule timer start operation timeout_periodic = (mp_nodes[timer_id].mode == APP_TIMER_MODE_REPEATED) ? timeout_ticks : 0; return timer_start_op_schedule(user_id_get(), timer_id, timeout_ticks, timeout_periodic, p_context); }
uint32_t app_timer_stop(app_timer_id_t timer_id) { // Check state and parameters if (mp_nodes == NULL) { #ifdef DEBUG_LOG printf("app_timer_stop\r\n"); #endif return NRF_ERROR_INVALID_STATE; } if (timer_id >= m_node_array_size) { return NRF_ERROR_INVALID_PARAM; } if (mp_nodes[timer_id].state != STATE_ALLOCATED) { #ifdef DEBUG_LOG printf("app_timer_stop\r\n"); #endif return NRF_ERROR_INVALID_STATE; } // Schedule timer stop operation return timer_stop_op_schedule(user_id_get(), timer_id); }
uint32_t app_timer_stop_all(void) { // Check state if (mp_users == NULL) { return NRF_ERROR_INVALID_STATE; } return timer_stop_all_op_schedule(user_id_get()); }
uint32_t app_timer_stop_all(void) { // Check state if (mp_nodes == NULL) { #ifdef DEBUG_LOG printf("app_timer_stop_all\r\n"); #endif return NRF_ERROR_INVALID_STATE; } return timer_stop_all_op_schedule(user_id_get()); }
uint32_t app_timer_stop(app_timer_id_t timer_id) { timer_node_t * p_node = (timer_node_t*)timer_id; // Check state and parameters if (mp_users == NULL) { return NRF_ERROR_INVALID_STATE; } if ((timer_id == NULL) || (p_node->p_timeout_handler == NULL)) { return NRF_ERROR_INVALID_STATE; } // Schedule timer stop operation return timer_stop_op_schedule(user_id_get(), p_node); }