50#include "sl_sleeptimer.h"
52static volatile uint32_t ticks;
53static sl_sleeptimer_timer_handle_t periodic_timer;
56on_periodic_timeout(sl_sleeptimer_timer_handle_t *handle,
66delay_callback(sl_sleeptimer_timer_handle_t *handle,
69 volatile bool *wait_flag = (
bool *)data;
79 uint32_t timer_frequency;
82 timer_frequency = sl_sleeptimer_get_timer_frequency();
84 sl_sleeptimer_start_periodic_timer(&periodic_timer,
85 timer_frequency / CLOCK_CONF_SECOND,
86 on_periodic_timeout, NULL,
88 SL_SLEEPTIMER_NO_HIGH_PRECISION_HF_CLOCKS_REQUIRED_FLAG);
94 return (clock_time_t)(ticks & 0xFFFFFFFF);
100 return (
unsigned long)ticks / CLOCK_CONF_SECOND;
116 volatile bool wait =
true;
117 sl_status_t error_code;
118 sl_sleeptimer_timer_handle_t delay_timer;
119 uint32_t timer_frequency = sl_sleeptimer_get_timer_frequency();
120 uint32_t delay = (uint32_t)((((uint32_t)dt * timer_frequency) + 999999) / 1000000L);
122 error_code = sl_sleeptimer_start_timer(&delay_timer,
128 if(error_code == SL_STATUS_OK) {
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 start(void)
Start measurement.