52 #include "hal/nrf_timer.h" 57 nrf_timer_event_clear(NRF_TIMER0, NRF_TIMER_EVENT_COMPARE0);
59 nrf_timer_frequency_set(NRF_TIMER0, NRF_TIMER_FREQ_62500Hz);
60 nrf_timer_bit_width_set(NRF_TIMER0, NRF_TIMER_BIT_WIDTH_32);
61 nrf_timer_mode_set(NRF_TIMER0, NRF_TIMER_MODE_TIMER);
62 nrf_timer_int_enable(NRF_TIMER0, NRF_TIMER_INT_COMPARE0_MASK);
63 NVIC_ClearPendingIRQ(TIMER0_IRQn);
64 NVIC_EnableIRQ(TIMER0_IRQn);
65 nrf_timer_task_trigger(NRF_TIMER0, NRF_TIMER_TASK_START);
74 nrf_timer_cc_set(NRF_TIMER0, NRF_TIMER_CC_CHANNEL0, t);
80 nrf_timer_task_trigger(NRF_TIMER0, NRF_TIMER_TASK_CAPTURE1);
81 return nrf_timer_cc_get(NRF_TIMER0, NRF_TIMER_CC_CHANNEL1);
85 TIMER0_IRQHandler(
void)
87 if(nrf_timer_event_check(NRF_TIMER0, NRF_TIMER_EVENT_COMPARE0)) {
88 nrf_timer_event_clear(NRF_TIMER0, NRF_TIMER_EVENT_COMPARE0);
rtimer_clock_t rtimer_arch_now()
Returns the current real-time clock time.
void rtimer_arch_schedule(rtimer_clock_t t)
Schedules an rtimer task to be triggered at time t.
void rtimer_arch_init(void)
We don't need to explicitly initialise anything but this routine is required by the API...
void rtimer_run_next(void)
Execute the next real-time task and schedule the next task, if any.