STM8L15x Standard Peripherals Drivers
|
RTC driver modules. More...
Modules | |
RTC_Exported_Types | |
RTC_Exported_Macros | |
RTC_Private_Functions_Prototype | |
RTC_Private_Functions | |
Defines | |
#define | ALRAWF_TIMEOUT ((uint16_t)0xFFFF) |
#define | INIT_TIMEOUT ((uint16_t)0xFFFF) |
#define | INITF_TIMEOUT ((uint16_t)0xFFFF) |
#define | RECALPF_TIMEOUT ((uint16_t)0xFFFF) |
#define | RSF_TIMEOUT ((uint16_t)0xFFFF) |
#define | SHPF_TIMEOUT ((uint16_t)0xFFFF) |
#define | TEN_VALUE_BCD ((uint8_t)0x10) |
#define | TEN_VALUE_BIN ((uint8_t)0x0A) |
#define | WUTWF_TIMEOUT ((uint16_t)0xFFFF) |
Functions | |
ErrorStatus | RTC_AlarmCmd (FunctionalState NewState) |
Enables or disables the RTC Alarm. | |
void | RTC_AlarmStructInit (RTC_AlarmTypeDef *RTC_AlarmStruct) |
Fills each RTC_AlarmStruct member with its default value (Time = 00h:00mn:00sec / Date = 1st day of the month/Mask = all fields are masked). | |
ErrorStatus | RTC_AlarmSubSecondConfig (uint16_t RTC_AlarmSubSecondValue, RTC_AlarmSubSecondMask_TypeDef RTC_AlarmSubSecondMask) |
Configure the RTC Alarm Subseconds value and mask. | |
void | RTC_BypassShadowCmd (FunctionalState NewState) |
Enables or Disables the Bypass Shadow feature. | |
void | RTC_CalibOutputCmd (FunctionalState NewState) |
Enables or disables the RTC clock to be output through the relative pin. | |
void | RTC_CalibOutputConfig (RTC_CalibOutput_TypeDef RTC_CalibOutput) |
Configure the Calibration Pin-out (RTC_CALIB) Selection (1Hz or 512Hz). | |
void | RTC_ClearFlag (RTC_Flag_TypeDef RTC_FLAG) |
Clears the RTC's pending flags. | |
void | RTC_ClearITPendingBit (RTC_IT_TypeDef RTC_IT) |
Clears the RTC's interrupt pending bits. | |
void | RTC_DateStructInit (RTC_DateTypeDef *RTC_DateStruct) |
Fills each RTC_DateStruct member with its default value (Monday 01 January xx00). | |
void | RTC_DayLightSavingConfig (RTC_DayLightSaving_TypeDef RTC_DayLightSaving, RTC_StoreOperation_TypeDef RTC_StoreOperation) |
Adds or subtracts one hour from the current time depending on the daylight saving parameter. | |
ErrorStatus | RTC_DeInit (void) |
Deinitializes the RTC registers to their default reset values. | |
ErrorStatus | RTC_EnterInitMode (void) |
Enters the RTC Initialization mode. | |
void | RTC_ExitInitMode (void) |
Exits the RTC Initialization mode. | |
void | RTC_GetAlarm (RTC_Format_TypeDef RTC_Format, RTC_AlarmTypeDef *RTC_AlarmStruct) |
Gets the RTC Alarm configuration. | |
void | RTC_GetDate (RTC_Format_TypeDef RTC_Format, RTC_DateTypeDef *RTC_DateStruct) |
Get the RTC current date. | |
FlagStatus | RTC_GetFlagStatus (RTC_Flag_TypeDef RTC_FLAG) |
Checks whether the specified RTC flag is set or not. | |
ITStatus | RTC_GetITStatus (RTC_IT_TypeDef RTC_IT) |
Checks whether the specified RTC interrupt has occurred or not. | |
RTC_StoreOperation_TypeDef | RTC_GetStoreOperation (void) |
Returns the stored operation. | |
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. | |
uint16_t | RTC_GetWakeUpCounter (void) |
Returns the RTC Wakeup timer counter value. | |
ErrorStatus | RTC_Init (RTC_InitTypeDef *RTC_InitStruct) |
Initializes the RTC registers according to the specified parameters in RTC_InitStruct. | |
void | RTC_ITConfig (RTC_IT_TypeDef RTC_IT, FunctionalState NewState) |
Enables or Disables the specified RTC interrupts. | |
void | RTC_OutputConfig (RTC_Output_TypeDef RTC_Output, RTC_OutputPolarity_TypeDef RTC_OutputPolarity) |
Configures the RTC output for the output pin (RTC_ALARM output). | |
void | RTC_RatioCmd (FunctionalState NewState) |
Enables or Disables the RTC Ratio. | |
void | RTC_SetAlarm (RTC_Format_TypeDef RTC_Format, RTC_AlarmTypeDef *RTC_AlarmStruct) |
Sets the RTC Alarm configuration. | |
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_SetWakeUpCounter (uint16_t RTC_WakeupCounter) |
Sets the RTC Wakeup counter. | |
ErrorStatus | RTC_SmoothCalibConfig (RTC_SmoothCalibPeriod_TypeDef RTC_SmoothCalibPeriod, RTC_SmoothCalibPlusPulses_TypeDef RTC_SmoothCalibPlusPulses, uint16_t RTC_SmouthCalibMinusPulsesValue) |
Configures the Smooth Calibration Settings. | |
void | RTC_StructInit (RTC_InitTypeDef *RTC_InitStruct) |
Fills each RTC_InitStruct member with its default value Hour format = 24h / Prescalers configured to their reset values. | |
ErrorStatus | RTC_SynchroShiftConfig (RTC_ShiftAdd1S_TypeDef RTC_ShiftAdd1S, uint16_t RTC_ShiftSubFS) |
Configures the Synchronization Shift Control Settings. | |
void | RTC_TamperCmd (RTC_Tamper_TypeDef RTC_Tamper, FunctionalState NewState) |
Enables or Disables the Tamper detection. | |
void | RTC_TamperFilterConfig (RTC_TamperFilter_TypeDef RTC_TamperFilter) |
Configures the Tampers Filter. | |
void | RTC_TamperLevelConfig (RTC_Tamper_TypeDef RTC_Tamper, RTC_TamperLevel_TypeDef RTC_TamperLevel) |
Configures the Tamper Sensitive Level. | |
void | RTC_TamperPinsPrechargeDuration (RTC_TamperPrechargeDuration_TypeDef RTC_TamperPrechargeDuration) |
Configures the Tampers Pins input Precharge Duration. | |
void | RTC_TamperSamplingFreqConfig (RTC_TamperSamplingFreq_TypeDef RTC_TamperSamplingFreq) |
Configures the Tampers Sampling Frequency. | |
void | RTC_TimeStructInit (RTC_TimeTypeDef *RTC_TimeStruct) |
Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec). | |
ErrorStatus | RTC_WaitForSynchro (void) |
Waits until the RTC Calendar registers (Time and Date) are synchronized with RTC clock. | |
void | RTC_WakeUpClockConfig (RTC_WakeUpClock_TypeDef RTC_WakeUpClock) |
Configures the RTC Wakeup clock source. | |
ErrorStatus | RTC_WakeUpCmd (FunctionalState NewState) |
Enables or Disables the RTC Wakeup Unit. | |
void | RTC_WriteProtectionCmd (FunctionalState NewState) |
Enables or disables the RTC registers write protection. |
Detailed Description
RTC driver modules.
Define Documentation
#define ALRAWF_TIMEOUT ((uint16_t)0xFFFF) |
Definition at line 155 of file stm8l15x_rtc.c.
Referenced by RTC_AlarmCmd().
#define INIT_TIMEOUT ((uint16_t)0xFFFF) |
Definition at line 151 of file stm8l15x_rtc.c.
#define INITF_TIMEOUT ((uint16_t)0xFFFF) |
Definition at line 153 of file stm8l15x_rtc.c.
Referenced by RTC_EnterInitMode().
#define RECALPF_TIMEOUT ((uint16_t)0xFFFF) |
Definition at line 156 of file stm8l15x_rtc.c.
Referenced by RTC_DeInit(), and RTC_SmoothCalibConfig().
#define RSF_TIMEOUT ((uint16_t)0xFFFF) |
Definition at line 152 of file stm8l15x_rtc.c.
Referenced by RTC_WaitForSynchro().
#define SHPF_TIMEOUT ((uint16_t)0xFFFF) |
Definition at line 157 of file stm8l15x_rtc.c.
Referenced by RTC_SynchroShiftConfig().
#define TEN_VALUE_BCD ((uint8_t)0x10) |
Definition at line 159 of file stm8l15x_rtc.c.
Referenced by RTC_SetDate().
#define TEN_VALUE_BIN ((uint8_t)0x0A) |
Definition at line 160 of file stm8l15x_rtc.c.
Referenced by RTC_SetDate().
#define WUTWF_TIMEOUT ((uint16_t)0xFFFF) |
Definition at line 154 of file stm8l15x_rtc.c.
Referenced by RTC_DeInit(), and RTC_WakeUpCmd().
Function Documentation
ErrorStatus RTC_AlarmCmd | ( | FunctionalState | NewState | ) |
Enables or disables the RTC Alarm.
Definition at line 1236 of file stm8l15x_rtc.c.
References __IO, ALRAWF_TIMEOUT, DISABLE, ERROR, IS_FUNCTIONAL_STATE, RESET, RTC, RTC_CR2_ALRAE, RTC_ISR1_ALRAWF, and SUCCESS.
void RTC_AlarmStructInit | ( | RTC_AlarmTypeDef * | RTC_AlarmStruct | ) |
Fills each RTC_AlarmStruct member with its default value (Time = 00h:00mn:00sec / Date = 1st day of the month/Mask = all fields are masked).
Definition at line 1159 of file stm8l15x_rtc.c.
References RTC_AlarmTypeDef::RTC_AlarmDateWeekDay, RTC_AlarmTypeDef::RTC_AlarmDateWeekDaySel, RTC_AlarmDateWeekDaySel_Date, RTC_AlarmTypeDef::RTC_AlarmMask, RTC_AlarmMask_All, RTC_AlarmTypeDef::RTC_AlarmTime, RTC_TimeTypeDef::RTC_H12, RTC_H12_AM, RTC_TimeTypeDef::RTC_Hours, RTC_TimeTypeDef::RTC_Minutes, and RTC_TimeTypeDef::RTC_Seconds.
ErrorStatus RTC_AlarmSubSecondConfig | ( | uint16_t | RTC_AlarmSubSecondValue, |
RTC_AlarmSubSecondMask_TypeDef | RTC_AlarmSubSecondMask | ||
) |
Configure the RTC Alarm Subseconds value and mask.
Definition at line 1292 of file stm8l15x_rtc.c.
References ERROR, IS_RTC_ALARM_SS_MASK, IS_RTC_ALARM_SS_VALUE, RESET, RTC, RTC_CR2_ALRAE, RTC_ISR1_INITF, and SUCCESS.
void RTC_BypassShadowCmd | ( | FunctionalState | NewState | ) |
Enables or Disables the Bypass Shadow feature.
Definition at line 592 of file stm8l15x_rtc.c.
References DISABLE, IS_FUNCTIONAL_STATE, RTC, and RTC_CR1_BYPSHAD.
void RTC_CalibOutputCmd | ( | FunctionalState | NewState | ) |
Enables or disables the RTC clock to be output through the relative pin.
Definition at line 1814 of file stm8l15x_rtc.c.
References DISABLE, IS_FUNCTIONAL_STATE, RTC, and RTC_CR3_COE.
void RTC_CalibOutputConfig | ( | RTC_CalibOutput_TypeDef | RTC_CalibOutput | ) |
Configure the Calibration Pin-out (RTC_CALIB) Selection (1Hz or 512Hz).
Definition at line 1784 of file stm8l15x_rtc.c.
References IS_RTC_CALOUTPUT_SELECT, RTC, RTC_CalibOutput_512Hz, and RTC_CR3_COSEL.
void RTC_ClearFlag | ( | RTC_Flag_TypeDef | RTC_FLAG | ) |
Clears the RTC's pending flags.
Definition at line 2116 of file stm8l15x_rtc.c.
References IS_RTC_CLEAR_FLAG, RTC, and RTC_ISR1_INIT.
void RTC_ClearITPendingBit | ( | RTC_IT_TypeDef | RTC_IT | ) |
Clears the RTC's interrupt pending bits.
Definition at line 2166 of file stm8l15x_rtc.c.
References IS_RTC_CLEAR_IT, and RTC.
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_DayLightSavingConfig | ( | RTC_DayLightSaving_TypeDef | RTC_DayLightSaving, |
RTC_StoreOperation_TypeDef | RTC_StoreOperation | ||
) |
Adds or subtracts one hour from the current time depending on the daylight saving parameter.
Definition at line 1516 of file stm8l15x_rtc.c.
References IS_RTC_DAYLIGHT_SAVING, IS_RTC_STORE_OPERATION, RTC, and RTC_CR3_BCK.
ErrorStatus RTC_DeInit | ( | void | ) |
Deinitializes the RTC registers to their default reset values.
- Note:
- This function doesn't reset the RTC Clock source.
Definition at line 226 of file stm8l15x_rtc.c.
References ERROR, RECALPF_TIMEOUT, RESET, RTC, RTC_ALRMAR1_RESET_VALUE, RTC_ALRMAR2_RESET_VALUE, RTC_ALRMAR3_RESET_VALUE, RTC_ALRMAR4_RESET_VALUE, RTC_ALRMASSMSKR_RESET_VALUE, RTC_ALRMASSRH_RESET_VALUE, RTC_ALRMASSRL_RESET_VALUE, RTC_APRER_RESET_VALUE, RTC_CALRH_RESET_VALUE, RTC_CALRL_RESET_VALUE, RTC_CR1_RESET_VALUE, RTC_CR2_RESET_VALUE, RTC_CR3_RESET_VALUE, RTC_DR1_RESET_VALUE, RTC_DR2_RESET_VALUE, RTC_DR3_RESET_VALUE, RTC_EnterInitMode(), RTC_ISR1_RECALPF, RTC_ISR1_WUTWF, RTC_ISR2_RESET_VALUE, RTC_SPRERH_RESET_VALUE, RTC_SPRERL_RESET_VALUE, RTC_TCR1_RESET_VALUE, RTC_TCR2_RESET_VALUE, RTC_TR1_RESET_VALUE, RTC_TR2_RESET_VALUE, RTC_TR3_RESET_VALUE, RTC_WaitForSynchro(), RTC_WUTRH_RESET_VALUE, RTC_WUTRL_RESET_VALUE, SUCCESS, and WUTWF_TIMEOUT.
ErrorStatus RTC_EnterInitMode | ( | void | ) |
Enters the RTC Initialization mode.
- Note:
- The RTC Initialization mode is write protected, use the RTC_WriteProtectionCmd(DISABLE) before calling this function.
Definition at line 452 of file stm8l15x_rtc.c.
References ERROR, INITF_TIMEOUT, RESET, RTC, RTC_ISR1_INIT, RTC_ISR1_INITF, and SUCCESS.
Referenced by RTC_DeInit(), RTC_Init(), RTC_SetDate(), and RTC_SetTime().
void RTC_ExitInitMode | ( | void | ) |
Exits the RTC Initialization mode.
- Note:
- When the initialization sequence is complete, the Calendar restarts counting after 4 RTCCLK cycles.
- The RTC Initialization mode is write protected, use the RTC_WriteProtectionCmd(DISABLE) before calling this function.
Definition at line 492 of file stm8l15x_rtc.c.
References RTC, and RTC_ISR1_INIT.
void RTC_GetAlarm | ( | RTC_Format_TypeDef | RTC_Format, |
RTC_AlarmTypeDef * | RTC_AlarmStruct | ||
) |
Gets the RTC Alarm configuration.
Definition at line 1182 of file stm8l15x_rtc.c.
References Bcd2ToByte(), IS_RTC_FORMAT, RTC, RTC_AlarmTypeDef::RTC_AlarmDateWeekDay, RTC_AlarmTypeDef::RTC_AlarmDateWeekDaySel, RTC_AlarmTypeDef::RTC_AlarmMask, RTC_AlarmTypeDef::RTC_AlarmTime, RTC_ALRMAR1_MSK1, RTC_ALRMAR1_ST, RTC_ALRMAR1_SU, RTC_ALRMAR2_MNT, RTC_ALRMAR2_MNU, RTC_ALRMAR2_MSK2, RTC_ALRMAR3_HT, RTC_ALRMAR3_HU, RTC_ALRMAR3_MSK3, RTC_ALRMAR3_PM, RTC_ALRMAR4_DT, RTC_ALRMAR4_DU, RTC_ALRMAR4_MSK4, RTC_ALRMAR4_WDSEL, RTC_Format_BIN, RTC_TimeTypeDef::RTC_H12, RTC_TimeTypeDef::RTC_Hours, RTC_TimeTypeDef::RTC_Minutes, and RTC_TimeTypeDef::RTC_Seconds.
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.
FlagStatus RTC_GetFlagStatus | ( | RTC_Flag_TypeDef | RTC_FLAG | ) |
Checks whether the specified RTC flag is set or not.
Definition at line 2084 of file stm8l15x_rtc.c.
References IS_RTC_GET_FLAG, RESET, RTC, and SET.
ITStatus RTC_GetITStatus | ( | RTC_IT_TypeDef | RTC_IT | ) |
Checks whether the specified RTC interrupt has occurred or not.
Definition at line 2132 of file stm8l15x_rtc.c.
References IS_RTC_GET_IT, RESET, RTC, and SET.
RTC_StoreOperation_TypeDef RTC_GetStoreOperation | ( | void | ) |
Returns the stored operation.
Definition at line 1543 of file stm8l15x_rtc.c.
References RTC, and RTC_CR3_BCK.
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.
uint16_t RTC_GetWakeUpCounter | ( | void | ) |
Returns the RTC Wakeup timer counter value.
Definition at line 1414 of file stm8l15x_rtc.c.
References RTC.
ErrorStatus RTC_Init | ( | RTC_InitTypeDef * | RTC_InitStruct | ) |
Initializes the RTC registers according to the specified parameters in RTC_InitStruct.
- Note:
- The RTC Prescaler register is write protected and can be written in initialization mode only.
Definition at line 353 of file stm8l15x_rtc.c.
References ERROR, IS_RTC_ASYNCH_PREDIV, IS_RTC_HOUR_FORMAT, IS_RTC_SYNCH_PREDIV, RTC, RTC_InitTypeDef::RTC_AsynchPrediv, RTC_CR1_FMT, RTC_EnterInitMode(), RTC_InitTypeDef::RTC_HourFormat, RTC_ISR1_INIT, RTC_InitTypeDef::RTC_SynchPrediv, and SUCCESS.
void RTC_ITConfig | ( | RTC_IT_TypeDef | RTC_IT, |
FunctionalState | NewState | ||
) |
Enables or Disables the specified RTC interrupts.
Definition at line 2052 of file stm8l15x_rtc.c.
References DISABLE, IS_FUNCTIONAL_STATE, IS_RTC_CONFIG_IT, RTC, and RTC_TCR1_TAMPIE.
void RTC_OutputConfig | ( | RTC_Output_TypeDef | RTC_Output, |
RTC_OutputPolarity_TypeDef | RTC_OutputPolarity | ||
) |
Configures the RTC output for the output pin (RTC_ALARM output).
Definition at line 1581 of file stm8l15x_rtc.c.
References IS_RTC_OUTPUT_POL, IS_RTC_OUTPUT_SEL, RTC, RTC_CR3_OSEL, and RTC_CR3_POL.
void RTC_RatioCmd | ( | FunctionalState | NewState | ) |
Enables or Disables the RTC Ratio.
Definition at line 562 of file stm8l15x_rtc.c.
References DISABLE, IS_FUNCTIONAL_STATE, RTC, and RTC_CR1_RATIO.
void RTC_SetAlarm | ( | RTC_Format_TypeDef | RTC_Format, |
RTC_AlarmTypeDef * | RTC_AlarmStruct | ||
) |
Sets the RTC Alarm configuration.
- Note:
- Before configuring the Alarm settings, the Alarm Unit must be disabled (if enabled) using RTC_AlarmCmd(DISABLE) function.
Definition at line 1038 of file stm8l15x_rtc.c.
References Bcd2ToByte(), ByteToBcd2(), IS_RTC_ALARM_DATEWEEKDAY_SEL, IS_RTC_ALARM_MASK, IS_RTC_DATE_MAX, IS_RTC_DATE_MIN, IS_RTC_FORMAT, IS_RTC_H12, IS_RTC_HOUR12_MAX, IS_RTC_HOUR12_MIN, IS_RTC_HOUR24, IS_RTC_MINUTES, IS_RTC_SECONDS, IS_RTC_WEEKDAY, RESET, RTC, RTC_AlarmTypeDef::RTC_AlarmDateWeekDay, RTC_AlarmTypeDef::RTC_AlarmDateWeekDaySel, RTC_AlarmDateWeekDaySel_WeekDay, RTC_AlarmTypeDef::RTC_AlarmMask, RTC_AlarmMask_DateWeekDay, RTC_AlarmTypeDef::RTC_AlarmTime, RTC_ALRMAR1_MSK1, RTC_ALRMAR2_MSK2, RTC_ALRMAR3_MSK3, RTC_ALRMAR4_MSK4, RTC_CR1_FMT, RTC_Format_BIN, RTC_TimeTypeDef::RTC_H12, RTC_TimeTypeDef::RTC_Hours, RTC_TimeTypeDef::RTC_Minutes, and RTC_TimeTypeDef::RTC_Seconds.
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_SetWakeUpCounter | ( | uint16_t | RTC_WakeupCounter | ) |
Sets the RTC Wakeup counter.
- Note:
- Before configuring the wakeup unit counter, the wake up Unit must be disabled (if enabled) using RTC_WakeUpCmd(Disable).
Definition at line 1394 of file stm8l15x_rtc.c.
References RTC.
ErrorStatus RTC_SmoothCalibConfig | ( | RTC_SmoothCalibPeriod_TypeDef | RTC_SmoothCalibPeriod, |
RTC_SmoothCalibPlusPulses_TypeDef | RTC_SmoothCalibPlusPulses, | ||
uint16_t | RTC_SmouthCalibMinusPulsesValue | ||
) |
Configures the Smooth Calibration Settings.
Definition at line 1712 of file stm8l15x_rtc.c.
References ERROR, IS_RTC_SMOOTH_CALIB_MINUS, IS_RTC_SMOOTH_CALIB_PERIOD, IS_RTC_SMOOTH_CALIB_PLUS, RECALPF_TIMEOUT, RESET, RTC, RTC_ISR1_RECALPF, and SUCCESS.
void RTC_StructInit | ( | RTC_InitTypeDef * | RTC_InitStruct | ) |
Fills each RTC_InitStruct member with its default value Hour format = 24h / Prescalers configured to their reset values.
Definition at line 404 of file stm8l15x_rtc.c.
References RTC_APRER_RESET_VALUE, RTC_InitTypeDef::RTC_AsynchPrediv, RTC_InitTypeDef::RTC_HourFormat, RTC_HourFormat_24, RTC_SPRERL_RESET_VALUE, and RTC_InitTypeDef::RTC_SynchPrediv.
ErrorStatus RTC_SynchroShiftConfig | ( | RTC_ShiftAdd1S_TypeDef | RTC_ShiftAdd1S, |
uint16_t | RTC_ShiftSubFS | ||
) |
Configures the Synchronization Shift Control Settings.
Definition at line 1633 of file stm8l15x_rtc.c.
References ERROR, IS_RTC_SHIFT_ADD1S, IS_RTC_SHIFT_SUBFS, RESET, RTC, RTC_ISR1_SHPF, SHPF_TIMEOUT, and SUCCESS.
void RTC_TamperCmd | ( | RTC_Tamper_TypeDef | RTC_Tamper, |
FunctionalState | NewState | ||
) |
Enables or Disables the Tamper detection.
Definition at line 1981 of file stm8l15x_rtc.c.
References DISABLE, IS_FUNCTIONAL_STATE, IS_RTC_TAMPER, and RTC.
void RTC_TamperFilterConfig | ( | RTC_TamperFilter_TypeDef | RTC_TamperFilter | ) |
Configures the Tampers Filter.
Definition at line 1897 of file stm8l15x_rtc.c.
References IS_RTC_TAMPER_FILTER, RTC, and RTC_TCR2_TAMPFLT.
void RTC_TamperLevelConfig | ( | RTC_Tamper_TypeDef | RTC_Tamper, |
RTC_TamperLevel_TypeDef | RTC_TamperLevel | ||
) |
Configures the Tamper Sensitive Level.
Definition at line 1865 of file stm8l15x_rtc.c.
References IS_RTC_TAMPER, IS_RTC_TAMPER_LEVEL, RTC, and RTC_TamperLevel_Low.
void RTC_TamperPinsPrechargeDuration | ( | RTC_TamperPrechargeDuration_TypeDef | RTC_TamperPrechargeDuration | ) |
Configures the Tampers Pins input Precharge Duration.
Definition at line 1952 of file stm8l15x_rtc.c.
References IS_RTC_TAMPER_PINS_PRECHAR_DURATION, RTC, RTC_TCR2_TAMPPRCH, and RTC_TCR2_TAMPPUDIS.
void RTC_TamperSamplingFreqConfig | ( | RTC_TamperSamplingFreq_TypeDef | RTC_TamperSamplingFreq | ) |
Configures the Tampers Sampling Frequency.
Definition at line 1925 of file stm8l15x_rtc.c.
References IS_RTC_TAMPER_SAMPLING_FREQ, RTC, and RTC_TCR2_TAMPFREQ.
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.
ErrorStatus RTC_WaitForSynchro | ( | void | ) |
Waits until the RTC Calendar registers (Time and Date) are synchronized with RTC clock.
- Note:
- This function is meaningless when BAYPASS feature is enabled in RTC_CR1 register.
- To read the Calendar through the shadow registers after Calendar initialization, Calendar update or after wakeup from low power modes the software must first clear the RSF flag. The software must then wait until it is set again before reading the Calendar (if not yet done), which means that the Calendar registers have been correctly copied into the RTC_TRx and RTC_DRx shadow registers.
- RTC_SetTime() and RTC_SetDate() functions call RTC_WaitForSynchro() function after updating the Calendar. In Run mode, User can use RTC_GetDate(), RTC_GetTime() and/or RTC_GetSubSecond() without need to call RTC_WaitForSynchro() function. After waking up from low power mode, this function must be called before calling RTC_GetDate(), RTC_GetTime() or RTC_GetSubSecond() functions.
Definition at line 521 of file stm8l15x_rtc.c.
References ERROR, RESET, RSF_TIMEOUT, RTC, RTC_ISR1_INIT, RTC_ISR1_RSF, and SUCCESS.
Referenced by RTC_DeInit(), RTC_SetDate(), and RTC_SetTime().
void RTC_WakeUpClockConfig | ( | RTC_WakeUpClock_TypeDef | RTC_WakeUpClock | ) |
Configures the RTC Wakeup clock source.
- Precondition:
- Before configuring the wakeup unit Clock source, the wake up Unit must be disabled (if enabled) using RTC_WakeUpCmd(Disable) .
Definition at line 1363 of file stm8l15x_rtc.c.
References IS_RTC_WAKEUP_CLOCK, RTC, RTC_CR1_WUCKSEL, and RTC_CR2_WUTE.
ErrorStatus RTC_WakeUpCmd | ( | FunctionalState | NewState | ) |
Enables or Disables the RTC Wakeup Unit.
Definition at line 1434 of file stm8l15x_rtc.c.
References DISABLE, ERROR, IS_FUNCTIONAL_STATE, RESET, RTC, RTC_CR2_WUTE, RTC_ISR1_WUTWF, SUCCESS, and WUTWF_TIMEOUT.
void RTC_WriteProtectionCmd | ( | FunctionalState | NewState | ) |
Enables or disables the RTC registers write protection.
- Note:
- Writing a wrong key reactivates the write protection.
- The protection mechanism is not affected by system reset.
Definition at line 424 of file stm8l15x_rtc.c.
References DISABLE, IS_FUNCTIONAL_STATE, RTC, RTC_WPR_DisableKey1, RTC_WPR_DisableKey2, and RTC_WPR_EnableKey.