Real Time Clock driver reausable in different platforms.
- NUCLEO-H745ZI-Q
rtc_initialize: function used to initialize the peripheral.rtc_deinitialize: function used to deinitialize the peripheral.rtc_get_time_data: function used to store in the main structure time and date.rtc_set_time: function used to store the new time in the MCU.rtc_set_date: function used to store the new date in the MCU.rtc_deactivateWakeupTimer: function used for deactivate wake up timer.rtc_setWakeUpTimer: function used to activate wake up timer. MUST fill the "WakeUpCounter" in a main structure.
- Enable the RTC timer in the
.iocfile. - Include the header file
drv_rtc.h. - Create the
rtc_tinstance. The following members of the structure must be defined:instance.handler: handler assigned by hardware.instance.mx_init: init function generated by the configuration tool.
rtc_t rtc = {
.handler = MX_RTC_Init,
.mx_init = &hrtc
};
rtc_initialize(&rtc);
rtc_get_time_data(&rtc);
uint8_t hours;
uint8_t minutes;
uint8_t seconds;
rtc_set_time(hours, minutes, seconds);
uint8_t weekday;
uint8_t month;
uint8_t date;
uint8_t year:
rtc_set_date(weekday, month, date, year);