STM8L15x Standard Peripherals Drivers
|
This file provides firmware functions to manage the following functionalities of the Real-Time Clock (RTC) peripheral:
- Initialization
- Calendar (Time and Date) configuration
- Alarm configuration
- WakeUp Timer configuration
- Daylight Saving configuration
- Output pin Configuration
- Smooth Calibration configuration
- Tampers configuration
- Output Type configuration
- Interrupts and flags management.
#include "stm8l15x_rtc.h"
Go to the source code of this file.
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 | |
static uint8_t | Bcd2ToByte (uint8_t Value) |
Converts from 2 digit BCD to Binary format. | |
static uint8_t | ByteToBcd2 (uint8_t Value) |
Converts a 2 digit decimal to BCD format. | |
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
This file provides firmware functions to manage the following functionalities of the Real-Time Clock (RTC) peripheral:
- Initialization
- Calendar (Time and Date) configuration
- Alarm configuration
- WakeUp Timer configuration
- Daylight Saving configuration
- Output pin Configuration
- Smooth Calibration configuration
- Tampers configuration
- Output Type configuration
- Interrupts and flags management.
- Attention:
THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
© COPYRIGHT 2011 STMicroelectronics
Definition in file stm8l15x_rtc.c.