47 #include PLATFORM_HEADER
48 #include "hal/error.h"
50 #include "dev/stm32w-systick.h"
52 #include "sys/clock.h"
54 #include "dev/button-sensor.h"
59 #define DEBUG DEBUG_NONE
63 #define RELOAD_VALUE 24000-1 // 1 ms with a 24 MHz clock
65 static volatile clock_time_t count;
66 static volatile unsigned long current_seconds = 0;
70 void SysTick_Handler(
void)
76 button_sensor.value(0);
83 if (--second_countdown == 0) {
123 for (j = 50; j > 0; j--)
138 while(
clock_time() - start < (clock_time_t)i);
144 return current_seconds;
147 void sleep_seconds(
int seconds)
149 uint32_t quarter_seconds = seconds * 4;
154 radio_on = stm32w_radio_is_on();
155 stm32w_radio_driver.
off();
165 current_seconds += seconds - quarter_seconds / 4 ;
179 stm32w_radio_driver.init();
181 stm32w_radio_driver.
on();