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