50 #include "nrf_drv_config.h" 51 #include "nrf_drv_rtc.h" 52 #include "nrf_drv_clock.h" 53 #include "nrf_delay.h" 54 #include "app_error.h" 60 static volatile uint32_t ticks;
61 void clock_update(
void);
63 #define TICKS (RTC1_CONFIG_FREQUENCY/CLOCK_CONF_SECOND) 72 if (int_type == NRF_DRV_RTC_INT_TICK) {
77 #ifndef SOFTDEVICE_PRESENT 83 ret_code_t err_code = nrf_drv_clock_init(NULL);
84 APP_ERROR_CHECK(err_code);
86 nrf_drv_clock_lfclk_request();
100 APP_ERROR_CHECK(err_code);
103 nrf_drv_rtc_tick_enable(&
rtc,
true);
106 nrf_drv_rtc_enable(&
rtc);
113 #ifndef SOFTDEVICE_PRESENT 122 return (clock_time_t)(ticks & 0xFFFFFFFF);
137 return (
unsigned long)ticks/CLOCK_CONF_SECOND;
145 while (
clock_time() - start < (clock_time_t)i) {
const nrf_drv_rtc_t rtc
RTC instance used for platform clock.
static bool start(void)
Start measurement.
void etimer_request_poll(void)
Make the event timer aware that the clock has changed.
__STATIC_INLINE void __WFE(void)
Wait For Event.
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.
unsigned long clock_seconds(void)
Get the current value of the platform seconds.
int etimer_pending(void)
Check if there are any non-expired event timers.
void clock_delay(unsigned int i)
Obsolete delay function but we implement it here since some code still uses it.
clock_time_t clock_time(void)
Get the current clock time.
static void rtc_config(void)
Function initialization and configuration of RTC driver instance.
static void rtc_handler(nrf_drv_rtc_int_type_t int_type)
Function for handling the RTC0 interrupts.
void clock_init(void)
Arch-specific implementation of clock_init for the cc2538.