Subversion Repositories DashDisplay

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /**
  2.   ******************************************************************************
  3.   * @file    stm32f1xx_hal_rtc.h
  4.   * @author  MCD Application Team
  5.   * @version V1.0.1
  6.   * @date    31-July-2015
  7.   * @brief   Header file of RTC HAL module.
  8.   ******************************************************************************
  9.   * @attention
  10.   *
  11.   * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
  12.   *
  13.   * Redistribution and use in source and binary forms, with or without modification,
  14.   * are permitted provided that the following conditions are met:
  15.   *   1. Redistributions of source code must retain the above copyright notice,
  16.   *      this list of conditions and the following disclaimer.
  17.   *   2. Redistributions in binary form must reproduce the above copyright notice,
  18.   *      this list of conditions and the following disclaimer in the documentation
  19.   *      and/or other materials provided with the distribution.
  20.   *   3. Neither the name of STMicroelectronics nor the names of its contributors
  21.   *      may be used to endorse or promote products derived from this software
  22.   *      without specific prior written permission.
  23.   *
  24.   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25.   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26.   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27.   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28.   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29.   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30.   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31.   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32.   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33.   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34.   *
  35.   ******************************************************************************  
  36.   */
  37.  
  38. /* Define to prevent recursive inclusion -------------------------------------*/
  39. #ifndef __STM32F1xx_HAL_RTC_H
  40. #define __STM32F1xx_HAL_RTC_H
  41.  
  42. #ifdef __cplusplus
  43.  extern "C" {
  44. #endif
  45.  
  46. /* Includes ------------------------------------------------------------------*/
  47. #include "stm32f1xx_hal_def.h"
  48.  
  49. /** @addtogroup STM32F1xx_HAL_Driver
  50.   * @{
  51.   */
  52.  
  53. /** @addtogroup RTC
  54.   * @{
  55.   */
  56.  
  57. /** @addtogroup RTC_Private_Macros
  58.   * @{
  59.   */
  60.  
  61. #define IS_RTC_ASYNCH_PREDIV(PREDIV)  (((PREDIV) <= (uint32_t)0xFFFFF) || ((PREDIV) == RTC_AUTO_1_SECOND))
  62. #define IS_RTC_HOUR24(HOUR)           ((HOUR) <= (uint32_t)23)
  63. #define IS_RTC_MINUTES(MINUTES)       ((MINUTES) <= (uint32_t)59)
  64. #define IS_RTC_SECONDS(SECONDS)       ((SECONDS) <= (uint32_t)59)
  65. #define IS_RTC_FORMAT(FORMAT)         (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD))
  66. #define IS_RTC_YEAR(YEAR)             ((YEAR) <= (uint32_t)99)
  67. #define IS_RTC_MONTH(MONTH)           (((MONTH) >= (uint32_t)1) && ((MONTH) <= (uint32_t)12))
  68. #define IS_RTC_DATE(DATE)             (((DATE) >= (uint32_t)1) && ((DATE) <= (uint32_t)31))
  69. #define IS_RTC_ALARM(ALARM)           ((ALARM) == RTC_ALARM_A)
  70. #define IS_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == RTC_OUTPUTSOURCE_NONE) || \
  71.                                          ((__OUTPUT__) == RTC_OUTPUTSOURCE_CALIBCLOCK) || \
  72.                                          ((__OUTPUT__) == RTC_OUTPUTSOURCE_ALARM) || \
  73.                                          ((__OUTPUT__) == RTC_OUTPUTSOURCE_SECOND))
  74.  
  75.  
  76. /**
  77.   * @}
  78.   */
  79.  
  80. /** @addtogroup RTC_Private_Constants
  81.   * @{
  82.   */
  83. /** @defgroup RTC_Timeout_Value Default Timeout Value
  84.   * @{
  85.   */
  86. #define RTC_TIMEOUT_VALUE           1000
  87. /**
  88.   * @}
  89.   */  
  90.  
  91. /** @defgroup RTC_EXTI_Line_Event RTC EXTI Line event
  92.   * @{
  93.   */
  94. #define RTC_EXTI_LINE_ALARM_EVENT   ((uint32_t)EXTI_IMR_MR17)  /*!< External interrupt line 17 Connected to the RTC Alarm event */
  95. /**
  96.   * @}
  97.   */
  98.  
  99.  
  100. /**
  101.   * @}
  102.   */
  103.  
  104. /* Exported types ------------------------------------------------------------*/
  105. /** @defgroup RTC_Exported_Types RTC Exported Types
  106.   * @{
  107.   */
  108. /**
  109.   * @brief  RTC Time structure definition  
  110.   */
  111. typedef struct
  112. {
  113.   uint8_t Hours;            /*!< Specifies the RTC Time Hour.
  114.                                  This parameter must be a number between Min_Data = 0 and Max_Data = 23 */
  115.  
  116.   uint8_t Minutes;          /*!< Specifies the RTC Time Minutes.
  117.                                  This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
  118.  
  119.   uint8_t Seconds;          /*!< Specifies the RTC Time Seconds.
  120.                                  This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
  121.  
  122. }RTC_TimeTypeDef;
  123.  
  124. /**
  125.   * @brief  RTC Alarm structure definition  
  126.   */
  127. typedef struct
  128. {
  129.   RTC_TimeTypeDef AlarmTime;     /*!< Specifies the RTC Alarm Time members */
  130.    
  131.   uint32_t Alarm;                /*!< Specifies the alarm ID (only 1 alarm ID for STM32F1).
  132.                                       This parameter can be a value of @ref RTC_Alarms_Definitions */
  133. }RTC_AlarmTypeDef;
  134.  
  135. /**
  136.   * @brief  HAL State structures definition  
  137.   */
  138. typedef enum
  139. {
  140.   HAL_RTC_STATE_RESET             = 0x00,  /*!< RTC not yet initialized or disabled */
  141.   HAL_RTC_STATE_READY             = 0x01,  /*!< RTC initialized and ready for use   */
  142.   HAL_RTC_STATE_BUSY              = 0x02,  /*!< RTC process is ongoing              */    
  143.   HAL_RTC_STATE_TIMEOUT           = 0x03,  /*!< RTC timeout state                   */  
  144.   HAL_RTC_STATE_ERROR             = 0x04   /*!< RTC error state                     */      
  145.                                                                        
  146. }HAL_RTCStateTypeDef;
  147.  
  148. /**
  149.   * @brief  RTC Configuration Structure definition  
  150.   */
  151. typedef struct
  152. {
  153.   uint32_t AsynchPrediv;    /*!< Specifies the RTC Asynchronous Predivider value.
  154.                                  This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFFF  or RTC_AUTO_1_SECOND
  155.                                  If RTC_AUTO_1_SECOND is selected, AsynchPrediv will be set automatically to get 1sec timebase */
  156.                                
  157.   uint32_t OutPut;          /*!< Specifies which signal will be routed to the RTC Tamper pin.
  158.                                  This parameter can be a value of @ref RTC_output_source_to_output_on_the_Tamper_pin */      
  159.  
  160. }RTC_InitTypeDef;
  161.  
  162. /**
  163.   * @brief  RTC Date structure definition  
  164.   */
  165. typedef struct
  166. {
  167.   uint8_t WeekDay;  /*!< Specifies the RTC Date WeekDay (not necessary for HAL_RTC_SetDate).
  168.                          This parameter can be a value of @ref RTC_WeekDay_Definitions */
  169.  
  170.   uint8_t Month;    /*!< Specifies the RTC Date Month (in BCD format).
  171.                          This parameter can be a value of @ref RTC_Month_Date_Definitions */
  172.  
  173.   uint8_t Date;     /*!< Specifies the RTC Date.
  174.                          This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
  175.  
  176.   uint8_t Year;     /*!< Specifies the RTC Date Year.
  177.                          This parameter must be a number between Min_Data = 0 and Max_Data = 99 */
  178.                        
  179. }RTC_DateTypeDef;
  180.  
  181. /**
  182.   * @brief  Time Handle Structure definition  
  183.   */
  184. typedef struct
  185. {
  186.   RTC_TypeDef                 *Instance;  /*!< Register base address    */
  187.  
  188.   RTC_InitTypeDef             Init;       /*!< RTC required parameters  */
  189.  
  190.   RTC_DateTypeDef             DateToUpdate;       /*!< Current date set by user and updated automatically  */
  191.  
  192.   HAL_LockTypeDef             Lock;       /*!< RTC locking object       */
  193.  
  194.   __IO HAL_RTCStateTypeDef    State;      /*!< Time communication state */
  195.  
  196. }RTC_HandleTypeDef;
  197.  
  198. /**
  199.   * @}
  200.   */
  201.  
  202. /* Exported constants --------------------------------------------------------*/
  203. /** @defgroup RTC_Exported_Constants RTC Exported Constants
  204.   * @{
  205.   */
  206.  
  207. /** @defgroup RTC_Automatic_Prediv_1_Second Automatic calculation of prediv for 1sec timebase
  208.   * @{
  209.   */
  210. #define RTC_AUTO_1_SECOND                      ((uint32_t)0xFFFFFFFF)
  211.  
  212. /**
  213.   * @}
  214.   */
  215.  
  216. /** @defgroup RTC_Input_parameter_format_definitions Input Parameter Format
  217.   * @{
  218.   */
  219. #define RTC_FORMAT_BIN                      ((uint32_t)0x000000000)
  220. #define RTC_FORMAT_BCD                      ((uint32_t)0x000000001)
  221.  
  222. /**
  223.   * @}
  224.   */
  225.  
  226. /** @defgroup RTC_Month_Date_Definitions Month Definitions
  227.   * @{
  228.   */
  229.  
  230. /* Coded in BCD format */
  231. #define RTC_MONTH_JANUARY              ((uint8_t)0x01)
  232. #define RTC_MONTH_FEBRUARY             ((uint8_t)0x02)
  233. #define RTC_MONTH_MARCH                ((uint8_t)0x03)
  234. #define RTC_MONTH_APRIL                ((uint8_t)0x04)
  235. #define RTC_MONTH_MAY                  ((uint8_t)0x05)
  236. #define RTC_MONTH_JUNE                 ((uint8_t)0x06)
  237. #define RTC_MONTH_JULY                 ((uint8_t)0x07)
  238. #define RTC_MONTH_AUGUST               ((uint8_t)0x08)
  239. #define RTC_MONTH_SEPTEMBER            ((uint8_t)0x09)
  240. #define RTC_MONTH_OCTOBER              ((uint8_t)0x10)
  241. #define RTC_MONTH_NOVEMBER             ((uint8_t)0x11)
  242. #define RTC_MONTH_DECEMBER             ((uint8_t)0x12)
  243.  
  244. /**
  245.   * @}
  246.   */
  247.  
  248. /** @defgroup RTC_WeekDay_Definitions WeekDay Definitions
  249.   * @{
  250.   */
  251. #define RTC_WEEKDAY_MONDAY             ((uint8_t)0x01)
  252. #define RTC_WEEKDAY_TUESDAY            ((uint8_t)0x02)
  253. #define RTC_WEEKDAY_WEDNESDAY          ((uint8_t)0x03)
  254. #define RTC_WEEKDAY_THURSDAY           ((uint8_t)0x04)
  255. #define RTC_WEEKDAY_FRIDAY             ((uint8_t)0x05)
  256. #define RTC_WEEKDAY_SATURDAY           ((uint8_t)0x06)
  257. #define RTC_WEEKDAY_SUNDAY             ((uint8_t)0x00)
  258.  
  259. /**
  260.   * @}
  261.   */
  262.  
  263. /** @defgroup RTC_Alarms_Definitions Alarms Definitions
  264.   * @{
  265.   */
  266. #define RTC_ALARM_A          0                  /*!< Specify alarm ID (mainly for legacy purposes) */
  267.  
  268. /**
  269.   * @}
  270.   */
  271.  
  272.  
  273. /** @defgroup RTC_output_source_to_output_on_the_Tamper_pin Output source to output on the Tamper pin
  274.   * @{
  275.   */
  276.  
  277. #define RTC_OUTPUTSOURCE_NONE               ((uint32_t)0x00000000)            /*!< No output on the TAMPER pin  */
  278. #define RTC_OUTPUTSOURCE_CALIBCLOCK         BKP_RTCCR_CCO                     /*!< RTC clock with a frequency divided by 64 on the TAMPER pin  */
  279. #define RTC_OUTPUTSOURCE_ALARM              BKP_RTCCR_ASOE                    /*!< Alarm pulse signal on the TAMPER pin  */
  280. #define RTC_OUTPUTSOURCE_SECOND             (BKP_RTCCR_ASOS | BKP_RTCCR_ASOE) /*!< Second pulse signal on the TAMPER pin  */
  281.  
  282. /**
  283.   * @}
  284.   */
  285.  
  286. /** @defgroup RTC_Interrupts_Definitions Interrupts Definitions
  287.   * @{
  288.   */
  289. #define RTC_IT_OW            RTC_CRH_OWIE       /*!< Overflow interrupt */
  290. #define RTC_IT_ALRA          RTC_CRH_ALRIE      /*!< Alarm interrupt */
  291. #define RTC_IT_SEC           RTC_CRH_SECIE      /*!< Second interrupt */
  292. #define RTC_IT_TAMP1         BKP_CSR_TPIE       /*!< TAMPER Pin interrupt enable */  
  293. /**
  294.   * @}
  295.   */
  296.  
  297. /** @defgroup RTC_Flags_Definitions Flags Definitions
  298.   * @{
  299.   */
  300. #define RTC_FLAG_RTOFF       RTC_CRL_RTOFF      /*!< RTC Operation OFF flag */
  301. #define RTC_FLAG_RSF         RTC_CRL_RSF        /*!< Registers Synchronized flag */
  302. #define RTC_FLAG_OW          RTC_CRL_OWF        /*!< Overflow flag */
  303. #define RTC_FLAG_ALRAF       RTC_CRL_ALRF       /*!< Alarm flag */
  304. #define RTC_FLAG_SEC         RTC_CRL_SECF       /*!< Second flag */
  305. #define RTC_FLAG_TAMP1F      BKP_CSR_TEF        /*!< Tamper Interrupt Flag */
  306.  
  307. /**
  308.   * @}
  309.   */
  310.  
  311. /**
  312.   * @}
  313.   */
  314.  
  315. /* Exported macro ------------------------------------------------------------*/
  316. /** @defgroup RTC_Exported_macros RTC Exported Macros
  317.   * @{
  318.   */
  319.  
  320. /** @brief  Reset RTC handle state
  321.   * @param  __HANDLE__: RTC handle.
  322.   * @retval None
  323.   */
  324. #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__)              ((__HANDLE__)->State = HAL_RTC_STATE_RESET)
  325.  
  326. /**
  327.   * @brief  Disable the write protection for RTC registers.
  328.   * @param  __HANDLE__: specifies the RTC handle.
  329.   * @retval None
  330.   */
  331. #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__)         SET_BIT((__HANDLE__)->Instance->CRL, RTC_CRL_CNF)
  332.  
  333. /**
  334.   * @brief  Enable the write protection for RTC registers.
  335.   * @param  __HANDLE__: specifies the RTC handle.
  336.   * @retval None
  337.   */
  338. #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__)          CLEAR_BIT((__HANDLE__)->Instance->CRL, RTC_CRL_CNF)
  339.  
  340. /**
  341.   * @brief  Enable the RTC Alarm interrupt.
  342.   * @param  __HANDLE__: specifies the RTC handle.
  343.   * @param  __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
  344.   *          This parameter can be any combination of the following values:
  345.   *            @arg RTC_IT_ALRA: Alarm A interrupt
  346.   * @retval None
  347.   */  
  348. #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__)  SET_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
  349.  
  350. /**
  351.   * @brief  Disable the RTC Alarm interrupt.
  352.   * @param  __HANDLE__: specifies the RTC handle.
  353.   * @param  __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
  354.   *         This parameter can be any combination of the following values:
  355.   *            @arg RTC_IT_ALRA: Alarm A interrupt
  356.   * @retval None
  357.   */
  358. #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
  359.  
  360. /**
  361.   * @brief  Check whether the specified RTC Alarm interrupt has been enabled or not.
  362.   * @param  __HANDLE__: specifies the RTC handle.
  363.   * @param  __INTERRUPT__: specifies the RTC Alarm interrupt sources to be checked
  364.   *         This parameter can be:
  365.   *            @arg RTC_IT_ALRA: Alarm A interrupt
  366.   * @retval None
  367.   */
  368. #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)     ((((((__HANDLE__)->Instance->CRH)& ((__INTERRUPT__)))) != RESET)? SET : RESET)
  369.  
  370. /**
  371.   * @brief  Get the selected RTC Alarm's flag status.
  372.   * @param  __HANDLE__: specifies the RTC handle.
  373.   * @param  __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
  374.   *          This parameter can be:
  375.   *            @arg RTC_FLAG_ALRAF
  376.   * @retval None
  377.   */
  378. #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__)        (((((__HANDLE__)->Instance->CRL) & (__FLAG__)) != RESET)? SET : RESET)
  379.  
  380. /**
  381.   * @brief  Check whether the specified RTC Alarm interrupt has occurred or not.
  382.   * @param  __HANDLE__: specifies the RTC handle.
  383.   * @param  __INTERRUPT__: specifies the RTC Alarm interrupt sources to check.
  384.   *         This parameter can be:
  385.   *            @arg RTC_IT_ALRA: Alarm A interrupt
  386.   * @retval None
  387.   */
  388. #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__)        (((((__HANDLE__)->Instance->CRL) & (__INTERRUPT__)) != RESET)? SET : RESET)
  389.  
  390. /**
  391.   * @brief  Clear the RTC Alarm's pending flags.
  392.   * @param  __HANDLE__: specifies the RTC handle.
  393.   * @param  __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
  394.   *         This parameter can be:
  395.   *            @arg RTC_FLAG_ALRAF
  396.   * @retval None
  397.   */
  398. #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__)      ((__HANDLE__)->Instance->CRL) = ~(__FLAG__)
  399.  
  400. /**
  401.   * @brief Enable interrupt on ALARM Exti Line 17.
  402.   * @retval None.
  403.   */
  404. #define __HAL_RTC_ALARM_EXTI_ENABLE_IT()                  SET_BIT(EXTI->IMR, RTC_EXTI_LINE_ALARM_EVENT)
  405.  
  406. /**
  407.   * @brief Disable interrupt on ALARM Exti Line 17.
  408.   * @retval None.
  409.   */
  410. #define __HAL_RTC_ALARM_EXTI_DISABLE_IT()                 CLEAR_BIT(EXTI->IMR, RTC_EXTI_LINE_ALARM_EVENT)
  411.  
  412. /**
  413.   * @brief Enable event on ALARM Exti Line 17.
  414.   * @retval None.
  415.   */
  416. #define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT()               SET_BIT(EXTI->EMR, RTC_EXTI_LINE_ALARM_EVENT)
  417.  
  418. /**
  419.   * @brief Disable event on ALARM Exti Line 17.
  420.   * @retval None.
  421.   */
  422. #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT()              CLEAR_BIT(EXTI->EMR, RTC_EXTI_LINE_ALARM_EVENT)
  423.  
  424.  
  425. /**
  426.   * @brief  ALARM EXTI line configuration: set falling edge trigger.  
  427.   * @retval None.
  428.   */
  429. #define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE()        SET_BIT(EXTI->FTSR, RTC_EXTI_LINE_ALARM_EVENT)
  430.  
  431.  
  432. /**
  433.   * @brief Disable the ALARM Extended Interrupt Falling Trigger.
  434.   * @retval None.
  435.   */
  436. #define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE()       CLEAR_BIT(EXTI->FTSR, RTC_EXTI_LINE_ALARM_EVENT)
  437.  
  438.  
  439. /**
  440.   * @brief  ALARM EXTI line configuration: set rising edge trigger.
  441.   * @retval None.
  442.   */
  443. #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE()         SET_BIT(EXTI->RTSR, RTC_EXTI_LINE_ALARM_EVENT)
  444.  
  445. /**
  446.   * @brief Disable the ALARM Extended Interrupt Rising Trigger.
  447.   * This parameter can be:
  448.   * @retval None.
  449.   */
  450. #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE()        CLEAR_BIT(EXTI->RTSR, RTC_EXTI_LINE_ALARM_EVENT)
  451.  
  452. /**
  453.   * @brief  ALARM EXTI line configuration: set rising & falling edge trigger.
  454.   * @retval None.
  455.   */
  456. #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE();
  457.  
  458. /**
  459.   * @brief Disable the ALARM Extended Interrupt Rising & Falling Trigger.
  460.   * This parameter can be:
  461.   * @retval None.
  462.   */
  463. #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE()();
  464.  
  465. /**
  466.   * @brief Check whether the specified ALARM EXTI interrupt flag is set or not.
  467.   * @retval EXTI ALARM Line Status.
  468.   */
  469. #define __HAL_RTC_ALARM_EXTI_GET_FLAG()                   (EXTI->PR & (RTC_EXTI_LINE_ALARM_EVENT))
  470.  
  471. /**
  472.   * @brief Clear the ALARM EXTI flag.
  473.   * @retval None.
  474.   */
  475. #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG()                 (EXTI->PR = (RTC_EXTI_LINE_ALARM_EVENT))
  476.  
  477. /**
  478.   * @brief Generate a Software interrupt on selected EXTI line.
  479.   * @retval None.
  480.   */
  481. #define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT()              SET_BIT(EXTI->SWIER, RTC_EXTI_LINE_ALARM_EVENT)
  482. /**
  483.   * @}
  484.   */
  485.  
  486. /* Include RTC HAL Extension module */
  487. #include "stm32f1xx_hal_rtc_ex.h"
  488.  
  489. /* Exported functions --------------------------------------------------------*/
  490. /** @addtogroup RTC_Exported_Functions
  491.   * @{
  492.   */
  493.  
  494.  
  495. /* Initialization and de-initialization functions  ****************************/
  496. /** @addtogroup RTC_Exported_Functions_Group1
  497.   * @{
  498.   */
  499. HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc);
  500. HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc);
  501. void              HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc);
  502. void              HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc);
  503. /**
  504.   * @}
  505.   */
  506.  
  507. /* RTC Time and Date functions ************************************************/
  508. /** @addtogroup RTC_Exported_Functions_Group2
  509.   * @{
  510.   */
  511. HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
  512. HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
  513. HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
  514. HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
  515. /**
  516.   * @}
  517.   */
  518.  
  519. /* RTC Alarm functions ********************************************************/
  520. /** @addtogroup RTC_Exported_Functions_Group3
  521.   * @{
  522.   */
  523. HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
  524. HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
  525. HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm);
  526. HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format);
  527. void              HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc);
  528. HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  529. void              HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc);
  530. /**
  531.   * @}
  532.   */
  533.  
  534. /* Peripheral State functions *************************************************/
  535. /** @addtogroup RTC_Exported_Functions_Group4
  536.   * @{
  537.   */
  538. HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
  539. /**
  540.   * @}
  541.   */
  542.  
  543. /* Peripheral Control functions ***********************************************/
  544. /** @addtogroup RTC_Exported_Functions_Group5
  545.   * @{
  546.   */
  547. HAL_StatusTypeDef   HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc);
  548. /**
  549.   * @}
  550.   */
  551.  
  552. /**
  553.   * @}
  554.   */
  555.  
  556. /**
  557.   * @}
  558.   */
  559.  
  560. /**
  561.   * @}
  562.   */
  563.  
  564. #ifdef __cplusplus
  565. }
  566. #endif
  567.  
  568. #endif /* __STM32F1xx_HAL_RTC_H */
  569.  
  570. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
  571.