43 #include PLATFORM_HEADER
44 #include "hal/error.h"
46 #include "dev/stm32w_systick.h"
54 #define DEBUG DEBUG_NONE
58 #define RELOAD_VALUE 24000-1 // 1 ms with a 24 MHz clock
60 static volatile clock_time_t count;
61 static volatile unsigned long current_seconds = 0;
65 void SysTick_Handler(
void)
74 if (--second_countdown == 0) {
91 SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
92 SysTick_SetReload(RELOAD_VALUE);
93 SysTick_ITConfig(ENABLE);
94 SysTick_CounterCmd(SysTick_Counter_Enable);
115 for (j = 50; j > 0; j--)
130 while(
clock_time() - start < (clock_time_t)i);
134 unsigned long clock_seconds(
void)
136 return current_seconds;
141 void sleep_seconds(
int seconds)
143 int32u quarter_seconds = seconds * 4;
148 radio_on = stm32w_radio_is_on();
149 stm32w_radio_driver.
off();
159 current_seconds += seconds - quarter_seconds / 4 ;
166 SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
167 SysTick_SetReload(RELOAD_VALUE);
168 SysTick_ITConfig(ENABLE);
169 SysTick_CounterCmd(SysTick_Counter_Enable);
173 stm32w_radio_driver.init();
175 stm32w_radio_driver.
on();