STM8L15x Standard Peripherals Drivers
|
Time and Date configuration functions. More...
Functions | |
void | RTC_DateStructInit (RTC_DateTypeDef *RTC_DateStruct) |
Fills each RTC_DateStruct member with its default value (Monday 01 January xx00). | |
void | RTC_GetDate (RTC_Format_TypeDef RTC_Format, RTC_DateTypeDef *RTC_DateStruct) |
Get the RTC current date. | |
uint16_t | RTC_GetSubSecond (void) |
Gets the RTC current Calendar Subseconds value. | |
void | RTC_GetTime (RTC_Format_TypeDef RTC_Format, RTC_TimeTypeDef *RTC_TimeStruct) |
Gets the RTC current Time. | |
ErrorStatus | RTC_SetDate (RTC_Format_TypeDef RTC_Format, RTC_DateTypeDef *RTC_DateStruct) |
Set the RTC current date. | |
ErrorStatus | RTC_SetTime (RTC_Format_TypeDef RTC_Format, RTC_TimeTypeDef *RTC_TimeStruct) |
Sets the RTC current time. | |
void | RTC_TimeStructInit (RTC_TimeTypeDef *RTC_TimeStruct) |
Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec). |
Detailed Description
Time and Date configuration functions.
=============================================================================== Time and Date configuration functions =============================================================================== This section provide functions allowing to program and read the RTC Calendar (Time and Date).
Function Documentation
void RTC_DateStructInit | ( | RTC_DateTypeDef * | RTC_DateStruct | ) |
Fills each RTC_DateStruct member with its default value (Monday 01 January xx00).
Definition at line 962 of file stm8l15x_rtc.c.
References RTC_DateTypeDef::RTC_Date, RTC_DateTypeDef::RTC_Month, RTC_Month_January, RTC_DateTypeDef::RTC_WeekDay, RTC_Weekday_Monday, and RTC_DateTypeDef::RTC_Year.
void RTC_GetDate | ( | RTC_Format_TypeDef | RTC_Format, |
RTC_DateTypeDef * | RTC_DateStruct | ||
) |
Get the RTC current date.
- Note:
- To read the Calendar after wake up from low power mode, user software must first check that the RSF flag is set in RTC_ISR1, using RTC_WaitForSynchro() function, which means that the Calendar registers have been correctly copied into the shadow registers (RTC_TRx and RTC_DRx).
Definition at line 982 of file stm8l15x_rtc.c.
References Bcd2ToByte(), IS_RTC_FORMAT, RTC, RTC_DateTypeDef::RTC_Date, RTC_DR2_MT, RTC_DR2_MU, RTC_DR2_WDU, RTC_Format_BIN, RTC_DateTypeDef::RTC_Month, RTC_DateTypeDef::RTC_WeekDay, and RTC_DateTypeDef::RTC_Year.
uint16_t RTC_GetSubSecond | ( | void | ) |
Gets the RTC current Calendar Subseconds value.
- Note:
- To read the Calendar after wake up from low power mode, user software must first check that the RSF flag is set in RTC_ISR1, using RTC_WaitForSynchro() function, which means that the Calendar registers have been correctly copied into the shadow registers (RTC_TRx and RTC_DRx).
Definition at line 839 of file stm8l15x_rtc.c.
References RTC.
void RTC_GetTime | ( | RTC_Format_TypeDef | RTC_Format, |
RTC_TimeTypeDef * | RTC_TimeStruct | ||
) |
Gets the RTC current Time.
- Note:
- To read the Calendar after wake up from low power mode, user software must first check that the RSF flag is set in RTC_ISR1, using RTC_WaitForSynchro() function, which means that the Calendar registers have been correctly copied into the shadow registers (RTC_TRx and RTC_DRx).
Definition at line 792 of file stm8l15x_rtc.c.
References Bcd2ToByte(), IS_RTC_FORMAT, RTC, RTC_Format_BIN, RTC_TimeTypeDef::RTC_H12, RTC_TimeTypeDef::RTC_Hours, RTC_TimeTypeDef::RTC_Minutes, RTC_TimeTypeDef::RTC_Seconds, and RTC_TR3_PM.
ErrorStatus RTC_SetDate | ( | RTC_Format_TypeDef | RTC_Format, |
RTC_DateTypeDef * | RTC_DateStruct | ||
) |
Set the RTC current date.
- Note:
- After updating the Calendar, this routine clears the RSF flag and waits until it is set again (using RTC_WaitForSynchro() function) , which means that the Calendar registers have been correctly copied into the RTC_TRx and RTC_DRx shadow registers.
Definition at line 870 of file stm8l15x_rtc.c.
References Bcd2ToByte(), ByteToBcd2(), ERROR, IS_RTC_DATE_MAX, IS_RTC_DATE_MIN, IS_RTC_FORMAT, IS_RTC_MONTH_MAX, IS_RTC_MONTH_MIN, IS_RTC_WEEKDAY, IS_RTC_YEAR, RESET, RTC, RTC_CR1_BYPSHAD, RTC_DateTypeDef::RTC_Date, RTC_EnterInitMode(), RTC_Format_BIN, RTC_ISR1_INIT, RTC_DateTypeDef::RTC_Month, RTC_WaitForSynchro(), RTC_DateTypeDef::RTC_WeekDay, RTC_DateTypeDef::RTC_Year, SUCCESS, TEN_VALUE_BCD, and TEN_VALUE_BIN.
ErrorStatus RTC_SetTime | ( | RTC_Format_TypeDef | RTC_Format, |
RTC_TimeTypeDef * | RTC_TimeStruct | ||
) |
Sets the RTC current time.
- Note:
- After updating the Calendar, this routine clears the RSF flag and waits until it is set again (using RTC_WaitForSynchro() function) , which means that the Calendar registers have been correctly copied into the RTC_TRx and RTC_DRx shadow registers.
Definition at line 653 of file stm8l15x_rtc.c.
References Bcd2ToByte(), ByteToBcd2(), ERROR, IS_RTC_FORMAT, IS_RTC_H12, IS_RTC_HOUR12_MAX, IS_RTC_HOUR12_MIN, IS_RTC_HOUR24, IS_RTC_MINUTES, IS_RTC_SECONDS, RESET, RTC, RTC_CR1_BYPSHAD, RTC_CR1_FMT, RTC_EnterInitMode(), RTC_Format_BIN, RTC_TimeTypeDef::RTC_H12, RTC_TimeTypeDef::RTC_Hours, RTC_ISR1_INIT, RTC_TimeTypeDef::RTC_Minutes, RTC_TimeTypeDef::RTC_Seconds, RTC_WaitForSynchro(), and SUCCESS.
void RTC_TimeStructInit | ( | RTC_TimeTypeDef * | RTC_TimeStruct | ) |
Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec).
Definition at line 769 of file stm8l15x_rtc.c.
References RTC_TimeTypeDef::RTC_H12, RTC_H12_AM, RTC_TimeTypeDef::RTC_Hours, RTC_TimeTypeDef::RTC_Minutes, and RTC_TimeTypeDef::RTC_Seconds.