/**@brief Function for handling the Running Speed and Cadence measurement timer timeout. * * @details This function will be called each time the running speed and cadence * measurement timer expires. * * @param[in] p_context Pointer used for passing some arbitrary information (context) from the * app_start_timer() call to the timeout handler. */ static void rsc_meas_timeout_handler(void * p_context) { static uint8_t i; uint32_t err_code; ble_rscs_meas_t rscs_measurement; ak8963_cmps *cmps; UNUSED_PARAMETER(p_context); if(get_work_mode() == SYSTEM_PEDOMETER_MODE) pedometer_startup(); if(++i >= 100) //100 * 10ms = 1s { i = 0; if(get_work_mode() == SYSTEM_PEDOMETER_MODE) { rsc_sim_measurement(&rscs_measurement); err_code = ble_rscs_measurement_send(&m_rscs, &rscs_measurement); } else if(get_work_mode() == SYSTEM_TEMP_MODE) { temperature_measurement_send(); } else if(get_work_mode() == SYSTEM_COMPASS_MODE) { cmps = ak8963_get_value(); oled_update_cmps(cmps); } if ( (err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_INVALID_STATE) && (err_code != BLE_ERROR_NO_TX_BUFFERS) && (err_code != BLE_ERROR_GATTS_SYS_ATTR_MISSING) ) { // APP_ERROR_HANDLER(err_code); } } }
/*--------------------------- -----------------------*/ void system_default_work_mode_operate() { pedometer_startup(); }