/* Driver for the STM32L151 RTC */ #pragma once #include #include typedef struct { uint16_t year; uint8_t month; uint8_t day; uint8_t hour; uint8_t minute; uint8_t second; uint8_t day_of_week; /* Not needed when setting time, 1 = Monday */ } time_t; void set_rtc(const time_t *time); // Returns false if RTC has not been set. bool get_rtc(time_t *time); // Check if the sun is up at given time. bool is_sun_up(const time_t *time); // Go to STOP mode for given number of milliseconds. void rtc_sleep(int timeout_msec);