static void event_handler(nrfx_rtc_int_type_t int_type, void *p_context) { struct device *dev = p_context; struct counter_nrfx_data *data = get_dev_data(dev); if (int_type == COUNTER_TOP_INT) { /* Manually reset counter if top value is different than max. */ if ((data->top != COUNTER_MAX_TOP_VALUE) #if CONFIG_COUNTER_RTC_WITH_PPI_WRAP && !get_nrfx_config(dev)->use_ppi #endif ) { nrfx_rtc_counter_clear(&get_nrfx_config(dev)->rtc); } nrfx_rtc_cc_set(&get_nrfx_config(dev)->rtc, TOP_CH, data->top, true); if (data->top_cb) { data->top_cb(dev, data->top_user_data); } } else if (int_type > COUNTER_TOP_INT) { alarm_event_handler(dev, CC_TO_ID(int_type)); } }
static void event_handler(nrf_timer_event_t event_type, void *p_context) { struct device *dev = p_context; struct counter_nrfx_data *dev_data = get_dev_data(dev); if (event_type == COUNTER_TOP_INT) { if (dev_data->top_cb) { dev_data->top_cb(dev, dev_data->top_user_data); } } else if (event_type > NRF_TIMER_EVENT_COMPARE1) { alarm_event_handler(dev, COUNTER_EVENT_TO_ID(event_type)); } }