31#if (HAL_USE_RTC == TRUE) || defined(__DOXYGEN__)
49 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
53 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
87#if RTC_HAS_STORAGE == TRUE
88 rtcp->
vmt = &_rtc_lld_vmt;
136#if (RTC_ALARMS > 0) || defined(__DOXYGEN__)
184 (alarmspec != NULL));
190#if (RTC_SUPPORTS_CALLBACKS == TRUE) || defined(__DOXYGEN__)
231 timp->tm_mon = (int)timespec->
month - 1;
232 timp->tm_mday = (int)timespec->
day;
233 timp->tm_isdst = (int)timespec->
dstflag;
234 timp->tm_wday = (int)timespec->
dayofweek % 7;
237 timp->tm_hour = sec / 3600;
239 timp->tm_min = sec / 60;
240 timp->tm_sec = sec % 60;
242 if (NULL != tv_msec) {
243 *tv_msec = (uint32_t)timespec->
millisecond % 1000U;
247 year = timp->tm_year + 1900;
248 timp->tm_yday = timp->tm_mday - 1;
250 is_leap_year = (((year % 4) == 0) && ((year % 100) != 0)) || ((year % 400) == 0);
251 if (is_leap_year && (timp->tm_mon > 1)) {
271 timespec->
month = (uint32_t)timp->tm_mon + 1U;
272 timespec->
day = (uint32_t)timp->tm_mday;
273 timespec->
dayofweek = (((uint32_t)timp->tm_wday + 6U) % 7U) + 1U;
275 if (-1 == timp->tm_isdst) {
279 timespec->
dstflag = (uint32_t)timp->tm_isdst;
283 timespec->
millisecond = tv_msec + (uint32_t)(((timp->tm_hour * 3600) +
284 (timp->tm_min * 60) +
285 timp->tm_sec) * 1000);
301 uint32_t sec, min, hour, day, month;
309 month = timespec->
month;
317 if (day > (uint32_t)
month_len[month - 1U]) {
325 fattime |= min << 5U;
326 fattime |= hour << 11U;
327 fattime |= day << 16U;
328 fattime |= month << 21U;
329 fattime |= (uint32_t)timespec->
year << 25U;
#define osalDbgCheck(c)
Function parameters check.
#define RTC_ALARMS
Number of alarms available.
void rtc_lld_init(void)
RTC driver identifier.
void rtc_lld_set_time(RTCDriver *rtcp, const RTCDateTime *timespec)
Set current time.
void rtcSetTime(RTCDriver *rtcp, const RTCDateTime *timespec)
Set current time.
void rtcSetCallback(RTCDriver *rtcp, rtccb_t callback)
Enables or disables RTC callbacks.
void rtcConvertStructTmToDateTime(const struct tm *timp, uint32_t tv_msec, RTCDateTime *timespec)
Convert broken-down time structure to RTCDateTime.
void rtc_lld_set_callback(RTCDriver *rtcp, rtccb_t callback)
void rtc_lld_get_time(RTCDriver *rtcp, RTCDateTime *timespec)
Get current time.
static const uint8_t month_len[12]
void rtcInit(void)
RTC Driver initialization.
void rtc_lld_set_alarm(RTCDriver *rtcp, rtcalarm_t alarm, const RTCAlarm *alarmspec)
Set alarm time.
void rtcSetAlarm(RTCDriver *rtcp, rtcalarm_t alarm, const RTCAlarm *alarmspec)
Set alarm time.
void rtcGetTime(RTCDriver *rtcp, RTCDateTime *timespec)
Get current time.
void rtcGetAlarm(RTCDriver *rtcp, rtcalarm_t alarm, RTCAlarm *alarmspec)
Get current alarm.
void rtcConvertDateTimeToStructTm(const RTCDateTime *timespec, struct tm *timp, uint32_t *tv_msec)
Convert RTCDateTime to broken-down time structure.
#define RTC_BASE_YEAR
Base year of the calendar.
unsigned int rtcalarm_t
Type of an RTC alarm number.
void(* rtccb_t)(RTCDriver *rtcp, rtcevent_t event)
Type of a generic RTC callback.
uint32_t rtcConvertDateTimeToFAT(const RTCDateTime *timespec)
Get current time in format suitable for usage in FAT file system.
static const uint16_t accu_month_len[12]
void rtcObjectInit(RTCDriver *rtcp)
Initializes a generic RTC driver object.
void rtc_lld_get_alarm(RTCDriver *rtcp, rtcalarm_t alarm, RTCAlarm *alarmspec)
Get alarm time.
Type of a structure representing an RTC alarm time stamp.
Type of a structure representing an RTC date/time stamp.
uint32_t dstflag
DST correction flag.
uint32_t day
Day of the month 1..31.
uint32_t millisecond
Milliseconds since midnight.
uint32_t dayofweek
Day of week 1..7.
uint32_t month
Months 1..12.
uint32_t year
Years since 1980.
Structure representing an RTC driver.
const struct RTCDriverVMT * vmt
Virtual Methods Table.