50#include "nrfx_config.h"
52#include "nrfx_clock.h"
55const nrfx_rtc_t
rtc = NRFX_RTC_INSTANCE(0);
57static volatile uint32_t ticks;
58void clock_update(
void);
61clock_handler(nrfx_clock_evt_type_t event)
73 if(int_type == NRFX_RTC_INT_TICK) {
83 nrfx_err_t err_code = nrfx_clock_init(clock_handler);
85 if(err_code != NRFX_SUCCESS) {
91 nrfx_clock_lfclk_start();
102 nrfx_rtc_config_t config = NRFX_RTC_DEFAULT_CONFIG;
103 config.prescaler = 255;
104 config.interrupt_priority = 6;
109 if(err_code != NRFX_SUCCESS) {
114 nrfx_rtc_tick_enable(&
rtc,
true);
117 nrfx_rtc_enable(&
rtc);
131 return (clock_time_t)(ticks & 0xFFFFFFFF);
146 return (
unsigned long)ticks / CLOCK_CONF_SECOND;
int etimer_pending(void)
Check if there are any non-expired event timers.
void etimer_request_poll(void)
Make the event timer aware that the clock has changed.
unsigned long clock_seconds(void)
Get the current value of the platform seconds.
void clock_init(void)
Initialize the clock library.
void clock_delay_usec(uint16_t dt)
Delay a given number of microseconds.
void clock_wait(clock_time_t i)
Wait for a given number of ticks.
clock_time_t clock_time(void)
Get the current clock time.
void clock_delay(unsigned int i)
Obsolete delay function but we implement it here since some code still uses it.
static void rtc_handler(nrfx_rtc_int_type_t int_type)
Function for handling the RTC0 interrupts.
static void rtc_config(void)
Function initialization and configuration of RTC driver instance.
const nrfx_rtc_t rtc
RTC instance used for platform clock.
static void lfclk_config(void)
Function starting the internal LFCLK XTAL oscillator.
static void start(void)
Start measurement.