STM32F103xB HAL User Manual
stm32f1xx_hal_rtc.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32f1xx_hal_rtc.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of RTC HAL module.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
00010   * All rights reserved.</center></h2>
00011   *
00012   * This software component is licensed by ST under BSD 3-Clause license,
00013   * the "License"; You may not use this file except in compliance with the
00014   * License. You may obtain a copy of the License at:
00015   *                        opensource.org/licenses/BSD-3-Clause
00016   *
00017   ******************************************************************************
00018   */
00019 
00020 /* Define to prevent recursive inclusion -------------------------------------*/
00021 #ifndef __STM32F1xx_HAL_RTC_H
00022 #define __STM32F1xx_HAL_RTC_H
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 /* Includes ------------------------------------------------------------------*/
00029 #include "stm32f1xx_hal_def.h"
00030 
00031 /** @addtogroup STM32F1xx_HAL_Driver
00032   * @{
00033   */
00034 
00035 /** @addtogroup RTC
00036   * @{
00037   */
00038 
00039 /** @addtogroup RTC_Private_Macros
00040   * @{
00041   */
00042 
00043 #define IS_RTC_ASYNCH_PREDIV(PREDIV)  (((PREDIV) <= 0xFFFFFU) || ((PREDIV) == RTC_AUTO_1_SECOND))
00044 #define IS_RTC_HOUR24(HOUR)           ((HOUR) <= 23U)
00045 #define IS_RTC_MINUTES(MINUTES)       ((MINUTES) <= 59U)
00046 #define IS_RTC_SECONDS(SECONDS)       ((SECONDS) <= 59U)
00047 #define IS_RTC_FORMAT(FORMAT)         (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD))
00048 #define IS_RTC_YEAR(YEAR)             ((YEAR) <= 99U)
00049 #define IS_RTC_MONTH(MONTH)           (((MONTH) >= 1U) && ((MONTH) <= 12U))
00050 #define IS_RTC_DATE(DATE)             (((DATE) >= 1U) && ((DATE) <= 31U))
00051 #define IS_RTC_ALARM(ALARM)           ((ALARM) == RTC_ALARM_A)
00052 #define IS_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == RTC_OUTPUTSOURCE_NONE) || \
00053                                          ((__OUTPUT__) == RTC_OUTPUTSOURCE_CALIBCLOCK) || \
00054                                          ((__OUTPUT__) == RTC_OUTPUTSOURCE_ALARM) || \
00055                                          ((__OUTPUT__) == RTC_OUTPUTSOURCE_SECOND))
00056 
00057 
00058 /**
00059   * @}
00060   */
00061 
00062 /** @addtogroup RTC_Private_Constants
00063   * @{
00064   */
00065 /** @defgroup RTC_Timeout_Value Default Timeout Value
00066   * @{
00067   */
00068 #define RTC_TIMEOUT_VALUE           1000U
00069 /**
00070   * @}
00071   */
00072 
00073 /** @defgroup RTC_EXTI_Line_Event RTC EXTI Line event
00074   * @{
00075   */
00076 #define RTC_EXTI_LINE_ALARM_EVENT   ((uint32_t)EXTI_IMR_MR17)  /*!< External interrupt line 17 Connected to the RTC Alarm event */
00077 /**
00078   * @}
00079   */
00080 
00081 
00082 /**
00083   * @}
00084   */
00085 
00086 /* Exported types ------------------------------------------------------------*/
00087 /** @defgroup RTC_Exported_Types RTC Exported Types
00088   * @{
00089   */
00090 /**
00091   * @brief  RTC Time structure definition
00092   */
00093 typedef struct
00094 {
00095   uint8_t Hours;            /*!< Specifies the RTC Time Hour.
00096                                  This parameter must be a number between Min_Data = 0 and Max_Data = 23 */
00097 
00098   uint8_t Minutes;          /*!< Specifies the RTC Time Minutes.
00099                                  This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
00100 
00101   uint8_t Seconds;          /*!< Specifies the RTC Time Seconds.
00102                                  This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
00103 
00104 } RTC_TimeTypeDef;
00105 
00106 /**
00107   * @brief  RTC Alarm structure definition
00108   */
00109 typedef struct
00110 {
00111   RTC_TimeTypeDef AlarmTime;     /*!< Specifies the RTC Alarm Time members */
00112 
00113   uint32_t Alarm;                /*!< Specifies the alarm ID (only 1 alarm ID for STM32F1).
00114                                       This parameter can be a value of @ref RTC_Alarms_Definitions */
00115 } RTC_AlarmTypeDef;
00116 
00117 /**
00118   * @brief  HAL State structures definition
00119   */
00120 typedef enum
00121 {
00122   HAL_RTC_STATE_RESET             = 0x00U,  /*!< RTC not yet initialized or disabled */
00123   HAL_RTC_STATE_READY             = 0x01U,  /*!< RTC initialized and ready for use   */
00124   HAL_RTC_STATE_BUSY              = 0x02U,  /*!< RTC process is ongoing              */
00125   HAL_RTC_STATE_TIMEOUT           = 0x03U,  /*!< RTC timeout state                   */
00126   HAL_RTC_STATE_ERROR             = 0x04U   /*!< RTC error state                     */
00127 
00128 } HAL_RTCStateTypeDef;
00129 
00130 /**
00131   * @brief  RTC Configuration Structure definition
00132   */
00133 typedef struct
00134 {
00135   uint32_t AsynchPrediv;    /*!< Specifies the RTC Asynchronous Predivider value.
00136                                  This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFFF  or RTC_AUTO_1_SECOND
00137                                  If RTC_AUTO_1_SECOND is selected, AsynchPrediv will be set automatically to get 1sec timebase */
00138 
00139   uint32_t OutPut;          /*!< Specifies which signal will be routed to the RTC Tamper pin.
00140                                  This parameter can be a value of @ref RTC_output_source_to_output_on_the_Tamper_pin */
00141 
00142 } RTC_InitTypeDef;
00143 
00144 /**
00145   * @brief  RTC Date structure definition
00146   */
00147 typedef struct
00148 {
00149   uint8_t WeekDay;  /*!< Specifies the RTC Date WeekDay (not necessary for HAL_RTC_SetDate).
00150                          This parameter can be a value of @ref RTC_WeekDay_Definitions */
00151 
00152   uint8_t Month;    /*!< Specifies the RTC Date Month (in BCD format).
00153                          This parameter can be a value of @ref RTC_Month_Date_Definitions */
00154 
00155   uint8_t Date;     /*!< Specifies the RTC Date.
00156                          This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
00157 
00158   uint8_t Year;     /*!< Specifies the RTC Date Year.
00159                          This parameter must be a number between Min_Data = 0 and Max_Data = 99 */
00160 
00161 } RTC_DateTypeDef;
00162 
00163 /**
00164   * @brief  Time Handle Structure definition
00165   */
00166 #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
00167 typedef struct __RTC_HandleTypeDef
00168 #else
00169 typedef struct
00170 #endif /* (USE_HAL_RTC_REGISTER_CALLBACKS) */
00171 {
00172   RTC_TypeDef                 *Instance;  /*!< Register base address    */
00173 
00174   RTC_InitTypeDef             Init;       /*!< RTC required parameters  */
00175 
00176   RTC_DateTypeDef             DateToUpdate;       /*!< Current date set by user and updated automatically  */
00177 
00178   HAL_LockTypeDef             Lock;       /*!< RTC locking object       */
00179 
00180   __IO HAL_RTCStateTypeDef    State;      /*!< Time communication state */
00181 
00182 #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
00183   void (* AlarmAEventCallback)(struct __RTC_HandleTypeDef *hrtc);           /*!< RTC Alarm A Event callback         */
00184 
00185   void (* Tamper1EventCallback)(struct __RTC_HandleTypeDef *hrtc);          /*!< RTC Tamper 1 Event callback        */
00186 
00187   void (* MspInitCallback)(struct __RTC_HandleTypeDef *hrtc);               /*!< RTC Msp Init callback              */
00188 
00189   void (* MspDeInitCallback)(struct __RTC_HandleTypeDef *hrtc);             /*!< RTC Msp DeInit callback            */
00190 
00191 #endif /* (USE_HAL_RTC_REGISTER_CALLBACKS) */
00192 
00193 } RTC_HandleTypeDef;
00194 
00195 #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
00196 /**
00197   * @brief  HAL RTC Callback ID enumeration definition
00198   */
00199 typedef enum
00200 {
00201   HAL_RTC_ALARM_A_EVENT_CB_ID           = 0x00u,    /*!< RTC Alarm A Event Callback ID       */
00202   HAL_RTC_TAMPER1_EVENT_CB_ID           = 0x04u,    /*!< RTC Tamper 1 Callback ID            */
00203   HAL_RTC_MSPINIT_CB_ID                 = 0x0Eu,    /*!< RTC Msp Init callback ID            */
00204   HAL_RTC_MSPDEINIT_CB_ID               = 0x0Fu     /*!< RTC Msp DeInit callback ID          */
00205 } HAL_RTC_CallbackIDTypeDef;
00206 
00207 /**
00208   * @brief  HAL RTC Callback pointer definition
00209   */
00210 typedef  void (*pRTC_CallbackTypeDef)(RTC_HandleTypeDef *hrtc);  /*!< pointer to an RTC callback function */
00211 #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
00212 
00213 /**
00214   * @}
00215   */
00216 
00217 /* Exported constants --------------------------------------------------------*/
00218 /** @defgroup RTC_Exported_Constants RTC Exported Constants
00219   * @{
00220   */
00221 
00222 /** @defgroup RTC_Automatic_Prediv_1_Second Automatic calculation of prediv for 1sec timebase
00223   * @{
00224   */
00225 #define RTC_AUTO_1_SECOND                      0xFFFFFFFFU
00226 
00227 /**
00228   * @}
00229   */
00230 
00231 /** @defgroup RTC_Input_parameter_format_definitions Input Parameter Format
00232   * @{
00233   */
00234 #define RTC_FORMAT_BIN                         0x000000000U
00235 #define RTC_FORMAT_BCD                         0x000000001U
00236 
00237 /**
00238   * @}
00239   */
00240 
00241 /** @defgroup RTC_Month_Date_Definitions Month Definitions
00242   * @{
00243   */
00244 
00245 /* Coded in BCD format */
00246 #define RTC_MONTH_JANUARY              ((uint8_t)0x01)
00247 #define RTC_MONTH_FEBRUARY             ((uint8_t)0x02)
00248 #define RTC_MONTH_MARCH                ((uint8_t)0x03)
00249 #define RTC_MONTH_APRIL                ((uint8_t)0x04)
00250 #define RTC_MONTH_MAY                  ((uint8_t)0x05)
00251 #define RTC_MONTH_JUNE                 ((uint8_t)0x06)
00252 #define RTC_MONTH_JULY                 ((uint8_t)0x07)
00253 #define RTC_MONTH_AUGUST               ((uint8_t)0x08)
00254 #define RTC_MONTH_SEPTEMBER            ((uint8_t)0x09)
00255 #define RTC_MONTH_OCTOBER              ((uint8_t)0x10)
00256 #define RTC_MONTH_NOVEMBER             ((uint8_t)0x11)
00257 #define RTC_MONTH_DECEMBER             ((uint8_t)0x12)
00258 
00259 /**
00260   * @}
00261   */
00262 
00263 /** @defgroup RTC_WeekDay_Definitions WeekDay Definitions
00264   * @{
00265   */
00266 #define RTC_WEEKDAY_MONDAY             ((uint8_t)0x01)
00267 #define RTC_WEEKDAY_TUESDAY            ((uint8_t)0x02)
00268 #define RTC_WEEKDAY_WEDNESDAY          ((uint8_t)0x03)
00269 #define RTC_WEEKDAY_THURSDAY           ((uint8_t)0x04)
00270 #define RTC_WEEKDAY_FRIDAY             ((uint8_t)0x05)
00271 #define RTC_WEEKDAY_SATURDAY           ((uint8_t)0x06)
00272 #define RTC_WEEKDAY_SUNDAY             ((uint8_t)0x00)
00273 
00274 /**
00275   * @}
00276   */
00277 
00278 /** @defgroup RTC_Alarms_Definitions Alarms Definitions
00279   * @{
00280   */
00281 #define RTC_ALARM_A                        0U                                 /*!< Specify alarm ID (mainly for legacy purposes) */
00282 
00283 /**
00284   * @}
00285   */
00286 
00287 
00288 /** @defgroup RTC_output_source_to_output_on_the_Tamper_pin Output source to output on the Tamper pin
00289   * @{
00290   */
00291 
00292 #define RTC_OUTPUTSOURCE_NONE               0x00000000U                       /*!< No output on the TAMPER pin  */
00293 #define RTC_OUTPUTSOURCE_CALIBCLOCK         BKP_RTCCR_CCO                     /*!< RTC clock with a frequency divided by 64 on the TAMPER pin  */
00294 #define RTC_OUTPUTSOURCE_ALARM              BKP_RTCCR_ASOE                    /*!< Alarm pulse signal on the TAMPER pin  */
00295 #define RTC_OUTPUTSOURCE_SECOND             (BKP_RTCCR_ASOS | BKP_RTCCR_ASOE) /*!< Second pulse signal on the TAMPER pin  */
00296 
00297 /**
00298   * @}
00299   */
00300 
00301 /** @defgroup RTC_Interrupts_Definitions Interrupts Definitions
00302   * @{
00303   */
00304 #define RTC_IT_OW            RTC_CRH_OWIE       /*!< Overflow interrupt */
00305 #define RTC_IT_ALRA          RTC_CRH_ALRIE      /*!< Alarm interrupt */
00306 #define RTC_IT_SEC           RTC_CRH_SECIE      /*!< Second interrupt */
00307 #define RTC_IT_TAMP1         BKP_CSR_TPIE       /*!< TAMPER Pin interrupt enable */
00308 /**
00309   * @}
00310   */
00311 
00312 /** @defgroup RTC_Flags_Definitions Flags Definitions
00313   * @{
00314   */
00315 #define RTC_FLAG_RTOFF       RTC_CRL_RTOFF      /*!< RTC Operation OFF flag */
00316 #define RTC_FLAG_RSF         RTC_CRL_RSF        /*!< Registers Synchronized flag */
00317 #define RTC_FLAG_OW          RTC_CRL_OWF        /*!< Overflow flag */
00318 #define RTC_FLAG_ALRAF       RTC_CRL_ALRF       /*!< Alarm flag */
00319 #define RTC_FLAG_SEC         RTC_CRL_SECF       /*!< Second flag */
00320 #define RTC_FLAG_TAMP1F      BKP_CSR_TEF        /*!< Tamper Interrupt Flag */
00321 
00322 /**
00323   * @}
00324   */
00325 
00326 /**
00327   * @}
00328   */
00329 
00330 /* Exported macro ------------------------------------------------------------*/
00331 /** @defgroup RTC_Exported_macros RTC Exported Macros
00332   * @{
00333   */
00334 
00335 /** @brief  Reset RTC handle state
00336   * @param  __HANDLE__: RTC handle.
00337   * @retval None
00338   */
00339 #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
00340 #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) do{\
00341                                                       (__HANDLE__)->State = HAL_RTC_STATE_RESET;\
00342                                                       (__HANDLE__)->MspInitCallback = NULL;\
00343                                                       (__HANDLE__)->MspDeInitCallback = NULL;\
00344                                                      }while(0u)
00345 #else
00346 #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET)
00347 #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
00348 
00349 /**
00350   * @brief  Disable the write protection for RTC registers.
00351   * @param  __HANDLE__: specifies the RTC handle.
00352   * @retval None
00353   */
00354 #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__)         SET_BIT((__HANDLE__)->Instance->CRL, RTC_CRL_CNF)
00355 
00356 /**
00357   * @brief  Enable the write protection for RTC registers.
00358   * @param  __HANDLE__: specifies the RTC handle.
00359   * @retval None
00360   */
00361 #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__)          CLEAR_BIT((__HANDLE__)->Instance->CRL, RTC_CRL_CNF)
00362 
00363 /**
00364   * @brief  Enable the RTC Alarm interrupt.
00365   * @param  __HANDLE__: specifies the RTC handle.
00366   * @param  __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
00367   *          This parameter can be any combination of the following values:
00368   *            @arg RTC_IT_ALRA: Alarm A interrupt
00369   * @retval None
00370   */
00371 #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__)  SET_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
00372 
00373 /**
00374   * @brief  Disable the RTC Alarm interrupt.
00375   * @param  __HANDLE__: specifies the RTC handle.
00376   * @param  __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
00377   *         This parameter can be any combination of the following values:
00378   *            @arg RTC_IT_ALRA: Alarm A interrupt
00379   * @retval None
00380   */
00381 #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
00382 
00383 /**
00384   * @brief  Check whether the specified RTC Alarm interrupt has been enabled or not.
00385   * @param  __HANDLE__: specifies the RTC handle.
00386   * @param  __INTERRUPT__: specifies the RTC Alarm interrupt sources to be checked
00387   *         This parameter can be:
00388   *            @arg RTC_IT_ALRA: Alarm A interrupt
00389   * @retval None
00390   */
00391 #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)     ((((((__HANDLE__)->Instance->CRH)& ((__INTERRUPT__)))) != RESET)? SET : RESET)
00392 
00393 /**
00394   * @brief  Get the selected RTC Alarm's flag status.
00395   * @param  __HANDLE__: specifies the RTC handle.
00396   * @param  __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
00397   *          This parameter can be:
00398   *            @arg RTC_FLAG_ALRAF
00399   * @retval None
00400   */
00401 #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__)        (((((__HANDLE__)->Instance->CRL) & (__FLAG__)) != RESET)? SET : RESET)
00402 
00403 /**
00404   * @brief  Check whether the specified RTC Alarm interrupt has occurred or not.
00405   * @param  __HANDLE__: specifies the RTC handle.
00406   * @param  __INTERRUPT__: specifies the RTC Alarm interrupt sources to check.
00407   *         This parameter can be:
00408   *            @arg RTC_IT_ALRA: Alarm A interrupt
00409   * @retval None
00410   */
00411 #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__)        (((((__HANDLE__)->Instance->CRL) & (__INTERRUPT__)) != RESET)? SET : RESET)
00412 
00413 /**
00414   * @brief  Clear the RTC Alarm's pending flags.
00415   * @param  __HANDLE__: specifies the RTC handle.
00416   * @param  __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
00417   *         This parameter can be:
00418   *            @arg RTC_FLAG_ALRAF
00419   * @retval None
00420   */
00421 #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__)      ((__HANDLE__)->Instance->CRL) &= ~(__FLAG__)
00422 
00423 /**
00424   * @brief Enable interrupt on ALARM Exti Line 17.
00425   * @retval None.
00426   */
00427 #define __HAL_RTC_ALARM_EXTI_ENABLE_IT()                  SET_BIT(EXTI->IMR, RTC_EXTI_LINE_ALARM_EVENT)
00428 
00429 /**
00430   * @brief Disable interrupt on ALARM Exti Line 17.
00431   * @retval None.
00432   */
00433 #define __HAL_RTC_ALARM_EXTI_DISABLE_IT()                 CLEAR_BIT(EXTI->IMR, RTC_EXTI_LINE_ALARM_EVENT)
00434 
00435 /**
00436   * @brief Enable event on ALARM Exti Line 17.
00437   * @retval None.
00438   */
00439 #define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT()               SET_BIT(EXTI->EMR, RTC_EXTI_LINE_ALARM_EVENT)
00440 
00441 /**
00442   * @brief Disable event on ALARM Exti Line 17.
00443   * @retval None.
00444   */
00445 #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT()              CLEAR_BIT(EXTI->EMR, RTC_EXTI_LINE_ALARM_EVENT)
00446 
00447 
00448 /**
00449   * @brief  ALARM EXTI line configuration: set falling edge trigger.
00450   * @retval None.
00451   */
00452 #define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE()        SET_BIT(EXTI->FTSR, RTC_EXTI_LINE_ALARM_EVENT)
00453 
00454 
00455 /**
00456   * @brief Disable the ALARM Extended Interrupt Falling Trigger.
00457   * @retval None.
00458   */
00459 #define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE()       CLEAR_BIT(EXTI->FTSR, RTC_EXTI_LINE_ALARM_EVENT)
00460 
00461 
00462 /**
00463   * @brief  ALARM EXTI line configuration: set rising edge trigger.
00464   * @retval None.
00465   */
00466 #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE()         SET_BIT(EXTI->RTSR, RTC_EXTI_LINE_ALARM_EVENT)
00467 
00468 /**
00469   * @brief Disable the ALARM Extended Interrupt Rising Trigger.
00470   * This parameter can be:
00471   * @retval None.
00472   */
00473 #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE()        CLEAR_BIT(EXTI->RTSR, RTC_EXTI_LINE_ALARM_EVENT)
00474 
00475 /**
00476   * @brief  ALARM EXTI line configuration: set rising & falling edge trigger.
00477   * @retval None.
00478   */
00479 #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE()      \
00480 do{                                                            \
00481     __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE();                 \
00482     __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE();                \
00483   } while(0U)
00484 
00485 /**
00486   * @brief Disable the ALARM Extended Interrupt Rising & Falling Trigger.
00487   * This parameter can be:
00488   * @retval None.
00489   */
00490 #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE()      \
00491 do{                                                             \
00492     __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE();                 \
00493     __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE();                \
00494   } while(0U)
00495 
00496 /**
00497   * @brief Check whether the specified ALARM EXTI interrupt flag is set or not.
00498   * @retval EXTI ALARM Line Status.
00499   */
00500 #define __HAL_RTC_ALARM_EXTI_GET_FLAG()                   (EXTI->PR & (RTC_EXTI_LINE_ALARM_EVENT))
00501 
00502 /**
00503   * @brief Clear the ALARM EXTI flag.
00504   * @retval None.
00505   */
00506 #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG()                 (EXTI->PR = (RTC_EXTI_LINE_ALARM_EVENT))
00507 
00508 /**
00509   * @brief Generate a Software interrupt on selected EXTI line.
00510   * @retval None.
00511   */
00512 #define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT()              SET_BIT(EXTI->SWIER, RTC_EXTI_LINE_ALARM_EVENT)
00513 /**
00514   * @}
00515   */
00516 
00517 /* Include RTC HAL Extension module */
00518 #include "stm32f1xx_hal_rtc_ex.h"
00519 
00520 /* Exported functions --------------------------------------------------------*/
00521 /** @addtogroup RTC_Exported_Functions
00522   * @{
00523   */
00524 
00525 
00526 /* Initialization and de-initialization functions  ****************************/
00527 /** @addtogroup RTC_Exported_Functions_Group1
00528   * @{
00529   */
00530 HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc);
00531 HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc);
00532 void              HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc);
00533 void              HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc);
00534 
00535 /* Callbacks Register/UnRegister functions  ***********************************/
00536 #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
00537 HAL_StatusTypeDef HAL_RTC_RegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID, pRTC_CallbackTypeDef pCallback);
00538 HAL_StatusTypeDef HAL_RTC_UnRegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID);
00539 #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
00540 /**
00541   * @}
00542   */
00543 
00544 /* RTC Time and Date functions ************************************************/
00545 /** @addtogroup RTC_Exported_Functions_Group2
00546   * @{
00547   */
00548 HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
00549 HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
00550 HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
00551 HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
00552 /**
00553   * @}
00554   */
00555 
00556 /* RTC Alarm functions ********************************************************/
00557 /** @addtogroup RTC_Exported_Functions_Group3
00558   * @{
00559   */
00560 HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
00561 HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
00562 HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm);
00563 HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format);
00564 void              HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc);
00565 HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
00566 void              HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc);
00567 /**
00568   * @}
00569   */
00570 
00571 /* Peripheral State functions *************************************************/
00572 /** @addtogroup RTC_Exported_Functions_Group4
00573   * @{
00574   */
00575 HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
00576 /**
00577   * @}
00578   */
00579 
00580 /* Peripheral Control functions ***********************************************/
00581 /** @addtogroup RTC_Exported_Functions_Group5
00582   * @{
00583   */
00584 HAL_StatusTypeDef   HAL_RTC_WaitForSynchro(RTC_HandleTypeDef *hrtc);
00585 /**
00586   * @}
00587   */
00588 
00589 /**
00590   * @}
00591   */
00592 
00593 /**
00594   * @}
00595   */
00596 
00597 /**
00598   * @}
00599   */
00600 
00601 #ifdef __cplusplus
00602 }
00603 #endif
00604 
00605 #endif /* __STM32F1xx_HAL_RTC_H */
00606 
00607 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/