31 #if (HAL_USE_RTC == TRUE) || defined(__DOXYGEN__) 48 static const uint8_t month_len[12] = {
49 31, 30, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
83 #if RTC_HAS_STORAGE == TRUE 84 rtcp->
vmt = &_rtc_lld_vmt;
132 #if (RTC_ALARMS > 0) || defined(__DOXYGEN__) 180 (alarmspec != NULL));
186 #if (RTC_SUPPORTS_CALLBACKS == TRUE) || defined(__DOXYGEN__) 207 rtc_lld_set_callback(rtcp, callback);
225 timp->tm_year = (int)timespec->
year + (1980 - 1900);
226 timp->tm_mon = (int)timespec->
month - 1;
227 timp->tm_mday = (
int)timespec->
day;
228 timp->tm_isdst = (int)timespec->
dstflag;
229 timp->tm_wday = (
int)timespec->
dayofweek - 1;
232 timp->tm_hour = sec / 3600;
234 timp->tm_min = sec / 60;
235 timp->tm_sec = sec % 60;
237 if (NULL != tv_msec) {
238 *tv_msec = (uint32_t)timespec->
millisecond % 1000U;
256 timespec->
year = (uint32_t)timp->tm_year - (1980U - 1900U);
257 timespec->
month = (uint32_t)timp->tm_mon + 1U;
258 timespec->
day = (uint32_t)timp->tm_mday;
259 timespec->
dayofweek = (uint32_t)timp->tm_wday + 1U;
260 if (-1 == timp->tm_isdst) {
264 timespec->
dstflag = (uint32_t)timp->tm_isdst;
268 timespec->
millisecond = tv_msec + (uint32_t)(((timp->tm_hour * 3600) +
269 (timp->tm_min * 60) +
270 timp->tm_sec) * 1000);
286 uint32_t sec, min, hour, day, month;
294 month = timespec->
month;
302 if (day > month_len[month - 1U]) {
310 fattime |= min << 5U;
311 fattime |= hour << 11U;
312 fattime |= day << 16U;
313 fattime |= month << 21U;
314 fattime |= (uint32_t)timespec->
year << 25U;
void rtc_lld_get_time(RTCDriver *rtcp, RTCDateTime *timespec)
Get current time.
uint32_t month
Months 1..12.
uint32_t dstflag
DST correction flag.
uint32_t day
Day of the month 1..31.
void rtcSetAlarm(RTCDriver *rtcp, rtcalarm_t alarm, const RTCAlarm *alarmspec)
Set alarm time.
void rtcGetAlarm(RTCDriver *rtcp, rtcalarm_t alarm, RTCAlarm *alarmspec)
Get current alarm.
void rtcObjectInit(RTCDriver *rtcp)
Initializes a generic RTC driver object.
void rtc_lld_set_alarm(RTCDriver *rtcp, rtcalarm_t alarm, const RTCAlarm *alarmspec)
Set alarm time.
uint32_t year
Years since 1980.
uint32_t rtcConvertDateTimeToFAT(const RTCDateTime *timespec)
Get current time in format suitable for usage in FAT file system.
uint32_t dayofweek
Day of week 1..7.
Type of a structure representing an RTC alarm time stamp.
void rtc_lld_init(void)
RTC driver identifier.
void rtcSetCallback(RTCDriver *rtcp, rtccb_t callback)
Enables or disables RTC callbacks.
#define RTC_ALARMS
Number of alarms available.
#define osalDbgCheck(c)
Function parameters check.
void rtc_lld_get_alarm(RTCDriver *rtcp, rtcalarm_t alarm, RTCAlarm *alarmspec)
Get alarm time.
void rtcGetTime(RTCDriver *rtcp, RTCDateTime *timespec)
Get current time.
void rtcInit(void)
RTC Driver initialization.
uint32_t rtcalarm_t
Type of an RTC alarm number.
Type of a structure representing an RTC date/time stamp.
const struct RTCDriverVMT * vmt
Virtual Methods Table.
void rtc_lld_set_time(RTCDriver *rtcp, const RTCDateTime *timespec)
Set current time.
Structure representing an RTC driver.
void rtcConvertStructTmToDateTime(const struct tm *timp, uint32_t tv_msec, RTCDateTime *timespec)
Convert broken-down time structure to RTCDateTime.
void(* rtccb_t)(RTCDriver *rtcp, rtcevent_t event)
Type of a generic RTC callback.
uint32_t millisecond
Milliseconds since midnight.
void rtcSetTime(RTCDriver *rtcp, const RTCDateTime *timespec)
Set current time.
void rtcConvertDateTimeToStructTm(const RTCDateTime *timespec, struct tm *timp, uint32_t *tv_msec)
Convert RTCDateTime to broken-down time structure.