/* Function for Timer 2 initialization. 
Initializes Timer 2 peripheral, creates event and interrupt every 2 seconds by configuring CC to half of timer overflow value. Events are created at odd number of seconds. For example, events are created at 1,3,5,... seconds. This event can be used to start Timer 0 with Timer2->Event_Compare triggering Timer 0 TASK_START through PPI.  */
static void timer2_init(void)
/* Function for Timer 2 initialization. 
Initializes Timer 2 peripheral, creates event and interrupt every 2 seconds by configuring CC to half of timer overflow value. Events are created at odd number of seconds. For example, events are created at 1,3,5,... seconds. This event can be used to start Timer 0 with Timer2->Event_Compare triggering Timer 0 TASK_START through PPI.  */
static void timer2_init(void)
{
    nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
    timer_cfg.frequency = NRF_TIMER_FREQ_31250Hz;
    ret_code_t err_code = nrf_drv_timer_init(&timer2, &timer_cfg, timer_event_handler);
    APP_ERROR_CHECK(err_code);
    nrf_drv_timer_extended_compare(&timer2, NRF_TIMER_CC_CHANNEL0, 0x7FFFUL, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, false);
}