Mercurial > public > ostc4
comparison Common/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rtc.h @ 128:c78bcbd5deda FlipDisplay
Added current STM32 standandard libraries in version independend folder structure
author | Ideenmodellierer |
---|---|
date | Sun, 17 Feb 2019 21:12:22 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
127:1369f8660eaa | 128:c78bcbd5deda |
---|---|
1 /** | |
2 ****************************************************************************** | |
3 * @file stm32f4xx_ll_rtc.h | |
4 * @author MCD Application Team | |
5 * @brief Header file of RTC LL module. | |
6 ****************************************************************************** | |
7 * @attention | |
8 * | |
9 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |
10 * | |
11 * Redistribution and use in source and binary forms, with or without modification, | |
12 * are permitted provided that the following conditions are met: | |
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. | |
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 | |
20 * without specific prior written permission. | |
21 * | |
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 ****************************************************************************** | |
34 */ | |
35 | |
36 /* Define to prevent recursive inclusion -------------------------------------*/ | |
37 #ifndef __STM32F4xx_LL_RTC_H | |
38 #define __STM32F4xx_LL_RTC_H | |
39 | |
40 #ifdef __cplusplus | |
41 extern "C" { | |
42 #endif | |
43 | |
44 /* Includes ------------------------------------------------------------------*/ | |
45 #include "stm32f4xx.h" | |
46 | |
47 /** @addtogroup STM32F4xx_LL_Driver | |
48 * @{ | |
49 */ | |
50 | |
51 #if defined(RTC) | |
52 | |
53 /** @defgroup RTC_LL RTC | |
54 * @{ | |
55 */ | |
56 | |
57 /* Private types -------------------------------------------------------------*/ | |
58 /* Private variables ---------------------------------------------------------*/ | |
59 /* Private constants ---------------------------------------------------------*/ | |
60 /** @defgroup RTC_LL_Private_Constants RTC Private Constants | |
61 * @{ | |
62 */ | |
63 /* Masks Definition */ | |
64 #define RTC_INIT_MASK 0xFFFFFFFFU | |
65 #define RTC_RSF_MASK 0xFFFFFF5FU | |
66 | |
67 /* Write protection defines */ | |
68 #define RTC_WRITE_PROTECTION_DISABLE ((uint8_t)0xFFU) | |
69 #define RTC_WRITE_PROTECTION_ENABLE_1 ((uint8_t)0xCAU) | |
70 #define RTC_WRITE_PROTECTION_ENABLE_2 ((uint8_t)0x53U) | |
71 | |
72 /* Defines used to combine date & time */ | |
73 #define RTC_OFFSET_WEEKDAY 24U | |
74 #define RTC_OFFSET_DAY 16U | |
75 #define RTC_OFFSET_MONTH 8U | |
76 #define RTC_OFFSET_HOUR 16U | |
77 #define RTC_OFFSET_MINUTE 8U | |
78 | |
79 /** | |
80 * @} | |
81 */ | |
82 | |
83 /* Private macros ------------------------------------------------------------*/ | |
84 #if defined(USE_FULL_LL_DRIVER) | |
85 /** @defgroup RTC_LL_Private_Macros RTC Private Macros | |
86 * @{ | |
87 */ | |
88 /** | |
89 * @} | |
90 */ | |
91 #endif /*USE_FULL_LL_DRIVER*/ | |
92 | |
93 /* Exported types ------------------------------------------------------------*/ | |
94 #if defined(USE_FULL_LL_DRIVER) | |
95 /** @defgroup RTC_LL_ES_INIT RTC Exported Init structure | |
96 * @{ | |
97 */ | |
98 | |
99 /** | |
100 * @brief RTC Init structures definition | |
101 */ | |
102 typedef struct | |
103 { | |
104 uint32_t HourFormat; /*!< Specifies the RTC Hours Format. | |
105 This parameter can be a value of @ref RTC_LL_EC_HOURFORMAT | |
106 | |
107 This feature can be modified afterwards using unitary function | |
108 @ref LL_RTC_SetHourFormat(). */ | |
109 | |
110 uint32_t AsynchPrescaler; /*!< Specifies the RTC Asynchronous Predivider value. | |
111 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F | |
112 | |
113 This feature can be modified afterwards using unitary function | |
114 @ref LL_RTC_SetAsynchPrescaler(). */ | |
115 | |
116 uint32_t SynchPrescaler; /*!< Specifies the RTC Synchronous Predivider value. | |
117 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF | |
118 | |
119 This feature can be modified afterwards using unitary function | |
120 @ref LL_RTC_SetSynchPrescaler(). */ | |
121 } LL_RTC_InitTypeDef; | |
122 | |
123 /** | |
124 * @brief RTC Time structure definition | |
125 */ | |
126 typedef struct | |
127 { | |
128 uint32_t TimeFormat; /*!< Specifies the RTC AM/PM Time. | |
129 This parameter can be a value of @ref RTC_LL_EC_TIME_FORMAT | |
130 | |
131 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetFormat(). */ | |
132 | |
133 uint8_t Hours; /*!< Specifies the RTC Time Hours. | |
134 This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the @ref LL_RTC_TIME_FORMAT_PM is selected. | |
135 This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the @ref LL_RTC_TIME_FORMAT_AM_OR_24 is selected. | |
136 | |
137 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetHour(). */ | |
138 | |
139 uint8_t Minutes; /*!< Specifies the RTC Time Minutes. | |
140 This parameter must be a number between Min_Data = 0 and Max_Data = 59 | |
141 | |
142 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetMinute(). */ | |
143 | |
144 uint8_t Seconds; /*!< Specifies the RTC Time Seconds. | |
145 This parameter must be a number between Min_Data = 0 and Max_Data = 59 | |
146 | |
147 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetSecond(). */ | |
148 } LL_RTC_TimeTypeDef; | |
149 | |
150 /** | |
151 * @brief RTC Date structure definition | |
152 */ | |
153 typedef struct | |
154 { | |
155 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay. | |
156 This parameter can be a value of @ref RTC_LL_EC_WEEKDAY | |
157 | |
158 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetWeekDay(). */ | |
159 | |
160 uint8_t Month; /*!< Specifies the RTC Date Month. | |
161 This parameter can be a value of @ref RTC_LL_EC_MONTH | |
162 | |
163 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetMonth(). */ | |
164 | |
165 uint8_t Day; /*!< Specifies the RTC Date Day. | |
166 This parameter must be a number between Min_Data = 1 and Max_Data = 31 | |
167 | |
168 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetDay(). */ | |
169 | |
170 uint8_t Year; /*!< Specifies the RTC Date Year. | |
171 This parameter must be a number between Min_Data = 0 and Max_Data = 99 | |
172 | |
173 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetYear(). */ | |
174 } LL_RTC_DateTypeDef; | |
175 | |
176 /** | |
177 * @brief RTC Alarm structure definition | |
178 */ | |
179 typedef struct | |
180 { | |
181 LL_RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members. */ | |
182 | |
183 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks. | |
184 This parameter can be a value of @ref RTC_LL_EC_ALMA_MASK for ALARM A or @ref RTC_LL_EC_ALMB_MASK for ALARM B. | |
185 | |
186 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetMask() for ALARM A | |
187 or @ref LL_RTC_ALMB_SetMask() for ALARM B | |
188 */ | |
189 | |
190 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on day or WeekDay. | |
191 This parameter can be a value of @ref RTC_LL_EC_ALMA_WEEKDAY_SELECTION for ALARM A or @ref RTC_LL_EC_ALMB_WEEKDAY_SELECTION for ALARM B | |
192 | |
193 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_EnableWeekday() or @ref LL_RTC_ALMA_DisableWeekday() | |
194 for ALARM A or @ref LL_RTC_ALMB_EnableWeekday() or @ref LL_RTC_ALMB_DisableWeekday() for ALARM B | |
195 */ | |
196 | |
197 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Day/WeekDay. | |
198 If AlarmDateWeekDaySel set to day, this parameter must be a number between Min_Data = 1 and Max_Data = 31. | |
199 | |
200 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetDay() | |
201 for ALARM A or @ref LL_RTC_ALMB_SetDay() for ALARM B. | |
202 | |
203 If AlarmDateWeekDaySel set to Weekday, this parameter can be a value of @ref RTC_LL_EC_WEEKDAY. | |
204 | |
205 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetWeekDay() | |
206 for ALARM A or @ref LL_RTC_ALMB_SetWeekDay() for ALARM B. | |
207 */ | |
208 } LL_RTC_AlarmTypeDef; | |
209 | |
210 /** | |
211 * @} | |
212 */ | |
213 #endif /* USE_FULL_LL_DRIVER */ | |
214 | |
215 /* Exported constants --------------------------------------------------------*/ | |
216 /** @defgroup RTC_LL_Exported_Constants RTC Exported Constants | |
217 * @{ | |
218 */ | |
219 | |
220 #if defined(USE_FULL_LL_DRIVER) | |
221 /** @defgroup RTC_LL_EC_FORMAT FORMAT | |
222 * @{ | |
223 */ | |
224 #define LL_RTC_FORMAT_BIN 0x000000000U /*!< Binary data format */ | |
225 #define LL_RTC_FORMAT_BCD 0x000000001U /*!< BCD data format */ | |
226 /** | |
227 * @} | |
228 */ | |
229 | |
230 /** @defgroup RTC_LL_EC_ALMA_WEEKDAY_SELECTION RTC Alarm A Date WeekDay | |
231 * @{ | |
232 */ | |
233 #define LL_RTC_ALMA_DATEWEEKDAYSEL_DATE 0x00000000U /*!< Alarm A Date is selected */ | |
234 #define LL_RTC_ALMA_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMAR_WDSEL /*!< Alarm A WeekDay is selected */ | |
235 /** | |
236 * @} | |
237 */ | |
238 | |
239 /** @defgroup RTC_LL_EC_ALMB_WEEKDAY_SELECTION RTC Alarm B Date WeekDay | |
240 * @{ | |
241 */ | |
242 #define LL_RTC_ALMB_DATEWEEKDAYSEL_DATE 0x00000000U /*!< Alarm B Date is selected */ | |
243 #define LL_RTC_ALMB_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMBR_WDSEL /*!< Alarm B WeekDay is selected */ | |
244 /** | |
245 * @} | |
246 */ | |
247 | |
248 #endif /* USE_FULL_LL_DRIVER */ | |
249 | |
250 /** @defgroup RTC_LL_EC_GET_FLAG Get Flags Defines | |
251 * @brief Flags defines which can be used with LL_RTC_ReadReg function | |
252 * @{ | |
253 */ | |
254 #define LL_RTC_ISR_RECALPF RTC_ISR_RECALPF | |
255 #define LL_RTC_ISR_TAMP3F RTC_ISR_TAMP3F | |
256 #define LL_RTC_ISR_TAMP2F RTC_ISR_TAMP2F | |
257 #define LL_RTC_ISR_TAMP1F RTC_ISR_TAMP1F | |
258 #define LL_RTC_ISR_TSOVF RTC_ISR_TSOVF | |
259 #define LL_RTC_ISR_TSF RTC_ISR_TSF | |
260 #define LL_RTC_ISR_WUTF RTC_ISR_WUTF | |
261 #define LL_RTC_ISR_ALRBF RTC_ISR_ALRBF | |
262 #define LL_RTC_ISR_ALRAF RTC_ISR_ALRAF | |
263 #define LL_RTC_ISR_INITF RTC_ISR_INITF | |
264 #define LL_RTC_ISR_RSF RTC_ISR_RSF | |
265 #define LL_RTC_ISR_INITS RTC_ISR_INITS | |
266 #define LL_RTC_ISR_SHPF RTC_ISR_SHPF | |
267 #define LL_RTC_ISR_WUTWF RTC_ISR_WUTWF | |
268 #define LL_RTC_ISR_ALRBWF RTC_ISR_ALRBWF | |
269 #define LL_RTC_ISR_ALRAWF RTC_ISR_ALRAWF | |
270 /** | |
271 * @} | |
272 */ | |
273 | |
274 /** @defgroup RTC_LL_EC_IT IT Defines | |
275 * @brief IT defines which can be used with LL_RTC_ReadReg and LL_RTC_WriteReg functions | |
276 * @{ | |
277 */ | |
278 #define LL_RTC_CR_TSIE RTC_CR_TSIE | |
279 #define LL_RTC_CR_WUTIE RTC_CR_WUTIE | |
280 #define LL_RTC_CR_ALRBIE RTC_CR_ALRBIE | |
281 #define LL_RTC_CR_ALRAIE RTC_CR_ALRAIE | |
282 #define LL_RTC_TAFCR_TAMPIE RTC_TAFCR_TAMPIE | |
283 /** | |
284 * @} | |
285 */ | |
286 | |
287 /** @defgroup RTC_LL_EC_WEEKDAY WEEK DAY | |
288 * @{ | |
289 */ | |
290 #define LL_RTC_WEEKDAY_MONDAY ((uint8_t)0x01U) /*!< Monday */ | |
291 #define LL_RTC_WEEKDAY_TUESDAY ((uint8_t)0x02U) /*!< Tuesday */ | |
292 #define LL_RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03U) /*!< Wednesday */ | |
293 #define LL_RTC_WEEKDAY_THURSDAY ((uint8_t)0x04U) /*!< Thrusday */ | |
294 #define LL_RTC_WEEKDAY_FRIDAY ((uint8_t)0x05U) /*!< Friday */ | |
295 #define LL_RTC_WEEKDAY_SATURDAY ((uint8_t)0x06U) /*!< Saturday */ | |
296 #define LL_RTC_WEEKDAY_SUNDAY ((uint8_t)0x07U) /*!< Sunday */ | |
297 /** | |
298 * @} | |
299 */ | |
300 | |
301 /** @defgroup RTC_LL_EC_MONTH MONTH | |
302 * @{ | |
303 */ | |
304 #define LL_RTC_MONTH_JANUARY ((uint8_t)0x01U) /*!< January */ | |
305 #define LL_RTC_MONTH_FEBRUARY ((uint8_t)0x02U) /*!< February */ | |
306 #define LL_RTC_MONTH_MARCH ((uint8_t)0x03U) /*!< March */ | |
307 #define LL_RTC_MONTH_APRIL ((uint8_t)0x04U) /*!< April */ | |
308 #define LL_RTC_MONTH_MAY ((uint8_t)0x05U) /*!< May */ | |
309 #define LL_RTC_MONTH_JUNE ((uint8_t)0x06U) /*!< June */ | |
310 #define LL_RTC_MONTH_JULY ((uint8_t)0x07U) /*!< July */ | |
311 #define LL_RTC_MONTH_AUGUST ((uint8_t)0x08U) /*!< August */ | |
312 #define LL_RTC_MONTH_SEPTEMBER ((uint8_t)0x09U) /*!< September */ | |
313 #define LL_RTC_MONTH_OCTOBER ((uint8_t)0x10U) /*!< October */ | |
314 #define LL_RTC_MONTH_NOVEMBER ((uint8_t)0x11U) /*!< November */ | |
315 #define LL_RTC_MONTH_DECEMBER ((uint8_t)0x12U) /*!< December */ | |
316 /** | |
317 * @} | |
318 */ | |
319 | |
320 /** @defgroup RTC_LL_EC_HOURFORMAT HOUR FORMAT | |
321 * @{ | |
322 */ | |
323 #define LL_RTC_HOURFORMAT_24HOUR 0x00000000U /*!< 24 hour/day format */ | |
324 #define LL_RTC_HOURFORMAT_AMPM RTC_CR_FMT /*!< AM/PM hour format */ | |
325 /** | |
326 * @} | |
327 */ | |
328 | |
329 /** @defgroup RTC_LL_EC_ALARMOUT ALARM OUTPUT | |
330 * @{ | |
331 */ | |
332 #define LL_RTC_ALARMOUT_DISABLE 0x00000000U /*!< Output disabled */ | |
333 #define LL_RTC_ALARMOUT_ALMA RTC_CR_OSEL_0 /*!< Alarm A output enabled */ | |
334 #define LL_RTC_ALARMOUT_ALMB RTC_CR_OSEL_1 /*!< Alarm B output enabled */ | |
335 #define LL_RTC_ALARMOUT_WAKEUP RTC_CR_OSEL /*!< Wakeup output enabled */ | |
336 /** | |
337 * @} | |
338 */ | |
339 | |
340 /** @defgroup RTC_LL_EC_ALARM_OUTPUTTYPE ALARM OUTPUT TYPE | |
341 * @{ | |
342 */ | |
343 #define LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN 0x00000000U /*!< RTC_ALARM, when mapped on PC13, is open-drain output */ | |
344 #define LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL RTC_TAFCR_ALARMOUTTYPE /*!< RTC_ALARM, when mapped on PC13, is push-pull output */ | |
345 /** | |
346 * @} | |
347 */ | |
348 | |
349 /** @defgroup RTC_LL_EC_PIN PIN | |
350 * @{ | |
351 */ | |
352 #define LL_RTC_PIN_PC13 RTC_TAFCR_PC13MODE /*!< PC13 is forced to push-pull output if all RTC alternate functions are disabled */ | |
353 #define LL_RTC_PIN_PC14 RTC_TAFCR_PC14MODE /*!< PC14 is forced to push-pull output if LSE is disabled */ | |
354 #define LL_RTC_PIN_PC15 RTC_TAFCR_PC15MODE /*!< PC15 is forced to push-pull output if LSE is disabled */ | |
355 /** | |
356 * @} | |
357 */ | |
358 | |
359 /** @defgroup RTC_LL_EC_OUTPUTPOLARITY_PIN OUTPUT POLARITY PIN | |
360 * @{ | |
361 */ | |
362 #define LL_RTC_OUTPUTPOLARITY_PIN_HIGH 0x00000000U /*!< Pin is high when ALRAF/ALRBF/WUTF is asserted (depending on OSEL)*/ | |
363 #define LL_RTC_OUTPUTPOLARITY_PIN_LOW RTC_CR_POL /*!< Pin is low when ALRAF/ALRBF/WUTF is asserted (depending on OSEL) */ | |
364 /** | |
365 * @} | |
366 */ | |
367 | |
368 /** @defgroup RTC_LL_EC_TIME_FORMAT TIME FORMAT | |
369 * @{ | |
370 */ | |
371 #define LL_RTC_TIME_FORMAT_AM_OR_24 0x00000000U /*!< AM or 24-hour format */ | |
372 #define LL_RTC_TIME_FORMAT_PM RTC_TR_PM /*!< PM */ | |
373 /** | |
374 * @} | |
375 */ | |
376 | |
377 /** @defgroup RTC_LL_EC_SHIFT_SECOND SHIFT SECOND | |
378 * @{ | |
379 */ | |
380 #define LL_RTC_SHIFT_SECOND_DELAY 0x00000000U /* Delay (seconds) = SUBFS / (PREDIV_S + 1) */ | |
381 #define LL_RTC_SHIFT_SECOND_ADVANCE RTC_SHIFTR_ADD1S /* Advance (seconds) = (1 - (SUBFS / (PREDIV_S + 1))) */ | |
382 /** | |
383 * @} | |
384 */ | |
385 | |
386 /** @defgroup RTC_LL_EC_ALMA_MASK ALARMA MASK | |
387 * @{ | |
388 */ | |
389 #define LL_RTC_ALMA_MASK_NONE 0x00000000U /*!< No masks applied on Alarm A*/ | |
390 #define LL_RTC_ALMA_MASK_DATEWEEKDAY RTC_ALRMAR_MSK4 /*!< Date/day do not care in Alarm A comparison */ | |
391 #define LL_RTC_ALMA_MASK_HOURS RTC_ALRMAR_MSK3 /*!< Hours do not care in Alarm A comparison */ | |
392 #define LL_RTC_ALMA_MASK_MINUTES RTC_ALRMAR_MSK2 /*!< Minutes do not care in Alarm A comparison */ | |
393 #define LL_RTC_ALMA_MASK_SECONDS RTC_ALRMAR_MSK1 /*!< Seconds do not care in Alarm A comparison */ | |
394 #define LL_RTC_ALMA_MASK_ALL (RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1) /*!< Masks all */ | |
395 /** | |
396 * @} | |
397 */ | |
398 | |
399 /** @defgroup RTC_LL_EC_ALMA_TIME_FORMAT ALARMA TIME FORMAT | |
400 * @{ | |
401 */ | |
402 #define LL_RTC_ALMA_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */ | |
403 #define LL_RTC_ALMA_TIME_FORMAT_PM RTC_ALRMAR_PM /*!< PM */ | |
404 /** | |
405 * @} | |
406 */ | |
407 | |
408 /** @defgroup RTC_LL_EC_ALMB_MASK ALARMB MASK | |
409 * @{ | |
410 */ | |
411 #define LL_RTC_ALMB_MASK_NONE 0x00000000U /*!< No masks applied on Alarm B*/ | |
412 #define LL_RTC_ALMB_MASK_DATEWEEKDAY RTC_ALRMBR_MSK4 /*!< Date/day do not care in Alarm B comparison */ | |
413 #define LL_RTC_ALMB_MASK_HOURS RTC_ALRMBR_MSK3 /*!< Hours do not care in Alarm B comparison */ | |
414 #define LL_RTC_ALMB_MASK_MINUTES RTC_ALRMBR_MSK2 /*!< Minutes do not care in Alarm B comparison */ | |
415 #define LL_RTC_ALMB_MASK_SECONDS RTC_ALRMBR_MSK1 /*!< Seconds do not care in Alarm B comparison */ | |
416 #define LL_RTC_ALMB_MASK_ALL (RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1) /*!< Masks all */ | |
417 /** | |
418 * @} | |
419 */ | |
420 | |
421 /** @defgroup RTC_LL_EC_ALMB_TIME_FORMAT ALARMB TIME FORMAT | |
422 * @{ | |
423 */ | |
424 #define LL_RTC_ALMB_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */ | |
425 #define LL_RTC_ALMB_TIME_FORMAT_PM RTC_ALRMBR_PM /*!< PM */ | |
426 /** | |
427 * @} | |
428 */ | |
429 | |
430 /** @defgroup RTC_LL_EC_TIMESTAMP_EDGE TIMESTAMP EDGE | |
431 * @{ | |
432 */ | |
433 #define LL_RTC_TIMESTAMP_EDGE_RISING 0x00000000U /*!< RTC_TS input rising edge generates a time-stamp event */ | |
434 #define LL_RTC_TIMESTAMP_EDGE_FALLING RTC_CR_TSEDGE /*!< RTC_TS input falling edge generates a time-stamp even */ | |
435 /** | |
436 * @} | |
437 */ | |
438 | |
439 /** @defgroup RTC_LL_EC_TS_TIME_FORMAT TIMESTAMP TIME FORMAT | |
440 * @{ | |
441 */ | |
442 #define LL_RTC_TS_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */ | |
443 #define LL_RTC_TS_TIME_FORMAT_PM RTC_TSTR_PM /*!< PM */ | |
444 /** | |
445 * @} | |
446 */ | |
447 | |
448 /** @defgroup RTC_LL_EC_TAMPER TAMPER | |
449 * @{ | |
450 */ | |
451 #define LL_RTC_TAMPER_1 RTC_TAFCR_TAMP1E /*!< RTC_TAMP1 input detection */ | |
452 #if defined(RTC_TAMPER2_SUPPORT) | |
453 #define LL_RTC_TAMPER_2 RTC_TAFCR_TAMP2E /*!< RTC_TAMP2 input detection */ | |
454 #endif /* RTC_TAMPER2_SUPPORT */ | |
455 /** | |
456 * @} | |
457 */ | |
458 | |
459 /** @defgroup RTC_LL_EC_TAMPER_MASK TAMPER MASK | |
460 * @{ | |
461 */ | |
462 #define LL_RTC_TAMPER_MASK_TAMPER1 RTC_TAFCR_TAMP1MF /*!< Tamper 1 event generates a trigger event. TAMP1F is masked and internally cleared by hardware.The backup registers are not erased */ | |
463 #if defined(RTC_TAMPER2_SUPPORT) | |
464 #define LL_RTC_TAMPER_MASK_TAMPER2 RTC_TAFCR_TAMP2MF /*!< Tamper 2 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */ | |
465 #endif /* RTC_TAMPER2_SUPPORT */ | |
466 /** | |
467 * @} | |
468 */ | |
469 | |
470 /** @defgroup RTC_LL_EC_TAMPER_NOERASE TAMPER NO ERASE | |
471 * @{ | |
472 */ | |
473 #define LL_RTC_TAMPER_NOERASE_TAMPER1 RTC_TAFCR_TAMP1NOERASE /*!< Tamper 1 event does not erase the backup registers. */ | |
474 #if defined(RTC_TAMPER2_SUPPORT) | |
475 #define LL_RTC_TAMPER_NOERASE_TAMPER2 RTC_TAFCR_TAMP2NOERASE /*!< Tamper 2 event does not erase the backup registers. */ | |
476 #endif /* RTC_TAMPER2_SUPPORT */ | |
477 /** | |
478 * @} | |
479 */ | |
480 | |
481 #if defined(RTC_TAFCR_TAMPPRCH) | |
482 /** @defgroup RTC_LL_EC_TAMPER_DURATION TAMPER DURATION | |
483 * @{ | |
484 */ | |
485 #define LL_RTC_TAMPER_DURATION_1RTCCLK 0x00000000U /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle */ | |
486 #define LL_RTC_TAMPER_DURATION_2RTCCLK RTC_TAFCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */ | |
487 #define LL_RTC_TAMPER_DURATION_4RTCCLK RTC_TAFCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */ | |
488 #define LL_RTC_TAMPER_DURATION_8RTCCLK RTC_TAFCR_TAMPPRCH /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */ | |
489 /** | |
490 * @} | |
491 */ | |
492 #endif /* RTC_TAFCR_TAMPPRCH */ | |
493 | |
494 #if defined(RTC_TAFCR_TAMPFLT) | |
495 /** @defgroup RTC_LL_EC_TAMPER_FILTER TAMPER FILTER | |
496 * @{ | |
497 */ | |
498 #define LL_RTC_TAMPER_FILTER_DISABLE 0x00000000U /*!< Tamper filter is disabled */ | |
499 #define LL_RTC_TAMPER_FILTER_2SAMPLE RTC_TAFCR_TAMPFLT_0 /*!< Tamper is activated after 2 consecutive samples at the active level */ | |
500 #define LL_RTC_TAMPER_FILTER_4SAMPLE RTC_TAFCR_TAMPFLT_1 /*!< Tamper is activated after 4 consecutive samples at the active level */ | |
501 #define LL_RTC_TAMPER_FILTER_8SAMPLE RTC_TAFCR_TAMPFLT /*!< Tamper is activated after 8 consecutive samples at the active level. */ | |
502 /** | |
503 * @} | |
504 */ | |
505 #endif /* RTC_TAFCR_TAMPFLT */ | |
506 | |
507 #if defined(RTC_TAFCR_TAMPFREQ) | |
508 /** @defgroup RTC_LL_EC_TAMPER_SAMPLFREQDIV TAMPER SAMPLING FREQUENCY DIVIDER | |
509 * @{ | |
510 */ | |
511 #define LL_RTC_TAMPER_SAMPLFREQDIV_32768 0x00000000U /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 32768 */ | |
512 #define LL_RTC_TAMPER_SAMPLFREQDIV_16384 RTC_TAFCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 16384 */ | |
513 #define LL_RTC_TAMPER_SAMPLFREQDIV_8192 RTC_TAFCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 8192 */ | |
514 #define LL_RTC_TAMPER_SAMPLFREQDIV_4096 (RTC_TAFCR_TAMPFREQ_1 | RTC_TAFCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 4096 */ | |
515 #define LL_RTC_TAMPER_SAMPLFREQDIV_2048 RTC_TAFCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 2048 */ | |
516 #define LL_RTC_TAMPER_SAMPLFREQDIV_1024 (RTC_TAFCR_TAMPFREQ_2 | RTC_TAFCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 1024 */ | |
517 #define LL_RTC_TAMPER_SAMPLFREQDIV_512 (RTC_TAFCR_TAMPFREQ_2 | RTC_TAFCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 512 */ | |
518 #define LL_RTC_TAMPER_SAMPLFREQDIV_256 RTC_TAFCR_TAMPFREQ /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 256 */ | |
519 /** | |
520 * @} | |
521 */ | |
522 #endif /* RTC_TAFCR_TAMPFREQ */ | |
523 | |
524 /** @defgroup RTC_LL_EC_TAMPER_ACTIVELEVEL TAMPER ACTIVE LEVEL | |
525 * @{ | |
526 */ | |
527 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 RTC_TAFCR_TAMP1TRG /*!< RTC_TAMP1 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/ | |
528 #if defined(RTC_TAMPER2_SUPPORT) | |
529 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 RTC_TAFCR_TAMP2TRG /*!< RTC_TAMP2 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/ | |
530 #endif /* RTC_TAMPER2_SUPPORT */ | |
531 /** | |
532 * @} | |
533 */ | |
534 | |
535 /** @defgroup RTC_LL_EC_WAKEUPCLOCK_DIV WAKEUP CLOCK DIV | |
536 * @{ | |
537 */ | |
538 #define LL_RTC_WAKEUPCLOCK_DIV_16 0x00000000U /*!< RTC/16 clock is selected */ | |
539 #define LL_RTC_WAKEUPCLOCK_DIV_8 (RTC_CR_WUCKSEL_0) /*!< RTC/8 clock is selected */ | |
540 #define LL_RTC_WAKEUPCLOCK_DIV_4 (RTC_CR_WUCKSEL_1) /*!< RTC/4 clock is selected */ | |
541 #define LL_RTC_WAKEUPCLOCK_DIV_2 (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_0) /*!< RTC/2 clock is selected */ | |
542 #define LL_RTC_WAKEUPCLOCK_CKSPRE (RTC_CR_WUCKSEL_2) /*!< ck_spre (usually 1 Hz) clock is selected */ | |
543 #define LL_RTC_WAKEUPCLOCK_CKSPRE_WUT (RTC_CR_WUCKSEL_2 | RTC_CR_WUCKSEL_1) /*!< ck_spre (usually 1 Hz) clock is selected and 2exp16 is added to the WUT counter value*/ | |
544 /** | |
545 * @} | |
546 */ | |
547 | |
548 /** @defgroup RTC_LL_EC_BKP BACKUP | |
549 * @{ | |
550 */ | |
551 #define LL_RTC_BKP_DR0 0x00000000U | |
552 #define LL_RTC_BKP_DR1 0x00000001U | |
553 #define LL_RTC_BKP_DR2 0x00000002U | |
554 #define LL_RTC_BKP_DR3 0x00000003U | |
555 #define LL_RTC_BKP_DR4 0x00000004U | |
556 #if RTC_BKP_NUMBER > 5 | |
557 #define LL_RTC_BKP_DR5 0x00000005U | |
558 #define LL_RTC_BKP_DR6 0x00000006U | |
559 #define LL_RTC_BKP_DR7 0x00000007U | |
560 #define LL_RTC_BKP_DR8 0x00000008U | |
561 #define LL_RTC_BKP_DR9 0x00000009U | |
562 #define LL_RTC_BKP_DR10 0x0000000AU | |
563 #define LL_RTC_BKP_DR11 0x0000000BU | |
564 #define LL_RTC_BKP_DR12 0x0000000CU | |
565 #define LL_RTC_BKP_DR13 0x0000000DU | |
566 #define LL_RTC_BKP_DR14 0x0000000EU | |
567 #define LL_RTC_BKP_DR15 0x0000000FU | |
568 #endif /* RTC_BKP_NUMBER > 5 */ | |
569 | |
570 #if RTC_BKP_NUMBER > 16 | |
571 #define LL_RTC_BKP_DR16 0x00000010U | |
572 #define LL_RTC_BKP_DR17 0x00000011U | |
573 #define LL_RTC_BKP_DR18 0x00000012U | |
574 #define LL_RTC_BKP_DR19 0x00000013U | |
575 #endif /* RTC_BKP_NUMBER > 16 */ | |
576 /** | |
577 * @} | |
578 */ | |
579 | |
580 /** @defgroup RTC_LL_EC_CALIB_OUTPUT Calibration output | |
581 * @{ | |
582 */ | |
583 #define LL_RTC_CALIB_OUTPUT_NONE 0x00000000U /*!< Calibration output disabled */ | |
584 #define LL_RTC_CALIB_OUTPUT_1HZ (RTC_CR_COE | RTC_CR_COSEL) /*!< Calibration output is 1 Hz */ | |
585 #define LL_RTC_CALIB_OUTPUT_512HZ (RTC_CR_COE) /*!< Calibration output is 512 Hz */ | |
586 /** | |
587 * @} | |
588 */ | |
589 | |
590 /** @defgroup RTC_LL_EC_CALIB_SIGN Coarse digital calibration sign | |
591 * @{ | |
592 */ | |
593 #define LL_RTC_CALIB_SIGN_POSITIVE 0x00000000U /*!< Positive calibration: calendar update frequency is increased */ | |
594 #define LL_RTC_CALIB_SIGN_NEGATIVE RTC_CALIBR_DCS /*!< Negative calibration: calendar update frequency is decreased */ | |
595 /** | |
596 * @} | |
597 */ | |
598 | |
599 /** @defgroup RTC_LL_EC_CALIB_INSERTPULSE Calibration pulse insertion | |
600 * @{ | |
601 */ | |
602 #define LL_RTC_CALIB_INSERTPULSE_NONE 0x00000000U /*!< No RTCCLK pulses are added */ | |
603 #define LL_RTC_CALIB_INSERTPULSE_SET RTC_CALR_CALP /*!< One RTCCLK pulse is effectively inserted every 2exp11 pulses (frequency increased by 488.5 ppm) */ | |
604 /** | |
605 * @} | |
606 */ | |
607 | |
608 /** @defgroup RTC_LL_EC_CALIB_PERIOD Calibration period | |
609 * @{ | |
610 */ | |
611 #define LL_RTC_CALIB_PERIOD_32SEC 0x00000000U /*!< Use a 32-second calibration cycle period */ | |
612 #define LL_RTC_CALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< Use a 16-second calibration cycle period */ | |
613 #define LL_RTC_CALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< Use a 8-second calibration cycle period */ | |
614 /** | |
615 * @} | |
616 */ | |
617 | |
618 /** @defgroup RTC_LL_EC_TSINSEL TIMESTAMP mapping | |
619 * @{ | |
620 */ | |
621 #define LL_RTC_TimeStampPin_Default 0x00000000U /*!< Use RTC_AF1 as TIMESTAMP */ | |
622 #if defined(RTC_AF2_SUPPORT) | |
623 #define LL_RTC_TimeStampPin_Pos1 RTC_TAFCR_TSINSEL /*!< Use RTC_AF2 as TIMESTAMP */ | |
624 #endif | |
625 /** | |
626 * @} | |
627 */ | |
628 | |
629 /** @defgroup RTC_LL_EC_TAMP1INSEL TAMPER1 mapping | |
630 * @{ | |
631 */ | |
632 #define LL_RTC_TamperPin_Default 0x00000000U /*!< Use RTC_AF1 as TAMPER1 */ | |
633 #if defined(RTC_AF2_SUPPORT) | |
634 #define LL_RTC_TamperPin_Pos1 RTC_TAFCR_TAMP1INSEL /*!< Use RTC_AF2 as TAMPER1 */ | |
635 #endif | |
636 /** | |
637 * @} | |
638 */ | |
639 | |
640 /** | |
641 * @} | |
642 */ | |
643 | |
644 /* Exported macro ------------------------------------------------------------*/ | |
645 /** @defgroup RTC_LL_Exported_Macros RTC Exported Macros | |
646 * @{ | |
647 */ | |
648 | |
649 /** @defgroup RTC_LL_EM_WRITE_READ Common Write and read registers Macros | |
650 * @{ | |
651 */ | |
652 | |
653 /** | |
654 * @brief Write a value in RTC register | |
655 * @param __INSTANCE__ RTC Instance | |
656 * @param __REG__ Register to be written | |
657 * @param __VALUE__ Value to be written in the register | |
658 * @retval None | |
659 */ | |
660 #define LL_RTC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) | |
661 | |
662 /** | |
663 * @brief Read a value in RTC register | |
664 * @param __INSTANCE__ RTC Instance | |
665 * @param __REG__ Register to be read | |
666 * @retval Register value | |
667 */ | |
668 #define LL_RTC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) | |
669 /** | |
670 * @} | |
671 */ | |
672 | |
673 /** @defgroup RTC_LL_EM_Convert Convert helper Macros | |
674 * @{ | |
675 */ | |
676 | |
677 /** | |
678 * @brief Helper macro to convert a value from 2 digit decimal format to BCD format | |
679 * @param __VALUE__ Byte to be converted | |
680 * @retval Converted byte | |
681 */ | |
682 #define __LL_RTC_CONVERT_BIN2BCD(__VALUE__) (uint8_t)((((__VALUE__) / 10U) << 4U) | ((__VALUE__) % 10U)) | |
683 | |
684 /** | |
685 * @brief Helper macro to convert a value from BCD format to 2 digit decimal format | |
686 * @param __VALUE__ BCD value to be converted | |
687 * @retval Converted byte | |
688 */ | |
689 #define __LL_RTC_CONVERT_BCD2BIN(__VALUE__) (uint8_t)(((uint8_t)((__VALUE__) & (uint8_t)0xF0U) >> (uint8_t)0x4U) * 10U + ((__VALUE__) & (uint8_t)0x0FU)) | |
690 | |
691 /** | |
692 * @} | |
693 */ | |
694 | |
695 /** @defgroup RTC_LL_EM_Date Date helper Macros | |
696 * @{ | |
697 */ | |
698 | |
699 /** | |
700 * @brief Helper macro to retrieve weekday. | |
701 * @param __RTC_DATE__ Date returned by @ref LL_RTC_DATE_Get function. | |
702 * @retval Returned value can be one of the following values: | |
703 * @arg @ref LL_RTC_WEEKDAY_MONDAY | |
704 * @arg @ref LL_RTC_WEEKDAY_TUESDAY | |
705 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY | |
706 * @arg @ref LL_RTC_WEEKDAY_THURSDAY | |
707 * @arg @ref LL_RTC_WEEKDAY_FRIDAY | |
708 * @arg @ref LL_RTC_WEEKDAY_SATURDAY | |
709 * @arg @ref LL_RTC_WEEKDAY_SUNDAY | |
710 */ | |
711 #define __LL_RTC_GET_WEEKDAY(__RTC_DATE__) (((__RTC_DATE__) >> RTC_OFFSET_WEEKDAY) & 0x000000FFU) | |
712 | |
713 /** | |
714 * @brief Helper macro to retrieve Year in BCD format | |
715 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get | |
716 * @retval Year in BCD format (0x00 . . . 0x99) | |
717 */ | |
718 #define __LL_RTC_GET_YEAR(__RTC_DATE__) ((__RTC_DATE__) & 0x000000FFU) | |
719 | |
720 /** | |
721 * @brief Helper macro to retrieve Month in BCD format | |
722 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get | |
723 * @retval Returned value can be one of the following values: | |
724 * @arg @ref LL_RTC_MONTH_JANUARY | |
725 * @arg @ref LL_RTC_MONTH_FEBRUARY | |
726 * @arg @ref LL_RTC_MONTH_MARCH | |
727 * @arg @ref LL_RTC_MONTH_APRIL | |
728 * @arg @ref LL_RTC_MONTH_MAY | |
729 * @arg @ref LL_RTC_MONTH_JUNE | |
730 * @arg @ref LL_RTC_MONTH_JULY | |
731 * @arg @ref LL_RTC_MONTH_AUGUST | |
732 * @arg @ref LL_RTC_MONTH_SEPTEMBER | |
733 * @arg @ref LL_RTC_MONTH_OCTOBER | |
734 * @arg @ref LL_RTC_MONTH_NOVEMBER | |
735 * @arg @ref LL_RTC_MONTH_DECEMBER | |
736 */ | |
737 #define __LL_RTC_GET_MONTH(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_MONTH) & 0x000000FFU) | |
738 | |
739 /** | |
740 * @brief Helper macro to retrieve Day in BCD format | |
741 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get | |
742 * @retval Day in BCD format (0x01 . . . 0x31) | |
743 */ | |
744 #define __LL_RTC_GET_DAY(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_DAY) & 0x000000FFU) | |
745 | |
746 /** | |
747 * @} | |
748 */ | |
749 | |
750 /** @defgroup RTC_LL_EM_Time Time helper Macros | |
751 * @{ | |
752 */ | |
753 | |
754 /** | |
755 * @brief Helper macro to retrieve hour in BCD format | |
756 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function | |
757 * @retval Hours in BCD format (0x01. . .0x12 or between Min_Data=0x00 and Max_Data=0x23) | |
758 */ | |
759 #define __LL_RTC_GET_HOUR(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_HOUR) & 0x000000FFU) | |
760 | |
761 /** | |
762 * @brief Helper macro to retrieve minute in BCD format | |
763 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function | |
764 * @retval Minutes in BCD format (0x00. . .0x59) | |
765 */ | |
766 #define __LL_RTC_GET_MINUTE(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_MINUTE) & 0x000000FFU) | |
767 | |
768 /** | |
769 * @brief Helper macro to retrieve second in BCD format | |
770 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function | |
771 * @retval Seconds in format (0x00. . .0x59) | |
772 */ | |
773 #define __LL_RTC_GET_SECOND(__RTC_TIME__) ((__RTC_TIME__) & 0x000000FFU) | |
774 | |
775 /** | |
776 * @} | |
777 */ | |
778 | |
779 /** | |
780 * @} | |
781 */ | |
782 | |
783 /* Exported functions --------------------------------------------------------*/ | |
784 /** @defgroup RTC_LL_Exported_Functions RTC Exported Functions | |
785 * @{ | |
786 */ | |
787 | |
788 /** @defgroup RTC_LL_EF_Configuration Configuration | |
789 * @{ | |
790 */ | |
791 | |
792 /** | |
793 * @brief Set Hours format (24 hour/day or AM/PM hour format) | |
794 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
795 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) | |
796 * @rmtoll CR FMT LL_RTC_SetHourFormat | |
797 * @param RTCx RTC Instance | |
798 * @param HourFormat This parameter can be one of the following values: | |
799 * @arg @ref LL_RTC_HOURFORMAT_24HOUR | |
800 * @arg @ref LL_RTC_HOURFORMAT_AMPM | |
801 * @retval None | |
802 */ | |
803 __STATIC_INLINE void LL_RTC_SetHourFormat(RTC_TypeDef *RTCx, uint32_t HourFormat) | |
804 { | |
805 MODIFY_REG(RTCx->CR, RTC_CR_FMT, HourFormat); | |
806 } | |
807 | |
808 /** | |
809 * @brief Get Hours format (24 hour/day or AM/PM hour format) | |
810 * @rmtoll CR FMT LL_RTC_GetHourFormat | |
811 * @param RTCx RTC Instance | |
812 * @retval Returned value can be one of the following values: | |
813 * @arg @ref LL_RTC_HOURFORMAT_24HOUR | |
814 * @arg @ref LL_RTC_HOURFORMAT_AMPM | |
815 */ | |
816 __STATIC_INLINE uint32_t LL_RTC_GetHourFormat(RTC_TypeDef *RTCx) | |
817 { | |
818 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_FMT)); | |
819 } | |
820 | |
821 /** | |
822 * @brief Select the flag to be routed to RTC_ALARM output | |
823 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
824 * @rmtoll CR OSEL LL_RTC_SetAlarmOutEvent | |
825 * @param RTCx RTC Instance | |
826 * @param AlarmOutput This parameter can be one of the following values: | |
827 * @arg @ref LL_RTC_ALARMOUT_DISABLE | |
828 * @arg @ref LL_RTC_ALARMOUT_ALMA | |
829 * @arg @ref LL_RTC_ALARMOUT_ALMB | |
830 * @arg @ref LL_RTC_ALARMOUT_WAKEUP | |
831 * @retval None | |
832 */ | |
833 __STATIC_INLINE void LL_RTC_SetAlarmOutEvent(RTC_TypeDef *RTCx, uint32_t AlarmOutput) | |
834 { | |
835 MODIFY_REG(RTCx->CR, RTC_CR_OSEL, AlarmOutput); | |
836 } | |
837 | |
838 /** | |
839 * @brief Get the flag to be routed to RTC_ALARM output | |
840 * @rmtoll CR OSEL LL_RTC_GetAlarmOutEvent | |
841 * @param RTCx RTC Instance | |
842 * @retval Returned value can be one of the following values: | |
843 * @arg @ref LL_RTC_ALARMOUT_DISABLE | |
844 * @arg @ref LL_RTC_ALARMOUT_ALMA | |
845 * @arg @ref LL_RTC_ALARMOUT_ALMB | |
846 * @arg @ref LL_RTC_ALARMOUT_WAKEUP | |
847 */ | |
848 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutEvent(RTC_TypeDef *RTCx) | |
849 { | |
850 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_OSEL)); | |
851 } | |
852 | |
853 /** | |
854 * @brief Set RTC_ALARM output type (ALARM in push-pull or open-drain output) | |
855 * @note Used only when RTC_ALARM is mapped on PC13 | |
856 * @note If all RTC alternate functions are disabled and PC13MODE = 1, PC13VALUE configures the | |
857 * PC13 output data | |
858 * @rmtoll TAFCR ALARMOUTTYPE LL_RTC_SetAlarmOutputType | |
859 * @param RTCx RTC Instance | |
860 * @param Output This parameter can be one of the following values: | |
861 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN | |
862 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL | |
863 * @retval None | |
864 */ | |
865 __STATIC_INLINE void LL_RTC_SetAlarmOutputType(RTC_TypeDef *RTCx, uint32_t Output) | |
866 { | |
867 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_ALARMOUTTYPE, Output); | |
868 } | |
869 | |
870 /** | |
871 * @brief Get RTC_ALARM output type (ALARM in push-pull or open-drain output) | |
872 * @note used only when RTC_ALARM is mapped on PC13 | |
873 * @note If all RTC alternate functions are disabled and PC13MODE = 1, PC13VALUE configures the | |
874 * PC13 output data | |
875 * @rmtoll TAFCR ALARMOUTTYPE LL_RTC_GetAlarmOutputType | |
876 * @param RTCx RTC Instance | |
877 * @retval Returned value can be one of the following values: | |
878 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN | |
879 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL | |
880 */ | |
881 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutputType(RTC_TypeDef *RTCx) | |
882 { | |
883 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_ALARMOUTTYPE)); | |
884 } | |
885 | |
886 /** | |
887 * @brief Enable push-pull output on PC13, PC14 and/or PC15 | |
888 * @note PC13 forced to push-pull output if all RTC alternate functions are disabled | |
889 * @note PC14 and PC15 forced to push-pull output if LSE is disabled | |
890 * @rmtoll TAFCR PC13MODE LL_RTC_EnablePushPullMode\n | |
891 * @rmtoll TAFCR PC14MODE LL_RTC_EnablePushPullMode\n | |
892 * @rmtoll TAFCR PC15MODE LL_RTC_EnablePushPullMode | |
893 * @param RTCx RTC Instance | |
894 * @param PinMask This parameter can be a combination of the following values: | |
895 * @arg @ref LL_RTC_PIN_PC13 | |
896 * @arg @ref LL_RTC_PIN_PC14 | |
897 * @arg @ref LL_RTC_PIN_PC15 | |
898 * @retval None | |
899 */ | |
900 __STATIC_INLINE void LL_RTC_EnablePushPullMode(RTC_TypeDef *RTCx, uint32_t PinMask) | |
901 { | |
902 SET_BIT(RTCx->TAFCR, PinMask); | |
903 } | |
904 | |
905 /** | |
906 * @brief Disable push-pull output on PC13, PC14 and/or PC15 | |
907 * @note PC13, PC14 and/or PC15 are controlled by the GPIO configuration registers. | |
908 * Consequently PC13, PC14 and/or PC15 are floating in Standby mode. | |
909 * @rmtoll TAFCR PC13MODE LL_RTC_DisablePushPullMode\n | |
910 * TAFCR PC14MODE LL_RTC_DisablePushPullMode\n | |
911 * TAFCR PC15MODE LL_RTC_DisablePushPullMode | |
912 * @param RTCx RTC Instance | |
913 * @param PinMask This parameter can be a combination of the following values: | |
914 * @arg @ref LL_RTC_PIN_PC13 | |
915 * @arg @ref LL_RTC_PIN_PC14 | |
916 * @arg @ref LL_RTC_PIN_PC15 | |
917 * @retval None | |
918 */ | |
919 __STATIC_INLINE void LL_RTC_DisablePushPullMode(RTC_TypeDef* RTCx, uint32_t PinMask) | |
920 { | |
921 CLEAR_BIT(RTCx->TAFCR, PinMask); | |
922 } | |
923 | |
924 /** | |
925 * @brief Set PC14 and/or PC15 to high level. | |
926 * @note Output data configuration is possible if the LSE is disabled and PushPull output is enabled (through @ref LL_RTC_EnablePushPullMode) | |
927 * @rmtoll TAFCR PC14VALUE LL_RTC_SetOutputPin\n | |
928 * TAFCR PC15VALUE LL_RTC_SetOutputPin | |
929 * @param RTCx RTC Instance | |
930 * @param PinMask This parameter can be a combination of the following values: | |
931 * @arg @ref LL_RTC_PIN_PC14 | |
932 * @arg @ref LL_RTC_PIN_PC15 | |
933 * @retval None | |
934 */ | |
935 __STATIC_INLINE void LL_RTC_SetOutputPin(RTC_TypeDef* RTCx, uint32_t PinMask) | |
936 { | |
937 SET_BIT(RTCx->TAFCR, (PinMask >> 1)); | |
938 } | |
939 | |
940 /** | |
941 * @brief Set PC14 and/or PC15 to low level. | |
942 * @note Output data configuration is possible if the LSE is disabled and PushPull output is enabled (through @ref LL_RTC_EnablePushPullMode) | |
943 * @rmtoll TAFCR PC14VALUE LL_RTC_ResetOutputPin\n | |
944 * TAFCR PC15VALUE LL_RTC_ResetOutputPin | |
945 * @param RTCx RTC Instance | |
946 * @param PinMask This parameter can be a combination of the following values: | |
947 * @arg @ref LL_RTC_PIN_PC14 | |
948 * @arg @ref LL_RTC_PIN_PC15 | |
949 * @retval None | |
950 */ | |
951 __STATIC_INLINE void LL_RTC_ResetOutputPin(RTC_TypeDef* RTCx, uint32_t PinMask) | |
952 { | |
953 CLEAR_BIT(RTCx->TAFCR, (PinMask >> 1)); | |
954 } | |
955 | |
956 /** | |
957 * @brief Enable initialization mode | |
958 * @note Initialization mode is used to program time and date register (RTC_TR and RTC_DR) | |
959 * and prescaler register (RTC_PRER). | |
960 * Counters are stopped and start counting from the new value when INIT is reset. | |
961 * @rmtoll ISR INIT LL_RTC_EnableInitMode | |
962 * @param RTCx RTC Instance | |
963 * @retval None | |
964 */ | |
965 __STATIC_INLINE void LL_RTC_EnableInitMode(RTC_TypeDef *RTCx) | |
966 { | |
967 /* Set the Initialization mode */ | |
968 WRITE_REG(RTCx->ISR, RTC_INIT_MASK); | |
969 } | |
970 | |
971 /** | |
972 * @brief Disable initialization mode (Free running mode) | |
973 * @rmtoll ISR INIT LL_RTC_DisableInitMode | |
974 * @param RTCx RTC Instance | |
975 * @retval None | |
976 */ | |
977 __STATIC_INLINE void LL_RTC_DisableInitMode(RTC_TypeDef *RTCx) | |
978 { | |
979 /* Exit Initialization mode */ | |
980 WRITE_REG(RTCx->ISR, (uint32_t)~RTC_ISR_INIT); | |
981 } | |
982 | |
983 /** | |
984 * @brief Set Output polarity (pin is low when ALRAF/ALRBF/WUTF is asserted) | |
985 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
986 * @rmtoll CR POL LL_RTC_SetOutputPolarity | |
987 * @param RTCx RTC Instance | |
988 * @param Polarity This parameter can be one of the following values: | |
989 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH | |
990 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW | |
991 * @retval None | |
992 */ | |
993 __STATIC_INLINE void LL_RTC_SetOutputPolarity(RTC_TypeDef *RTCx, uint32_t Polarity) | |
994 { | |
995 MODIFY_REG(RTCx->CR, RTC_CR_POL, Polarity); | |
996 } | |
997 | |
998 /** | |
999 * @brief Get Output polarity | |
1000 * @rmtoll CR POL LL_RTC_GetOutputPolarity | |
1001 * @param RTCx RTC Instance | |
1002 * @retval Returned value can be one of the following values: | |
1003 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH | |
1004 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW | |
1005 */ | |
1006 __STATIC_INLINE uint32_t LL_RTC_GetOutputPolarity(RTC_TypeDef *RTCx) | |
1007 { | |
1008 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_POL)); | |
1009 } | |
1010 | |
1011 /** | |
1012 * @brief Enable Bypass the shadow registers | |
1013 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1014 * @rmtoll CR BYPSHAD LL_RTC_EnableShadowRegBypass | |
1015 * @param RTCx RTC Instance | |
1016 * @retval None | |
1017 */ | |
1018 __STATIC_INLINE void LL_RTC_EnableShadowRegBypass(RTC_TypeDef *RTCx) | |
1019 { | |
1020 SET_BIT(RTCx->CR, RTC_CR_BYPSHAD); | |
1021 } | |
1022 | |
1023 /** | |
1024 * @brief Disable Bypass the shadow registers | |
1025 * @rmtoll CR BYPSHAD LL_RTC_DisableShadowRegBypass | |
1026 * @param RTCx RTC Instance | |
1027 * @retval None | |
1028 */ | |
1029 __STATIC_INLINE void LL_RTC_DisableShadowRegBypass(RTC_TypeDef *RTCx) | |
1030 { | |
1031 CLEAR_BIT(RTCx->CR, RTC_CR_BYPSHAD); | |
1032 } | |
1033 | |
1034 /** | |
1035 * @brief Check if Shadow registers bypass is enabled or not. | |
1036 * @rmtoll CR BYPSHAD LL_RTC_IsShadowRegBypassEnabled | |
1037 * @param RTCx RTC Instance | |
1038 * @retval State of bit (1 or 0). | |
1039 */ | |
1040 __STATIC_INLINE uint32_t LL_RTC_IsShadowRegBypassEnabled(RTC_TypeDef *RTCx) | |
1041 { | |
1042 return (READ_BIT(RTCx->CR, RTC_CR_BYPSHAD) == (RTC_CR_BYPSHAD)); | |
1043 } | |
1044 | |
1045 /** | |
1046 * @brief Enable RTC_REFIN reference clock detection (50 or 60 Hz) | |
1047 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1048 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) | |
1049 * @rmtoll CR REFCKON LL_RTC_EnableRefClock | |
1050 * @param RTCx RTC Instance | |
1051 * @retval None | |
1052 */ | |
1053 __STATIC_INLINE void LL_RTC_EnableRefClock(RTC_TypeDef *RTCx) | |
1054 { | |
1055 SET_BIT(RTCx->CR, RTC_CR_REFCKON); | |
1056 } | |
1057 | |
1058 /** | |
1059 * @brief Disable RTC_REFIN reference clock detection (50 or 60 Hz) | |
1060 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1061 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) | |
1062 * @rmtoll CR REFCKON LL_RTC_DisableRefClock | |
1063 * @param RTCx RTC Instance | |
1064 * @retval None | |
1065 */ | |
1066 __STATIC_INLINE void LL_RTC_DisableRefClock(RTC_TypeDef *RTCx) | |
1067 { | |
1068 CLEAR_BIT(RTCx->CR, RTC_CR_REFCKON); | |
1069 } | |
1070 | |
1071 /** | |
1072 * @brief Set Asynchronous prescaler factor | |
1073 * @rmtoll PRER PREDIV_A LL_RTC_SetAsynchPrescaler | |
1074 * @param RTCx RTC Instance | |
1075 * @param AsynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7F | |
1076 * @retval None | |
1077 */ | |
1078 __STATIC_INLINE void LL_RTC_SetAsynchPrescaler(RTC_TypeDef *RTCx, uint32_t AsynchPrescaler) | |
1079 { | |
1080 MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_A, AsynchPrescaler << RTC_PRER_PREDIV_A_Pos); | |
1081 } | |
1082 | |
1083 /** | |
1084 * @brief Set Synchronous prescaler factor | |
1085 * @rmtoll PRER PREDIV_S LL_RTC_SetSynchPrescaler | |
1086 * @param RTCx RTC Instance | |
1087 * @param SynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7FFF | |
1088 * @retval None | |
1089 */ | |
1090 __STATIC_INLINE void LL_RTC_SetSynchPrescaler(RTC_TypeDef *RTCx, uint32_t SynchPrescaler) | |
1091 { | |
1092 MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_S, SynchPrescaler); | |
1093 } | |
1094 | |
1095 /** | |
1096 * @brief Get Asynchronous prescaler factor | |
1097 * @rmtoll PRER PREDIV_A LL_RTC_GetAsynchPrescaler | |
1098 * @param RTCx RTC Instance | |
1099 * @retval Value between Min_Data = 0 and Max_Data = 0x7F | |
1100 */ | |
1101 __STATIC_INLINE uint32_t LL_RTC_GetAsynchPrescaler(RTC_TypeDef *RTCx) | |
1102 { | |
1103 return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_A) >> RTC_PRER_PREDIV_A_Pos); | |
1104 } | |
1105 | |
1106 /** | |
1107 * @brief Get Synchronous prescaler factor | |
1108 * @rmtoll PRER PREDIV_S LL_RTC_GetSynchPrescaler | |
1109 * @param RTCx RTC Instance | |
1110 * @retval Value between Min_Data = 0 and Max_Data = 0x7FFF | |
1111 */ | |
1112 __STATIC_INLINE uint32_t LL_RTC_GetSynchPrescaler(RTC_TypeDef *RTCx) | |
1113 { | |
1114 return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_S)); | |
1115 } | |
1116 | |
1117 /** | |
1118 * @brief Enable the write protection for RTC registers. | |
1119 * @rmtoll WPR KEY LL_RTC_EnableWriteProtection | |
1120 * @param RTCx RTC Instance | |
1121 * @retval None | |
1122 */ | |
1123 __STATIC_INLINE void LL_RTC_EnableWriteProtection(RTC_TypeDef *RTCx) | |
1124 { | |
1125 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_DISABLE); | |
1126 } | |
1127 | |
1128 /** | |
1129 * @brief Disable the write protection for RTC registers. | |
1130 * @rmtoll WPR KEY LL_RTC_DisableWriteProtection | |
1131 * @param RTCx RTC Instance | |
1132 * @retval None | |
1133 */ | |
1134 __STATIC_INLINE void LL_RTC_DisableWriteProtection(RTC_TypeDef *RTCx) | |
1135 { | |
1136 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_1); | |
1137 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_2); | |
1138 } | |
1139 | |
1140 /** | |
1141 * @} | |
1142 */ | |
1143 | |
1144 /** @defgroup RTC_LL_EF_Time Time | |
1145 * @{ | |
1146 */ | |
1147 | |
1148 /** | |
1149 * @brief Set time format (AM/24-hour or PM notation) | |
1150 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1151 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) | |
1152 * @rmtoll TR PM LL_RTC_TIME_SetFormat | |
1153 * @param RTCx RTC Instance | |
1154 * @param TimeFormat This parameter can be one of the following values: | |
1155 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24 | |
1156 * @arg @ref LL_RTC_TIME_FORMAT_PM | |
1157 * @retval None | |
1158 */ | |
1159 __STATIC_INLINE void LL_RTC_TIME_SetFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat) | |
1160 { | |
1161 MODIFY_REG(RTCx->TR, RTC_TR_PM, TimeFormat); | |
1162 } | |
1163 | |
1164 /** | |
1165 * @brief Get time format (AM or PM notation) | |
1166 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set | |
1167 * before reading this bit | |
1168 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar | |
1169 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). | |
1170 * @rmtoll TR PM LL_RTC_TIME_GetFormat | |
1171 * @param RTCx RTC Instance | |
1172 * @retval Returned value can be one of the following values: | |
1173 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24 | |
1174 * @arg @ref LL_RTC_TIME_FORMAT_PM | |
1175 */ | |
1176 __STATIC_INLINE uint32_t LL_RTC_TIME_GetFormat(RTC_TypeDef *RTCx) | |
1177 { | |
1178 return (uint32_t)(READ_BIT(RTCx->TR, RTC_TR_PM)); | |
1179 } | |
1180 | |
1181 /** | |
1182 * @brief Set Hours in BCD format | |
1183 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1184 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) | |
1185 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert hour from binary to BCD format | |
1186 * @rmtoll TR HT LL_RTC_TIME_SetHour\n | |
1187 * TR HU LL_RTC_TIME_SetHour | |
1188 * @param RTCx RTC Instance | |
1189 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 | |
1190 * @retval None | |
1191 */ | |
1192 __STATIC_INLINE void LL_RTC_TIME_SetHour(RTC_TypeDef *RTCx, uint32_t Hours) | |
1193 { | |
1194 MODIFY_REG(RTCx->TR, (RTC_TR_HT | RTC_TR_HU), | |
1195 (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos))); | |
1196 } | |
1197 | |
1198 /** | |
1199 * @brief Get Hours in BCD format | |
1200 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set | |
1201 * before reading this bit | |
1202 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar | |
1203 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). | |
1204 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert hour from BCD to | |
1205 * Binary format | |
1206 * @rmtoll TR HT LL_RTC_TIME_GetHour\n | |
1207 * TR HU LL_RTC_TIME_GetHour | |
1208 * @param RTCx RTC Instance | |
1209 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 | |
1210 */ | |
1211 __STATIC_INLINE uint32_t LL_RTC_TIME_GetHour(RTC_TypeDef *RTCx) | |
1212 { | |
1213 register uint32_t temp = 0U; | |
1214 | |
1215 temp = READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU)); | |
1216 return (uint32_t)((((temp & RTC_TR_HT) >> RTC_TR_HT_Pos) << 4U) | ((temp & RTC_TR_HU) >> RTC_TR_HU_Pos)); | |
1217 } | |
1218 | |
1219 /** | |
1220 * @brief Set Minutes in BCD format | |
1221 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1222 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) | |
1223 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format | |
1224 * @rmtoll TR MNT LL_RTC_TIME_SetMinute\n | |
1225 * TR MNU LL_RTC_TIME_SetMinute | |
1226 * @param RTCx RTC Instance | |
1227 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 | |
1228 * @retval None | |
1229 */ | |
1230 __STATIC_INLINE void LL_RTC_TIME_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes) | |
1231 { | |
1232 MODIFY_REG(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU), | |
1233 (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos))); | |
1234 } | |
1235 | |
1236 /** | |
1237 * @brief Get Minutes in BCD format | |
1238 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set | |
1239 * before reading this bit | |
1240 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar | |
1241 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). | |
1242 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert minute from BCD | |
1243 * to Binary format | |
1244 * @rmtoll TR MNT LL_RTC_TIME_GetMinute\n | |
1245 * TR MNU LL_RTC_TIME_GetMinute | |
1246 * @param RTCx RTC Instance | |
1247 * @retval Value between Min_Data=0x00 and Max_Data=0x59 | |
1248 */ | |
1249 __STATIC_INLINE uint32_t LL_RTC_TIME_GetMinute(RTC_TypeDef *RTCx) | |
1250 { | |
1251 register uint32_t temp = 0U; | |
1252 | |
1253 temp = READ_BIT(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU)); | |
1254 return (uint32_t)((((temp & RTC_TR_MNT) >> RTC_TR_MNT_Pos) << 4U) | ((temp & RTC_TR_MNU) >> RTC_TR_MNU_Pos)); | |
1255 } | |
1256 | |
1257 /** | |
1258 * @brief Set Seconds in BCD format | |
1259 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1260 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) | |
1261 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format | |
1262 * @rmtoll TR ST LL_RTC_TIME_SetSecond\n | |
1263 * TR SU LL_RTC_TIME_SetSecond | |
1264 * @param RTCx RTC Instance | |
1265 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 | |
1266 * @retval None | |
1267 */ | |
1268 __STATIC_INLINE void LL_RTC_TIME_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds) | |
1269 { | |
1270 MODIFY_REG(RTCx->TR, (RTC_TR_ST | RTC_TR_SU), | |
1271 (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos))); | |
1272 } | |
1273 | |
1274 /** | |
1275 * @brief Get Seconds in BCD format | |
1276 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set | |
1277 * before reading this bit | |
1278 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar | |
1279 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). | |
1280 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD | |
1281 * to Binary format | |
1282 * @rmtoll TR ST LL_RTC_TIME_GetSecond\n | |
1283 * TR SU LL_RTC_TIME_GetSecond | |
1284 * @param RTCx RTC Instance | |
1285 * @retval Value between Min_Data=0x00 and Max_Data=0x59 | |
1286 */ | |
1287 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSecond(RTC_TypeDef *RTCx) | |
1288 { | |
1289 register uint32_t temp = 0U; | |
1290 | |
1291 temp = READ_BIT(RTCx->TR, (RTC_TR_ST | RTC_TR_SU)); | |
1292 return (uint32_t)((((temp & RTC_TR_ST) >> RTC_TR_ST_Pos) << 4U) | ((temp & RTC_TR_SU) >> RTC_TR_SU_Pos)); | |
1293 } | |
1294 | |
1295 /** | |
1296 * @brief Set time (hour, minute and second) in BCD format | |
1297 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1298 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) | |
1299 * @note TimeFormat and Hours should follow the same format | |
1300 * @rmtoll TR PM LL_RTC_TIME_Config\n | |
1301 * TR HT LL_RTC_TIME_Config\n | |
1302 * TR HU LL_RTC_TIME_Config\n | |
1303 * TR MNT LL_RTC_TIME_Config\n | |
1304 * TR MNU LL_RTC_TIME_Config\n | |
1305 * TR ST LL_RTC_TIME_Config\n | |
1306 * TR SU LL_RTC_TIME_Config | |
1307 * @param RTCx RTC Instance | |
1308 * @param Format12_24 This parameter can be one of the following values: | |
1309 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24 | |
1310 * @arg @ref LL_RTC_TIME_FORMAT_PM | |
1311 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 | |
1312 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 | |
1313 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 | |
1314 * @retval None | |
1315 */ | |
1316 __STATIC_INLINE void LL_RTC_TIME_Config(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds) | |
1317 { | |
1318 register uint32_t temp = 0U; | |
1319 | |
1320 temp = Format12_24 | \ | |
1321 (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos)) | \ | |
1322 (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)) | \ | |
1323 (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos)); | |
1324 MODIFY_REG(RTCx->TR, (RTC_TR_PM | RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU), temp); | |
1325 } | |
1326 | |
1327 /** | |
1328 * @brief Get time (hour, minute and second) in BCD format | |
1329 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set | |
1330 * before reading this bit | |
1331 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar | |
1332 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). | |
1333 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND | |
1334 * are available to get independently each parameter. | |
1335 * @rmtoll TR HT LL_RTC_TIME_Get\n | |
1336 * TR HU LL_RTC_TIME_Get\n | |
1337 * TR MNT LL_RTC_TIME_Get\n | |
1338 * TR MNU LL_RTC_TIME_Get\n | |
1339 * TR ST LL_RTC_TIME_Get\n | |
1340 * TR SU LL_RTC_TIME_Get | |
1341 * @param RTCx RTC Instance | |
1342 * @retval Combination of hours, minutes and seconds (Format: 0x00HHMMSS). | |
1343 */ | |
1344 __STATIC_INLINE uint32_t LL_RTC_TIME_Get(RTC_TypeDef *RTCx) | |
1345 { | |
1346 register uint32_t temp = 0U; | |
1347 | |
1348 temp = READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU)); | |
1349 return (uint32_t)((((((temp & RTC_TR_HT) >> RTC_TR_HT_Pos) << 4U) | ((temp & RTC_TR_HU) >> RTC_TR_HU_Pos)) << RTC_OFFSET_HOUR) | \ | |
1350 (((((temp & RTC_TR_MNT) >> RTC_TR_MNT_Pos) << 4U) | ((temp & RTC_TR_MNU) >> RTC_TR_MNU_Pos)) << RTC_OFFSET_MINUTE) | \ | |
1351 ((((temp & RTC_TR_ST) >> RTC_TR_ST_Pos) << 4U) | ((temp & RTC_TR_SU) >> RTC_TR_SU_Pos))); | |
1352 } | |
1353 | |
1354 /** | |
1355 * @brief Memorize whether the daylight saving time change has been performed | |
1356 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1357 * @rmtoll CR BKP LL_RTC_TIME_EnableDayLightStore | |
1358 * @param RTCx RTC Instance | |
1359 * @retval None | |
1360 */ | |
1361 __STATIC_INLINE void LL_RTC_TIME_EnableDayLightStore(RTC_TypeDef *RTCx) | |
1362 { | |
1363 SET_BIT(RTCx->CR, RTC_CR_BKP); | |
1364 } | |
1365 | |
1366 /** | |
1367 * @brief Disable memorization whether the daylight saving time change has been performed. | |
1368 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1369 * @rmtoll CR BKP LL_RTC_TIME_DisableDayLightStore | |
1370 * @param RTCx RTC Instance | |
1371 * @retval None | |
1372 */ | |
1373 __STATIC_INLINE void LL_RTC_TIME_DisableDayLightStore(RTC_TypeDef *RTCx) | |
1374 { | |
1375 CLEAR_BIT(RTCx->CR, RTC_CR_BKP); | |
1376 } | |
1377 | |
1378 /** | |
1379 * @brief Check if RTC Day Light Saving stored operation has been enabled or not | |
1380 * @rmtoll CR BKP LL_RTC_TIME_IsDayLightStoreEnabled | |
1381 * @param RTCx RTC Instance | |
1382 * @retval State of bit (1 or 0). | |
1383 */ | |
1384 __STATIC_INLINE uint32_t LL_RTC_TIME_IsDayLightStoreEnabled(RTC_TypeDef *RTCx) | |
1385 { | |
1386 return (READ_BIT(RTCx->CR, RTC_CR_BKP) == (RTC_CR_BKP)); | |
1387 } | |
1388 | |
1389 /** | |
1390 * @brief Subtract 1 hour (winter time change) | |
1391 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1392 * @rmtoll CR SUB1H LL_RTC_TIME_DecHour | |
1393 * @param RTCx RTC Instance | |
1394 * @retval None | |
1395 */ | |
1396 __STATIC_INLINE void LL_RTC_TIME_DecHour(RTC_TypeDef *RTCx) | |
1397 { | |
1398 SET_BIT(RTCx->CR, RTC_CR_SUB1H); | |
1399 } | |
1400 | |
1401 /** | |
1402 * @brief Add 1 hour (summer time change) | |
1403 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1404 * @rmtoll CR ADD1H LL_RTC_TIME_IncHour | |
1405 * @param RTCx RTC Instance | |
1406 * @retval None | |
1407 */ | |
1408 __STATIC_INLINE void LL_RTC_TIME_IncHour(RTC_TypeDef *RTCx) | |
1409 { | |
1410 SET_BIT(RTCx->CR, RTC_CR_ADD1H); | |
1411 } | |
1412 | |
1413 /** | |
1414 * @brief Get Sub second value in the synchronous prescaler counter. | |
1415 * @note You can use both SubSeconds value and SecondFraction (PREDIV_S through | |
1416 * LL_RTC_GetSynchPrescaler function) terms returned to convert Calendar | |
1417 * SubSeconds value in second fraction ratio with time unit following | |
1418 * generic formula: | |
1419 * ==> Seconds fraction ratio * time_unit= [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit | |
1420 * This conversion can be performed only if no shift operation is pending | |
1421 * (ie. SHFP=0) when PREDIV_S >= SS. | |
1422 * @rmtoll SSR SS LL_RTC_TIME_GetSubSecond | |
1423 * @param RTCx RTC Instance | |
1424 * @retval Sub second value (number between 0 and 65535) | |
1425 */ | |
1426 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSubSecond(RTC_TypeDef *RTCx) | |
1427 { | |
1428 return (uint32_t)(READ_BIT(RTCx->SSR, RTC_SSR_SS)); | |
1429 } | |
1430 | |
1431 /** | |
1432 * @brief Synchronize to a remote clock with a high degree of precision. | |
1433 * @note This operation effectively subtracts from (delays) or advance the clock of a fraction of a second. | |
1434 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1435 * @note When REFCKON is set, firmware must not write to Shift control register. | |
1436 * @rmtoll SHIFTR ADD1S LL_RTC_TIME_Synchronize\n | |
1437 * SHIFTR SUBFS LL_RTC_TIME_Synchronize | |
1438 * @param RTCx RTC Instance | |
1439 * @param ShiftSecond This parameter can be one of the following values: | |
1440 * @arg @ref LL_RTC_SHIFT_SECOND_DELAY | |
1441 * @arg @ref LL_RTC_SHIFT_SECOND_ADVANCE | |
1442 * @param Fraction Number of Seconds Fractions (any value from 0 to 0x7FFF) | |
1443 * @retval None | |
1444 */ | |
1445 __STATIC_INLINE void LL_RTC_TIME_Synchronize(RTC_TypeDef *RTCx, uint32_t ShiftSecond, uint32_t Fraction) | |
1446 { | |
1447 WRITE_REG(RTCx->SHIFTR, ShiftSecond | Fraction); | |
1448 } | |
1449 | |
1450 /** | |
1451 * @} | |
1452 */ | |
1453 | |
1454 /** @defgroup RTC_LL_EF_Date Date | |
1455 * @{ | |
1456 */ | |
1457 | |
1458 /** | |
1459 * @brief Set Year in BCD format | |
1460 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Year from binary to BCD format | |
1461 * @rmtoll DR YT LL_RTC_DATE_SetYear\n | |
1462 * DR YU LL_RTC_DATE_SetYear | |
1463 * @param RTCx RTC Instance | |
1464 * @param Year Value between Min_Data=0x00 and Max_Data=0x99 | |
1465 * @retval None | |
1466 */ | |
1467 __STATIC_INLINE void LL_RTC_DATE_SetYear(RTC_TypeDef *RTCx, uint32_t Year) | |
1468 { | |
1469 MODIFY_REG(RTCx->DR, (RTC_DR_YT | RTC_DR_YU), | |
1470 (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos))); | |
1471 } | |
1472 | |
1473 /** | |
1474 * @brief Get Year in BCD format | |
1475 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set | |
1476 * before reading this bit | |
1477 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Year from BCD to Binary format | |
1478 * @rmtoll DR YT LL_RTC_DATE_GetYear\n | |
1479 * DR YU LL_RTC_DATE_GetYear | |
1480 * @param RTCx RTC Instance | |
1481 * @retval Value between Min_Data=0x00 and Max_Data=0x99 | |
1482 */ | |
1483 __STATIC_INLINE uint32_t LL_RTC_DATE_GetYear(RTC_TypeDef *RTCx) | |
1484 { | |
1485 register uint32_t temp = 0U; | |
1486 | |
1487 temp = READ_BIT(RTCx->DR, (RTC_DR_YT | RTC_DR_YU)); | |
1488 return (uint32_t)((((temp & RTC_DR_YT) >> RTC_DR_YT_Pos) << 4U) | ((temp & RTC_DR_YU) >> RTC_DR_YU_Pos)); | |
1489 } | |
1490 | |
1491 /** | |
1492 * @brief Set Week day | |
1493 * @rmtoll DR WDU LL_RTC_DATE_SetWeekDay | |
1494 * @param RTCx RTC Instance | |
1495 * @param WeekDay This parameter can be one of the following values: | |
1496 * @arg @ref LL_RTC_WEEKDAY_MONDAY | |
1497 * @arg @ref LL_RTC_WEEKDAY_TUESDAY | |
1498 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY | |
1499 * @arg @ref LL_RTC_WEEKDAY_THURSDAY | |
1500 * @arg @ref LL_RTC_WEEKDAY_FRIDAY | |
1501 * @arg @ref LL_RTC_WEEKDAY_SATURDAY | |
1502 * @arg @ref LL_RTC_WEEKDAY_SUNDAY | |
1503 * @retval None | |
1504 */ | |
1505 __STATIC_INLINE void LL_RTC_DATE_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay) | |
1506 { | |
1507 MODIFY_REG(RTCx->DR, RTC_DR_WDU, WeekDay << RTC_DR_WDU_Pos); | |
1508 } | |
1509 | |
1510 /** | |
1511 * @brief Get Week day | |
1512 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set | |
1513 * before reading this bit | |
1514 * @rmtoll DR WDU LL_RTC_DATE_GetWeekDay | |
1515 * @param RTCx RTC Instance | |
1516 * @retval Returned value can be one of the following values: | |
1517 * @arg @ref LL_RTC_WEEKDAY_MONDAY | |
1518 * @arg @ref LL_RTC_WEEKDAY_TUESDAY | |
1519 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY | |
1520 * @arg @ref LL_RTC_WEEKDAY_THURSDAY | |
1521 * @arg @ref LL_RTC_WEEKDAY_FRIDAY | |
1522 * @arg @ref LL_RTC_WEEKDAY_SATURDAY | |
1523 * @arg @ref LL_RTC_WEEKDAY_SUNDAY | |
1524 */ | |
1525 __STATIC_INLINE uint32_t LL_RTC_DATE_GetWeekDay(RTC_TypeDef *RTCx) | |
1526 { | |
1527 return (uint32_t)(READ_BIT(RTCx->DR, RTC_DR_WDU) >> RTC_DR_WDU_Pos); | |
1528 } | |
1529 | |
1530 /** | |
1531 * @brief Set Month in BCD format | |
1532 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Month from binary to BCD format | |
1533 * @rmtoll DR MT LL_RTC_DATE_SetMonth\n | |
1534 * DR MU LL_RTC_DATE_SetMonth | |
1535 * @param RTCx RTC Instance | |
1536 * @param Month This parameter can be one of the following values: | |
1537 * @arg @ref LL_RTC_MONTH_JANUARY | |
1538 * @arg @ref LL_RTC_MONTH_FEBRUARY | |
1539 * @arg @ref LL_RTC_MONTH_MARCH | |
1540 * @arg @ref LL_RTC_MONTH_APRIL | |
1541 * @arg @ref LL_RTC_MONTH_MAY | |
1542 * @arg @ref LL_RTC_MONTH_JUNE | |
1543 * @arg @ref LL_RTC_MONTH_JULY | |
1544 * @arg @ref LL_RTC_MONTH_AUGUST | |
1545 * @arg @ref LL_RTC_MONTH_SEPTEMBER | |
1546 * @arg @ref LL_RTC_MONTH_OCTOBER | |
1547 * @arg @ref LL_RTC_MONTH_NOVEMBER | |
1548 * @arg @ref LL_RTC_MONTH_DECEMBER | |
1549 * @retval None | |
1550 */ | |
1551 __STATIC_INLINE void LL_RTC_DATE_SetMonth(RTC_TypeDef *RTCx, uint32_t Month) | |
1552 { | |
1553 MODIFY_REG(RTCx->DR, (RTC_DR_MT | RTC_DR_MU), | |
1554 (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos))); | |
1555 } | |
1556 | |
1557 /** | |
1558 * @brief Get Month in BCD format | |
1559 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set | |
1560 * before reading this bit | |
1561 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format | |
1562 * @rmtoll DR MT LL_RTC_DATE_GetMonth\n | |
1563 * DR MU LL_RTC_DATE_GetMonth | |
1564 * @param RTCx RTC Instance | |
1565 * @retval Returned value can be one of the following values: | |
1566 * @arg @ref LL_RTC_MONTH_JANUARY | |
1567 * @arg @ref LL_RTC_MONTH_FEBRUARY | |
1568 * @arg @ref LL_RTC_MONTH_MARCH | |
1569 * @arg @ref LL_RTC_MONTH_APRIL | |
1570 * @arg @ref LL_RTC_MONTH_MAY | |
1571 * @arg @ref LL_RTC_MONTH_JUNE | |
1572 * @arg @ref LL_RTC_MONTH_JULY | |
1573 * @arg @ref LL_RTC_MONTH_AUGUST | |
1574 * @arg @ref LL_RTC_MONTH_SEPTEMBER | |
1575 * @arg @ref LL_RTC_MONTH_OCTOBER | |
1576 * @arg @ref LL_RTC_MONTH_NOVEMBER | |
1577 * @arg @ref LL_RTC_MONTH_DECEMBER | |
1578 */ | |
1579 __STATIC_INLINE uint32_t LL_RTC_DATE_GetMonth(RTC_TypeDef *RTCx) | |
1580 { | |
1581 register uint32_t temp = 0U; | |
1582 | |
1583 temp = READ_BIT(RTCx->DR, (RTC_DR_MT | RTC_DR_MU)); | |
1584 return (uint32_t)((((temp & RTC_DR_MT) >> RTC_DR_MT_Pos) << 4U) | ((temp & RTC_DR_MU) >> RTC_DR_MU_Pos)); | |
1585 } | |
1586 | |
1587 /** | |
1588 * @brief Set Day in BCD format | |
1589 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format | |
1590 * @rmtoll DR DT LL_RTC_DATE_SetDay\n | |
1591 * DR DU LL_RTC_DATE_SetDay | |
1592 * @param RTCx RTC Instance | |
1593 * @param Day Value between Min_Data=0x01 and Max_Data=0x31 | |
1594 * @retval None | |
1595 */ | |
1596 __STATIC_INLINE void LL_RTC_DATE_SetDay(RTC_TypeDef *RTCx, uint32_t Day) | |
1597 { | |
1598 MODIFY_REG(RTCx->DR, (RTC_DR_DT | RTC_DR_DU), | |
1599 (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos))); | |
1600 } | |
1601 | |
1602 /** | |
1603 * @brief Get Day in BCD format | |
1604 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set | |
1605 * before reading this bit | |
1606 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format | |
1607 * @rmtoll DR DT LL_RTC_DATE_GetDay\n | |
1608 * DR DU LL_RTC_DATE_GetDay | |
1609 * @param RTCx RTC Instance | |
1610 * @retval Value between Min_Data=0x01 and Max_Data=0x31 | |
1611 */ | |
1612 __STATIC_INLINE uint32_t LL_RTC_DATE_GetDay(RTC_TypeDef *RTCx) | |
1613 { | |
1614 register uint32_t temp = 0U; | |
1615 | |
1616 temp = READ_BIT(RTCx->DR, (RTC_DR_DT | RTC_DR_DU)); | |
1617 return (uint32_t)((((temp & RTC_DR_DT) >> RTC_DR_DT_Pos) << 4U) | ((temp & RTC_DR_DU) >> RTC_DR_DU_Pos)); | |
1618 } | |
1619 | |
1620 /** | |
1621 * @brief Set date (WeekDay, Day, Month and Year) in BCD format | |
1622 * @rmtoll DR WDU LL_RTC_DATE_Config\n | |
1623 * DR MT LL_RTC_DATE_Config\n | |
1624 * DR MU LL_RTC_DATE_Config\n | |
1625 * DR DT LL_RTC_DATE_Config\n | |
1626 * DR DU LL_RTC_DATE_Config\n | |
1627 * DR YT LL_RTC_DATE_Config\n | |
1628 * DR YU LL_RTC_DATE_Config | |
1629 * @param RTCx RTC Instance | |
1630 * @param WeekDay This parameter can be one of the following values: | |
1631 * @arg @ref LL_RTC_WEEKDAY_MONDAY | |
1632 * @arg @ref LL_RTC_WEEKDAY_TUESDAY | |
1633 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY | |
1634 * @arg @ref LL_RTC_WEEKDAY_THURSDAY | |
1635 * @arg @ref LL_RTC_WEEKDAY_FRIDAY | |
1636 * @arg @ref LL_RTC_WEEKDAY_SATURDAY | |
1637 * @arg @ref LL_RTC_WEEKDAY_SUNDAY | |
1638 * @param Day Value between Min_Data=0x01 and Max_Data=0x31 | |
1639 * @param Month This parameter can be one of the following values: | |
1640 * @arg @ref LL_RTC_MONTH_JANUARY | |
1641 * @arg @ref LL_RTC_MONTH_FEBRUARY | |
1642 * @arg @ref LL_RTC_MONTH_MARCH | |
1643 * @arg @ref LL_RTC_MONTH_APRIL | |
1644 * @arg @ref LL_RTC_MONTH_MAY | |
1645 * @arg @ref LL_RTC_MONTH_JUNE | |
1646 * @arg @ref LL_RTC_MONTH_JULY | |
1647 * @arg @ref LL_RTC_MONTH_AUGUST | |
1648 * @arg @ref LL_RTC_MONTH_SEPTEMBER | |
1649 * @arg @ref LL_RTC_MONTH_OCTOBER | |
1650 * @arg @ref LL_RTC_MONTH_NOVEMBER | |
1651 * @arg @ref LL_RTC_MONTH_DECEMBER | |
1652 * @param Year Value between Min_Data=0x00 and Max_Data=0x99 | |
1653 * @retval None | |
1654 */ | |
1655 __STATIC_INLINE void LL_RTC_DATE_Config(RTC_TypeDef *RTCx, uint32_t WeekDay, uint32_t Day, uint32_t Month, uint32_t Year) | |
1656 { | |
1657 register uint32_t temp = 0U; | |
1658 | |
1659 temp = (WeekDay << RTC_DR_WDU_Pos) | \ | |
1660 (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos)) | \ | |
1661 (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)) | \ | |
1662 (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos)); | |
1663 | |
1664 MODIFY_REG(RTCx->DR, (RTC_DR_WDU | RTC_DR_MT | RTC_DR_MU | RTC_DR_DT | RTC_DR_DU | RTC_DR_YT | RTC_DR_YU), temp); | |
1665 } | |
1666 | |
1667 /** | |
1668 * @brief Get date (WeekDay, Day, Month and Year) in BCD format | |
1669 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set | |
1670 * before reading this bit | |
1671 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_YEAR, __LL_RTC_GET_MONTH, | |
1672 * and __LL_RTC_GET_DAY are available to get independently each parameter. | |
1673 * @rmtoll DR WDU LL_RTC_DATE_Get\n | |
1674 * DR MT LL_RTC_DATE_Get\n | |
1675 * DR MU LL_RTC_DATE_Get\n | |
1676 * DR DT LL_RTC_DATE_Get\n | |
1677 * DR DU LL_RTC_DATE_Get\n | |
1678 * DR YT LL_RTC_DATE_Get\n | |
1679 * DR YU LL_RTC_DATE_Get | |
1680 * @param RTCx RTC Instance | |
1681 * @retval Combination of WeekDay, Day, Month and Year (Format: 0xWWDDMMYY). | |
1682 */ | |
1683 __STATIC_INLINE uint32_t LL_RTC_DATE_Get(RTC_TypeDef *RTCx) | |
1684 { | |
1685 register uint32_t temp = 0U; | |
1686 | |
1687 temp = READ_BIT(RTCx->DR, (RTC_DR_WDU | RTC_DR_MT | RTC_DR_MU | RTC_DR_DT | RTC_DR_DU | RTC_DR_YT | RTC_DR_YU)); | |
1688 return (uint32_t)((((temp & RTC_DR_WDU) >> RTC_DR_WDU_Pos) << RTC_OFFSET_WEEKDAY) | \ | |
1689 (((((temp & RTC_DR_DT) >> RTC_DR_DT_Pos) << 4U) | ((temp & RTC_DR_DU) >> RTC_DR_DU_Pos)) << RTC_OFFSET_DAY) | \ | |
1690 (((((temp & RTC_DR_MT) >> RTC_DR_MT_Pos) << 4U) | ((temp & RTC_DR_MU) >> RTC_DR_MU_Pos)) << RTC_OFFSET_MONTH) | \ | |
1691 ((((temp & RTC_DR_YT) >> RTC_DR_YT_Pos) << 4U) | ((temp & RTC_DR_YU) >> RTC_DR_YU_Pos))); | |
1692 } | |
1693 | |
1694 /** | |
1695 * @} | |
1696 */ | |
1697 | |
1698 /** @defgroup RTC_LL_EF_ALARMA ALARMA | |
1699 * @{ | |
1700 */ | |
1701 | |
1702 /** | |
1703 * @brief Enable Alarm A | |
1704 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1705 * @rmtoll CR ALRAE LL_RTC_ALMA_Enable | |
1706 * @param RTCx RTC Instance | |
1707 * @retval None | |
1708 */ | |
1709 __STATIC_INLINE void LL_RTC_ALMA_Enable(RTC_TypeDef *RTCx) | |
1710 { | |
1711 SET_BIT(RTCx->CR, RTC_CR_ALRAE); | |
1712 } | |
1713 | |
1714 /** | |
1715 * @brief Disable Alarm A | |
1716 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
1717 * @rmtoll CR ALRAE LL_RTC_ALMA_Disable | |
1718 * @param RTCx RTC Instance | |
1719 * @retval None | |
1720 */ | |
1721 __STATIC_INLINE void LL_RTC_ALMA_Disable(RTC_TypeDef *RTCx) | |
1722 { | |
1723 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAE); | |
1724 } | |
1725 | |
1726 /** | |
1727 * @brief Specify the Alarm A masks. | |
1728 * @rmtoll ALRMAR MSK4 LL_RTC_ALMA_SetMask\n | |
1729 * ALRMAR MSK3 LL_RTC_ALMA_SetMask\n | |
1730 * ALRMAR MSK2 LL_RTC_ALMA_SetMask\n | |
1731 * ALRMAR MSK1 LL_RTC_ALMA_SetMask | |
1732 * @param RTCx RTC Instance | |
1733 * @param Mask This parameter can be a combination of the following values: | |
1734 * @arg @ref LL_RTC_ALMA_MASK_NONE | |
1735 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY | |
1736 * @arg @ref LL_RTC_ALMA_MASK_HOURS | |
1737 * @arg @ref LL_RTC_ALMA_MASK_MINUTES | |
1738 * @arg @ref LL_RTC_ALMA_MASK_SECONDS | |
1739 * @arg @ref LL_RTC_ALMA_MASK_ALL | |
1740 * @retval None | |
1741 */ | |
1742 __STATIC_INLINE void LL_RTC_ALMA_SetMask(RTC_TypeDef *RTCx, uint32_t Mask) | |
1743 { | |
1744 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1, Mask); | |
1745 } | |
1746 | |
1747 /** | |
1748 * @brief Get the Alarm A masks. | |
1749 * @rmtoll ALRMAR MSK4 LL_RTC_ALMA_GetMask\n | |
1750 * ALRMAR MSK3 LL_RTC_ALMA_GetMask\n | |
1751 * ALRMAR MSK2 LL_RTC_ALMA_GetMask\n | |
1752 * ALRMAR MSK1 LL_RTC_ALMA_GetMask | |
1753 * @param RTCx RTC Instance | |
1754 * @retval Returned value can be can be a combination of the following values: | |
1755 * @arg @ref LL_RTC_ALMA_MASK_NONE | |
1756 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY | |
1757 * @arg @ref LL_RTC_ALMA_MASK_HOURS | |
1758 * @arg @ref LL_RTC_ALMA_MASK_MINUTES | |
1759 * @arg @ref LL_RTC_ALMA_MASK_SECONDS | |
1760 * @arg @ref LL_RTC_ALMA_MASK_ALL | |
1761 */ | |
1762 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMask(RTC_TypeDef *RTCx) | |
1763 { | |
1764 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1)); | |
1765 } | |
1766 | |
1767 /** | |
1768 * @brief Enable AlarmA Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care) | |
1769 * @rmtoll ALRMAR WDSEL LL_RTC_ALMA_EnableWeekday | |
1770 * @param RTCx RTC Instance | |
1771 * @retval None | |
1772 */ | |
1773 __STATIC_INLINE void LL_RTC_ALMA_EnableWeekday(RTC_TypeDef *RTCx) | |
1774 { | |
1775 SET_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL); | |
1776 } | |
1777 | |
1778 /** | |
1779 * @brief Disable AlarmA Week day selection (DU[3:0] represents the date ) | |
1780 * @rmtoll ALRMAR WDSEL LL_RTC_ALMA_DisableWeekday | |
1781 * @param RTCx RTC Instance | |
1782 * @retval None | |
1783 */ | |
1784 __STATIC_INLINE void LL_RTC_ALMA_DisableWeekday(RTC_TypeDef *RTCx) | |
1785 { | |
1786 CLEAR_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL); | |
1787 } | |
1788 | |
1789 /** | |
1790 * @brief Set ALARM A Day in BCD format | |
1791 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format | |
1792 * @rmtoll ALRMAR DT LL_RTC_ALMA_SetDay\n | |
1793 * ALRMAR DU LL_RTC_ALMA_SetDay | |
1794 * @param RTCx RTC Instance | |
1795 * @param Day Value between Min_Data=0x01 and Max_Data=0x31 | |
1796 * @retval None | |
1797 */ | |
1798 __STATIC_INLINE void LL_RTC_ALMA_SetDay(RTC_TypeDef *RTCx, uint32_t Day) | |
1799 { | |
1800 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU), | |
1801 (((Day & 0xF0U) << (RTC_ALRMAR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMAR_DU_Pos))); | |
1802 } | |
1803 | |
1804 /** | |
1805 * @brief Get ALARM A Day in BCD format | |
1806 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format | |
1807 * @rmtoll ALRMAR DT LL_RTC_ALMA_GetDay\n | |
1808 * ALRMAR DU LL_RTC_ALMA_GetDay | |
1809 * @param RTCx RTC Instance | |
1810 * @retval Value between Min_Data=0x01 and Max_Data=0x31 | |
1811 */ | |
1812 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetDay(RTC_TypeDef *RTCx) | |
1813 { | |
1814 register uint32_t temp = 0U; | |
1815 | |
1816 temp = READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU)); | |
1817 return (uint32_t)((((temp & RTC_ALRMAR_DT) >> RTC_ALRMAR_DT_Pos) << 4U) | ((temp & RTC_ALRMAR_DU) >> RTC_ALRMAR_DU_Pos)); | |
1818 } | |
1819 | |
1820 /** | |
1821 * @brief Set ALARM A Weekday | |
1822 * @rmtoll ALRMAR DU LL_RTC_ALMA_SetWeekDay | |
1823 * @param RTCx RTC Instance | |
1824 * @param WeekDay This parameter can be one of the following values: | |
1825 * @arg @ref LL_RTC_WEEKDAY_MONDAY | |
1826 * @arg @ref LL_RTC_WEEKDAY_TUESDAY | |
1827 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY | |
1828 * @arg @ref LL_RTC_WEEKDAY_THURSDAY | |
1829 * @arg @ref LL_RTC_WEEKDAY_FRIDAY | |
1830 * @arg @ref LL_RTC_WEEKDAY_SATURDAY | |
1831 * @arg @ref LL_RTC_WEEKDAY_SUNDAY | |
1832 * @retval None | |
1833 */ | |
1834 __STATIC_INLINE void LL_RTC_ALMA_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay) | |
1835 { | |
1836 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_DU, WeekDay << RTC_ALRMAR_DU_Pos); | |
1837 } | |
1838 | |
1839 /** | |
1840 * @brief Get ALARM A Weekday | |
1841 * @rmtoll ALRMAR DU LL_RTC_ALMA_GetWeekDay | |
1842 * @param RTCx RTC Instance | |
1843 * @retval Returned value can be one of the following values: | |
1844 * @arg @ref LL_RTC_WEEKDAY_MONDAY | |
1845 * @arg @ref LL_RTC_WEEKDAY_TUESDAY | |
1846 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY | |
1847 * @arg @ref LL_RTC_WEEKDAY_THURSDAY | |
1848 * @arg @ref LL_RTC_WEEKDAY_FRIDAY | |
1849 * @arg @ref LL_RTC_WEEKDAY_SATURDAY | |
1850 * @arg @ref LL_RTC_WEEKDAY_SUNDAY | |
1851 */ | |
1852 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetWeekDay(RTC_TypeDef *RTCx) | |
1853 { | |
1854 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_DU) >> RTC_ALRMAR_DU_Pos); | |
1855 } | |
1856 | |
1857 /** | |
1858 * @brief Set Alarm A time format (AM/24-hour or PM notation) | |
1859 * @rmtoll ALRMAR PM LL_RTC_ALMA_SetTimeFormat | |
1860 * @param RTCx RTC Instance | |
1861 * @param TimeFormat This parameter can be one of the following values: | |
1862 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM | |
1863 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM | |
1864 * @retval None | |
1865 */ | |
1866 __STATIC_INLINE void LL_RTC_ALMA_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat) | |
1867 { | |
1868 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM, TimeFormat); | |
1869 } | |
1870 | |
1871 /** | |
1872 * @brief Get Alarm A time format (AM or PM notation) | |
1873 * @rmtoll ALRMAR PM LL_RTC_ALMA_GetTimeFormat | |
1874 * @param RTCx RTC Instance | |
1875 * @retval Returned value can be one of the following values: | |
1876 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM | |
1877 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM | |
1878 */ | |
1879 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTimeFormat(RTC_TypeDef *RTCx) | |
1880 { | |
1881 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_PM)); | |
1882 } | |
1883 | |
1884 /** | |
1885 * @brief Set ALARM A Hours in BCD format | |
1886 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format | |
1887 * @rmtoll ALRMAR HT LL_RTC_ALMA_SetHour\n | |
1888 * ALRMAR HU LL_RTC_ALMA_SetHour | |
1889 * @param RTCx RTC Instance | |
1890 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 | |
1891 * @retval None | |
1892 */ | |
1893 __STATIC_INLINE void LL_RTC_ALMA_SetHour(RTC_TypeDef *RTCx, uint32_t Hours) | |
1894 { | |
1895 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU), | |
1896 (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos))); | |
1897 } | |
1898 | |
1899 /** | |
1900 * @brief Get ALARM A Hours in BCD format | |
1901 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format | |
1902 * @rmtoll ALRMAR HT LL_RTC_ALMA_GetHour\n | |
1903 * ALRMAR HU LL_RTC_ALMA_GetHour | |
1904 * @param RTCx RTC Instance | |
1905 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 | |
1906 */ | |
1907 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetHour(RTC_TypeDef *RTCx) | |
1908 { | |
1909 register uint32_t temp = 0U; | |
1910 | |
1911 temp = READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU)); | |
1912 return (uint32_t)((((temp & RTC_ALRMAR_HT) >> RTC_ALRMAR_HT_Pos) << 4U) | ((temp & RTC_ALRMAR_HU) >> RTC_ALRMAR_HU_Pos)); | |
1913 } | |
1914 | |
1915 /** | |
1916 * @brief Set ALARM A Minutes in BCD format | |
1917 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format | |
1918 * @rmtoll ALRMAR MNT LL_RTC_ALMA_SetMinute\n | |
1919 * ALRMAR MNU LL_RTC_ALMA_SetMinute | |
1920 * @param RTCx RTC Instance | |
1921 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 | |
1922 * @retval None | |
1923 */ | |
1924 __STATIC_INLINE void LL_RTC_ALMA_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes) | |
1925 { | |
1926 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU), | |
1927 (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos))); | |
1928 } | |
1929 | |
1930 /** | |
1931 * @brief Get ALARM A Minutes in BCD format | |
1932 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format | |
1933 * @rmtoll ALRMAR MNT LL_RTC_ALMA_GetMinute\n | |
1934 * ALRMAR MNU LL_RTC_ALMA_GetMinute | |
1935 * @param RTCx RTC Instance | |
1936 * @retval Value between Min_Data=0x00 and Max_Data=0x59 | |
1937 */ | |
1938 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMinute(RTC_TypeDef *RTCx) | |
1939 { | |
1940 register uint32_t temp = 0U; | |
1941 | |
1942 temp = READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU)); | |
1943 return (uint32_t)((((temp & RTC_ALRMAR_MNT) >> RTC_ALRMAR_MNT_Pos) << 4U) | ((temp & RTC_ALRMAR_MNU) >> RTC_ALRMAR_MNU_Pos)); | |
1944 } | |
1945 | |
1946 /** | |
1947 * @brief Set ALARM A Seconds in BCD format | |
1948 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format | |
1949 * @rmtoll ALRMAR ST LL_RTC_ALMA_SetSecond\n | |
1950 * ALRMAR SU LL_RTC_ALMA_SetSecond | |
1951 * @param RTCx RTC Instance | |
1952 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 | |
1953 * @retval None | |
1954 */ | |
1955 __STATIC_INLINE void LL_RTC_ALMA_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds) | |
1956 { | |
1957 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU), | |
1958 (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos))); | |
1959 } | |
1960 | |
1961 /** | |
1962 * @brief Get ALARM A Seconds in BCD format | |
1963 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format | |
1964 * @rmtoll ALRMAR ST LL_RTC_ALMA_GetSecond\n | |
1965 * ALRMAR SU LL_RTC_ALMA_GetSecond | |
1966 * @param RTCx RTC Instance | |
1967 * @retval Value between Min_Data=0x00 and Max_Data=0x59 | |
1968 */ | |
1969 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSecond(RTC_TypeDef *RTCx) | |
1970 { | |
1971 register uint32_t temp = 0U; | |
1972 | |
1973 temp = READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU)); | |
1974 return (uint32_t)((((temp & RTC_ALRMAR_ST) >> RTC_ALRMAR_ST_Pos) << 4U) | ((temp & RTC_ALRMAR_SU) >> RTC_ALRMAR_SU_Pos)); | |
1975 } | |
1976 | |
1977 /** | |
1978 * @brief Set Alarm A Time (hour, minute and second) in BCD format | |
1979 * @rmtoll ALRMAR PM LL_RTC_ALMA_ConfigTime\n | |
1980 * ALRMAR HT LL_RTC_ALMA_ConfigTime\n | |
1981 * ALRMAR HU LL_RTC_ALMA_ConfigTime\n | |
1982 * ALRMAR MNT LL_RTC_ALMA_ConfigTime\n | |
1983 * ALRMAR MNU LL_RTC_ALMA_ConfigTime\n | |
1984 * ALRMAR ST LL_RTC_ALMA_ConfigTime\n | |
1985 * ALRMAR SU LL_RTC_ALMA_ConfigTime | |
1986 * @param RTCx RTC Instance | |
1987 * @param Format12_24 This parameter can be one of the following values: | |
1988 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM | |
1989 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM | |
1990 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 | |
1991 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 | |
1992 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 | |
1993 * @retval None | |
1994 */ | |
1995 __STATIC_INLINE void LL_RTC_ALMA_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds) | |
1996 { | |
1997 register uint32_t temp = 0U; | |
1998 | |
1999 temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos)) | \ | |
2000 (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)) | \ | |
2001 (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos)); | |
2002 | |
2003 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM | RTC_ALRMAR_HT | RTC_ALRMAR_HU | RTC_ALRMAR_MNT | RTC_ALRMAR_MNU | RTC_ALRMAR_ST | RTC_ALRMAR_SU, temp); | |
2004 } | |
2005 | |
2006 /** | |
2007 * @brief Get Alarm B Time (hour, minute and second) in BCD format | |
2008 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND | |
2009 * are available to get independently each parameter. | |
2010 * @rmtoll ALRMAR HT LL_RTC_ALMA_GetTime\n | |
2011 * ALRMAR HU LL_RTC_ALMA_GetTime\n | |
2012 * ALRMAR MNT LL_RTC_ALMA_GetTime\n | |
2013 * ALRMAR MNU LL_RTC_ALMA_GetTime\n | |
2014 * ALRMAR ST LL_RTC_ALMA_GetTime\n | |
2015 * ALRMAR SU LL_RTC_ALMA_GetTime | |
2016 * @param RTCx RTC Instance | |
2017 * @retval Combination of hours, minutes and seconds. | |
2018 */ | |
2019 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTime(RTC_TypeDef *RTCx) | |
2020 { | |
2021 return (uint32_t)((LL_RTC_ALMA_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMA_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMA_GetSecond(RTCx)); | |
2022 } | |
2023 | |
2024 /** | |
2025 * @brief Set Alarm A Mask the most-significant bits starting at this bit | |
2026 * @note This register can be written only when ALRAE is reset in RTC_CR register, | |
2027 * or in initialization mode. | |
2028 * @rmtoll ALRMASSR MASKSS LL_RTC_ALMA_SetSubSecondMask | |
2029 * @param RTCx RTC Instance | |
2030 * @param Mask Value between Min_Data=0x00 and Max_Data=0xF | |
2031 * @retval None | |
2032 */ | |
2033 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask) | |
2034 { | |
2035 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS, Mask << RTC_ALRMASSR_MASKSS_Pos); | |
2036 } | |
2037 | |
2038 /** | |
2039 * @brief Get Alarm A Mask the most-significant bits starting at this bit | |
2040 * @rmtoll ALRMASSR MASKSS LL_RTC_ALMA_GetSubSecondMask | |
2041 * @param RTCx RTC Instance | |
2042 * @retval Value between Min_Data=0x00 and Max_Data=0xF | |
2043 */ | |
2044 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecondMask(RTC_TypeDef *RTCx) | |
2045 { | |
2046 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS) >> RTC_ALRMASSR_MASKSS_Pos); | |
2047 } | |
2048 | |
2049 /** | |
2050 * @brief Set Alarm A Sub seconds value | |
2051 * @rmtoll ALRMASSR SS LL_RTC_ALMA_SetSubSecond | |
2052 * @param RTCx RTC Instance | |
2053 * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF | |
2054 * @retval None | |
2055 */ | |
2056 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond) | |
2057 { | |
2058 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_SS, Subsecond); | |
2059 } | |
2060 | |
2061 /** | |
2062 * @brief Get Alarm A Sub seconds value | |
2063 * @rmtoll ALRMASSR SS LL_RTC_ALMA_GetSubSecond | |
2064 * @param RTCx RTC Instance | |
2065 * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF | |
2066 */ | |
2067 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecond(RTC_TypeDef *RTCx) | |
2068 { | |
2069 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_SS)); | |
2070 } | |
2071 | |
2072 /** | |
2073 * @} | |
2074 */ | |
2075 | |
2076 /** @defgroup RTC_LL_EF_ALARMB ALARMB | |
2077 * @{ | |
2078 */ | |
2079 | |
2080 /** | |
2081 * @brief Enable Alarm B | |
2082 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
2083 * @rmtoll CR ALRBE LL_RTC_ALMB_Enable | |
2084 * @param RTCx RTC Instance | |
2085 * @retval None | |
2086 */ | |
2087 __STATIC_INLINE void LL_RTC_ALMB_Enable(RTC_TypeDef *RTCx) | |
2088 { | |
2089 SET_BIT(RTCx->CR, RTC_CR_ALRBE); | |
2090 } | |
2091 | |
2092 /** | |
2093 * @brief Disable Alarm B | |
2094 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
2095 * @rmtoll CR ALRBE LL_RTC_ALMB_Disable | |
2096 * @param RTCx RTC Instance | |
2097 * @retval None | |
2098 */ | |
2099 __STATIC_INLINE void LL_RTC_ALMB_Disable(RTC_TypeDef *RTCx) | |
2100 { | |
2101 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBE); | |
2102 } | |
2103 | |
2104 /** | |
2105 * @brief Specify the Alarm B masks. | |
2106 * @rmtoll ALRMBR MSK4 LL_RTC_ALMB_SetMask\n | |
2107 * ALRMBR MSK3 LL_RTC_ALMB_SetMask\n | |
2108 * ALRMBR MSK2 LL_RTC_ALMB_SetMask\n | |
2109 * ALRMBR MSK1 LL_RTC_ALMB_SetMask | |
2110 * @param RTCx RTC Instance | |
2111 * @param Mask This parameter can be a combination of the following values: | |
2112 * @arg @ref LL_RTC_ALMB_MASK_NONE | |
2113 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY | |
2114 * @arg @ref LL_RTC_ALMB_MASK_HOURS | |
2115 * @arg @ref LL_RTC_ALMB_MASK_MINUTES | |
2116 * @arg @ref LL_RTC_ALMB_MASK_SECONDS | |
2117 * @arg @ref LL_RTC_ALMB_MASK_ALL | |
2118 * @retval None | |
2119 */ | |
2120 __STATIC_INLINE void LL_RTC_ALMB_SetMask(RTC_TypeDef *RTCx, uint32_t Mask) | |
2121 { | |
2122 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1, Mask); | |
2123 } | |
2124 | |
2125 /** | |
2126 * @brief Get the Alarm B masks. | |
2127 * @rmtoll ALRMBR MSK4 LL_RTC_ALMB_GetMask\n | |
2128 * ALRMBR MSK3 LL_RTC_ALMB_GetMask\n | |
2129 * ALRMBR MSK2 LL_RTC_ALMB_GetMask\n | |
2130 * ALRMBR MSK1 LL_RTC_ALMB_GetMask | |
2131 * @param RTCx RTC Instance | |
2132 * @retval Returned value can be can be a combination of the following values: | |
2133 * @arg @ref LL_RTC_ALMB_MASK_NONE | |
2134 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY | |
2135 * @arg @ref LL_RTC_ALMB_MASK_HOURS | |
2136 * @arg @ref LL_RTC_ALMB_MASK_MINUTES | |
2137 * @arg @ref LL_RTC_ALMB_MASK_SECONDS | |
2138 * @arg @ref LL_RTC_ALMB_MASK_ALL | |
2139 */ | |
2140 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMask(RTC_TypeDef *RTCx) | |
2141 { | |
2142 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1)); | |
2143 } | |
2144 | |
2145 /** | |
2146 * @brief Enable AlarmB Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care) | |
2147 * @rmtoll ALRMBR WDSEL LL_RTC_ALMB_EnableWeekday | |
2148 * @param RTCx RTC Instance | |
2149 * @retval None | |
2150 */ | |
2151 __STATIC_INLINE void LL_RTC_ALMB_EnableWeekday(RTC_TypeDef *RTCx) | |
2152 { | |
2153 SET_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL); | |
2154 } | |
2155 | |
2156 /** | |
2157 * @brief Disable AlarmB Week day selection (DU[3:0] represents the date ) | |
2158 * @rmtoll ALRMBR WDSEL LL_RTC_ALMB_DisableWeekday | |
2159 * @param RTCx RTC Instance | |
2160 * @retval None | |
2161 */ | |
2162 __STATIC_INLINE void LL_RTC_ALMB_DisableWeekday(RTC_TypeDef *RTCx) | |
2163 { | |
2164 CLEAR_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL); | |
2165 } | |
2166 | |
2167 /** | |
2168 * @brief Set ALARM B Day in BCD format | |
2169 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format | |
2170 * @rmtoll ALRMBR DT LL_RTC_ALMB_SetDay\n | |
2171 * ALRMBR DU LL_RTC_ALMB_SetDay | |
2172 * @param RTCx RTC Instance | |
2173 * @param Day Value between Min_Data=0x01 and Max_Data=0x31 | |
2174 * @retval None | |
2175 */ | |
2176 __STATIC_INLINE void LL_RTC_ALMB_SetDay(RTC_TypeDef *RTCx, uint32_t Day) | |
2177 { | |
2178 MODIFY_REG(RTC->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU), | |
2179 (((Day & 0xF0U) << (RTC_ALRMBR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMBR_DU_Pos))); | |
2180 } | |
2181 | |
2182 /** | |
2183 * @brief Get ALARM B Day in BCD format | |
2184 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format | |
2185 * @rmtoll ALRMBR DT LL_RTC_ALMB_GetDay\n | |
2186 * ALRMBR DU LL_RTC_ALMB_GetDay | |
2187 * @param RTCx RTC Instance | |
2188 * @retval Value between Min_Data=0x01 and Max_Data=0x31 | |
2189 */ | |
2190 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetDay(RTC_TypeDef *RTCx) | |
2191 { | |
2192 register uint32_t temp = 0U; | |
2193 | |
2194 temp = READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU)); | |
2195 return (uint32_t)((((temp & RTC_ALRMBR_DT) >> RTC_ALRMBR_DT_Pos) << 4U) | ((temp & RTC_ALRMBR_DU) >> RTC_ALRMBR_DU_Pos)); | |
2196 } | |
2197 | |
2198 /** | |
2199 * @brief Set ALARM B Weekday | |
2200 * @rmtoll ALRMBR DU LL_RTC_ALMB_SetWeekDay | |
2201 * @param RTCx RTC Instance | |
2202 * @param WeekDay This parameter can be one of the following values: | |
2203 * @arg @ref LL_RTC_WEEKDAY_MONDAY | |
2204 * @arg @ref LL_RTC_WEEKDAY_TUESDAY | |
2205 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY | |
2206 * @arg @ref LL_RTC_WEEKDAY_THURSDAY | |
2207 * @arg @ref LL_RTC_WEEKDAY_FRIDAY | |
2208 * @arg @ref LL_RTC_WEEKDAY_SATURDAY | |
2209 * @arg @ref LL_RTC_WEEKDAY_SUNDAY | |
2210 * @retval None | |
2211 */ | |
2212 __STATIC_INLINE void LL_RTC_ALMB_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay) | |
2213 { | |
2214 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_DU, WeekDay << RTC_ALRMBR_DU_Pos); | |
2215 } | |
2216 | |
2217 /** | |
2218 * @brief Get ALARM B Weekday | |
2219 * @rmtoll ALRMBR DU LL_RTC_ALMB_GetWeekDay | |
2220 * @param RTCx RTC Instance | |
2221 * @retval Returned value can be one of the following values: | |
2222 * @arg @ref LL_RTC_WEEKDAY_MONDAY | |
2223 * @arg @ref LL_RTC_WEEKDAY_TUESDAY | |
2224 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY | |
2225 * @arg @ref LL_RTC_WEEKDAY_THURSDAY | |
2226 * @arg @ref LL_RTC_WEEKDAY_FRIDAY | |
2227 * @arg @ref LL_RTC_WEEKDAY_SATURDAY | |
2228 * @arg @ref LL_RTC_WEEKDAY_SUNDAY | |
2229 */ | |
2230 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetWeekDay(RTC_TypeDef *RTCx) | |
2231 { | |
2232 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_DU) >> RTC_ALRMBR_DU_Pos); | |
2233 } | |
2234 | |
2235 /** | |
2236 * @brief Set ALARM B time format (AM/24-hour or PM notation) | |
2237 * @rmtoll ALRMBR PM LL_RTC_ALMB_SetTimeFormat | |
2238 * @param RTCx RTC Instance | |
2239 * @param TimeFormat This parameter can be one of the following values: | |
2240 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM | |
2241 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM | |
2242 * @retval None | |
2243 */ | |
2244 __STATIC_INLINE void LL_RTC_ALMB_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat) | |
2245 { | |
2246 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM, TimeFormat); | |
2247 } | |
2248 | |
2249 /** | |
2250 * @brief Get ALARM B time format (AM or PM notation) | |
2251 * @rmtoll ALRMBR PM LL_RTC_ALMB_GetTimeFormat | |
2252 * @param RTCx RTC Instance | |
2253 * @retval Returned value can be one of the following values: | |
2254 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM | |
2255 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM | |
2256 */ | |
2257 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTimeFormat(RTC_TypeDef *RTCx) | |
2258 { | |
2259 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_PM)); | |
2260 } | |
2261 | |
2262 /** | |
2263 * @brief Set ALARM B Hours in BCD format | |
2264 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format | |
2265 * @rmtoll ALRMBR HT LL_RTC_ALMB_SetHour\n | |
2266 * ALRMBR HU LL_RTC_ALMB_SetHour | |
2267 * @param RTCx RTC Instance | |
2268 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 | |
2269 * @retval None | |
2270 */ | |
2271 __STATIC_INLINE void LL_RTC_ALMB_SetHour(RTC_TypeDef *RTCx, uint32_t Hours) | |
2272 { | |
2273 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU), | |
2274 (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos))); | |
2275 } | |
2276 | |
2277 /** | |
2278 * @brief Get ALARM B Hours in BCD format | |
2279 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format | |
2280 * @rmtoll ALRMBR HT LL_RTC_ALMB_GetHour\n | |
2281 * ALRMBR HU LL_RTC_ALMB_GetHour | |
2282 * @param RTCx RTC Instance | |
2283 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 | |
2284 */ | |
2285 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetHour(RTC_TypeDef *RTCx) | |
2286 { | |
2287 register uint32_t temp = 0U; | |
2288 | |
2289 temp = READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU)); | |
2290 return (uint32_t)((((temp & RTC_ALRMBR_HT) >> RTC_ALRMBR_HT_Pos) << 4U) | ((temp & RTC_ALRMBR_HU) >> RTC_ALRMBR_HU_Pos)); | |
2291 } | |
2292 | |
2293 /** | |
2294 * @brief Set ALARM B Minutes in BCD format | |
2295 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format | |
2296 * @rmtoll ALRMBR MNT LL_RTC_ALMB_SetMinute\n | |
2297 * ALRMBR MNU LL_RTC_ALMB_SetMinute | |
2298 * @param RTCx RTC Instance | |
2299 * @param Minutes between Min_Data=0x00 and Max_Data=0x59 | |
2300 * @retval None | |
2301 */ | |
2302 __STATIC_INLINE void LL_RTC_ALMB_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes) | |
2303 { | |
2304 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU), | |
2305 (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos))); | |
2306 } | |
2307 | |
2308 /** | |
2309 * @brief Get ALARM B Minutes in BCD format | |
2310 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format | |
2311 * @rmtoll ALRMBR MNT LL_RTC_ALMB_GetMinute\n | |
2312 * ALRMBR MNU LL_RTC_ALMB_GetMinute | |
2313 * @param RTCx RTC Instance | |
2314 * @retval Value between Min_Data=0x00 and Max_Data=0x59 | |
2315 */ | |
2316 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMinute(RTC_TypeDef *RTCx) | |
2317 { | |
2318 register uint32_t temp = 0U; | |
2319 | |
2320 temp = READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU)); | |
2321 return (uint32_t)((((temp & RTC_ALRMBR_MNT) >> RTC_ALRMBR_MNT_Pos) << 4U) | ((temp & RTC_ALRMBR_MNU) >> RTC_ALRMBR_MNU_Pos)); | |
2322 } | |
2323 | |
2324 /** | |
2325 * @brief Set ALARM B Seconds in BCD format | |
2326 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format | |
2327 * @rmtoll ALRMBR ST LL_RTC_ALMB_SetSecond\n | |
2328 * ALRMBR SU LL_RTC_ALMB_SetSecond | |
2329 * @param RTCx RTC Instance | |
2330 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 | |
2331 * @retval None | |
2332 */ | |
2333 __STATIC_INLINE void LL_RTC_ALMB_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds) | |
2334 { | |
2335 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU), | |
2336 (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos))); | |
2337 } | |
2338 | |
2339 /** | |
2340 * @brief Get ALARM B Seconds in BCD format | |
2341 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format | |
2342 * @rmtoll ALRMBR ST LL_RTC_ALMB_GetSecond\n | |
2343 * ALRMBR SU LL_RTC_ALMB_GetSecond | |
2344 * @param RTCx RTC Instance | |
2345 * @retval Value between Min_Data=0x00 and Max_Data=0x59 | |
2346 */ | |
2347 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSecond(RTC_TypeDef *RTCx) | |
2348 { | |
2349 register uint32_t temp = 0U; | |
2350 | |
2351 temp = READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU)); | |
2352 return (uint32_t)((((temp & RTC_ALRMBR_ST) >> RTC_ALRMBR_ST_Pos) << 4U) | ((temp & RTC_ALRMBR_SU) >> RTC_ALRMBR_SU_Pos)); | |
2353 } | |
2354 | |
2355 /** | |
2356 * @brief Set Alarm B Time (hour, minute and second) in BCD format | |
2357 * @rmtoll ALRMBR PM LL_RTC_ALMB_ConfigTime\n | |
2358 * ALRMBR HT LL_RTC_ALMB_ConfigTime\n | |
2359 * ALRMBR HU LL_RTC_ALMB_ConfigTime\n | |
2360 * ALRMBR MNT LL_RTC_ALMB_ConfigTime\n | |
2361 * ALRMBR MNU LL_RTC_ALMB_ConfigTime\n | |
2362 * ALRMBR ST LL_RTC_ALMB_ConfigTime\n | |
2363 * ALRMBR SU LL_RTC_ALMB_ConfigTime | |
2364 * @param RTCx RTC Instance | |
2365 * @param Format12_24 This parameter can be one of the following values: | |
2366 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM | |
2367 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM | |
2368 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 | |
2369 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 | |
2370 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 | |
2371 * @retval None | |
2372 */ | |
2373 __STATIC_INLINE void LL_RTC_ALMB_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds) | |
2374 { | |
2375 register uint32_t temp = 0U; | |
2376 | |
2377 temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos)) | \ | |
2378 (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)) | \ | |
2379 (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos)); | |
2380 | |
2381 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM| RTC_ALRMBR_HT | RTC_ALRMBR_HU | RTC_ALRMBR_MNT | RTC_ALRMBR_MNU | RTC_ALRMBR_ST | RTC_ALRMBR_SU, temp); | |
2382 } | |
2383 | |
2384 /** | |
2385 * @brief Get Alarm B Time (hour, minute and second) in BCD format | |
2386 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND | |
2387 * are available to get independently each parameter. | |
2388 * @rmtoll ALRMBR HT LL_RTC_ALMB_GetTime\n | |
2389 * ALRMBR HU LL_RTC_ALMB_GetTime\n | |
2390 * ALRMBR MNT LL_RTC_ALMB_GetTime\n | |
2391 * ALRMBR MNU LL_RTC_ALMB_GetTime\n | |
2392 * ALRMBR ST LL_RTC_ALMB_GetTime\n | |
2393 * ALRMBR SU LL_RTC_ALMB_GetTime | |
2394 * @param RTCx RTC Instance | |
2395 * @retval Combination of hours, minutes and seconds. | |
2396 */ | |
2397 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTime(RTC_TypeDef *RTCx) | |
2398 { | |
2399 return (uint32_t)((LL_RTC_ALMB_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMB_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMB_GetSecond(RTCx)); | |
2400 } | |
2401 | |
2402 /** | |
2403 * @brief Set Alarm B Mask the most-significant bits starting at this bit | |
2404 * @note This register can be written only when ALRBE is reset in RTC_CR register, | |
2405 * or in initialization mode. | |
2406 * @rmtoll ALRMBSSR MASKSS LL_RTC_ALMB_SetSubSecondMask | |
2407 * @param RTCx RTC Instance | |
2408 * @param Mask Value between Min_Data=0x00 and Max_Data=0xF | |
2409 * @retval None | |
2410 */ | |
2411 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask) | |
2412 { | |
2413 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS, Mask << RTC_ALRMBSSR_MASKSS_Pos); | |
2414 } | |
2415 | |
2416 /** | |
2417 * @brief Get Alarm B Mask the most-significant bits starting at this bit | |
2418 * @rmtoll ALRMBSSR MASKSS LL_RTC_ALMB_GetSubSecondMask | |
2419 * @param RTCx RTC Instance | |
2420 * @retval Value between Min_Data=0x00 and Max_Data=0xF | |
2421 */ | |
2422 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecondMask(RTC_TypeDef *RTCx) | |
2423 { | |
2424 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS) >> RTC_ALRMBSSR_MASKSS_Pos); | |
2425 } | |
2426 | |
2427 /** | |
2428 * @brief Set Alarm B Sub seconds value | |
2429 * @rmtoll ALRMBSSR SS LL_RTC_ALMB_SetSubSecond | |
2430 * @param RTCx RTC Instance | |
2431 * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF | |
2432 * @retval None | |
2433 */ | |
2434 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond) | |
2435 { | |
2436 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS, Subsecond); | |
2437 } | |
2438 | |
2439 /** | |
2440 * @brief Get Alarm B Sub seconds value | |
2441 * @rmtoll ALRMBSSR SS LL_RTC_ALMB_GetSubSecond | |
2442 * @param RTCx RTC Instance | |
2443 * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF | |
2444 */ | |
2445 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecond(RTC_TypeDef *RTCx) | |
2446 { | |
2447 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS)); | |
2448 } | |
2449 | |
2450 /** | |
2451 * @} | |
2452 */ | |
2453 | |
2454 /** @defgroup RTC_LL_EF_Timestamp Timestamp | |
2455 * @{ | |
2456 */ | |
2457 | |
2458 /** | |
2459 * @brief Enable Timestamp | |
2460 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
2461 * @rmtoll CR TSE LL_RTC_TS_Enable | |
2462 * @param RTCx RTC Instance | |
2463 * @retval None | |
2464 */ | |
2465 __STATIC_INLINE void LL_RTC_TS_Enable(RTC_TypeDef *RTCx) | |
2466 { | |
2467 SET_BIT(RTCx->CR, RTC_CR_TSE); | |
2468 } | |
2469 | |
2470 /** | |
2471 * @brief Disable Timestamp | |
2472 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
2473 * @rmtoll CR TSE LL_RTC_TS_Disable | |
2474 * @param RTCx RTC Instance | |
2475 * @retval None | |
2476 */ | |
2477 __STATIC_INLINE void LL_RTC_TS_Disable(RTC_TypeDef *RTCx) | |
2478 { | |
2479 CLEAR_BIT(RTCx->CR, RTC_CR_TSE); | |
2480 } | |
2481 | |
2482 /** | |
2483 * @brief Set Time-stamp event active edge | |
2484 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
2485 * @note TSE must be reset when TSEDGE is changed to avoid unwanted TSF setting | |
2486 * @rmtoll CR TSEDGE LL_RTC_TS_SetActiveEdge | |
2487 * @param RTCx RTC Instance | |
2488 * @param Edge This parameter can be one of the following values: | |
2489 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING | |
2490 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING | |
2491 * @retval None | |
2492 */ | |
2493 __STATIC_INLINE void LL_RTC_TS_SetActiveEdge(RTC_TypeDef *RTCx, uint32_t Edge) | |
2494 { | |
2495 MODIFY_REG(RTCx->CR, RTC_CR_TSEDGE, Edge); | |
2496 } | |
2497 | |
2498 /** | |
2499 * @brief Get Time-stamp event active edge | |
2500 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
2501 * @rmtoll CR TSEDGE LL_RTC_TS_GetActiveEdge | |
2502 * @param RTCx RTC Instance | |
2503 * @retval Returned value can be one of the following values: | |
2504 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING | |
2505 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING | |
2506 */ | |
2507 __STATIC_INLINE uint32_t LL_RTC_TS_GetActiveEdge(RTC_TypeDef *RTCx) | |
2508 { | |
2509 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TSEDGE)); | |
2510 } | |
2511 | |
2512 /** | |
2513 * @brief Get Timestamp AM/PM notation (AM or 24-hour format) | |
2514 * @rmtoll TSTR PM LL_RTC_TS_GetTimeFormat | |
2515 * @param RTCx RTC Instance | |
2516 * @retval Returned value can be one of the following values: | |
2517 * @arg @ref LL_RTC_TS_TIME_FORMAT_AM | |
2518 * @arg @ref LL_RTC_TS_TIME_FORMAT_PM | |
2519 */ | |
2520 __STATIC_INLINE uint32_t LL_RTC_TS_GetTimeFormat(RTC_TypeDef *RTCx) | |
2521 { | |
2522 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_PM)); | |
2523 } | |
2524 | |
2525 /** | |
2526 * @brief Get Timestamp Hours in BCD format | |
2527 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format | |
2528 * @rmtoll TSTR HT LL_RTC_TS_GetHour\n | |
2529 * TSTR HU LL_RTC_TS_GetHour | |
2530 * @param RTCx RTC Instance | |
2531 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 | |
2532 */ | |
2533 __STATIC_INLINE uint32_t LL_RTC_TS_GetHour(RTC_TypeDef *RTCx) | |
2534 { | |
2535 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_HT | RTC_TSTR_HU) >> RTC_TSTR_HU_Pos); | |
2536 } | |
2537 | |
2538 /** | |
2539 * @brief Get Timestamp Minutes in BCD format | |
2540 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format | |
2541 * @rmtoll TSTR MNT LL_RTC_TS_GetMinute\n | |
2542 * TSTR MNU LL_RTC_TS_GetMinute | |
2543 * @param RTCx RTC Instance | |
2544 * @retval Value between Min_Data=0x00 and Max_Data=0x59 | |
2545 */ | |
2546 __STATIC_INLINE uint32_t LL_RTC_TS_GetMinute(RTC_TypeDef *RTCx) | |
2547 { | |
2548 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_MNT | RTC_TSTR_MNU) >> RTC_TSTR_MNU_Pos); | |
2549 } | |
2550 | |
2551 /** | |
2552 * @brief Get Timestamp Seconds in BCD format | |
2553 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format | |
2554 * @rmtoll TSTR ST LL_RTC_TS_GetSecond\n | |
2555 * TSTR SU LL_RTC_TS_GetSecond | |
2556 * @param RTCx RTC Instance | |
2557 * @retval Value between Min_Data=0x00 and Max_Data=0x59 | |
2558 */ | |
2559 __STATIC_INLINE uint32_t LL_RTC_TS_GetSecond(RTC_TypeDef *RTCx) | |
2560 { | |
2561 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_ST | RTC_TSTR_SU)); | |
2562 } | |
2563 | |
2564 /** | |
2565 * @brief Get Timestamp time (hour, minute and second) in BCD format | |
2566 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND | |
2567 * are available to get independently each parameter. | |
2568 * @rmtoll TSTR HT LL_RTC_TS_GetTime\n | |
2569 * TSTR HU LL_RTC_TS_GetTime\n | |
2570 * TSTR MNT LL_RTC_TS_GetTime\n | |
2571 * TSTR MNU LL_RTC_TS_GetTime\n | |
2572 * TSTR ST LL_RTC_TS_GetTime\n | |
2573 * TSTR SU LL_RTC_TS_GetTime | |
2574 * @param RTCx RTC Instance | |
2575 * @retval Combination of hours, minutes and seconds. | |
2576 */ | |
2577 __STATIC_INLINE uint32_t LL_RTC_TS_GetTime(RTC_TypeDef *RTCx) | |
2578 { | |
2579 return (uint32_t)(READ_BIT(RTCx->TSTR, | |
2580 RTC_TSTR_HT | RTC_TSTR_HU | RTC_TSTR_MNT | RTC_TSTR_MNU | RTC_TSTR_ST | RTC_TSTR_SU)); | |
2581 } | |
2582 | |
2583 /** | |
2584 * @brief Get Timestamp Week day | |
2585 * @rmtoll TSDR WDU LL_RTC_TS_GetWeekDay | |
2586 * @param RTCx RTC Instance | |
2587 * @retval Returned value can be one of the following values: | |
2588 * @arg @ref LL_RTC_WEEKDAY_MONDAY | |
2589 * @arg @ref LL_RTC_WEEKDAY_TUESDAY | |
2590 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY | |
2591 * @arg @ref LL_RTC_WEEKDAY_THURSDAY | |
2592 * @arg @ref LL_RTC_WEEKDAY_FRIDAY | |
2593 * @arg @ref LL_RTC_WEEKDAY_SATURDAY | |
2594 * @arg @ref LL_RTC_WEEKDAY_SUNDAY | |
2595 */ | |
2596 __STATIC_INLINE uint32_t LL_RTC_TS_GetWeekDay(RTC_TypeDef *RTCx) | |
2597 { | |
2598 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU) >> RTC_TSDR_WDU_Pos); | |
2599 } | |
2600 | |
2601 /** | |
2602 * @brief Get Timestamp Month in BCD format | |
2603 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format | |
2604 * @rmtoll TSDR MT LL_RTC_TS_GetMonth\n | |
2605 * TSDR MU LL_RTC_TS_GetMonth | |
2606 * @param RTCx RTC Instance | |
2607 * @retval Returned value can be one of the following values: | |
2608 * @arg @ref LL_RTC_MONTH_JANUARY | |
2609 * @arg @ref LL_RTC_MONTH_FEBRUARY | |
2610 * @arg @ref LL_RTC_MONTH_MARCH | |
2611 * @arg @ref LL_RTC_MONTH_APRIL | |
2612 * @arg @ref LL_RTC_MONTH_MAY | |
2613 * @arg @ref LL_RTC_MONTH_JUNE | |
2614 * @arg @ref LL_RTC_MONTH_JULY | |
2615 * @arg @ref LL_RTC_MONTH_AUGUST | |
2616 * @arg @ref LL_RTC_MONTH_SEPTEMBER | |
2617 * @arg @ref LL_RTC_MONTH_OCTOBER | |
2618 * @arg @ref LL_RTC_MONTH_NOVEMBER | |
2619 * @arg @ref LL_RTC_MONTH_DECEMBER | |
2620 */ | |
2621 __STATIC_INLINE uint32_t LL_RTC_TS_GetMonth(RTC_TypeDef *RTCx) | |
2622 { | |
2623 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_MT | RTC_TSDR_MU) >> RTC_TSDR_MU_Pos); | |
2624 } | |
2625 | |
2626 /** | |
2627 * @brief Get Timestamp Day in BCD format | |
2628 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format | |
2629 * @rmtoll TSDR DT LL_RTC_TS_GetDay\n | |
2630 * TSDR DU LL_RTC_TS_GetDay | |
2631 * @param RTCx RTC Instance | |
2632 * @retval Value between Min_Data=0x01 and Max_Data=0x31 | |
2633 */ | |
2634 __STATIC_INLINE uint32_t LL_RTC_TS_GetDay(RTC_TypeDef *RTCx) | |
2635 { | |
2636 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_DT | RTC_TSDR_DU)); | |
2637 } | |
2638 | |
2639 /** | |
2640 * @brief Get Timestamp date (WeekDay, Day and Month) in BCD format | |
2641 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_MONTH, | |
2642 * and __LL_RTC_GET_DAY are available to get independently each parameter. | |
2643 * @rmtoll TSDR WDU LL_RTC_TS_GetDate\n | |
2644 * TSDR MT LL_RTC_TS_GetDate\n | |
2645 * TSDR MU LL_RTC_TS_GetDate\n | |
2646 * TSDR DT LL_RTC_TS_GetDate\n | |
2647 * TSDR DU LL_RTC_TS_GetDate | |
2648 * @param RTCx RTC Instance | |
2649 * @retval Combination of Weekday, Day and Month | |
2650 */ | |
2651 __STATIC_INLINE uint32_t LL_RTC_TS_GetDate(RTC_TypeDef *RTCx) | |
2652 { | |
2653 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU | RTC_TSDR_MT | RTC_TSDR_MU | RTC_TSDR_DT | RTC_TSDR_DU)); | |
2654 } | |
2655 | |
2656 /** | |
2657 * @brief Get time-stamp sub second value | |
2658 * @rmtoll TSSSR SS LL_RTC_TS_GetSubSecond | |
2659 * @param RTCx RTC Instance | |
2660 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF | |
2661 */ | |
2662 __STATIC_INLINE uint32_t LL_RTC_TS_GetSubSecond(RTC_TypeDef *RTCx) | |
2663 { | |
2664 return (uint32_t)(READ_BIT(RTCx->TSSSR, RTC_TSSSR_SS)); | |
2665 } | |
2666 | |
2667 #if defined(RTC_TAFCR_TAMPTS) | |
2668 /** | |
2669 * @brief Activate timestamp on tamper detection event | |
2670 * @rmtoll TAFCR TAMPTS LL_RTC_TS_EnableOnTamper | |
2671 * @param RTCx RTC Instance | |
2672 * @retval None | |
2673 */ | |
2674 __STATIC_INLINE void LL_RTC_TS_EnableOnTamper(RTC_TypeDef *RTCx) | |
2675 { | |
2676 SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPTS); | |
2677 } | |
2678 | |
2679 /** | |
2680 * @brief Disable timestamp on tamper detection event | |
2681 * @rmtoll TAFCR TAMPTS LL_RTC_TS_DisableOnTamper | |
2682 * @param RTCx RTC Instance | |
2683 * @retval None | |
2684 */ | |
2685 __STATIC_INLINE void LL_RTC_TS_DisableOnTamper(RTC_TypeDef *RTCx) | |
2686 { | |
2687 CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPTS); | |
2688 } | |
2689 #endif /* RTC_TAFCR_TAMPTS */ | |
2690 | |
2691 /** | |
2692 * @brief Set timestamp Pin | |
2693 * @rmtoll TAFCR TSINSEL LL_RTC_TS_SetPin | |
2694 * @param RTCx RTC Instance | |
2695 * @param TSPin specifies the RTC TimeStamp Pin. | |
2696 * This parameter can be one of the following values: | |
2697 * @arg LL_RTC_TimeStampPin_Default: RTC_AF1 is used as RTC TimeStamp. | |
2698 * @arg LL_RTC_TimeStampPin_Pos1: RTC_AF2 is selected as RTC TimeStamp. (*) | |
2699 * | |
2700 * (*) value not defined in all devices. | |
2701 * @retval None | |
2702 */ | |
2703 __STATIC_INLINE void LL_RTC_TS_SetPin(RTC_TypeDef *RTCx, uint32_t TSPin) | |
2704 { | |
2705 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TSINSEL , TSPin); | |
2706 } | |
2707 | |
2708 /** | |
2709 * @brief Get timestamp Pin | |
2710 * @rmtoll TAFCR TSINSEL LL_RTC_TS_GetPin | |
2711 * @param RTCx RTC Instance | |
2712 * @retval Returned value can be one of the following values: | |
2713 * @arg LL_RTC_TimeStampPin_Default: RTC_AF1 is used as RTC TimeStamp Pin. | |
2714 * @arg LL_RTC_TimeStampPin_Pos1: RTC_AF2 is selected as RTC TimeStamp Pin. (*) | |
2715 * | |
2716 * (*) value not defined in all devices. | |
2717 * @retval None | |
2718 */ | |
2719 | |
2720 __STATIC_INLINE uint32_t LL_RTC_TS_GetPin(RTC_TypeDef *RTCx) | |
2721 { | |
2722 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TSINSEL)); | |
2723 } | |
2724 | |
2725 /** | |
2726 * @} | |
2727 */ | |
2728 | |
2729 /** @defgroup RTC_LL_EF_Tamper Tamper | |
2730 * @{ | |
2731 */ | |
2732 | |
2733 /** | |
2734 * @brief Enable RTC_TAMPx input detection | |
2735 * @rmtoll TAFCR TAMP1E LL_RTC_TAMPER_Enable\n | |
2736 * TAFCR TAMP2E LL_RTC_TAMPER_Enable\n | |
2737 * @param RTCx RTC Instance | |
2738 * @param Tamper This parameter can be a combination of the following values: | |
2739 * @arg @ref LL_RTC_TAMPER_1 | |
2740 * @arg @ref LL_RTC_TAMPER_2 (*) | |
2741 * | |
2742 * (*) value not defined in all devices. | |
2743 * @retval None | |
2744 */ | |
2745 __STATIC_INLINE void LL_RTC_TAMPER_Enable(RTC_TypeDef *RTCx, uint32_t Tamper) | |
2746 { | |
2747 SET_BIT(RTCx->TAFCR, Tamper); | |
2748 } | |
2749 | |
2750 /** | |
2751 * @brief Clear RTC_TAMPx input detection | |
2752 * @rmtoll TAFCR TAMP1E LL_RTC_TAMPER_Disable\n | |
2753 * TAFCR TAMP2E LL_RTC_TAMPER_Disable\n | |
2754 * @param RTCx RTC Instance | |
2755 * @param Tamper This parameter can be a combination of the following values: | |
2756 * @arg @ref LL_RTC_TAMPER_1 | |
2757 * @arg @ref LL_RTC_TAMPER_2 (*) | |
2758 * | |
2759 * (*) value not defined in all devices. | |
2760 * @retval None | |
2761 */ | |
2762 __STATIC_INLINE void LL_RTC_TAMPER_Disable(RTC_TypeDef *RTCx, uint32_t Tamper) | |
2763 { | |
2764 CLEAR_BIT(RTCx->TAFCR, Tamper); | |
2765 } | |
2766 | |
2767 #if defined(RTC_TAFCR_TAMPPUDIS) | |
2768 /** | |
2769 * @brief Disable RTC_TAMPx pull-up disable (Disable precharge of RTC_TAMPx pins) | |
2770 * @rmtoll TAFCR TAMPPUDIS LL_RTC_TAMPER_DisablePullUp | |
2771 * @param RTCx RTC Instance | |
2772 * @retval None | |
2773 */ | |
2774 __STATIC_INLINE void LL_RTC_TAMPER_DisablePullUp(RTC_TypeDef *RTCx) | |
2775 { | |
2776 SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPUDIS); | |
2777 } | |
2778 | |
2779 /** | |
2780 * @brief Enable RTC_TAMPx pull-up disable ( Precharge RTC_TAMPx pins before sampling) | |
2781 * @rmtoll TAFCR TAMPPUDIS LL_RTC_TAMPER_EnablePullUp | |
2782 * @param RTCx RTC Instance | |
2783 * @retval None | |
2784 */ | |
2785 __STATIC_INLINE void LL_RTC_TAMPER_EnablePullUp(RTC_TypeDef *RTCx) | |
2786 { | |
2787 CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPUDIS); | |
2788 } | |
2789 #endif /* RTC_TAFCR_TAMPPUDIS */ | |
2790 | |
2791 #if defined(RTC_TAFCR_TAMPPRCH) | |
2792 /** | |
2793 * @brief Set RTC_TAMPx precharge duration | |
2794 * @rmtoll TAFCR TAMPPRCH LL_RTC_TAMPER_SetPrecharge | |
2795 * @param RTCx RTC Instance | |
2796 * @param Duration This parameter can be one of the following values: | |
2797 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK | |
2798 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK | |
2799 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK | |
2800 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK | |
2801 * @retval None | |
2802 */ | |
2803 __STATIC_INLINE void LL_RTC_TAMPER_SetPrecharge(RTC_TypeDef *RTCx, uint32_t Duration) | |
2804 { | |
2805 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPPRCH, Duration); | |
2806 } | |
2807 | |
2808 /** | |
2809 * @brief Get RTC_TAMPx precharge duration | |
2810 * @rmtoll TAFCR TAMPPRCH LL_RTC_TAMPER_GetPrecharge | |
2811 * @param RTCx RTC Instance | |
2812 * @retval Returned value can be one of the following values: | |
2813 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK | |
2814 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK | |
2815 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK | |
2816 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK | |
2817 */ | |
2818 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPrecharge(RTC_TypeDef *RTCx) | |
2819 { | |
2820 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPRCH)); | |
2821 } | |
2822 #endif /* RTC_TAFCR_TAMPPRCH */ | |
2823 | |
2824 #if defined(RTC_TAFCR_TAMPFLT) | |
2825 /** | |
2826 * @brief Set RTC_TAMPx filter count | |
2827 * @rmtoll TAFCR TAMPFLT LL_RTC_TAMPER_SetFilterCount | |
2828 * @param RTCx RTC Instance | |
2829 * @param FilterCount This parameter can be one of the following values: | |
2830 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE | |
2831 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE | |
2832 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE | |
2833 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE | |
2834 * @retval None | |
2835 */ | |
2836 __STATIC_INLINE void LL_RTC_TAMPER_SetFilterCount(RTC_TypeDef *RTCx, uint32_t FilterCount) | |
2837 { | |
2838 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPFLT, FilterCount); | |
2839 } | |
2840 | |
2841 /** | |
2842 * @brief Get RTC_TAMPx filter count | |
2843 * @rmtoll TAFCR TAMPFLT LL_RTC_TAMPER_GetFilterCount | |
2844 * @param RTCx RTC Instance | |
2845 * @retval Returned value can be one of the following values: | |
2846 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE | |
2847 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE | |
2848 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE | |
2849 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE | |
2850 */ | |
2851 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetFilterCount(RTC_TypeDef *RTCx) | |
2852 { | |
2853 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPFLT)); | |
2854 } | |
2855 #endif /* RTC_TAFCR_TAMPFLT */ | |
2856 | |
2857 #if defined(RTC_TAFCR_TAMPFREQ) | |
2858 /** | |
2859 * @brief Set Tamper sampling frequency | |
2860 * @rmtoll TAFCR TAMPFREQ LL_RTC_TAMPER_SetSamplingFreq | |
2861 * @param RTCx RTC Instance | |
2862 * @param SamplingFreq This parameter can be one of the following values: | |
2863 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768 | |
2864 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384 | |
2865 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192 | |
2866 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096 | |
2867 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048 | |
2868 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024 | |
2869 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512 | |
2870 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256 | |
2871 * @retval None | |
2872 */ | |
2873 __STATIC_INLINE void LL_RTC_TAMPER_SetSamplingFreq(RTC_TypeDef *RTCx, uint32_t SamplingFreq) | |
2874 { | |
2875 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPFREQ, SamplingFreq); | |
2876 } | |
2877 | |
2878 /** | |
2879 * @brief Get Tamper sampling frequency | |
2880 * @rmtoll TAFCR TAMPFREQ LL_RTC_TAMPER_GetSamplingFreq | |
2881 * @param RTCx RTC Instance | |
2882 * @retval Returned value can be one of the following values: | |
2883 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768 | |
2884 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384 | |
2885 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192 | |
2886 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096 | |
2887 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048 | |
2888 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024 | |
2889 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512 | |
2890 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256 | |
2891 */ | |
2892 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetSamplingFreq(RTC_TypeDef *RTCx) | |
2893 { | |
2894 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPFREQ)); | |
2895 } | |
2896 #endif /* RTC_TAFCR_TAMPFREQ */ | |
2897 | |
2898 /** | |
2899 * @brief Enable Active level for Tamper input | |
2900 * @rmtoll TAFCR TAMP1TRG LL_RTC_TAMPER_EnableActiveLevel\n | |
2901 * TAFCR TAMP2TRG LL_RTC_TAMPER_EnableActiveLevel\n | |
2902 * @param RTCx RTC Instance | |
2903 * @param Tamper This parameter can be a combination of the following values: | |
2904 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 | |
2905 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 (*) | |
2906 * | |
2907 * (*) value not defined in all devices. | |
2908 * @retval None | |
2909 */ | |
2910 __STATIC_INLINE void LL_RTC_TAMPER_EnableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper) | |
2911 { | |
2912 SET_BIT(RTCx->TAFCR, Tamper); | |
2913 } | |
2914 | |
2915 /** | |
2916 * @brief Disable Active level for Tamper input | |
2917 * @rmtoll TAFCR TAMP1TRG LL_RTC_TAMPER_DisableActiveLevel\n | |
2918 * TAFCR TAMP2TRG LL_RTC_TAMPER_DisableActiveLevel\n | |
2919 * @param RTCx RTC Instance | |
2920 * @param Tamper This parameter can be a combination of the following values: | |
2921 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 | |
2922 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 (*) | |
2923 * | |
2924 * (*) value not defined in all devices. | |
2925 * @retval None | |
2926 */ | |
2927 __STATIC_INLINE void LL_RTC_TAMPER_DisableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper) | |
2928 { | |
2929 CLEAR_BIT(RTCx->TAFCR, Tamper); | |
2930 } | |
2931 | |
2932 /** | |
2933 * @brief Set Tamper Pin | |
2934 * @rmtoll TAFCR TAMP1INSEL LL_RTC_TAMPER_SetPin | |
2935 * @param RTCx RTC Instance | |
2936 * @param TamperPin specifies the RTC Tamper Pin. | |
2937 * This parameter can be one of the following values: | |
2938 * @arg LL_RTC_TamperPin_Default: RTC_AF1 is used as RTC Tamper. | |
2939 * @arg LL_RTC_TamperPin_Pos1: RTC_AF2 is selected as RTC Tamper. (*) | |
2940 * | |
2941 * (*) value not defined in all devices. | |
2942 * @retval None | |
2943 */ | |
2944 __STATIC_INLINE void LL_RTC_TAMPER_SetPin(RTC_TypeDef *RTCx, uint32_t TamperPin) | |
2945 { | |
2946 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMP1INSEL , TamperPin); | |
2947 } | |
2948 | |
2949 /** | |
2950 * @brief Get Tamper Pin | |
2951 * @rmtoll TAFCR TAMP1INSEL LL_RTC_TAMPER_GetPin | |
2952 * @param RTCx RTC Instance | |
2953 * @retval Returned value can be one of the following values: | |
2954 * @arg LL_RTC_TamperPin_Default: RTC_AF1 is used as RTC Tamper Pin. | |
2955 * @arg LL_RTC_TamperPin_Pos1: RTC_AF2 is selected as RTC Tamper Pin. (*) | |
2956 * | |
2957 * (*) value not defined in all devices. | |
2958 * @retval None | |
2959 */ | |
2960 | |
2961 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPin(RTC_TypeDef *RTCx) | |
2962 { | |
2963 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMP1INSEL)); | |
2964 } | |
2965 | |
2966 /** | |
2967 * @} | |
2968 */ | |
2969 | |
2970 /** @defgroup RTC_LL_EF_Wakeup Wakeup | |
2971 * @{ | |
2972 */ | |
2973 | |
2974 /** | |
2975 * @brief Enable Wakeup timer | |
2976 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
2977 * @rmtoll CR WUTE LL_RTC_WAKEUP_Enable | |
2978 * @param RTCx RTC Instance | |
2979 * @retval None | |
2980 */ | |
2981 __STATIC_INLINE void LL_RTC_WAKEUP_Enable(RTC_TypeDef *RTCx) | |
2982 { | |
2983 SET_BIT(RTCx->CR, RTC_CR_WUTE); | |
2984 } | |
2985 | |
2986 /** | |
2987 * @brief Disable Wakeup timer | |
2988 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
2989 * @rmtoll CR WUTE LL_RTC_WAKEUP_Disable | |
2990 * @param RTCx RTC Instance | |
2991 * @retval None | |
2992 */ | |
2993 __STATIC_INLINE void LL_RTC_WAKEUP_Disable(RTC_TypeDef *RTCx) | |
2994 { | |
2995 CLEAR_BIT(RTCx->CR, RTC_CR_WUTE); | |
2996 } | |
2997 | |
2998 /** | |
2999 * @brief Check if Wakeup timer is enabled or not | |
3000 * @rmtoll CR WUTE LL_RTC_WAKEUP_IsEnabled | |
3001 * @param RTCx RTC Instance | |
3002 * @retval State of bit (1 or 0). | |
3003 */ | |
3004 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_IsEnabled(RTC_TypeDef *RTCx) | |
3005 { | |
3006 return (READ_BIT(RTCx->CR, RTC_CR_WUTE) == (RTC_CR_WUTE)); | |
3007 } | |
3008 | |
3009 /** | |
3010 * @brief Select Wakeup clock | |
3011 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3012 * @note Bit can be written only when RTC_CR WUTE bit = 0 and RTC_ISR WUTWF bit = 1 | |
3013 * @rmtoll CR WUCKSEL LL_RTC_WAKEUP_SetClock | |
3014 * @param RTCx RTC Instance | |
3015 * @param WakeupClock This parameter can be one of the following values: | |
3016 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16 | |
3017 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8 | |
3018 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4 | |
3019 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2 | |
3020 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE | |
3021 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT | |
3022 * @retval None | |
3023 */ | |
3024 __STATIC_INLINE void LL_RTC_WAKEUP_SetClock(RTC_TypeDef *RTCx, uint32_t WakeupClock) | |
3025 { | |
3026 MODIFY_REG(RTCx->CR, RTC_CR_WUCKSEL, WakeupClock); | |
3027 } | |
3028 | |
3029 /** | |
3030 * @brief Get Wakeup clock | |
3031 * @rmtoll CR WUCKSEL LL_RTC_WAKEUP_GetClock | |
3032 * @param RTCx RTC Instance | |
3033 * @retval Returned value can be one of the following values: | |
3034 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16 | |
3035 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8 | |
3036 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4 | |
3037 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2 | |
3038 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE | |
3039 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT | |
3040 */ | |
3041 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetClock(RTC_TypeDef *RTCx) | |
3042 { | |
3043 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_WUCKSEL)); | |
3044 } | |
3045 | |
3046 /** | |
3047 * @brief Set Wakeup auto-reload value | |
3048 * @note Bit can be written only when WUTWF is set to 1 in RTC_ISR | |
3049 * @rmtoll WUTR WUT LL_RTC_WAKEUP_SetAutoReload | |
3050 * @param RTCx RTC Instance | |
3051 * @param Value Value between Min_Data=0x00 and Max_Data=0xFFFF | |
3052 * @retval None | |
3053 */ | |
3054 __STATIC_INLINE void LL_RTC_WAKEUP_SetAutoReload(RTC_TypeDef *RTCx, uint32_t Value) | |
3055 { | |
3056 MODIFY_REG(RTCx->WUTR, RTC_WUTR_WUT, Value); | |
3057 } | |
3058 | |
3059 /** | |
3060 * @brief Get Wakeup auto-reload value | |
3061 * @rmtoll WUTR WUT LL_RTC_WAKEUP_GetAutoReload | |
3062 * @param RTCx RTC Instance | |
3063 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF | |
3064 */ | |
3065 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetAutoReload(RTC_TypeDef *RTCx) | |
3066 { | |
3067 return (uint32_t)(READ_BIT(RTCx->WUTR, RTC_WUTR_WUT)); | |
3068 } | |
3069 | |
3070 /** | |
3071 * @} | |
3072 */ | |
3073 | |
3074 /** @defgroup RTC_LL_EF_Backup_Registers Backup_Registers | |
3075 * @{ | |
3076 */ | |
3077 | |
3078 /** | |
3079 * @brief Writes a data in a specified RTC Backup data register. | |
3080 * @rmtoll BKPxR BKP LL_RTC_BAK_SetRegister | |
3081 * @param RTCx RTC Instance | |
3082 * @param BackupRegister This parameter can be one of the following values: | |
3083 * @arg @ref LL_RTC_BKP_DR0 | |
3084 * @arg @ref LL_RTC_BKP_DR1 | |
3085 * @arg @ref LL_RTC_BKP_DR2 | |
3086 * @arg @ref LL_RTC_BKP_DR3 | |
3087 * @arg @ref LL_RTC_BKP_DR4 | |
3088 * @arg @ref LL_RTC_BKP_DR5 | |
3089 * @arg @ref LL_RTC_BKP_DR6 | |
3090 * @arg @ref LL_RTC_BKP_DR7 | |
3091 * @arg @ref LL_RTC_BKP_DR8 | |
3092 * @arg @ref LL_RTC_BKP_DR9 | |
3093 * @arg @ref LL_RTC_BKP_DR10 | |
3094 * @arg @ref LL_RTC_BKP_DR11 | |
3095 * @arg @ref LL_RTC_BKP_DR12 | |
3096 * @arg @ref LL_RTC_BKP_DR13 | |
3097 * @arg @ref LL_RTC_BKP_DR14 | |
3098 * @arg @ref LL_RTC_BKP_DR15 | |
3099 * @arg @ref LL_RTC_BKP_DR16 | |
3100 * @arg @ref LL_RTC_BKP_DR17 | |
3101 * @arg @ref LL_RTC_BKP_DR18 | |
3102 * @arg @ref LL_RTC_BKP_DR19 | |
3103 * @param Data Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF | |
3104 * @retval None | |
3105 */ | |
3106 __STATIC_INLINE void LL_RTC_BAK_SetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister, uint32_t Data) | |
3107 { | |
3108 register uint32_t tmp = 0U; | |
3109 | |
3110 tmp = (uint32_t)(&(RTCx->BKP0R)); | |
3111 tmp += (BackupRegister * 4U); | |
3112 | |
3113 /* Write the specified register */ | |
3114 *(__IO uint32_t *)tmp = (uint32_t)Data; | |
3115 } | |
3116 | |
3117 /** | |
3118 * @brief Reads data from the specified RTC Backup data Register. | |
3119 * @rmtoll BKPxR BKP LL_RTC_BAK_GetRegister | |
3120 * @param RTCx RTC Instance | |
3121 * @param BackupRegister This parameter can be one of the following values: | |
3122 * @arg @ref LL_RTC_BKP_DR0 | |
3123 * @arg @ref LL_RTC_BKP_DR1 | |
3124 * @arg @ref LL_RTC_BKP_DR2 | |
3125 * @arg @ref LL_RTC_BKP_DR3 | |
3126 * @arg @ref LL_RTC_BKP_DR4 | |
3127 * @arg @ref LL_RTC_BKP_DR5 | |
3128 * @arg @ref LL_RTC_BKP_DR6 | |
3129 * @arg @ref LL_RTC_BKP_DR7 | |
3130 * @arg @ref LL_RTC_BKP_DR8 | |
3131 * @arg @ref LL_RTC_BKP_DR9 | |
3132 * @arg @ref LL_RTC_BKP_DR10 | |
3133 * @arg @ref LL_RTC_BKP_DR11 | |
3134 * @arg @ref LL_RTC_BKP_DR12 | |
3135 * @arg @ref LL_RTC_BKP_DR13 | |
3136 * @arg @ref LL_RTC_BKP_DR14 | |
3137 * @arg @ref LL_RTC_BKP_DR15 | |
3138 * @arg @ref LL_RTC_BKP_DR16 | |
3139 * @arg @ref LL_RTC_BKP_DR17 | |
3140 * @arg @ref LL_RTC_BKP_DR18 | |
3141 * @arg @ref LL_RTC_BKP_DR19 | |
3142 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF | |
3143 */ | |
3144 __STATIC_INLINE uint32_t LL_RTC_BAK_GetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister) | |
3145 { | |
3146 register uint32_t tmp = 0U; | |
3147 | |
3148 tmp = (uint32_t)(&(RTCx->BKP0R)); | |
3149 tmp += (BackupRegister * 4U); | |
3150 | |
3151 /* Read the specified register */ | |
3152 return (*(__IO uint32_t *)tmp); | |
3153 } | |
3154 | |
3155 /** | |
3156 * @} | |
3157 */ | |
3158 | |
3159 /** @defgroup RTC_LL_EF_Calibration Calibration | |
3160 * @{ | |
3161 */ | |
3162 | |
3163 /** | |
3164 * @brief Set Calibration output frequency (1 Hz or 512 Hz) | |
3165 * @note Bits are write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3166 * @rmtoll CR COE LL_RTC_CAL_SetOutputFreq\n | |
3167 * CR COSEL LL_RTC_CAL_SetOutputFreq | |
3168 * @param RTCx RTC Instance | |
3169 * @param Frequency This parameter can be one of the following values: | |
3170 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE | |
3171 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ | |
3172 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ | |
3173 * @retval None | |
3174 */ | |
3175 __STATIC_INLINE void LL_RTC_CAL_SetOutputFreq(RTC_TypeDef *RTCx, uint32_t Frequency) | |
3176 { | |
3177 MODIFY_REG(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL, Frequency); | |
3178 } | |
3179 | |
3180 /** | |
3181 * @brief Get Calibration output frequency (1 Hz or 512 Hz) | |
3182 * @rmtoll CR COE LL_RTC_CAL_GetOutputFreq\n | |
3183 * CR COSEL LL_RTC_CAL_GetOutputFreq | |
3184 * @param RTCx RTC Instance | |
3185 * @retval Returned value can be one of the following values: | |
3186 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE | |
3187 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ | |
3188 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ | |
3189 */ | |
3190 __STATIC_INLINE uint32_t LL_RTC_CAL_GetOutputFreq(RTC_TypeDef *RTCx) | |
3191 { | |
3192 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL)); | |
3193 } | |
3194 | |
3195 /** | |
3196 * @brief Enable Coarse digital calibration | |
3197 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3198 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) | |
3199 * @rmtoll CR DCE LL_RTC_CAL_EnableCoarseDigital | |
3200 * @param RTCx RTC Instance | |
3201 * @retval None | |
3202 */ | |
3203 __STATIC_INLINE void LL_RTC_CAL_EnableCoarseDigital(RTC_TypeDef *RTCx) | |
3204 { | |
3205 SET_BIT(RTCx->CR, RTC_CR_DCE); | |
3206 } | |
3207 | |
3208 /** | |
3209 * @brief Disable Coarse digital calibration | |
3210 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3211 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) | |
3212 * @rmtoll CR DCE LL_RTC_CAL_DisableCoarseDigital | |
3213 * @param RTCx RTC Instance | |
3214 * @retval None | |
3215 */ | |
3216 __STATIC_INLINE void LL_RTC_CAL_DisableCoarseDigital(RTC_TypeDef *RTCx) | |
3217 { | |
3218 CLEAR_BIT(RTCx->CR, RTC_CR_DCE); | |
3219 } | |
3220 | |
3221 /** | |
3222 * @brief Set the coarse digital calibration | |
3223 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3224 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) | |
3225 * @rmtoll CALIBR DCS LL_RTC_CAL_ConfigCoarseDigital\n | |
3226 * CALIBR DC LL_RTC_CAL_ConfigCoarseDigital | |
3227 * @param RTCx RTC Instance | |
3228 * @param Sign This parameter can be one of the following values: | |
3229 * @arg @ref LL_RTC_CALIB_SIGN_POSITIVE | |
3230 * @arg @ref LL_RTC_CALIB_SIGN_NEGATIVE | |
3231 * @param Value value of coarse calibration expressed in ppm (coded on 5 bits) | |
3232 * @note This Calibration value should be between 0 and 63 when using negative sign with a 2-ppm step. | |
3233 * @note This Calibration value should be between 0 and 126 when using positive sign with a 4-ppm step. | |
3234 * @retval None | |
3235 */ | |
3236 __STATIC_INLINE void LL_RTC_CAL_ConfigCoarseDigital(RTC_TypeDef* RTCx, uint32_t Sign, uint32_t Value) | |
3237 { | |
3238 MODIFY_REG(RTCx->CALIBR, RTC_CALIBR_DCS | RTC_CALIBR_DC, Sign | Value); | |
3239 } | |
3240 | |
3241 /** | |
3242 * @brief Get the coarse digital calibration value | |
3243 * @rmtoll CALIBR DC LL_RTC_CAL_GetCoarseDigitalValue | |
3244 * @param RTCx RTC Instance | |
3245 * @retval value of coarse calibration expressed in ppm (coded on 5 bits) | |
3246 */ | |
3247 __STATIC_INLINE uint32_t LL_RTC_CAL_GetCoarseDigitalValue(RTC_TypeDef *RTCx) | |
3248 { | |
3249 return (uint32_t)(READ_BIT(RTCx->CALIBR, RTC_CALIBR_DC)); | |
3250 } | |
3251 | |
3252 /** | |
3253 * @brief Get the coarse digital calibration sign | |
3254 * @rmtoll CALIBR DCS LL_RTC_CAL_GetCoarseDigitalSign | |
3255 * @param RTCx RTC Instance | |
3256 * @retval Returned value can be one of the following values: | |
3257 * @arg @ref LL_RTC_CALIB_SIGN_POSITIVE | |
3258 * @arg @ref LL_RTC_CALIB_SIGN_NEGATIVE | |
3259 */ | |
3260 __STATIC_INLINE uint32_t LL_RTC_CAL_GetCoarseDigitalSign(RTC_TypeDef* RTCx) | |
3261 { | |
3262 return (uint32_t)(READ_BIT(RTCx->CALIBR, RTC_CALIBR_DCS)); | |
3263 } | |
3264 | |
3265 /** | |
3266 * @brief Insert or not One RTCCLK pulse every 2exp11 pulses (frequency increased by 488.5 ppm) | |
3267 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3268 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR | |
3269 * @rmtoll CALR CALP LL_RTC_CAL_SetPulse | |
3270 * @param RTCx RTC Instance | |
3271 * @param Pulse This parameter can be one of the following values: | |
3272 * @arg @ref LL_RTC_CALIB_INSERTPULSE_NONE | |
3273 * @arg @ref LL_RTC_CALIB_INSERTPULSE_SET | |
3274 * @retval None | |
3275 */ | |
3276 __STATIC_INLINE void LL_RTC_CAL_SetPulse(RTC_TypeDef *RTCx, uint32_t Pulse) | |
3277 { | |
3278 MODIFY_REG(RTCx->CALR, RTC_CALR_CALP, Pulse); | |
3279 } | |
3280 | |
3281 /** | |
3282 * @brief Check if one RTCCLK has been inserted or not every 2exp11 pulses (frequency increased by 488.5 ppm) | |
3283 * @rmtoll CALR CALP LL_RTC_CAL_IsPulseInserted | |
3284 * @param RTCx RTC Instance | |
3285 * @retval State of bit (1 or 0). | |
3286 */ | |
3287 __STATIC_INLINE uint32_t LL_RTC_CAL_IsPulseInserted(RTC_TypeDef *RTCx) | |
3288 { | |
3289 return (READ_BIT(RTCx->CALR, RTC_CALR_CALP) == (RTC_CALR_CALP)); | |
3290 } | |
3291 | |
3292 /** | |
3293 * @brief Set the calibration cycle period | |
3294 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3295 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR | |
3296 * @rmtoll CALR CALW8 LL_RTC_CAL_SetPeriod\n | |
3297 * CALR CALW16 LL_RTC_CAL_SetPeriod | |
3298 * @param RTCx RTC Instance | |
3299 * @param Period This parameter can be one of the following values: | |
3300 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC | |
3301 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC | |
3302 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC | |
3303 * @retval None | |
3304 */ | |
3305 __STATIC_INLINE void LL_RTC_CAL_SetPeriod(RTC_TypeDef *RTCx, uint32_t Period) | |
3306 { | |
3307 MODIFY_REG(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16, Period); | |
3308 } | |
3309 | |
3310 /** | |
3311 * @brief Get the calibration cycle period | |
3312 * @rmtoll CALR CALW8 LL_RTC_CAL_GetPeriod\n | |
3313 * CALR CALW16 LL_RTC_CAL_GetPeriod | |
3314 * @param RTCx RTC Instance | |
3315 * @retval Returned value can be one of the following values: | |
3316 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC | |
3317 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC | |
3318 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC | |
3319 */ | |
3320 __STATIC_INLINE uint32_t LL_RTC_CAL_GetPeriod(RTC_TypeDef *RTCx) | |
3321 { | |
3322 return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16)); | |
3323 } | |
3324 | |
3325 /** | |
3326 * @brief Set Calibration minus | |
3327 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3328 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR | |
3329 * @rmtoll CALR CALM LL_RTC_CAL_SetMinus | |
3330 * @param RTCx RTC Instance | |
3331 * @param CalibMinus Value between Min_Data=0x00 and Max_Data=0x1FF | |
3332 * @retval None | |
3333 */ | |
3334 __STATIC_INLINE void LL_RTC_CAL_SetMinus(RTC_TypeDef *RTCx, uint32_t CalibMinus) | |
3335 { | |
3336 MODIFY_REG(RTCx->CALR, RTC_CALR_CALM, CalibMinus); | |
3337 } | |
3338 | |
3339 /** | |
3340 * @brief Get Calibration minus | |
3341 * @rmtoll CALR CALM LL_RTC_CAL_GetMinus | |
3342 * @param RTCx RTC Instance | |
3343 * @retval Value between Min_Data=0x00 and Max_Data= 0x1FF | |
3344 */ | |
3345 __STATIC_INLINE uint32_t LL_RTC_CAL_GetMinus(RTC_TypeDef *RTCx) | |
3346 { | |
3347 return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALM)); | |
3348 } | |
3349 | |
3350 /** | |
3351 * @} | |
3352 */ | |
3353 | |
3354 /** @defgroup RTC_LL_EF_FLAG_Management FLAG_Management | |
3355 * @{ | |
3356 */ | |
3357 | |
3358 /** | |
3359 * @brief Get Recalibration pending Flag | |
3360 * @rmtoll ISR RECALPF LL_RTC_IsActiveFlag_RECALP | |
3361 * @param RTCx RTC Instance | |
3362 * @retval State of bit (1 or 0). | |
3363 */ | |
3364 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RECALP(RTC_TypeDef *RTCx) | |
3365 { | |
3366 return (READ_BIT(RTCx->ISR, RTC_ISR_RECALPF) == (RTC_ISR_RECALPF)); | |
3367 } | |
3368 | |
3369 | |
3370 #if defined(RTC_TAMPER2_SUPPORT) | |
3371 /** | |
3372 * @brief Get RTC_TAMP2 detection flag | |
3373 * @rmtoll ISR TAMP2F LL_RTC_IsActiveFlag_TAMP2 | |
3374 * @param RTCx RTC Instance | |
3375 * @retval State of bit (1 or 0). | |
3376 */ | |
3377 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2(RTC_TypeDef *RTCx) | |
3378 { | |
3379 return (READ_BIT(RTCx->ISR, RTC_ISR_TAMP2F) == (RTC_ISR_TAMP2F)); | |
3380 } | |
3381 #endif /* RTC_TAMPER2_SUPPORT */ | |
3382 | |
3383 /** | |
3384 * @brief Get RTC_TAMP1 detection flag | |
3385 * @rmtoll ISR TAMP1F LL_RTC_IsActiveFlag_TAMP1 | |
3386 * @param RTCx RTC Instance | |
3387 * @retval State of bit (1 or 0). | |
3388 */ | |
3389 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1(RTC_TypeDef *RTCx) | |
3390 { | |
3391 return (READ_BIT(RTCx->ISR, RTC_ISR_TAMP1F) == (RTC_ISR_TAMP1F)); | |
3392 } | |
3393 | |
3394 /** | |
3395 * @brief Get Time-stamp overflow flag | |
3396 * @rmtoll ISR TSOVF LL_RTC_IsActiveFlag_TSOV | |
3397 * @param RTCx RTC Instance | |
3398 * @retval State of bit (1 or 0). | |
3399 */ | |
3400 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOV(RTC_TypeDef *RTCx) | |
3401 { | |
3402 return (READ_BIT(RTCx->ISR, RTC_ISR_TSOVF) == (RTC_ISR_TSOVF)); | |
3403 } | |
3404 | |
3405 /** | |
3406 * @brief Get Time-stamp flag | |
3407 * @rmtoll ISR TSF LL_RTC_IsActiveFlag_TS | |
3408 * @param RTCx RTC Instance | |
3409 * @retval State of bit (1 or 0). | |
3410 */ | |
3411 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TS(RTC_TypeDef *RTCx) | |
3412 { | |
3413 return (READ_BIT(RTCx->ISR, RTC_ISR_TSF) == (RTC_ISR_TSF)); | |
3414 } | |
3415 | |
3416 /** | |
3417 * @brief Get Wakeup timer flag | |
3418 * @rmtoll ISR WUTF LL_RTC_IsActiveFlag_WUT | |
3419 * @param RTCx RTC Instance | |
3420 * @retval State of bit (1 or 0). | |
3421 */ | |
3422 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUT(RTC_TypeDef *RTCx) | |
3423 { | |
3424 return (READ_BIT(RTCx->ISR, RTC_ISR_WUTF) == (RTC_ISR_WUTF)); | |
3425 } | |
3426 | |
3427 /** | |
3428 * @brief Get Alarm B flag | |
3429 * @rmtoll ISR ALRBF LL_RTC_IsActiveFlag_ALRB | |
3430 * @param RTCx RTC Instance | |
3431 * @retval State of bit (1 or 0). | |
3432 */ | |
3433 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRB(RTC_TypeDef *RTCx) | |
3434 { | |
3435 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRBF) == (RTC_ISR_ALRBF)); | |
3436 } | |
3437 | |
3438 /** | |
3439 * @brief Get Alarm A flag | |
3440 * @rmtoll ISR ALRAF LL_RTC_IsActiveFlag_ALRA | |
3441 * @param RTCx RTC Instance | |
3442 * @retval State of bit (1 or 0). | |
3443 */ | |
3444 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRA(RTC_TypeDef *RTCx) | |
3445 { | |
3446 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRAF) == (RTC_ISR_ALRAF)); | |
3447 } | |
3448 | |
3449 | |
3450 #if defined(RTC_TAMPER2_SUPPORT) | |
3451 /** | |
3452 * @brief Clear RTC_TAMP2 detection flag | |
3453 * @rmtoll ISR TAMP2F LL_RTC_ClearFlag_TAMP2 | |
3454 * @param RTCx RTC Instance | |
3455 * @retval None | |
3456 */ | |
3457 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP2(RTC_TypeDef *RTCx) | |
3458 { | |
3459 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP2F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); | |
3460 } | |
3461 #endif /* RTC_TAMPER2_SUPPORT */ | |
3462 | |
3463 /** | |
3464 * @brief Clear RTC_TAMP1 detection flag | |
3465 * @rmtoll ISR TAMP1F LL_RTC_ClearFlag_TAMP1 | |
3466 * @param RTCx RTC Instance | |
3467 * @retval None | |
3468 */ | |
3469 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP1(RTC_TypeDef *RTCx) | |
3470 { | |
3471 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP1F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); | |
3472 } | |
3473 | |
3474 /** | |
3475 * @brief Clear Time-stamp overflow flag | |
3476 * @rmtoll ISR TSOVF LL_RTC_ClearFlag_TSOV | |
3477 * @param RTCx RTC Instance | |
3478 * @retval None | |
3479 */ | |
3480 __STATIC_INLINE void LL_RTC_ClearFlag_TSOV(RTC_TypeDef *RTCx) | |
3481 { | |
3482 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSOVF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); | |
3483 } | |
3484 | |
3485 /** | |
3486 * @brief Clear Time-stamp flag | |
3487 * @rmtoll ISR TSF LL_RTC_ClearFlag_TS | |
3488 * @param RTCx RTC Instance | |
3489 * @retval None | |
3490 */ | |
3491 __STATIC_INLINE void LL_RTC_ClearFlag_TS(RTC_TypeDef *RTCx) | |
3492 { | |
3493 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); | |
3494 } | |
3495 | |
3496 /** | |
3497 * @brief Clear Wakeup timer flag | |
3498 * @rmtoll ISR WUTF LL_RTC_ClearFlag_WUT | |
3499 * @param RTCx RTC Instance | |
3500 * @retval None | |
3501 */ | |
3502 __STATIC_INLINE void LL_RTC_ClearFlag_WUT(RTC_TypeDef *RTCx) | |
3503 { | |
3504 WRITE_REG(RTCx->ISR, (~((RTC_ISR_WUTF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); | |
3505 } | |
3506 | |
3507 /** | |
3508 * @brief Clear Alarm B flag | |
3509 * @rmtoll ISR ALRBF LL_RTC_ClearFlag_ALRB | |
3510 * @param RTCx RTC Instance | |
3511 * @retval None | |
3512 */ | |
3513 __STATIC_INLINE void LL_RTC_ClearFlag_ALRB(RTC_TypeDef *RTCx) | |
3514 { | |
3515 WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRBF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); | |
3516 } | |
3517 | |
3518 /** | |
3519 * @brief Clear Alarm A flag | |
3520 * @rmtoll ISR ALRAF LL_RTC_ClearFlag_ALRA | |
3521 * @param RTCx RTC Instance | |
3522 * @retval None | |
3523 */ | |
3524 __STATIC_INLINE void LL_RTC_ClearFlag_ALRA(RTC_TypeDef *RTCx) | |
3525 { | |
3526 WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRAF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); | |
3527 } | |
3528 | |
3529 /** | |
3530 * @brief Get Initialization flag | |
3531 * @rmtoll ISR INITF LL_RTC_IsActiveFlag_INIT | |
3532 * @param RTCx RTC Instance | |
3533 * @retval State of bit (1 or 0). | |
3534 */ | |
3535 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INIT(RTC_TypeDef *RTCx) | |
3536 { | |
3537 return (READ_BIT(RTCx->ISR, RTC_ISR_INITF) == (RTC_ISR_INITF)); | |
3538 } | |
3539 | |
3540 /** | |
3541 * @brief Get Registers synchronization flag | |
3542 * @rmtoll ISR RSF LL_RTC_IsActiveFlag_RS | |
3543 * @param RTCx RTC Instance | |
3544 * @retval State of bit (1 or 0). | |
3545 */ | |
3546 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RS(RTC_TypeDef *RTCx) | |
3547 { | |
3548 return (READ_BIT(RTCx->ISR, RTC_ISR_RSF) == (RTC_ISR_RSF)); | |
3549 } | |
3550 | |
3551 /** | |
3552 * @brief Clear Registers synchronization flag | |
3553 * @rmtoll ISR RSF LL_RTC_ClearFlag_RS | |
3554 * @param RTCx RTC Instance | |
3555 * @retval None | |
3556 */ | |
3557 __STATIC_INLINE void LL_RTC_ClearFlag_RS(RTC_TypeDef *RTCx) | |
3558 { | |
3559 WRITE_REG(RTCx->ISR, (~((RTC_ISR_RSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); | |
3560 } | |
3561 | |
3562 /** | |
3563 * @brief Get Initialization status flag | |
3564 * @rmtoll ISR INITS LL_RTC_IsActiveFlag_INITS | |
3565 * @param RTCx RTC Instance | |
3566 * @retval State of bit (1 or 0). | |
3567 */ | |
3568 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INITS(RTC_TypeDef *RTCx) | |
3569 { | |
3570 return (READ_BIT(RTCx->ISR, RTC_ISR_INITS) == (RTC_ISR_INITS)); | |
3571 } | |
3572 | |
3573 /** | |
3574 * @brief Get Shift operation pending flag | |
3575 * @rmtoll ISR SHPF LL_RTC_IsActiveFlag_SHP | |
3576 * @param RTCx RTC Instance | |
3577 * @retval State of bit (1 or 0). | |
3578 */ | |
3579 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SHP(RTC_TypeDef *RTCx) | |
3580 { | |
3581 return (READ_BIT(RTCx->ISR, RTC_ISR_SHPF) == (RTC_ISR_SHPF)); | |
3582 } | |
3583 | |
3584 /** | |
3585 * @brief Get Wakeup timer write flag | |
3586 * @rmtoll ISR WUTWF LL_RTC_IsActiveFlag_WUTW | |
3587 * @param RTCx RTC Instance | |
3588 * @retval State of bit (1 or 0). | |
3589 */ | |
3590 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTW(RTC_TypeDef *RTCx) | |
3591 { | |
3592 return (READ_BIT(RTCx->ISR, RTC_ISR_WUTWF) == (RTC_ISR_WUTWF)); | |
3593 } | |
3594 | |
3595 /** | |
3596 * @brief Get Alarm B write flag | |
3597 * @rmtoll ISR ALRBWF LL_RTC_IsActiveFlag_ALRBW | |
3598 * @param RTCx RTC Instance | |
3599 * @retval State of bit (1 or 0). | |
3600 */ | |
3601 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBW(RTC_TypeDef *RTCx) | |
3602 { | |
3603 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRBWF) == (RTC_ISR_ALRBWF)); | |
3604 } | |
3605 | |
3606 /** | |
3607 * @brief Get Alarm A write flag | |
3608 * @rmtoll ISR ALRAWF LL_RTC_IsActiveFlag_ALRAW | |
3609 * @param RTCx RTC Instance | |
3610 * @retval State of bit (1 or 0). | |
3611 */ | |
3612 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAW(RTC_TypeDef *RTCx) | |
3613 { | |
3614 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRAWF) == (RTC_ISR_ALRAWF)); | |
3615 } | |
3616 | |
3617 /** | |
3618 * @} | |
3619 */ | |
3620 | |
3621 /** @defgroup RTC_LL_EF_IT_Management IT_Management | |
3622 * @{ | |
3623 */ | |
3624 | |
3625 /** | |
3626 * @brief Enable Time-stamp interrupt | |
3627 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3628 * @rmtoll CR TSIE LL_RTC_EnableIT_TS | |
3629 * @param RTCx RTC Instance | |
3630 * @retval None | |
3631 */ | |
3632 __STATIC_INLINE void LL_RTC_EnableIT_TS(RTC_TypeDef *RTCx) | |
3633 { | |
3634 SET_BIT(RTCx->CR, RTC_CR_TSIE); | |
3635 } | |
3636 | |
3637 /** | |
3638 * @brief Disable Time-stamp interrupt | |
3639 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3640 * @rmtoll CR TSIE LL_RTC_DisableIT_TS | |
3641 * @param RTCx RTC Instance | |
3642 * @retval None | |
3643 */ | |
3644 __STATIC_INLINE void LL_RTC_DisableIT_TS(RTC_TypeDef *RTCx) | |
3645 { | |
3646 CLEAR_BIT(RTCx->CR, RTC_CR_TSIE); | |
3647 } | |
3648 | |
3649 /** | |
3650 * @brief Enable Wakeup timer interrupt | |
3651 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3652 * @rmtoll CR WUTIE LL_RTC_EnableIT_WUT | |
3653 * @param RTCx RTC Instance | |
3654 * @retval None | |
3655 */ | |
3656 __STATIC_INLINE void LL_RTC_EnableIT_WUT(RTC_TypeDef *RTCx) | |
3657 { | |
3658 SET_BIT(RTCx->CR, RTC_CR_WUTIE); | |
3659 } | |
3660 | |
3661 /** | |
3662 * @brief Disable Wakeup timer interrupt | |
3663 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3664 * @rmtoll CR WUTIE LL_RTC_DisableIT_WUT | |
3665 * @param RTCx RTC Instance | |
3666 * @retval None | |
3667 */ | |
3668 __STATIC_INLINE void LL_RTC_DisableIT_WUT(RTC_TypeDef *RTCx) | |
3669 { | |
3670 CLEAR_BIT(RTCx->CR, RTC_CR_WUTIE); | |
3671 } | |
3672 | |
3673 /** | |
3674 * @brief Enable Alarm B interrupt | |
3675 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3676 * @rmtoll CR ALRBIE LL_RTC_EnableIT_ALRB | |
3677 * @param RTCx RTC Instance | |
3678 * @retval None | |
3679 */ | |
3680 __STATIC_INLINE void LL_RTC_EnableIT_ALRB(RTC_TypeDef *RTCx) | |
3681 { | |
3682 SET_BIT(RTCx->CR, RTC_CR_ALRBIE); | |
3683 } | |
3684 | |
3685 /** | |
3686 * @brief Disable Alarm B interrupt | |
3687 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3688 * @rmtoll CR ALRBIE LL_RTC_DisableIT_ALRB | |
3689 * @param RTCx RTC Instance | |
3690 * @retval None | |
3691 */ | |
3692 __STATIC_INLINE void LL_RTC_DisableIT_ALRB(RTC_TypeDef *RTCx) | |
3693 { | |
3694 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBIE); | |
3695 } | |
3696 | |
3697 /** | |
3698 * @brief Enable Alarm A interrupt | |
3699 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3700 * @rmtoll CR ALRAIE LL_RTC_EnableIT_ALRA | |
3701 * @param RTCx RTC Instance | |
3702 * @retval None | |
3703 */ | |
3704 __STATIC_INLINE void LL_RTC_EnableIT_ALRA(RTC_TypeDef *RTCx) | |
3705 { | |
3706 SET_BIT(RTCx->CR, RTC_CR_ALRAIE); | |
3707 } | |
3708 | |
3709 /** | |
3710 * @brief Disable Alarm A interrupt | |
3711 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. | |
3712 * @rmtoll CR ALRAIE LL_RTC_DisableIT_ALRA | |
3713 * @param RTCx RTC Instance | |
3714 * @retval None | |
3715 */ | |
3716 __STATIC_INLINE void LL_RTC_DisableIT_ALRA(RTC_TypeDef *RTCx) | |
3717 { | |
3718 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAIE); | |
3719 } | |
3720 | |
3721 /** | |
3722 * @brief Enable all Tamper Interrupt | |
3723 * @rmtoll TAFCR TAMPIE LL_RTC_EnableIT_TAMP | |
3724 * @param RTCx RTC Instance | |
3725 * @retval None | |
3726 */ | |
3727 __STATIC_INLINE void LL_RTC_EnableIT_TAMP(RTC_TypeDef *RTCx) | |
3728 { | |
3729 SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPIE); | |
3730 } | |
3731 | |
3732 /** | |
3733 * @brief Disable all Tamper Interrupt | |
3734 * @rmtoll TAFCR TAMPIE LL_RTC_DisableIT_TAMP | |
3735 * @param RTCx RTC Instance | |
3736 * @retval None | |
3737 */ | |
3738 __STATIC_INLINE void LL_RTC_DisableIT_TAMP(RTC_TypeDef *RTCx) | |
3739 { | |
3740 CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPIE); | |
3741 } | |
3742 | |
3743 /** | |
3744 * @brief Check if Time-stamp interrupt is enabled or not | |
3745 * @rmtoll CR TSIE LL_RTC_IsEnabledIT_TS | |
3746 * @param RTCx RTC Instance | |
3747 * @retval State of bit (1 or 0). | |
3748 */ | |
3749 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TS(RTC_TypeDef *RTCx) | |
3750 { | |
3751 return (READ_BIT(RTCx->CR, RTC_CR_TSIE) == (RTC_CR_TSIE)); | |
3752 } | |
3753 | |
3754 /** | |
3755 * @brief Check if Wakeup timer interrupt is enabled or not | |
3756 * @rmtoll CR WUTIE LL_RTC_IsEnabledIT_WUT | |
3757 * @param RTCx RTC Instance | |
3758 * @retval State of bit (1 or 0). | |
3759 */ | |
3760 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_WUT(RTC_TypeDef *RTCx) | |
3761 { | |
3762 return (READ_BIT(RTCx->CR, RTC_CR_WUTIE) == (RTC_CR_WUTIE)); | |
3763 } | |
3764 | |
3765 /** | |
3766 * @brief Check if Alarm B interrupt is enabled or not | |
3767 * @rmtoll CR ALRBIE LL_RTC_IsEnabledIT_ALRB | |
3768 * @param RTCx RTC Instance | |
3769 * @retval State of bit (1 or 0). | |
3770 */ | |
3771 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRB(RTC_TypeDef *RTCx) | |
3772 { | |
3773 return (READ_BIT(RTCx->CR, RTC_CR_ALRBIE) == (RTC_CR_ALRBIE)); | |
3774 } | |
3775 | |
3776 /** | |
3777 * @brief Check if Alarm A interrupt is enabled or not | |
3778 * @rmtoll CR ALRAIE LL_RTC_IsEnabledIT_ALRA | |
3779 * @param RTCx RTC Instance | |
3780 * @retval State of bit (1 or 0). | |
3781 */ | |
3782 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRA(RTC_TypeDef *RTCx) | |
3783 { | |
3784 return (READ_BIT(RTCx->CR, RTC_CR_ALRAIE) == (RTC_CR_ALRAIE)); | |
3785 } | |
3786 | |
3787 /** | |
3788 * @brief Check if all the TAMPER interrupts are enabled or not | |
3789 * @rmtoll TAFCR TAMPIE LL_RTC_IsEnabledIT_TAMP | |
3790 * @param RTCx RTC Instance | |
3791 * @retval State of bit (1 or 0). | |
3792 */ | |
3793 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP(RTC_TypeDef *RTCx) | |
3794 { | |
3795 return (READ_BIT(RTCx->TAFCR, | |
3796 RTC_TAFCR_TAMPIE) == (RTC_TAFCR_TAMPIE)); | |
3797 } | |
3798 | |
3799 /** | |
3800 * @} | |
3801 */ | |
3802 | |
3803 #if defined(USE_FULL_LL_DRIVER) | |
3804 /** @defgroup RTC_LL_EF_Init Initialization and de-initialization functions | |
3805 * @{ | |
3806 */ | |
3807 | |
3808 ErrorStatus LL_RTC_DeInit(RTC_TypeDef *RTCx); | |
3809 ErrorStatus LL_RTC_Init(RTC_TypeDef *RTCx, LL_RTC_InitTypeDef *RTC_InitStruct); | |
3810 void LL_RTC_StructInit(LL_RTC_InitTypeDef *RTC_InitStruct); | |
3811 ErrorStatus LL_RTC_TIME_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_TimeTypeDef *RTC_TimeStruct); | |
3812 void LL_RTC_TIME_StructInit(LL_RTC_TimeTypeDef *RTC_TimeStruct); | |
3813 ErrorStatus LL_RTC_DATE_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_DateTypeDef *RTC_DateStruct); | |
3814 void LL_RTC_DATE_StructInit(LL_RTC_DateTypeDef *RTC_DateStruct); | |
3815 ErrorStatus LL_RTC_ALMA_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct); | |
3816 ErrorStatus LL_RTC_ALMB_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct); | |
3817 void LL_RTC_ALMA_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct); | |
3818 void LL_RTC_ALMB_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct); | |
3819 ErrorStatus LL_RTC_EnterInitMode(RTC_TypeDef *RTCx); | |
3820 ErrorStatus LL_RTC_ExitInitMode(RTC_TypeDef *RTCx); | |
3821 ErrorStatus LL_RTC_WaitForSynchro(RTC_TypeDef *RTCx); | |
3822 | |
3823 /** | |
3824 * @} | |
3825 */ | |
3826 #endif /* USE_FULL_LL_DRIVER */ | |
3827 | |
3828 /** | |
3829 * @} | |
3830 */ | |
3831 | |
3832 /** | |
3833 * @} | |
3834 */ | |
3835 | |
3836 #endif /* defined(RTC) */ | |
3837 | |
3838 /** | |
3839 * @} | |
3840 */ | |
3841 | |
3842 #ifdef __cplusplus | |
3843 } | |
3844 #endif | |
3845 | |
3846 #endif /* __STM32F4xx_LL_RTC_H */ | |
3847 | |
3848 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |