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);
67 if(int_type == NRFX_RTC_INT_TICK) {
77 nrfx_err_t err_code = nrfx_clock_init(NULL);
79 if(err_code != NRFX_SUCCESS) {
83 nrfx_clock_lfclk_start();
94 nrfx_rtc_config_t
config = NRFX_RTC_DEFAULT_CONFIG;
96 config.interrupt_priority = 6;
101 if(err_code != NRFX_SUCCESS) {
106 nrfx_rtc_tick_enable(&
rtc,
true);
109 nrfx_rtc_enable(&
rtc);
123 return (clock_time_t)(ticks & 0xFFFFFFFF);
138 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.
static void rtc_handler(nrfx_rtc_int_type_t int_type)
Function for handling the RTC0 interrupts.
void clock_init(void)
Initialize the clock library.
static void rtc_config(void)
Function initialization and configuration of RTC driver instance.
const nrfx_rtc_t rtc
RTC instance used for platform clock.
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.
static void lfclk_config(void)
Function starting the internal LFCLK XTAL oscillator.
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 start(void)
Start measurement.