Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 9 | ||
---|---|---|---|
Line 4... | Line 4... | ||
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</center></h2> |
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
- | 10 | * All rights reserved.</center></h2> |
|
10 | * |
11 | * |
11 | * Redistribution and use in source and binary forms, with or without modification, |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
12 | * are permitted provided that the following conditions are met: |
13 | * the "License"; You may not use this file except in compliance with the |
13 | * 1. Redistributions of source code must retain the above copyright notice, |
- | |
14 | * this list of conditions and the following disclaimer. |
- | |
15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
- | |
16 | * this list of conditions and the following disclaimer in the documentation |
- | |
17 | * and/or other materials provided with the distribution. |
14 | * License. You may obtain a copy of the License at: |
18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
- | |
19 | * may be used to endorse or promote products derived from this software |
15 | * opensource.org/licenses/BSD-3-Clause |
20 | * without specific prior written permission. |
- | |
21 | * |
16 | * |
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
- | |
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
- | |
25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
- | |
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
- | |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
- | |
28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
- | |
29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
- | |
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
- | |
31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- | |
32 | * |
- | |
33 | ****************************************************************************** |
17 | ****************************************************************************** |
34 | */ |
18 | */ |
35 | 19 | ||
36 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
37 | #ifndef __STM32F1xx_HAL_RTC_H |
21 | #ifndef __STM32F1xx_HAL_RTC_H |
38 | #define __STM32F1xx_HAL_RTC_H |
22 | #define __STM32F1xx_HAL_RTC_H |
39 | 23 | ||
40 | #ifdef __cplusplus |
24 | #ifdef __cplusplus |
41 | extern "C" { |
25 | extern "C" { |
42 | #endif |
26 | #endif |
43 | 27 | ||
44 | /* Includes ------------------------------------------------------------------*/ |
28 | /* Includes ------------------------------------------------------------------*/ |
45 | #include "stm32f1xx_hal_def.h" |
29 | #include "stm32f1xx_hal_def.h" |
46 | 30 | ||
Line 48... | Line 32... | ||
48 | * @{ |
32 | * @{ |
49 | */ |
33 | */ |
50 | 34 | ||
51 | /** @addtogroup RTC |
35 | /** @addtogroup RTC |
52 | * @{ |
36 | * @{ |
53 | */ |
37 | */ |
54 | 38 | ||
55 | /** @addtogroup RTC_Private_Macros |
39 | /** @addtogroup RTC_Private_Macros |
56 | * @{ |
40 | * @{ |
57 | */ |
41 | */ |
58 | 42 | ||
Line 66... | Line 50... | ||
66 | #define IS_RTC_DATE(DATE) (((DATE) >= 1U) && ((DATE) <= 31U)) |
50 | #define IS_RTC_DATE(DATE) (((DATE) >= 1U) && ((DATE) <= 31U)) |
67 | #define IS_RTC_ALARM(ALARM) ((ALARM) == RTC_ALARM_A) |
51 | #define IS_RTC_ALARM(ALARM) ((ALARM) == RTC_ALARM_A) |
68 | #define IS_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == RTC_OUTPUTSOURCE_NONE) || \ |
52 | #define IS_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == RTC_OUTPUTSOURCE_NONE) || \ |
69 | ((__OUTPUT__) == RTC_OUTPUTSOURCE_CALIBCLOCK) || \ |
53 | ((__OUTPUT__) == RTC_OUTPUTSOURCE_CALIBCLOCK) || \ |
70 | ((__OUTPUT__) == RTC_OUTPUTSOURCE_ALARM) || \ |
54 | ((__OUTPUT__) == RTC_OUTPUTSOURCE_ALARM) || \ |
71 | ((__OUTPUT__) == RTC_OUTPUTSOURCE_SECOND)) |
55 | ((__OUTPUT__) == RTC_OUTPUTSOURCE_SECOND)) |
72 | 56 | ||
73 | 57 | ||
74 | /** |
58 | /** |
75 | * @} |
59 | * @} |
76 | */ |
60 | */ |
Line 78... | Line 62... | ||
78 | /** @addtogroup RTC_Private_Constants |
62 | /** @addtogroup RTC_Private_Constants |
79 | * @{ |
63 | * @{ |
80 | */ |
64 | */ |
81 | /** @defgroup RTC_Timeout_Value Default Timeout Value |
65 | /** @defgroup RTC_Timeout_Value Default Timeout Value |
82 | * @{ |
66 | * @{ |
83 | */ |
67 | */ |
84 | #define RTC_TIMEOUT_VALUE 1000U |
68 | #define RTC_TIMEOUT_VALUE 1000U |
85 | /** |
69 | /** |
86 | * @} |
70 | * @} |
87 | */ |
71 | */ |
88 | 72 | ||
89 | /** @defgroup RTC_EXTI_Line_Event RTC EXTI Line event |
73 | /** @defgroup RTC_EXTI_Line_Event RTC EXTI Line event |
90 | * @{ |
74 | * @{ |
91 | */ |
75 | */ |
92 | #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 */ |
93 | /** |
77 | /** |
94 | * @} |
78 | * @} |
95 | */ |
79 | */ |
96 | 80 | ||
97 | 81 | ||
98 | /** |
82 | /** |
99 | * @} |
83 | * @} |
100 | */ |
84 | */ |
101 | 85 | ||
102 | /* Exported types ------------------------------------------------------------*/ |
86 | /* Exported types ------------------------------------------------------------*/ |
103 | /** @defgroup RTC_Exported_Types RTC Exported Types |
87 | /** @defgroup RTC_Exported_Types RTC Exported Types |
104 | * @{ |
88 | * @{ |
105 | */ |
89 | */ |
106 | /** |
90 | /** |
107 | * @brief RTC Time structure definition |
91 | * @brief RTC Time structure definition |
108 | */ |
92 | */ |
109 | typedef struct |
93 | typedef struct |
110 | { |
94 | { |
111 | uint8_t Hours; /*!< Specifies the RTC Time Hour. |
95 | uint8_t Hours; /*!< Specifies the RTC Time Hour. |
112 | 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 */ |
113 | 97 | ||
114 | uint8_t Minutes; /*!< Specifies the RTC Time Minutes. |
98 | uint8_t Minutes; /*!< Specifies the RTC Time Minutes. |
115 | 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 */ |
116 | 100 | ||
117 | uint8_t Seconds; /*!< Specifies the RTC Time Seconds. |
101 | uint8_t Seconds; /*!< Specifies the RTC Time Seconds. |
118 | 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 */ |
119 | - | ||
120 | }RTC_TimeTypeDef; |
- | |
121 | 103 | ||
- | 104 | } RTC_TimeTypeDef; |
|
- | 105 | ||
122 | /** |
106 | /** |
123 | * @brief RTC Alarm structure definition |
107 | * @brief RTC Alarm structure definition |
124 | */ |
108 | */ |
125 | typedef struct |
109 | typedef struct |
126 | { |
110 | { |
127 | RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */ |
111 | RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */ |
128 | 112 | ||
129 | 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). |
130 | This parameter can be a value of @ref RTC_Alarms_Definitions */ |
114 | This parameter can be a value of @ref RTC_Alarms_Definitions */ |
131 | }RTC_AlarmTypeDef; |
115 | } RTC_AlarmTypeDef; |
132 | 116 | ||
133 | /** |
117 | /** |
134 | * @brief HAL State structures definition |
118 | * @brief HAL State structures definition |
135 | */ |
119 | */ |
136 | typedef enum |
120 | typedef enum |
137 | { |
121 | { |
138 | HAL_RTC_STATE_RESET = 0x00U, /*!< RTC not yet initialized or disabled */ |
122 | HAL_RTC_STATE_RESET = 0x00U, /*!< RTC not yet initialized or disabled */ |
139 | HAL_RTC_STATE_READY = 0x01U, /*!< RTC initialized and ready for use */ |
123 | HAL_RTC_STATE_READY = 0x01U, /*!< RTC initialized and ready for use */ |
140 | HAL_RTC_STATE_BUSY = 0x02U, /*!< RTC process is ongoing */ |
124 | HAL_RTC_STATE_BUSY = 0x02U, /*!< RTC process is ongoing */ |
141 | HAL_RTC_STATE_TIMEOUT = 0x03U, /*!< RTC timeout state */ |
125 | HAL_RTC_STATE_TIMEOUT = 0x03U, /*!< RTC timeout state */ |
142 | HAL_RTC_STATE_ERROR = 0x04U /*!< RTC error state */ |
126 | HAL_RTC_STATE_ERROR = 0x04U /*!< RTC error state */ |
143 | - | ||
- | 127 | ||
144 | }HAL_RTCStateTypeDef; |
128 | } HAL_RTCStateTypeDef; |
145 | 129 | ||
146 | /** |
130 | /** |
147 | * @brief RTC Configuration Structure definition |
131 | * @brief RTC Configuration Structure definition |
148 | */ |
132 | */ |
149 | typedef struct |
133 | typedef struct |
150 | { |
134 | { |
151 | uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value. |
135 | uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value. |
152 | 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 |
153 | 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 */ |
154 | - | ||
- | 138 | ||
155 | 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. |
156 | 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 */ |
157 | 141 | ||
158 | }RTC_InitTypeDef; |
142 | } RTC_InitTypeDef; |
159 | 143 | ||
160 | /** |
144 | /** |
161 | * @brief RTC Date structure definition |
145 | * @brief RTC Date structure definition |
162 | */ |
146 | */ |
163 | typedef struct |
147 | typedef struct |
164 | { |
148 | { |
165 | 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). |
166 | This parameter can be a value of @ref RTC_WeekDay_Definitions */ |
150 | This parameter can be a value of @ref RTC_WeekDay_Definitions */ |
167 | 151 | ||
168 | uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format). |
152 | uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format). |
169 | 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 */ |
170 | 154 | ||
171 | uint8_t Date; /*!< Specifies the RTC Date. |
155 | uint8_t Date; /*!< Specifies the RTC Date. |
172 | 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 */ |
173 | 157 | ||
174 | uint8_t Year; /*!< Specifies the RTC Date Year. |
158 | uint8_t Year; /*!< Specifies the RTC Date Year. |
175 | 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 */ |
176 | - | ||
177 | }RTC_DateTypeDef; |
- | |
178 | 160 | ||
- | 161 | } RTC_DateTypeDef; |
|
- | 162 | ||
179 | /** |
163 | /** |
180 | * @brief Time Handle Structure definition |
164 | * @brief Time Handle Structure definition |
181 | */ |
165 | */ |
- | 166 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) |
|
- | 167 | typedef struct __RTC_HandleTypeDef |
|
- | 168 | #else |
|
182 | typedef struct |
169 | typedef struct |
- | 170 | #endif /* (USE_HAL_RTC_REGISTER_CALLBACKS) */ |
|
183 | { |
171 | { |
184 | RTC_TypeDef *Instance; /*!< Register base address */ |
172 | RTC_TypeDef *Instance; /*!< Register base address */ |
185 | 173 | ||
186 | RTC_InitTypeDef Init; /*!< RTC required parameters */ |
174 | RTC_InitTypeDef Init; /*!< RTC required parameters */ |
187 | 175 | ||
188 | RTC_DateTypeDef DateToUpdate; /*!< Current date set by user and updated automatically */ |
176 | RTC_DateTypeDef DateToUpdate; /*!< Current date set by user and updated automatically */ |
189 | 177 | ||
190 | HAL_LockTypeDef Lock; /*!< RTC locking object */ |
178 | HAL_LockTypeDef Lock; /*!< RTC locking object */ |
191 | 179 | ||
192 | __IO HAL_RTCStateTypeDef State; /*!< Time communication state */ |
180 | __IO HAL_RTCStateTypeDef State; /*!< Time communication state */ |
193 | 181 | ||
- | 182 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) |
|
- | 183 | void (* AlarmAEventCallback)(struct __RTC_HandleTypeDef *hrtc); /*!< RTC Alarm A Event callback */ |
|
- | 184 | ||
- | 185 | void (* Tamper1EventCallback)(struct __RTC_HandleTypeDef *hrtc); /*!< RTC Tamper 1 Event callback */ |
|
- | 186 | ||
- | 187 | void (* MspInitCallback)(struct __RTC_HandleTypeDef *hrtc); /*!< RTC Msp Init callback */ |
|
- | 188 | ||
- | 189 | void (* MspDeInitCallback)(struct __RTC_HandleTypeDef *hrtc); /*!< RTC Msp DeInit callback */ |
|
- | 190 | ||
- | 191 | #endif /* (USE_HAL_RTC_REGISTER_CALLBACKS) */ |
|
- | 192 | ||
194 | }RTC_HandleTypeDef; |
193 | } RTC_HandleTypeDef; |
- | 194 | ||
- | 195 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) |
|
- | 196 | /** |
|
- | 197 | * @brief HAL RTC Callback ID enumeration definition |
|
- | 198 | */ |
|
- | 199 | typedef enum |
|
- | 200 | { |
|
- | 201 | HAL_RTC_ALARM_A_EVENT_CB_ID = 0x00u, /*!< RTC Alarm A Event Callback ID */ |
|
- | 202 | HAL_RTC_TAMPER1_EVENT_CB_ID = 0x04u, /*!< RTC Tamper 1 Callback ID */ |
|
- | 203 | HAL_RTC_MSPINIT_CB_ID = 0x0Eu, /*!< RTC Msp Init callback ID */ |
|
- | 204 | HAL_RTC_MSPDEINIT_CB_ID = 0x0Fu /*!< RTC Msp DeInit callback ID */ |
|
- | 205 | } HAL_RTC_CallbackIDTypeDef; |
|
- | 206 | ||
- | 207 | /** |
|
- | 208 | * @brief HAL RTC Callback pointer definition |
|
- | 209 | */ |
|
- | 210 | typedef void (*pRTC_CallbackTypeDef)(RTC_HandleTypeDef *hrtc); /*!< pointer to an RTC callback function */ |
|
- | 211 | #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */ |
|
195 | 212 | ||
196 | /** |
213 | /** |
197 | * @} |
214 | * @} |
198 | */ |
215 | */ |
199 | 216 | ||
200 | /* Exported constants --------------------------------------------------------*/ |
217 | /* Exported constants --------------------------------------------------------*/ |
201 | /** @defgroup RTC_Exported_Constants RTC Exported Constants |
218 | /** @defgroup RTC_Exported_Constants RTC Exported Constants |
202 | * @{ |
219 | * @{ |
203 | */ |
220 | */ |
204 | 221 | ||
205 | /** @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 |
206 | * @{ |
223 | * @{ |
207 | */ |
224 | */ |
208 | #define RTC_AUTO_1_SECOND 0xFFFFFFFFU |
225 | #define RTC_AUTO_1_SECOND 0xFFFFFFFFU |
209 | 226 | ||
210 | /** |
227 | /** |
211 | * @} |
228 | * @} |
212 | */ |
229 | */ |
213 | 230 | ||
214 | /** @defgroup RTC_Input_parameter_format_definitions Input Parameter Format |
231 | /** @defgroup RTC_Input_parameter_format_definitions Input Parameter Format |
215 | * @{ |
232 | * @{ |
216 | */ |
233 | */ |
217 | #define RTC_FORMAT_BIN 0x000000000U |
234 | #define RTC_FORMAT_BIN 0x000000000U |
218 | #define RTC_FORMAT_BCD 0x000000001U |
235 | #define RTC_FORMAT_BCD 0x000000001U |
219 | 236 | ||
220 | /** |
237 | /** |
221 | * @} |
238 | * @} |
222 | */ |
239 | */ |
223 | 240 | ||
224 | /** @defgroup RTC_Month_Date_Definitions Month Definitions |
241 | /** @defgroup RTC_Month_Date_Definitions Month Definitions |
225 | * @{ |
242 | * @{ |
226 | */ |
243 | */ |
227 | 244 | ||
228 | /* Coded in BCD format */ |
245 | /* Coded in BCD format */ |
229 | #define RTC_MONTH_JANUARY ((uint8_t)0x01) |
246 | #define RTC_MONTH_JANUARY ((uint8_t)0x01) |
230 | #define RTC_MONTH_FEBRUARY ((uint8_t)0x02) |
247 | #define RTC_MONTH_FEBRUARY ((uint8_t)0x02) |
231 | #define RTC_MONTH_MARCH ((uint8_t)0x03) |
248 | #define RTC_MONTH_MARCH ((uint8_t)0x03) |
Line 239... | Line 256... | ||
239 | #define RTC_MONTH_NOVEMBER ((uint8_t)0x11) |
256 | #define RTC_MONTH_NOVEMBER ((uint8_t)0x11) |
240 | #define RTC_MONTH_DECEMBER ((uint8_t)0x12) |
257 | #define RTC_MONTH_DECEMBER ((uint8_t)0x12) |
241 | 258 | ||
242 | /** |
259 | /** |
243 | * @} |
260 | * @} |
244 | */ |
261 | */ |
245 | 262 | ||
246 | /** @defgroup RTC_WeekDay_Definitions WeekDay Definitions |
263 | /** @defgroup RTC_WeekDay_Definitions WeekDay Definitions |
247 | * @{ |
264 | * @{ |
248 | */ |
265 | */ |
249 | #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01) |
266 | #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01) |
250 | #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02) |
267 | #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02) |
251 | #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03) |
268 | #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03) |
252 | #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04) |
269 | #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04) |
253 | #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05) |
270 | #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05) |
254 | #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06) |
271 | #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06) |
255 | #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x00) |
272 | #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x00) |
256 | 273 | ||
257 | /** |
274 | /** |
258 | * @} |
275 | * @} |
259 | */ |
276 | */ |
260 | 277 | ||
261 | /** @defgroup RTC_Alarms_Definitions Alarms Definitions |
278 | /** @defgroup RTC_Alarms_Definitions Alarms Definitions |
262 | * @{ |
279 | * @{ |
263 | */ |
280 | */ |
264 | #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) */ |
265 | 282 | ||
266 | /** |
283 | /** |
267 | * @} |
284 | * @} |
268 | */ |
285 | */ |
269 | 286 | ||
270 | 287 | ||
271 | /** @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 |
272 | * @{ |
289 | * @{ |
273 | */ |
290 | */ |
Line 279... | Line 296... | ||
279 | 296 | ||
280 | /** |
297 | /** |
281 | * @} |
298 | * @} |
282 | */ |
299 | */ |
283 | 300 | ||
284 | /** @defgroup RTC_Interrupts_Definitions Interrupts Definitions |
301 | /** @defgroup RTC_Interrupts_Definitions Interrupts Definitions |
285 | * @{ |
302 | * @{ |
286 | */ |
303 | */ |
287 | #define RTC_IT_OW RTC_CRH_OWIE /*!< Overflow interrupt */ |
304 | #define RTC_IT_OW RTC_CRH_OWIE /*!< Overflow interrupt */ |
288 | #define RTC_IT_ALRA RTC_CRH_ALRIE /*!< Alarm interrupt */ |
305 | #define RTC_IT_ALRA RTC_CRH_ALRIE /*!< Alarm interrupt */ |
289 | #define RTC_IT_SEC RTC_CRH_SECIE /*!< Second interrupt */ |
306 | #define RTC_IT_SEC RTC_CRH_SECIE /*!< Second interrupt */ |
290 | #define RTC_IT_TAMP1 BKP_CSR_TPIE /*!< TAMPER Pin interrupt enable */ |
307 | #define RTC_IT_TAMP1 BKP_CSR_TPIE /*!< TAMPER Pin interrupt enable */ |
291 | /** |
308 | /** |
292 | * @} |
309 | * @} |
293 | */ |
310 | */ |
294 | 311 | ||
295 | /** @defgroup RTC_Flags_Definitions Flags Definitions |
312 | /** @defgroup RTC_Flags_Definitions Flags Definitions |
296 | * @{ |
313 | * @{ |
297 | */ |
314 | */ |
298 | #define RTC_FLAG_RTOFF RTC_CRL_RTOFF /*!< RTC Operation OFF flag */ |
315 | #define RTC_FLAG_RTOFF RTC_CRL_RTOFF /*!< RTC Operation OFF flag */ |
299 | #define RTC_FLAG_RSF RTC_CRL_RSF /*!< Registers Synchronized flag */ |
316 | #define RTC_FLAG_RSF RTC_CRL_RSF /*!< Registers Synchronized flag */ |
300 | #define RTC_FLAG_OW RTC_CRL_OWF /*!< Overflow flag */ |
317 | #define RTC_FLAG_OW RTC_CRL_OWF /*!< Overflow flag */ |
301 | #define RTC_FLAG_ALRAF RTC_CRL_ALRF /*!< Alarm flag */ |
318 | #define RTC_FLAG_ALRAF RTC_CRL_ALRF /*!< Alarm flag */ |
302 | #define RTC_FLAG_SEC RTC_CRL_SECF /*!< Second flag */ |
319 | #define RTC_FLAG_SEC RTC_CRL_SECF /*!< Second flag */ |
Line 306... | Line 323... | ||
306 | * @} |
323 | * @} |
307 | */ |
324 | */ |
308 | 325 | ||
309 | /** |
326 | /** |
310 | * @} |
327 | * @} |
311 | */ |
328 | */ |
312 | 329 | ||
313 | /* Exported macro ------------------------------------------------------------*/ |
330 | /* Exported macro ------------------------------------------------------------*/ |
314 | /** @defgroup RTC_Exported_macros RTC Exported Macros |
331 | /** @defgroup RTC_Exported_macros RTC Exported Macros |
315 | * @{ |
332 | * @{ |
316 | */ |
333 | */ |
317 | 334 | ||
318 | /** @brief Reset RTC handle state |
335 | /** @brief Reset RTC handle state |
319 | * @param __HANDLE__: RTC handle. |
336 | * @param __HANDLE__: RTC handle. |
320 | * @retval None |
337 | * @retval None |
321 | */ |
338 | */ |
- | 339 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) |
|
- | 340 | #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) do{\ |
|
- | 341 | (__HANDLE__)->State = HAL_RTC_STATE_RESET;\ |
|
- | 342 | (__HANDLE__)->MspInitCallback = NULL;\ |
|
- | 343 | (__HANDLE__)->MspDeInitCallback = NULL;\ |
|
- | 344 | }while(0u) |
|
- | 345 | #else |
|
322 | #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) |
- | 347 | #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */ |
|
323 | 348 | ||
324 | /** |
349 | /** |
325 | * @brief Disable the write protection for RTC registers. |
350 | * @brief Disable the write protection for RTC registers. |
326 | * @param __HANDLE__: specifies the RTC handle. |
351 | * @param __HANDLE__: specifies the RTC handle. |
327 | * @retval None |
352 | * @retval None |
328 | */ |
353 | */ |
Line 332... | Line 357... | ||
332 | * @brief Enable the write protection for RTC registers. |
357 | * @brief Enable the write protection for RTC registers. |
333 | * @param __HANDLE__: specifies the RTC handle. |
358 | * @param __HANDLE__: specifies the RTC handle. |
334 | * @retval None |
359 | * @retval None |
335 | */ |
360 | */ |
336 | #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) |
337 | 362 | ||
338 | /** |
363 | /** |
339 | * @brief Enable the RTC Alarm interrupt. |
364 | * @brief Enable the RTC Alarm interrupt. |
340 | * @param __HANDLE__: specifies the RTC handle. |
365 | * @param __HANDLE__: specifies the RTC handle. |
341 | * @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. |
342 | * This parameter can be any combination of the following values: |
367 | * This parameter can be any combination of the following values: |
343 | * @arg RTC_IT_ALRA: Alarm A interrupt |
368 | * @arg RTC_IT_ALRA: Alarm A interrupt |
344 | * @retval None |
369 | * @retval None |
345 | */ |
370 | */ |
346 | #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__)) |
347 | 372 | ||
348 | /** |
373 | /** |
349 | * @brief Disable the RTC Alarm interrupt. |
374 | * @brief Disable the RTC Alarm interrupt. |
350 | * @param __HANDLE__: specifies the RTC handle. |
375 | * @param __HANDLE__: specifies the RTC handle. |
351 | * @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. |
352 | * This parameter can be any combination of the following values: |
377 | * This parameter can be any combination of the following values: |
353 | * @arg RTC_IT_ALRA: Alarm A interrupt |
378 | * @arg RTC_IT_ALRA: Alarm A interrupt |
354 | * @retval None |
379 | * @retval None |
355 | */ |
380 | */ |
356 | #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__)) |
Line 400... | Line 425... | ||
400 | * @retval None. |
425 | * @retval None. |
401 | */ |
426 | */ |
402 | #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) |
403 | 428 | ||
404 | /** |
429 | /** |
405 | * @brief Disable interrupt on ALARM Exti Line 17. |
430 | * @brief Disable interrupt on ALARM Exti Line 17. |
406 | * @retval None. |
431 | * @retval None. |
407 | */ |
432 | */ |
408 | #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) |
409 | 434 | ||
410 | /** |
435 | /** |
Line 419... | Line 444... | ||
419 | */ |
444 | */ |
420 | #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) |
421 | 446 | ||
422 | 447 | ||
423 | /** |
448 | /** |
424 | * @brief ALARM EXTI line configuration: set falling edge trigger. |
449 | * @brief ALARM EXTI line configuration: set falling edge trigger. |
425 | * @retval None. |
450 | * @retval None. |
426 | */ |
451 | */ |
427 | #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) |
428 | 453 | ||
429 | 454 | ||
Line 504... | Line 529... | ||
504 | */ |
529 | */ |
505 | HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc); |
530 | HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc); |
506 | HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc); |
531 | HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc); |
507 | void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc); |
532 | void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc); |
508 | void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc); |
533 | void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc); |
- | 534 | ||
- | 535 | /* Callbacks Register/UnRegister functions ***********************************/ |
|
- | 536 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) |
|
- | 537 | HAL_StatusTypeDef HAL_RTC_RegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID, pRTC_CallbackTypeDef pCallback); |
|
- | 538 | HAL_StatusTypeDef HAL_RTC_UnRegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID); |
|
- | 539 | #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */ |
|
509 | /** |
540 | /** |
510 | * @} |
541 | * @} |
511 | */ |
542 | */ |
512 | 543 | ||
513 | /* RTC Time and Date functions ************************************************/ |
544 | /* RTC Time and Date functions ************************************************/ |
514 | /** @addtogroup RTC_Exported_Functions_Group2 |
545 | /** @addtogroup RTC_Exported_Functions_Group2 |
515 | * @{ |
546 | * @{ |
516 | */ |
547 | */ |
517 | 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); |
Line 548... | Line 579... | ||
548 | 579 | ||
549 | /* Peripheral Control functions ***********************************************/ |
580 | /* Peripheral Control functions ***********************************************/ |
550 | /** @addtogroup RTC_Exported_Functions_Group5 |
581 | /** @addtogroup RTC_Exported_Functions_Group5 |
551 | * @{ |
582 | * @{ |
552 | */ |
583 | */ |
553 | HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc); |
584 | HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef *hrtc); |
554 | /** |
585 | /** |
555 | * @} |
586 | * @} |
556 | */ |
587 | */ |
557 | 588 | ||
558 | /** |
589 | /** |
559 | * @} |
590 | * @} |
560 | */ |
591 | */ |
561 | 592 | ||
562 | /** |
593 | /** |
563 | * @} |
594 | * @} |
564 | */ |
595 | */ |
565 | 596 | ||
566 | /** |
597 | /** |
567 | * @} |
598 | * @} |
568 | */ |
599 | */ |
569 | 600 | ||
570 | #ifdef __cplusplus |
601 | #ifdef __cplusplus |
571 | } |
602 | } |
572 | #endif |
603 | #endif |
573 | 604 |