Hi everyone.
In mesh light switch example., i try to add timer0 (or any timer).
After initialize timer, application always jump to timeout event, and i don't know why.
My code working perfectly in nRF SDK v15, but not working in Mesh SDK.
Any body have a solution to add timer into mesh project?
Here is my timer_config function.
const nrf_drv_timer_t TIMER_LED = NRF_DRV_TIMER_INSTANCE(0); void timeout_config(uint32_t milisecond) { uint32_t time_ms = milisecond; //Time(in miliseconds) between consecutive compare events. uint32_t time_ticks; uint32_t err_code = NRF_SUCCESS; nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG; err_code = nrf_drv_timer_init(&TIMER_PROVISION, &timer_cfg, provision_timeout_event_handler); APP_ERROR_CHECK(err_code); // time_ticks = nrf_drv_timer_ms_to_ticks(&TIMER_PROVISION, time_ms); nrfx_timer_compare(&TIMER_PROVISION, NRF_TIMER_CC_CHANNEL1, time_ms, true); nrf_drv_timer_enable(&TIMER_PROVISION); }
My event handle function
void provision_timeout_event_handler(nrf_timer_event_t event_type, void* p_context) { switch (event_type) { case NRF_TIMER_EVENT_COMPARE0: bsp_board_led_invert(1); break; default: //Do nothing. break; } }
main:
int main() { timeout_config(5000); // 5000ms timeout_start(); initialize(); execution_start(start); while(1) {} }
Thank you so much!