1 /**
2 ******************************************************************************
3 * @file stm32wbaxx_ll_rtc.h
4 * @author MCD Application Team
5 * @brief Header file of RTC LL module.
6 ******************************************************************************
7 * @attention
8 *
9 * Copyright (c) 2022 STMicroelectronics.
10 * All rights reserved.
11 *
12 * This software is licensed under terms that can be found in the LICENSE file
13 * in the root directory of this software component.
14 * If no LICENSE file comes with this software, it is provided AS-IS.
15 *
16 ******************************************************************************
17 */
18
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32WBAxx_LL_RTC_H
21 #define STM32WBAxx_LL_RTC_H
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32wbaxx.h"
29
30 /** @addtogroup STM32WBAxx_LL_Driver
31 * @{
32 */
33
34 #if defined(RTC)
35
36 /** @defgroup RTC_LL RTC
37 * @{
38 */
39
40 /* Private types -------------------------------------------------------------*/
41 /* Private variables ---------------------------------------------------------*/
42 /* Private constants ---------------------------------------------------------*/
43 /** @defgroup RTC_LL_Private_Constants RTC Private Constants
44 * @{
45 */
46 /* Masks Definition */
47 #define RTC_LL_INIT_MASK 0xFFFFFFFFU
48 #define RTC_LL_RSF_MASK 0xFFFFFF5FU
49
50 /* Write protection defines */
51 #define RTC_WRITE_PROTECTION_DISABLE (uint8_t)0xFF
52 #define RTC_WRITE_PROTECTION_ENABLE_1 (uint8_t)0xCA
53 #define RTC_WRITE_PROTECTION_ENABLE_2 (uint8_t)0x53
54
55 /* Defines used to combine date & time */
56 #define RTC_OFFSET_WEEKDAY 24U
57 #define RTC_OFFSET_DAY 16U
58 #define RTC_OFFSET_MONTH 8U
59 #define RTC_OFFSET_HOUR 16U
60 #define RTC_OFFSET_MINUTE 8U
61
62 /**
63 * @}
64 */
65
66 /* Private macros ------------------------------------------------------------*/
67 #if defined(USE_FULL_LL_DRIVER)
68 /** @defgroup RTC_LL_Private_Macros RTC Private Macros
69 * @{
70 */
71 /**
72 * @}
73 */
74 #endif /*USE_FULL_LL_DRIVER*/
75
76 #if !defined (UNUSED)
77 #define UNUSED(x) ((void)(x))
78 #endif /* !defined (UNUSED) */
79
80 /* Exported types ------------------------------------------------------------*/
81 #if defined(USE_FULL_LL_DRIVER)
82 /** @defgroup RTC_LL_ES_INIT RTC Exported Init structure
83 * @{
84 */
85
86 /**
87 * @brief RTC Init structures definition
88 */
89 typedef struct
90 {
91 uint32_t HourFormat; /*!< Specifies the RTC Hours Format.
92 This parameter can be a value of @ref RTC_LL_EC_HOURFORMAT
93
94 This feature can be modified afterwards using unitary function
95 @ref LL_RTC_SetHourFormat(). */
96
97 uint32_t AsynchPrescaler; /*!< Specifies the RTC Asynchronous Predivider value.
98 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F
99
100 This feature can be modified afterwards using unitary function
101 @ref LL_RTC_SetAsynchPrescaler(). */
102
103 uint32_t SynchPrescaler; /*!< Specifies the RTC Synchronous Predivider value.
104 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF
105
106 This feature can be modified afterwards using unitary function
107 @ref LL_RTC_SetSynchPrescaler(). */
108 } LL_RTC_InitTypeDef;
109
110 /**
111 * @brief RTC Time structure definition
112 */
113 typedef struct
114 {
115 uint32_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
116 This parameter can be a value of @ref RTC_LL_EC_TIME_FORMAT
117
118 This feature can be modified afterwards using unitary function
119 @ref LL_RTC_TIME_SetFormat(). */
120
121 uint8_t Hours; /*!< Specifies the RTC Time Hours.
122 This parameter must be a number between Min_Data = 0 and Max_Data = 12
123 if the @ref LL_RTC_TIME_FORMAT_PM is selected.
124
125 This parameter must be a number between Min_Data = 0 and Max_Data = 23
126 if the @ref LL_RTC_TIME_FORMAT_AM_OR_24 is selected.
127
128 This feature can be modified afterwards using unitary function
129 @ref LL_RTC_TIME_SetHour(). */
130
131 uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
132 This parameter must be a number between Min_Data = 0 and Max_Data = 59
133
134 This feature can be modified afterwards using unitary function
135 @ref LL_RTC_TIME_SetMinute(). */
136
137 uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
138 This parameter must be a number between Min_Data = 0 and Max_Data = 59
139
140 This feature can be modified afterwards using unitary function
141 @ref LL_RTC_TIME_SetSecond(). */
142 } LL_RTC_TimeTypeDef;
143
144 /**
145 * @brief RTC Date structure definition
146 */
147 typedef struct
148 {
149 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay.
150 This parameter can be a value of @ref RTC_LL_EC_WEEKDAY
151
152 This feature can be modified afterwards using unitary function
153 @ref LL_RTC_DATE_SetWeekDay(). */
154
155 uint8_t Month; /*!< Specifies the RTC Date Month.
156 This parameter can be a value of @ref RTC_LL_EC_MONTH
157
158 This feature can be modified afterwards using unitary function
159 @ref LL_RTC_DATE_SetMonth(). */
160
161 uint8_t Day; /*!< Specifies the RTC Date Day.
162 This parameter must be a number between Min_Data = 1 and Max_Data = 31
163
164 This feature can be modified afterwards using unitary function
165 @ref LL_RTC_DATE_SetDay(). */
166
167 uint8_t Year; /*!< Specifies the RTC Date Year.
168 This parameter must be a number between Min_Data = 0 and Max_Data = 99
169
170 This feature can be modified afterwards using unitary function
171 @ref LL_RTC_DATE_SetYear(). */
172 } LL_RTC_DateTypeDef;
173
174 /**
175 * @brief RTC Alarm structure definition
176 */
177 typedef struct
178 {
179 LL_RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members. */
180
181 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks.
182 This parameter can be a value of @ref RTC_LL_EC_ALMA_MASK for ALARM A or
183 @ref RTC_LL_EC_ALMB_MASK for ALARM B.
184
185 This feature can be modified afterwards using unitary function
186 @ref LL_RTC_ALMA_SetMask() for ALARM A or @ref LL_RTC_ALMB_SetMask() for ALARM B.
187 */
188
189 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on day or WeekDay.
190 This parameter can be a value of @ref RTC_LL_EC_ALMA_WEEKDAY_SELECTION
191 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
194 @ref LL_RTC_ALMA_EnableWeekday() or @ref LL_RTC_ALMA_DisableWeekday() for ALARM A
195 or @ref LL_RTC_ALMB_EnableWeekday() or @ref LL_RTC_ALMB_DisableWeekday()
196 for ALARM B.
197 */
198
199 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Day/WeekDay.
200 If AlarmDateWeekDaySel set to day, this parameter must be a number
201 between Min_Data = 1 and Max_Data = 31.
202
203 This feature can be modified afterwards using unitary function
204 @ref LL_RTC_ALMA_SetDay() for ALARM A or @ref LL_RTC_ALMB_SetDay() for ALARM B.
205
206 If AlarmDateWeekDaySel set to Weekday, this parameter can be a value of
207 @ref RTC_LL_EC_WEEKDAY.
208
209 This feature can be modified afterwards using unitary function
210 @ref LL_RTC_ALMA_SetWeekDay() for ALARM A or
211 @ref LL_RTC_ALMB_SetWeekDay() for ALARM B.
212 */
213 } LL_RTC_AlarmTypeDef;
214
215 /**
216 * @}
217 */
218 #endif /* USE_FULL_LL_DRIVER */
219
220 /* Exported constants --------------------------------------------------------*/
221 /** @defgroup RTC_LL_Exported_Constants RTC Exported Constants
222 * @{
223 */
224
225 #if defined(USE_FULL_LL_DRIVER)
226 /** @defgroup RTC_LL_EC_FORMAT FORMAT
227 * @{
228 */
229 #define LL_RTC_FORMAT_BIN 0U /*!< Binary data format */
230 #define LL_RTC_FORMAT_BCD 1U /*!< BCD data format */
231 /**
232 * @}
233 */
234
235 /** @defgroup RTC_LL_EC_ALMA_WEEKDAY_SELECTION RTC Alarm A Date WeekDay
236 * @{
237 */
238 #define LL_RTC_ALMA_DATEWEEKDAYSEL_DATE 0U /*!< Alarm A Date is selected */
239 #define LL_RTC_ALMA_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMAR_WDSEL /*!< Alarm A WeekDay is selected */
240 /**
241 * @}
242 */
243
244 /** @defgroup RTC_LL_EC_ALMB_WEEKDAY_SELECTION RTC Alarm B Date WeekDay
245 * @{
246 */
247 #define LL_RTC_ALMB_DATEWEEKDAYSEL_DATE 0U /*!< Alarm B Date is selected */
248 #define LL_RTC_ALMB_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMBR_WDSEL /*!< Alarm B WeekDay is selected */
249 /**
250 * @}
251 */
252
253 #endif /* USE_FULL_LL_DRIVER */
254
255 /** @defgroup RTC_LL_EC_GET_FLAG Get Flags Defines
256 * @brief Flags defines which can be used with LL_RTC_ReadReg function
257 * @{
258 */
259 #define LL_RTC_SCR_SSRUF RTC_SCR_CSSRUF
260 #define LL_RTC_SCR_TSOVF RTC_SCR_CTSOVF
261 #define LL_RTC_SCR_TSF RTC_SCR_CTSF
262 #define LL_RTC_SCR_WUTF RTC_SCR_CWUTF
263 #define LL_RTC_SCR_ALRBF RTC_SCR_CALRBF
264 #define LL_RTC_SCR_ALRAF RTC_SCR_CALRAF
265
266 #define LL_RTC_ICSR_RECALPF RTC_ICSR_RECALPF
267 #define LL_RTC_ICSR_BCDU_2 RTC_ICSR_BCDU_2
268 #define LL_RTC_ICSR_BCDU_1 RTC_ICSR_BCDU_1
269 #define LL_RTC_ICSR_BCDU_0 RTC_ICSR_BCDU_0
270 #define LL_RTC_ICSR_BIN_1 RTC_ICSR_BIN_1
271 #define LL_RTC_ICSR_BIN_0 RTC_ICSR_BIN_0
272 #define LL_RTC_ICSR_INITF RTC_ICSR_INITF
273 #define LL_RTC_ICSR_RSF RTC_ICSR_RSF
274 #define LL_RTC_ICSR_INITS RTC_ICSR_INITS
275 #define LL_RTC_ICSR_SHPF RTC_ICSR_SHPF
276 #define LL_RTC_ICSR_WUTWF RTC_ICSR_WUTWF
277 /**
278 * @}
279 */
280
281 /** @defgroup RTC_LL_EC_IT IT Defines
282 * @brief IT defines which can be used with LL_RTC_ReadReg and LL_RTC_WriteReg functions
283 * @{
284 */
285 #define LL_RTC_CR_TSIE RTC_CR_TSIE
286 #define LL_RTC_CR_WUTIE RTC_CR_WUTIE
287 #define LL_RTC_CR_ALRBIE RTC_CR_ALRBIE
288 #define LL_RTC_CR_ALRAIE RTC_CR_ALRAIE
289 /**
290 * @}
291 */
292
293 /** @defgroup RTC_LL_EC_WEEKDAY WEEK DAY
294 * @{
295 */
296 #define LL_RTC_WEEKDAY_MONDAY (uint8_t)0x01 /*!< Monday */
297 #define LL_RTC_WEEKDAY_TUESDAY (uint8_t)0x02 /*!< Tuesday */
298 #define LL_RTC_WEEKDAY_WEDNESDAY (uint8_t)0x03 /*!< Wednesday */
299 #define LL_RTC_WEEKDAY_THURSDAY (uint8_t)0x04 /*!< Thrusday */
300 #define LL_RTC_WEEKDAY_FRIDAY (uint8_t)0x05 /*!< Friday */
301 #define LL_RTC_WEEKDAY_SATURDAY (uint8_t)0x06 /*!< Saturday */
302 #define LL_RTC_WEEKDAY_SUNDAY (uint8_t)0x07 /*!< Sunday */
303 /**
304 * @}
305 */
306
307 /** @defgroup RTC_LL_EC_MONTH MONTH
308 * @{
309 */
310 #define LL_RTC_MONTH_JANUARY (uint8_t)0x01 /*!< January */
311 #define LL_RTC_MONTH_FEBRUARY (uint8_t)0x02 /*!< February */
312 #define LL_RTC_MONTH_MARCH (uint8_t)0x03 /*!< March */
313 #define LL_RTC_MONTH_APRIL (uint8_t)0x04 /*!< April */
314 #define LL_RTC_MONTH_MAY (uint8_t)0x05 /*!< May */
315 #define LL_RTC_MONTH_JUNE (uint8_t)0x06 /*!< June */
316 #define LL_RTC_MONTH_JULY (uint8_t)0x07 /*!< July */
317 #define LL_RTC_MONTH_AUGUST (uint8_t)0x08 /*!< August */
318 #define LL_RTC_MONTH_SEPTEMBER (uint8_t)0x09 /*!< September */
319 #define LL_RTC_MONTH_OCTOBER (uint8_t)0x10 /*!< October */
320 #define LL_RTC_MONTH_NOVEMBER (uint8_t)0x11 /*!< November */
321 #define LL_RTC_MONTH_DECEMBER (uint8_t)0x12 /*!< December */
322 /**
323 * @}
324 */
325
326 /** @defgroup RTC_LL_EC_HOURFORMAT HOUR FORMAT
327 * @{
328 */
329 #define LL_RTC_HOURFORMAT_24HOUR 0U /*!< 24 hour/day format */
330 #define LL_RTC_HOURFORMAT_AMPM RTC_CR_FMT /*!< AM/PM hour format */
331 /**
332 * @}
333 */
334
335 #if defined(RTC_CR_OSEL)
336 /** @defgroup RTC_LL_EC_ALARMOUT ALARM OUTPUT
337 * @{
338 */
339 #define LL_RTC_ALARMOUT_DISABLE 0U /*!< Output disabled */
340 #define LL_RTC_ALARMOUT_ALMA RTC_CR_OSEL_0 /*!< Alarm A output enabled */
341 #define LL_RTC_ALARMOUT_ALMB RTC_CR_OSEL_1 /*!< Alarm B output enabled */
342 #define LL_RTC_ALARMOUT_WAKEUP RTC_CR_OSEL /*!< Wakeup output enabled */
343 /**
344 * @}
345 */
346 #endif /* RTC_CR_OSEL */
347
348 /** @defgroup RTC_LL_EC_ALARM_OUTPUTTYPE ALARM OUTPUT TYPE
349 * @{
350 */
351 #define LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL 0U /*!< RTC_ALARM is push-pull output */
352 #define LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN RTC_CR_TAMPALRM_TYPE /*!< RTC_ALARM is open-drain output */
353 /**
354 * @}
355 */
356
357 /** @defgroup RTC_LL_EC_OUTPUTPOLARITY_PIN OUTPUT POLARITY PIN
358 * @{
359 */
360 #define LL_RTC_OUTPUTPOLARITY_PIN_HIGH 0U /*!< Pin is high when ALRAF/ALRBF/WUTF is asserted (depending on OSEL) */
361 #define LL_RTC_OUTPUTPOLARITY_PIN_LOW RTC_CR_POL /*!< Pin is low when ALRAF/ALRBF/WUTF is asserted (depending on OSEL) */
362 /**
363 * @}
364 */
365
366 /** @defgroup RTC_LL_EC_TIME_FORMAT TIME FORMAT
367 * @{
368 */
369 #define LL_RTC_TIME_FORMAT_AM_OR_24 0U /*!< AM or 24-hour format */
370 #define LL_RTC_TIME_FORMAT_PM RTC_TR_PM /*!< PM */
371 /**
372 * @}
373 */
374
375 /** @defgroup RTC_LL_EC_SHIFT_SECOND SHIFT SECOND
376 * @{
377 */
378 #define LL_RTC_SHIFT_SECOND_DELAY 0U /*!< Delay (seconds) = SUBFS / (PREDIV_S + 1) */
379 #define LL_RTC_SHIFT_SECOND_ADVANCE RTC_SHIFTR_ADD1S /*!< Advance (seconds) = (1 - (SUBFS / (PREDIV_S + 1))) */
380 /**
381 * @}
382 */
383
384 /** @defgroup RTC_LL_EC_ALMA_MASK ALARMA MASK
385 * @{
386 */
387 #define LL_RTC_ALMA_MASK_NONE 0U /*!< No masks applied on Alarm A */
388 #define LL_RTC_ALMA_MASK_DATEWEEKDAY RTC_ALRMAR_MSK4 /*!< Date/day do not care in Alarm A comparison */
389 #define LL_RTC_ALMA_MASK_HOURS RTC_ALRMAR_MSK3 /*!< Hours do not care in Alarm A comparison */
390 #define LL_RTC_ALMA_MASK_MINUTES RTC_ALRMAR_MSK2 /*!< Minutes do not care in Alarm A comparison */
391 #define LL_RTC_ALMA_MASK_SECONDS RTC_ALRMAR_MSK1 /*!< Seconds do not care in Alarm A comparison */
392 #define LL_RTC_ALMA_MASK_ALL (RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1) /*!< Masks all */
393 /**
394 * @}
395 */
396
397 /** @defgroup RTC_LL_EC_ALMA_TIME_FORMAT ALARMA TIME FORMAT
398 * @{
399 */
400 #define LL_RTC_ALMA_TIME_FORMAT_AM 0U /*!< AM or 24-hour format */
401 #define LL_RTC_ALMA_TIME_FORMAT_PM RTC_ALRMAR_PM /*!< PM */
402 /**
403 * @}
404 */
405
406 /** @defgroup RTC_LL_EC_ALMA_SUBSECONDBIN_AUTOCLR RTC Alarm Sub Seconds with binary mode auto clear Definitions
407 * @{
408 */
409 #define LL_RTC_ALMA_SUBSECONDBIN_AUTOCLR_NO 0UL
410 /*!< The synchronous binary counter (SS[31:0] in RTC_SSR) is free-running. */
411
412 #define LL_RTC_ALMA_SUBSECONDBIN_AUTOCLR_YES RTC_ALRMASSR_SSCLR
413 /*!< The synchronous binary counter (SS[31:0] in RTC_SSR) is running from 0xFFFF FFFF to RTC_ALRMABINR -> SS[31:0]
414 value and is automatically reloaded with 0xFFFF FFFF when reaching RTC_ALRMABINR -> SS[31:0]. */
415 /**
416 * @}
417 */
418
419 /** @defgroup RTC_LL_EC_ALMB_MASK ALARMB MASK
420 * @{
421 */
422 #define LL_RTC_ALMB_MASK_NONE 0U /*!< No masks applied on Alarm B */
423 #define LL_RTC_ALMB_MASK_DATEWEEKDAY RTC_ALRMBR_MSK4 /*!< Date/day do not care in Alarm B comparison */
424 #define LL_RTC_ALMB_MASK_HOURS RTC_ALRMBR_MSK3 /*!< Hours do not care in Alarm B comparison */
425 #define LL_RTC_ALMB_MASK_MINUTES RTC_ALRMBR_MSK2 /*!< Minutes do not care in Alarm B comparison */
426 #define LL_RTC_ALMB_MASK_SECONDS RTC_ALRMBR_MSK1 /*!< Seconds do not care in Alarm B comparison */
427 #define LL_RTC_ALMB_MASK_ALL (RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1) /*!< Masks all */
428 /**
429 * @}
430 */
431
432 /** @defgroup RTC_LL_EC_ALMB_TIME_FORMAT ALARMB TIME FORMAT
433 * @{
434 */
435 #define LL_RTC_ALMB_TIME_FORMAT_AM 0U /*!< AM or 24-hour format */
436 #define LL_RTC_ALMB_TIME_FORMAT_PM RTC_ALRMBR_PM /*!< PM */
437 /**
438 * @}
439 */
440
441 /** @defgroup RTC_LL_EC_ALMB_SUBSECONDBIN_AUTOCLR Alarm Sub Seconds with binary mode auto clear Definitions
442 * @{
443 */
444 #define LL_RTC_ALMB_SUBSECONDBIN_AUTOCLR_NO 0UL
445 /*!< The synchronous binary counter (SS[31:0] in RTC_SSR) is free-running. */
446
447 #define LL_RTC_ALMB_SUBSECONDBIN_AUTOCLR_YES RTC_ALRMBSSR_SSCLR
448 /*!< The synchronous binary counter (SS[31:0] in RTC_SSR) is running from 0xFFFF FFFF to RTC_ALRMBBINR -> SS[31:0]
449 value and is automatically reloaded with 0xFFFF FFFF when reaching RTC_ALRMBBINR -> SS[31:0]. */
450 /**
451 * @}
452 */
453
454 #if defined(RTC_CR_TSEDGE)
455 /** @defgroup RTC_LL_EC_TIMESTAMP_EDGE TIMESTAMP EDGE
456 * @{
457 */
458 #define LL_RTC_TIMESTAMP_EDGE_RISING 0U /*!< RTC_TS input rising edge generates a time-stamp event */
459 #define LL_RTC_TIMESTAMP_EDGE_FALLING RTC_CR_TSEDGE /*!< RTC_TS input falling edge generates a time-stamp even */
460 /**
461 * @}
462 */
463 #endif /* RTC_CR_TSEDGE */
464
465 /** @defgroup RTC_LL_EC_TS_TIME_FORMAT TIMESTAMP TIME FORMAT
466 * @{
467 */
468 #define LL_RTC_TS_TIME_FORMAT_AM 0U /*!< AM or 24-hour format */
469 #define LL_RTC_TS_TIME_FORMAT_PM RTC_TSTR_PM /*!< PM */
470 /**
471 * @}
472 */
473
474 /** @defgroup RTC_LL_EC_TAMPER TAMPER
475 * @{
476 */
477 #define LL_RTC_TAMPER_1 TAMP_CR1_TAMP1E /*!< Tamper 1 input detection */
478 #define LL_RTC_TAMPER_2 TAMP_CR1_TAMP2E /*!< Tamper 2 input detection */
479 #define LL_RTC_TAMPER_3 TAMP_CR1_TAMP3E /*!< Tamper 3 input detection */
480 #ifdef TAMP_CR1_TAMP4E
481 #define LL_RTC_TAMPER_4 TAMP_CR1_TAMP4E /*!< Tamper 4 input detection */
482 #define LL_RTC_TAMPER_5 TAMP_CR1_TAMP5E /*!< Tamper 5 input detection */
483 #define LL_RTC_TAMPER_6 TAMP_CR1_TAMP6E /*!< Tamper 6 input detection */
484 #endif /* TAMP_CR1_TAMP4E */
485 /**
486 * @}
487 */
488
489 /** @defgroup RTC_LL_EC_TAMPER_MASK TAMPER MASK
490 * @{
491 */
492 #define LL_RTC_TAMPER_MASK_TAMPER1 TAMP_CR2_TAMP1MSK /*!< Tamper 1 event generates a trigger event. TAMP1F is masked and internally cleared by hardware. The backup registers are not erased */
493 #define LL_RTC_TAMPER_MASK_TAMPER2 TAMP_CR2_TAMP2MSK /*!< Tamper 2 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased */
494 #define LL_RTC_TAMPER_MASK_TAMPER3 TAMP_CR2_TAMP3MSK /*!< Tamper 3 event generates a trigger event. TAMP3F is masked and internally cleared by hardware. The backup registers are not erased */
495 /**
496 * @}
497 */
498
499 /** @defgroup RTC_LL_EC_TAMPER_NOERASE TAMPER NO ERASE
500 * @{
501 */
502 #define LL_RTC_TAMPER_NOERASE_TAMPER1 TAMP_CR2_TAMP1POM /*!< Tamper 1 event does not erase the backup registers */
503 #define LL_RTC_TAMPER_NOERASE_TAMPER2 TAMP_CR2_TAMP2POM /*!< Tamper 2 event does not erase the backup registers */
504 #define LL_RTC_TAMPER_NOERASE_TAMPER3 TAMP_CR2_TAMP3POM /*!< Tamper 3 event does not erase the backup registers */
505 #ifdef TAMP_CR2_TAMP4POM
506 #define LL_RTC_TAMPER_NOERASE_TAMPER4 TAMP_CR2_TAMP4POM /*!< Tamper 4 event does not erase the backup registers */
507 #define LL_RTC_TAMPER_NOERASE_TAMPER5 TAMP_CR2_TAMP5POM /*!< Tamper 5 event does not erase the backup registers */
508 #define LL_RTC_TAMPER_NOERASE_TAMPER6 TAMP_CR2_TAMP6POM /*!< Tamper 6 event does not erase the backup registers */
509 #endif /* TAMP_CR2_TAMP4POM */
510 /**
511 * @}
512 */
513
514 /** @defgroup RTC_LL_EC_TAMPER_DURATION TAMPER DURATION
515 * @{
516 */
517 #define LL_RTC_TAMPER_DURATION_1RTCCLK 0U /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle */
518 #define LL_RTC_TAMPER_DURATION_2RTCCLK TAMP_FLTCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */
519 #define LL_RTC_TAMPER_DURATION_4RTCCLK TAMP_FLTCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */
520 #define LL_RTC_TAMPER_DURATION_8RTCCLK TAMP_FLTCR_TAMPPRCH /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */
521 /**
522 * @}
523 */
524
525 /** @defgroup RTC_LL_EC_TAMPER_FILTER TAMPER FILTER
526 * @{
527 */
528 #define LL_RTC_TAMPER_FILTER_DISABLE 0U /*!< Tamper filter is disabled */
529 #define LL_RTC_TAMPER_FILTER_2SAMPLE TAMP_FLTCR_TAMPFLT_0 /*!< Tamper is activated after 2 consecutive samples at the active level */
530 #define LL_RTC_TAMPER_FILTER_4SAMPLE TAMP_FLTCR_TAMPFLT_1 /*!< Tamper is activated after 4 consecutive samples at the active level */
531 #define LL_RTC_TAMPER_FILTER_8SAMPLE TAMP_FLTCR_TAMPFLT /*!< Tamper is activated after 8 consecutive samples at the active level */
532 /**
533 * @}
534 */
535
536 /** @defgroup RTC_LL_EC_TAMPER_SAMPLFREQDIV TAMPER SAMPLING FREQUENCY DIVIDER
537 * @{
538 */
539 #define LL_RTC_TAMPER_SAMPLFREQDIV_32768 0U /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 32768 */
540 #define LL_RTC_TAMPER_SAMPLFREQDIV_16384 TAMP_FLTCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 16384 */
541 #define LL_RTC_TAMPER_SAMPLFREQDIV_8192 TAMP_FLTCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 8192 */
542 #define LL_RTC_TAMPER_SAMPLFREQDIV_4096 (TAMP_FLTCR_TAMPFREQ_1 | TAMP_FLTCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 4096 */
543 #define LL_RTC_TAMPER_SAMPLFREQDIV_2048 TAMP_FLTCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 2048 */
544 #define LL_RTC_TAMPER_SAMPLFREQDIV_1024 (TAMP_FLTCR_TAMPFREQ_2 | TAMP_FLTCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 1024 */
545 #define LL_RTC_TAMPER_SAMPLFREQDIV_512 (TAMP_FLTCR_TAMPFREQ_2 | TAMP_FLTCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 512 */
546 #define LL_RTC_TAMPER_SAMPLFREQDIV_256 TAMP_FLTCR_TAMPFREQ /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 256 */
547 /**
548 * @}
549 */
550
551 /** @defgroup RTC_LL_EC_TAMPER_ACTIVELEVEL TAMPER ACTIVE LEVEL
552 * @{
553 */
554 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 TAMP_CR2_TAMP1TRG /*!< Tamper 1 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
555 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 TAMP_CR2_TAMP2TRG /*!< Tamper 2 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
556 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 TAMP_CR2_TAMP3TRG /*!< Tamper 3 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
557 #ifdef TAMP_CR2_TAMP4TRG
558 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP4 TAMP_CR2_TAMP4TRG /*!< Tamper 4 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
559 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP5 TAMP_CR2_TAMP5TRG /*!< Tamper 5 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
560 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP6 TAMP_CR2_TAMP6TRG /*!< Tamper 6 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
561 #endif /* TAMP_CR2_TAMP4TRG */
562 /**
563 * @}
564 */
565
566 /** @defgroup RTC_LL_EC_INTERNAL INTERNAL TAMPER
567 * @{
568 */
569 #define LL_RTC_TAMPER_ITAMP3 TAMP_CR1_ITAMP3E /*!< Internal tamper 3: LSE monitoring */
570 #define LL_RTC_TAMPER_ITAMP5 TAMP_CR1_ITAMP5E /*!< Internal tamper 5: RTC calendar overflow */
571 #define LL_RTC_TAMPER_ITAMP6 TAMP_CR1_ITAMP6E /*!< Internal tamper 6: JTAG/SWD access when RDP > 0 */
572 #define LL_RTC_TAMPER_ITAMP7 TAMP_CR1_ITAMP7E /*!< Internal tamper 7: ADC4 analog watchdog monitoring 1 */
573 #define LL_RTC_TAMPER_ITAMP8 TAMP_CR1_ITAMP8E /*!< Internal tamper 8: Monotonic counter overflow */
574 #define LL_RTC_TAMPER_ITAMP9 TAMP_CR1_ITAMP9E /*!< Internal tamper 9: Cryptographic IPs fault */
575 #define LL_RTC_TAMPER_ITAMP11 TAMP_CR1_ITAMP11E /*!< Internal tamper 11: IWDG reset when tamper flag is set */
576 #define LL_RTC_TAMPER_ITAMP12 TAMP_CR1_ITAMP12E /*!< Internal tamper 12: ADC4 analog watchdog monitoring 2 */
577 #define LL_RTC_TAMPER_ITAMP13 TAMP_CR1_ITAMP13E /*!< Internal tamper 13: ADC4 analog watchdog monitoring 3 */
578 /**
579 * @}
580 */
581
582 /** @defgroup RTC_LL_EC_ITAMPER_NOERASE INTERNAL TAMPER NO ERASE
583 * @{
584 */
585 #define LL_RTC_TAMPER_NOERASE_ITAMPER3 TAMP_CR3_ITAMP3POM /*!< Internal tamper 3 event does not erase the backup registers */
586 #define LL_RTC_TAMPER_NOERASE_ITAMPER5 TAMP_CR3_ITAMP5POM /*!< Internal tamper 5 event does not erase the backup registers */
587 #define LL_RTC_TAMPER_NOERASE_ITAMPER6 TAMP_CR3_ITAMP6POM /*!< Internal tamper 6 event does not erase the backup registers */
588 #define LL_RTC_TAMPER_NOERASE_ITAMPER7 TAMP_CR3_ITAMP7POM /*!< Internal tamper 7 event does not erase the backup registers */
589 #define LL_RTC_TAMPER_NOERASE_ITAMPER8 TAMP_CR3_ITAMP8POM /*!< Internal tamper 8 event does not erase the backup registers */
590 #define LL_RTC_TAMPER_NOERASE_ITAMPER9 TAMP_CR3_ITAMP9POM /*!< Internal tamper 9 event does not erase the backup registers */
591 #define LL_RTC_TAMPER_NOERASE_ITAMPER11 TAMP_CR3_ITAMP11POM /*!< Internal tamper 11 event does not erase the backup registers */
592 #define LL_RTC_TAMPER_NOERASE_ITAMPER12 TAMP_CR3_ITAMP12POM /*!< Internal tamper 12 event does not erase the backup registers */
593 #define LL_RTC_TAMPER_NOERASE_ITAMPER13 TAMP_CR3_ITAMP13POM /*!< Internal tamper 13 event does not erase the backup registers */
594 /**
595 * @}
596 */
597
598 /** @defgroup RTC_LL_EC_ACTIVE_MODE ACTIVE TAMPER MODE
599 * @{
600 */
601 #define LL_RTC_TAMPER_ATAMP_TAMP1AM TAMP_ATCR1_TAMP1AM /*!< Tamper 1 is active */
602 #define LL_RTC_TAMPER_ATAMP_TAMP2AM TAMP_ATCR1_TAMP2AM /*!< Tamper 2 is active */
603 #define LL_RTC_TAMPER_ATAMP_TAMP3AM TAMP_ATCR1_TAMP3AM /*!< Tamper 3 is active */
604 #ifdef TAMP_ATCR1_TAMP4AM
605 #define LL_RTC_TAMPER_ATAMP_TAMP4AM TAMP_ATCR1_TAMP4AM /*!< Tamper 4 is active */
606 #define LL_RTC_TAMPER_ATAMP_TAMP5AM TAMP_ATCR1_TAMP5AM /*!< Tamper 5 is active */
607 #define LL_RTC_TAMPER_ATAMP_TAMP6AM TAMP_ATCR1_TAMP6AM /*!< Tamper 6 is active */
608 #endif /* TAMP_ATCR1_TAMP4AM */
609 /**
610 * @}
611 */
612
613 /** @defgroup RTC_LL_EC_ACTIVE_ASYNC_PRESCALER ACTIVE TAMPER ASYNCHRONOUS PRESCALER CLOCK
614 * @{
615 */
616 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK 0U /*!< RTCCLK */
617 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_2 TAMP_ATCR1_ATCKSEL_0 /*!< RTCCLK/2 */
618 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_4 TAMP_ATCR1_ATCKSEL_1 /*!< RTCCLK/4 */
619 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_8 (TAMP_ATCR1_ATCKSEL_1 | TAMP_ATCR1_ATCKSEL_0) /*!< RTCCLK/8 */
620 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_16 TAMP_ATCR1_ATCKSEL_2 /*!< RTCCLK/16 */
621 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_32 (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_0) /*!< RTCCLK/32 */
622 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_64 (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_1) /*!< RTCCLK/64 */
623 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_128 (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_1 | TAMP_ATCR1_ATCKSEL_0) /*!< RTCCLK/128 */
624 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_2048 (TAMP_ATCR1_ATCKSEL_3 | TAMP_ATCR1_ATCKSEL_1 | TAMP_ATCR1_ATCKSEL_0) /*!< RTCCLK/2048 */
625 /**
626 * @}
627 */
628
629 /** @defgroup RTC_LL_EC_ACTIVE_OUTPUT_SELECTION ACTIVE TAMPER OUTPUT SELECTION
630 * @{
631 */
632 #define LL_RTC_TAMPER_ATAMP1IN_ATAMP1OUT (0U << TAMP_ATCR2_ATOSEL1_Pos)
633 #define LL_RTC_TAMPER_ATAMP1IN_ATAMP2OUT (1U << TAMP_ATCR2_ATOSEL1_Pos)
634 #define LL_RTC_TAMPER_ATAMP1IN_ATAMP3OUT (2U << TAMP_ATCR2_ATOSEL1_Pos)
635 #define LL_RTC_TAMPER_ATAMP1IN_ATAMP4OUT (3U << TAMP_ATCR2_ATOSEL1_Pos)
636 #define LL_RTC_TAMPER_ATAMP1IN_ATAMP5OUT (4U << TAMP_ATCR2_ATOSEL1_Pos)
637 #define LL_RTC_TAMPER_ATAMP1IN_ATAMP6OUT (5U << TAMP_ATCR2_ATOSEL1_Pos)
638
639 #define LL_RTC_TAMPER_ATAMP2IN_ATAMP1OUT (0U << TAMP_ATCR2_ATOSEL2_Pos)
640 #define LL_RTC_TAMPER_ATAMP2IN_ATAMP2OUT (1U << TAMP_ATCR2_ATOSEL2_Pos)
641 #define LL_RTC_TAMPER_ATAMP2IN_ATAMP3OUT (2U << TAMP_ATCR2_ATOSEL2_Pos)
642 #define LL_RTC_TAMPER_ATAMP2IN_ATAMP4OUT (3U << TAMP_ATCR2_ATOSEL2_Pos)
643 #define LL_RTC_TAMPER_ATAMP2IN_ATAMP5OUT (4U << TAMP_ATCR2_ATOSEL2_Pos)
644 #define LL_RTC_TAMPER_ATAMP2IN_ATAMP6OUT (5U << TAMP_ATCR2_ATOSEL2_Pos)
645
646 #define LL_RTC_TAMPER_ATAMP3IN_ATAMP1OUT (0U << TAMP_ATCR2_ATOSEL3_Pos)
647 #define LL_RTC_TAMPER_ATAMP3IN_ATAMP2OUT (1U << TAMP_ATCR2_ATOSEL3_Pos)
648 #define LL_RTC_TAMPER_ATAMP3IN_ATAMP3OUT (2U << TAMP_ATCR2_ATOSEL3_Pos)
649 #define LL_RTC_TAMPER_ATAMP3IN_ATAMP4OUT (3U << TAMP_ATCR2_ATOSEL3_Pos)
650 #define LL_RTC_TAMPER_ATAMP3IN_ATAMP5OUT (4U << TAMP_ATCR2_ATOSEL3_Pos)
651 #define LL_RTC_TAMPER_ATAMP3IN_ATAMP6OUT (5U << TAMP_ATCR2_ATOSEL3_Pos)
652
653 #define LL_RTC_TAMPER_ATAMP4IN_ATAMP1OUT (0U << TAMP_ATCR2_ATOSEL4_Pos)
654 #define LL_RTC_TAMPER_ATAMP4IN_ATAMP2OUT (1U << TAMP_ATCR2_ATOSEL4_Pos)
655 #define LL_RTC_TAMPER_ATAMP4IN_ATAMP3OUT (2U << TAMP_ATCR2_ATOSEL4_Pos)
656 #define LL_RTC_TAMPER_ATAMP4IN_ATAMP4OUT (3U << TAMP_ATCR2_ATOSEL4_Pos)
657 #define LL_RTC_TAMPER_ATAMP4IN_ATAMP5OUT (4U << TAMP_ATCR2_ATOSEL4_Pos)
658 #define LL_RTC_TAMPER_ATAMP4IN_ATAMP6OUT (5U << TAMP_ATCR2_ATOSEL4_Pos)
659
660 #define LL_RTC_TAMPER_ATAMP5IN_ATAMP1OUT (0U << TAMP_ATCR2_ATOSEL5_Pos)
661 #define LL_RTC_TAMPER_ATAMP5IN_ATAMP2OUT (1U << TAMP_ATCR2_ATOSEL5_Pos)
662 #define LL_RTC_TAMPER_ATAMP5IN_ATAMP3OUT (2U << TAMP_ATCR2_ATOSEL5_Pos)
663 #define LL_RTC_TAMPER_ATAMP5IN_ATAMP4OUT (3U << TAMP_ATCR2_ATOSEL5_Pos)
664 #define LL_RTC_TAMPER_ATAMP5IN_ATAMP5OUT (4U << TAMP_ATCR2_ATOSEL5_Pos)
665 #define LL_RTC_TAMPER_ATAMP5IN_ATAMP6OUT (5U << TAMP_ATCR2_ATOSEL5_Pos)
666
667 #define LL_RTC_TAMPER_ATAMP6IN_ATAMP1OUT (0U << TAMP_ATCR2_ATOSEL6_Pos)
668 #define LL_RTC_TAMPER_ATAMP6IN_ATAMP2OUT (1U << TAMP_ATCR2_ATOSEL6_Pos)
669 #define LL_RTC_TAMPER_ATAMP6IN_ATAMP3OUT (2U << TAMP_ATCR2_ATOSEL6_Pos)
670 #define LL_RTC_TAMPER_ATAMP6IN_ATAMP4OUT (3U << TAMP_ATCR2_ATOSEL6_Pos)
671 #define LL_RTC_TAMPER_ATAMP6IN_ATAMP5OUT (4U << TAMP_ATCR2_ATOSEL6_Pos)
672 #define LL_RTC_TAMPER_ATAMP6IN_ATAMP6OUT (5U << TAMP_ATCR2_ATOSEL6_Pos)
673 /**
674 * @}
675 */
676
677 /** @defgroup RTC_LL_EC_BKP BACKUP
678 * @{
679 */
680 #define LL_RTC_BKP_NUMBER RTC_BACKUP_NB
681 #define LL_RTC_BKP_DR0 0U
682 #define LL_RTC_BKP_DR1 1U
683 #define LL_RTC_BKP_DR2 2U
684 #define LL_RTC_BKP_DR3 3U
685 #define LL_RTC_BKP_DR4 4U
686 #define LL_RTC_BKP_DR5 5U
687 #define LL_RTC_BKP_DR6 6U
688 #define LL_RTC_BKP_DR7 7U
689 #define LL_RTC_BKP_DR8 8U
690 #define LL_RTC_BKP_DR9 9U
691 #define LL_RTC_BKP_DR10 10U
692 #define LL_RTC_BKP_DR11 11U
693 #define LL_RTC_BKP_DR12 12U
694 #define LL_RTC_BKP_DR13 13U
695 #define LL_RTC_BKP_DR14 14U
696 #define LL_RTC_BKP_DR15 15U
697 #define LL_RTC_BKP_DR16 16U
698 #define LL_RTC_BKP_DR17 17U
699 #define LL_RTC_BKP_DR18 18U
700 #define LL_RTC_BKP_DR19 19U
701 #define LL_RTC_BKP_DR20 20U
702 #define LL_RTC_BKP_DR21 21U
703 #define LL_RTC_BKP_DR22 22U
704 #define LL_RTC_BKP_DR23 23U
705 #define LL_RTC_BKP_DR24 24U
706 #define LL_RTC_BKP_DR25 25U
707 #define LL_RTC_BKP_DR26 26U
708 #define LL_RTC_BKP_DR27 27U
709 #define LL_RTC_BKP_DR28 28U
710 #define LL_RTC_BKP_DR29 29U
711 #define LL_RTC_BKP_DR30 30U
712 #define LL_RTC_BKP_DR31 31U
713 /**
714 * @}
715 */
716
717 /** @defgroup RTC_LL_EC_WAKEUPCLOCK_DIV WAKEUP CLOCK DIV
718 * @{
719 */
720 #define LL_RTC_WAKEUPCLOCK_DIV_16 0U /*!< RTC/16 clock is selected */
721 #define LL_RTC_WAKEUPCLOCK_DIV_8 RTC_CR_WUCKSEL_0 /*!< RTC/8 clock is selected */
722 #define LL_RTC_WAKEUPCLOCK_DIV_4 RTC_CR_WUCKSEL_1 /*!< RTC/4 clock is selected */
723 #define LL_RTC_WAKEUPCLOCK_DIV_2 (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_0) /*!< RTC/2 clock is selected */
724 #define LL_RTC_WAKEUPCLOCK_CKSPRE RTC_CR_WUCKSEL_2 /*!< ck_spre (usually 1 Hz) clock is selected */
725 #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 */
726 /**
727 * @}
728 */
729
730 #if defined(RTC_CR_COE)
731 /** @defgroup RTC_LL_EC_CALIB_OUTPUT Calibration output
732 * @{
733 */
734 #define LL_RTC_CALIB_OUTPUT_NONE 0U /*!< Calibration output disabled */
735 #define LL_RTC_CALIB_OUTPUT_1HZ (RTC_CR_COE | RTC_CR_COSEL) /*!< Calibration output is 1 Hz */
736 #define LL_RTC_CALIB_OUTPUT_512HZ RTC_CR_COE /*!< Calibration output is 512 Hz */
737 /**
738 * @}
739 */
740 #endif /* RTC_CR_COE */
741
742 /** @defgroup RTC_LL_EC_CALIB_INSERTPULSE Calibration pulse insertion
743 * @{
744 */
745 #define LL_RTC_CALIB_INSERTPULSE_NONE 0U /*!< No RTCCLK pulses are added */
746 #define LL_RTC_CALIB_INSERTPULSE_SET RTC_CALR_CALP /*!< One RTCCLK pulse is effectively inserted every 2exp11 pulses (frequency increased by 488.5 ppm) */
747 /**
748 * @}
749 */
750
751 /** @defgroup RTC_LL_EC_CALIB_PERIOD Calibration period
752 * @{
753 */
754 #define LL_RTC_CALIB_PERIOD_32SEC 0U /*!< Use a 32-second calibration cycle period */
755 #define LL_RTC_CALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< Use a 16-second calibration cycle period */
756 #define LL_RTC_CALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< Use a 8-second calibration cycle period */
757 /**
758 * @}
759 */
760
761 /** @defgroup RTC_LL_EC_CALIB_LOWPOWER Calibration low power
762 * @{
763 */
764 #define LL_RTC_CALIB_LOWPOWER_NONE 0U /*!< High conso mode */
765 #define LL_RTC_CALIB_LOWPOWER_SET RTC_CALR_LPCAL /*!< Low power mode */
766 /**
767 * @}
768 */
769
770 /** @defgroup RTC_LL_EC_BINARY_MODE Binary mode (Sub Second Register)
771 * @{
772 */
773 #define LL_RTC_BINARY_NONE 0U /*!< Free running BCD calendar mode (Binary mode disabled) */
774 #define LL_RTC_BINARY_ONLY RTC_ICSR_BIN_0 /*!< Free running Binary mode (BCD mode disabled) */
775 #define LL_RTC_BINARY_MIX RTC_ICSR_BIN_1 /*!< Free running BCD calendar and Binary mode enable */
776 /**
777 * @}
778 */
779
780 /** @defgroup RTC_LL_EC_BINARY_MIX_BCDU Calendar second incrementation in Binary mix mode
781 * @{
782 */
783 #define LL_RTC_BINARY_MIX_BCDU_0 0U /*!< 1s calendar increment is generated each time SS[7:0] = 0 */
784 #define LL_RTC_BINARY_MIX_BCDU_1 (0x1UL << RTC_ICSR_BCDU_Pos) /*!< 1s calendar increment is generated each time SS[8:0] = 0 */
785 #define LL_RTC_BINARY_MIX_BCDU_2 (0x2UL << RTC_ICSR_BCDU_Pos) /*!< 1s calendar increment is generated each time SS[9:0] = 0 */
786 #define LL_RTC_BINARY_MIX_BCDU_3 (0x3UL << RTC_ICSR_BCDU_Pos) /*!< 1s calendar increment is generated each time SS[10:0] = 0 */
787 #define LL_RTC_BINARY_MIX_BCDU_4 (0x4UL << RTC_ICSR_BCDU_Pos) /*!< 1s calendar increment is generated each time SS[11:0] = 0 */
788 #define LL_RTC_BINARY_MIX_BCDU_5 (0x5UL << RTC_ICSR_BCDU_Pos) /*!< 1s calendar increment is generated each time SS[12:0] = 0 */
789 #define LL_RTC_BINARY_MIX_BCDU_6 (0x6UL << RTC_ICSR_BCDU_Pos) /*!< 1s calendar increment is generated each time SS[13:0] = 0 */
790 #define LL_RTC_BINARY_MIX_BCDU_7 (0x7UL << RTC_ICSR_BCDU_Pos) /*!< 1s calendar increment is generated each time SS[14:0] = 0 */
791 /**
792 * @}
793 */
794
795 #if defined(RTC_SECCFGR_SEC)
796 /** @defgroup RTC_LL_EC_SECURE_RTC_FULL Secure full rtc
797 * @{
798 */
799 #define LL_RTC_SECURE_FULL_YES RTC_SECCFGR_SEC /*!< RTC full secure */
800 #define LL_RTC_SECURE_FULL_NO 0U /*!< RTC is not full secure, features can be secure. See RTC_LL_EC_SECURE_RTC_FEATURE */
801 /**
802 * @}
803 */
804 #endif /* RTC_SECCFGR_SEC */
805
806 /** @defgroup RTC_LL_EC_SECURE_RTC_FEATURE Secure features rtc in case of LL_RTC_SECURE_FULL_NO.
807 * @{
808 */
809 #define LL_RTC_SECURE_FEATURE_INIT RTC_SECCFGR_INITSEC /*!< Initialization feature is secure */
810 #define LL_RTC_SECURE_FEATURE_CAL RTC_SECCFGR_CALSEC /*!< Calibration feature is secure */
811 #define LL_RTC_SECURE_FEATURE_TS RTC_SECCFGR_TSSEC /*!< Time stamp feature is secure */
812 #define LL_RTC_SECURE_FEATURE_WUT RTC_SECCFGR_WUTSEC /*!< Wake up timer feature is secure */
813 #define LL_RTC_SECURE_FEATURE_ALRA RTC_SECCFGR_ALRASEC /*!< Alarm A feature is secure */
814 #define LL_RTC_SECURE_FEATURE_ALRB RTC_SECCFGR_ALRBSEC /*!< Alarm B feature is secure */
815 /**
816 * @}
817 */
818
819 /** @defgroup RTC_LL_EC_SECURE_TAMP Secure tamp
820 * @{
821 */
822 #define LL_TAMP_SECURE_FULL_YES TAMP_SECCFGR_TAMPSEC /*!< TAMP full secure */
823 #define LL_TAMP_SECURE_FULL_NO 0U /*!< TAMP is not secure */
824 /**
825 * @}
826 */
827
828 #if defined(RTC_PRIVCFGR_PRIV)
829 /** @defgroup RTC_LL_EC_PRIVILEGE_RTC_FULL Privilege full rtc
830 * @{
831 */
832 #define LL_RTC_PRIVILEGE_FULL_YES RTC_PRIVCFGR_PRIV /*!< RTC full privilege */
833 #define LL_RTC_PRIVILEGE_FULL_NO 0U /*!< RTC is not full privilege, features can be unprivilege. See RTC_LL_EC_PRIVILEGE_RTC_FEATURE */
834 /**
835 * @}
836 */
837 #endif /* RTC_PRIVCFGR_PRIV */
838
839 /** @defgroup RTC_LL_EC_PRIVILEGE_RTC_FEATURE Privilege rtc features in case of LL_RTC_PRIVILEGE_FULL_NO.
840 * @{
841 */
842 #define LL_RTC_PRIVILEGE_FEATURE_INIT RTC_PRIVCFGR_INITPRIV /*!< Initialization feature is privilege */
843 #define LL_RTC_PRIVILEGE_FEATURE_CAL RTC_PRIVCFGR_CALPRIV /*!< Calibration feature is privilege */
844 #define LL_RTC_PRIVILEGE_FEATURE_TS RTC_PRIVCFGR_TSPRIV /*!< Time stamp feature is privilege */
845 #define LL_RTC_PRIVILEGE_FEATURE_WUT RTC_PRIVCFGR_WUTPRIV /*!< Wake up timer feature is privilege */
846 #define LL_RTC_PRIVILEGE_FEATURE_ALRA RTC_PRIVCFGR_ALRAPRIV /*!< Alarm A feature is privilege */
847 #define LL_RTC_PRIVILEGE_FEATURE_ALRB RTC_PRIVCFGR_ALRBPRIV /*!< Alarm B feature is privilege */
848 /**
849 * @}
850 */
851
852 /** @defgroup RTC_LL_EC_PRIVILEGE_TAMP_FULL Privilege full tamp
853 * @{
854 */
855 #define LL_TAMP_PRIVILEGE_FULL_YES TAMP_PRIVCFGR_TAMPPRIV /*!< TAMP full privilege */
856 #define LL_TAMP_PRIVILEGE_FULL_NO 0U /*!< TAMP is not privilege */
857 /**
858 * @}
859 */
860
861 /** @defgroup RTC_LL_EC_PRIVILEGE_BACKUP_REG_ZONE Privilege Backup register privilege zone
862 * @{
863 */
864 #define LL_RTC_PRIVILEGE_BKUP_ZONE_NONE 0U
865 #define LL_RTC_PRIVILEGE_BKUP_ZONE_1 TAMP_PRIVCFGR_BKPRWPRIV
866 #define LL_RTC_PRIVILEGE_BKUP_ZONE_2 TAMP_PRIVCFGR_BKPWPRIV
867 #define LL_RTC_PRIVILEGE_BKUP_ZONE_ALL (LL_RTC_PRIVILEGE_BKUP_ZONE_1 | LL_RTC_PRIVILEGE_BKUP_ZONE_2)
868 /**
869 * @}
870 */
871
872 /**
873 * @}
874 */
875
876 /* Exported macro ------------------------------------------------------------*/
877 /** @defgroup RTC_LL_Exported_Macros RTC Exported Macros
878 * @{
879 */
880
881 /** @defgroup RTC_LL_EM_WRITE_READ Common Write and read registers Macros
882 * @{
883 */
884
885 /**
886 * @brief Write a value in RTC register
887 * @param __INSTANCE__ RTC Instance
888 * @param __REG__ Register to be written
889 * @param __VALUE__ Value to be written in the register
890 * @retval None
891 */
892 #define LL_RTC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
893
894 /**
895 * @brief Read a value in RTC register
896 * @param __INSTANCE__ RTC Instance
897 * @param __REG__ Register to be read
898 * @retval Register value
899 */
900 #define LL_RTC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
901 /**
902 * @}
903 */
904
905 /** @defgroup RTC_LL_EM_Convert Convert helper Macros
906 * @{
907 */
908
909 /**
910 * @brief Helper macro to convert a value from 2 digit decimal format to BCD format
911 * @param __VALUE__ Byte to be converted
912 * @retval Converted byte
913 */
914 #define __LL_RTC_CONVERT_BIN2BCD(__VALUE__) ((uint8_t)((((__VALUE__) / 10U) << 4U) | ((__VALUE__) % 10U)))
915
916 /**
917 * @brief Helper macro to convert a value from BCD format to 2 digit decimal format
918 * @param __VALUE__ BCD value to be converted
919 * @retval Converted byte
920 */
921 #define __LL_RTC_CONVERT_BCD2BIN(__VALUE__) \
922 ((uint8_t)((((uint8_t)((__VALUE__) & (uint8_t)0xF0U) >> (uint8_t)0x4U) * 10U) + ((__VALUE__) & (uint8_t)0x0FU)))
923
924 /**
925 * @}
926 */
927
928 /** @defgroup RTC_LL_EM_Date Date helper Macros
929 * @{
930 */
931
932 /**
933 * @brief Helper macro to retrieve weekday.
934 * @param __RTC_DATE__ Date returned by @ref LL_RTC_DATE_Get function.
935 * @retval Returned value can be one of the following values:
936 * @arg @ref LL_RTC_WEEKDAY_MONDAY
937 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
938 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
939 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
940 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
941 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
942 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
943 */
944 #define __LL_RTC_GET_WEEKDAY(__RTC_DATE__) (((__RTC_DATE__) >> RTC_OFFSET_WEEKDAY) & 0x000000FFU)
945
946 /**
947 * @brief Helper macro to retrieve Year in BCD format
948 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
949 * @retval Year in BCD format (0x00 . . . 0x99)
950 */
951 #define __LL_RTC_GET_YEAR(__RTC_DATE__) ((__RTC_DATE__) & 0x000000FFU)
952
953 /**
954 * @brief Helper macro to retrieve Month in BCD format
955 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
956 * @retval Returned value can be one of the following values:
957 * @arg @ref LL_RTC_MONTH_JANUARY
958 * @arg @ref LL_RTC_MONTH_FEBRUARY
959 * @arg @ref LL_RTC_MONTH_MARCH
960 * @arg @ref LL_RTC_MONTH_APRIL
961 * @arg @ref LL_RTC_MONTH_MAY
962 * @arg @ref LL_RTC_MONTH_JUNE
963 * @arg @ref LL_RTC_MONTH_JULY
964 * @arg @ref LL_RTC_MONTH_AUGUST
965 * @arg @ref LL_RTC_MONTH_SEPTEMBER
966 * @arg @ref LL_RTC_MONTH_OCTOBER
967 * @arg @ref LL_RTC_MONTH_NOVEMBER
968 * @arg @ref LL_RTC_MONTH_DECEMBER
969 */
970 #define __LL_RTC_GET_MONTH(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_MONTH) & 0x000000FFU)
971
972 /**
973 * @brief Helper macro to retrieve Day in BCD format
974 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
975 * @retval Day in BCD format (0x01 . . . 0x31)
976 */
977 #define __LL_RTC_GET_DAY(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_DAY) & 0x000000FFU)
978
979 /**
980 * @}
981 */
982
983 /** @defgroup RTC_LL_EM_Time Time helper Macros
984 * @{
985 */
986
987 /**
988 * @brief Helper macro to retrieve hour in BCD format
989 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
990 * @retval Hours in BCD format (0x01. . .0x12 or between Min_Data=0x00 and Max_Data=0x23)
991 */
992 #define __LL_RTC_GET_HOUR(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_HOUR) & 0x000000FFU)
993
994 /**
995 * @brief Helper macro to retrieve minute in BCD format
996 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
997 * @retval Minutes in BCD format (0x00. . .0x59)
998 */
999 #define __LL_RTC_GET_MINUTE(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_MINUTE) & 0x000000FFU)
1000
1001 /**
1002 * @brief Helper macro to retrieve second in BCD format
1003 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
1004 * @retval Seconds in format (0x00. . .0x59)
1005 */
1006 #define __LL_RTC_GET_SECOND(__RTC_TIME__) ((__RTC_TIME__) & 0x000000FFU)
1007
1008 /**
1009 * @}
1010 */
1011
1012 /**
1013 * @}
1014 */
1015
1016 /* Exported functions --------------------------------------------------------*/
1017 /** @defgroup RTC_LL_Exported_Functions RTC Exported Functions
1018 * @{
1019 */
1020
1021 /** @defgroup RTC_LL_EF_Configuration Configuration
1022 * @{
1023 */
1024
1025 /**
1026 * @brief Set Hours format (24 hour/day or AM/PM hour format)
1027 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1028 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1029 * @rmtoll RTC_CR FMT LL_RTC_SetHourFormat
1030 * @param RTCx RTC Instance
1031 * @param HourFormat This parameter can be one of the following values:
1032 * @arg @ref LL_RTC_HOURFORMAT_24HOUR
1033 * @arg @ref LL_RTC_HOURFORMAT_AMPM
1034 * @retval None
1035 */
LL_RTC_SetHourFormat(RTC_TypeDef * RTCx,uint32_t HourFormat)1036 __STATIC_INLINE void LL_RTC_SetHourFormat(RTC_TypeDef *RTCx, uint32_t HourFormat)
1037 {
1038 MODIFY_REG(RTCx->CR, RTC_CR_FMT, HourFormat);
1039 }
1040
1041 /**
1042 * @brief Get Hours format (24 hour/day or AM/PM hour format)
1043 * @rmtoll RTC_CR FMT LL_RTC_GetHourFormat
1044 * @param RTCx RTC Instance
1045 * @retval Returned value can be one of the following values:
1046 * @arg @ref LL_RTC_HOURFORMAT_24HOUR
1047 * @arg @ref LL_RTC_HOURFORMAT_AMPM
1048 */
LL_RTC_GetHourFormat(const RTC_TypeDef * RTCx)1049 __STATIC_INLINE uint32_t LL_RTC_GetHourFormat(const RTC_TypeDef *RTCx)
1050 {
1051 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_FMT));
1052 }
1053
1054 #if defined(RTC_CR_OSEL)
1055 /**
1056 * @brief Select the flag to be routed to RTC_ALARM output
1057 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1058 * @rmtoll RTC_CR OSEL LL_RTC_SetAlarmOutEvent
1059 * @param RTCx RTC Instance
1060 * @param AlarmOutput This parameter can be one of the following values:
1061 * @arg @ref LL_RTC_ALARMOUT_DISABLE
1062 * @arg @ref LL_RTC_ALARMOUT_ALMA
1063 * @arg @ref LL_RTC_ALARMOUT_ALMB
1064 * @arg @ref LL_RTC_ALARMOUT_WAKEUP
1065 * @retval None
1066 */
LL_RTC_SetAlarmOutEvent(RTC_TypeDef * RTCx,uint32_t AlarmOutput)1067 __STATIC_INLINE void LL_RTC_SetAlarmOutEvent(RTC_TypeDef *RTCx, uint32_t AlarmOutput)
1068 {
1069 MODIFY_REG(RTCx->CR, RTC_CR_OSEL, AlarmOutput);
1070 }
1071
1072 /**
1073 * @brief Get the flag to be routed to RTC_ALARM output
1074 * @rmtoll RTC_CR OSEL LL_RTC_GetAlarmOutEvent
1075 * @param RTCx RTC Instance
1076 * @retval Returned value can be one of the following values:
1077 * @arg @ref LL_RTC_ALARMOUT_DISABLE
1078 * @arg @ref LL_RTC_ALARMOUT_ALMA
1079 * @arg @ref LL_RTC_ALARMOUT_ALMB
1080 * @arg @ref LL_RTC_ALARMOUT_WAKEUP
1081 */
LL_RTC_GetAlarmOutEvent(const RTC_TypeDef * RTCx)1082 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutEvent(const RTC_TypeDef *RTCx)
1083 {
1084 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_OSEL));
1085 }
1086 #endif /* RTC_CR_OSEL */
1087
1088
1089 #ifdef RTC_CR_TAMPALRM_TYPE
1090 /**
1091 * @brief Set RTC_ALARM output type (ALARM in push-pull or open-drain output)
1092 * @rmtoll RTC_CR TAMPALRM_TYPE LL_RTC_SetAlarmOutputType
1093 * @param RTCx RTC Instance
1094 * @param Output This parameter can be one of the following values:
1095 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
1096 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
1097 * @retval None
1098 */
LL_RTC_SetAlarmOutputType(RTC_TypeDef * RTCx,uint32_t Output)1099 __STATIC_INLINE void LL_RTC_SetAlarmOutputType(RTC_TypeDef *RTCx, uint32_t Output)
1100 {
1101 MODIFY_REG(RTCx->CR, RTC_CR_TAMPALRM_TYPE, Output);
1102 }
1103
1104 /**
1105 * @brief Get RTC_ALARM output type (ALARM in push-pull or open-drain output)
1106 * @rmtoll RTC_CR TAMPALRM_TYPE LL_RTC_GetAlarmOutputType
1107 * @param RTCx RTC Instance
1108 * @retval Returned value can be one of the following values:
1109 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
1110 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
1111 */
LL_RTC_GetAlarmOutputType(const RTC_TypeDef * RTCx)1112 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutputType(const RTC_TypeDef *RTCx)
1113 {
1114 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TAMPALRM_TYPE));
1115 }
1116 #endif /* RTC_CR_TAMPALRM_TYPE */
1117
1118 /**
1119 * @brief Enable initialization mode
1120 * @note Initialization mode is used to program time and date register (RTC_TR and RTC_DR)
1121 * and prescaler register (RTC_PRER).
1122 * Counters are stopped and start counting from the new value when INIT is reset.
1123 * @rmtoll RTC_ICSR INIT LL_RTC_EnableInitMode
1124 * @param RTCx RTC Instance
1125 * @retval None
1126 */
LL_RTC_EnableInitMode(RTC_TypeDef * RTCx)1127 __STATIC_INLINE void LL_RTC_EnableInitMode(RTC_TypeDef *RTCx)
1128 {
1129 /* Set the Initialization mode */
1130 SET_BIT(RTCx->ICSR, RTC_ICSR_INIT);
1131 }
1132
1133 /**
1134 * @brief Disable initialization mode (Free running mode)
1135 * @rmtoll RTC_ICSR INIT LL_RTC_DisableInitMode
1136 * @param RTCx RTC Instance
1137 * @retval None
1138 */
LL_RTC_DisableInitMode(RTC_TypeDef * RTCx)1139 __STATIC_INLINE void LL_RTC_DisableInitMode(RTC_TypeDef *RTCx)
1140 {
1141 /* Exit Initialization mode */
1142 CLEAR_BIT(RTCx->ICSR, RTC_ICSR_INIT);
1143
1144 }
1145
1146 /**
1147 * @brief Set Binary mode (Sub Second Register)
1148 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1149 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function).
1150 * @rmtoll RTC_ICSR BIN LL_RTC_SetBinaryMode
1151 * @param RTCx RTC Instance
1152 * @param BinaryMode can be one of the following values:
1153 * @arg @ref LL_RTC_BINARY_NONE
1154 * @arg @ref LL_RTC_BINARY_ONLY
1155 * @arg @ref LL_RTC_BINARY_MIX
1156 * @retval None
1157 */
LL_RTC_SetBinaryMode(RTC_TypeDef * RTCx,uint32_t BinaryMode)1158 __STATIC_INLINE void LL_RTC_SetBinaryMode(RTC_TypeDef *RTCx, uint32_t BinaryMode)
1159 {
1160 MODIFY_REG(RTCx->ICSR, RTC_ICSR_BIN, BinaryMode);
1161 }
1162
1163 /**
1164 * @brief Get Binary mode (Sub Second Register)
1165 * @rmtoll RTC_ICSR BIN LL_RTC_GetBinaryMode
1166 * @param RTCx RTC Instance
1167 * @retval This parameter can be one of the following values:
1168 * @arg @ref LL_RTC_BINARY_NONE
1169 * @arg @ref LL_RTC_BINARY_ONLY
1170 * @arg @ref LL_RTC_BINARY_MIX
1171 * @retval None
1172 */
LL_RTC_GetBinaryMode(const RTC_TypeDef * RTCx)1173 __STATIC_INLINE uint32_t LL_RTC_GetBinaryMode(const RTC_TypeDef *RTCx)
1174 {
1175 return (uint32_t)(READ_BIT(RTCx->ICSR, RTC_ICSR_BIN));
1176 }
1177
1178 /**
1179 * @brief Set Binary Mix mode BCDU
1180 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1181 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function).
1182 * @rmtoll RTC_ICSR BCDU LL_RTC_SetBinMixBCDU
1183 * @param RTCx RTC Instance
1184 * @param BinMixBcdU can be one of the following values:
1185 * @arg @ref LL_RTC_BINARY_MIX_BCDU_0
1186 * @arg @ref LL_RTC_BINARY_MIX_BCDU_1
1187 * @arg @ref LL_RTC_BINARY_MIX_BCDU_2
1188 * @arg @ref LL_RTC_BINARY_MIX_BCDU_3
1189 * @arg @ref LL_RTC_BINARY_MIX_BCDU_4
1190 * @arg @ref LL_RTC_BINARY_MIX_BCDU_5
1191 * @arg @ref LL_RTC_BINARY_MIX_BCDU_6
1192 * @arg @ref LL_RTC_BINARY_MIX_BCDU_7
1193 * @retval None
1194 */
LL_RTC_SetBinMixBCDU(RTC_TypeDef * RTCx,uint32_t BinMixBcdU)1195 __STATIC_INLINE void LL_RTC_SetBinMixBCDU(RTC_TypeDef *RTCx, uint32_t BinMixBcdU)
1196 {
1197 MODIFY_REG(RTCx->ICSR, RTC_ICSR_BCDU, BinMixBcdU);
1198 }
1199
1200 /**
1201 * @brief Get Binary Mix mode BCDU
1202 * @rmtoll RTC_ICSR BCDU LL_RTC_GetBinMixBCDU
1203 * @param RTCx RTC Instance
1204 * @retval This parameter can be one of the following values:
1205 * @arg @ref LL_RTC_BINARY_MIX_BCDU_0
1206 * @arg @ref LL_RTC_BINARY_MIX_BCDU_1
1207 * @arg @ref LL_RTC_BINARY_MIX_BCDU_2
1208 * @arg @ref LL_RTC_BINARY_MIX_BCDU_3
1209 * @arg @ref LL_RTC_BINARY_MIX_BCDU_4
1210 * @arg @ref LL_RTC_BINARY_MIX_BCDU_5
1211 * @arg @ref LL_RTC_BINARY_MIX_BCDU_6
1212 * @arg @ref LL_RTC_BINARY_MIX_BCDU_7
1213 * @retval None
1214 */
LL_RTC_GetBinMixBCDU(const RTC_TypeDef * RTCx)1215 __STATIC_INLINE uint32_t LL_RTC_GetBinMixBCDU(const RTC_TypeDef *RTCx)
1216 {
1217 return (uint32_t)(READ_BIT(RTCx->ICSR, RTC_ICSR_BCDU));
1218 }
1219
1220 #ifdef RTC_CR_POL
1221 /**
1222 * @brief Set Output polarity (pin is low when ALRAF/ALRBF/WUTF is asserted)
1223 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1224 * @rmtoll RTC_CR POL LL_RTC_SetOutputPolarity
1225 * @param RTCx RTC Instance
1226 * @param Polarity This parameter can be one of the following values:
1227 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
1228 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
1229 * @retval None
1230 */
LL_RTC_SetOutputPolarity(RTC_TypeDef * RTCx,uint32_t Polarity)1231 __STATIC_INLINE void LL_RTC_SetOutputPolarity(RTC_TypeDef *RTCx, uint32_t Polarity)
1232 {
1233 MODIFY_REG(RTCx->CR, RTC_CR_POL, Polarity);
1234 }
1235
1236 /**
1237 * @brief Get Output polarity
1238 * @rmtoll RTC_CR POL LL_RTC_GetOutputPolarity
1239 * @param RTCx RTC Instance
1240 * @retval Returned value can be one of the following values:
1241 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
1242 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
1243 */
LL_RTC_GetOutputPolarity(const RTC_TypeDef * RTCx)1244 __STATIC_INLINE uint32_t LL_RTC_GetOutputPolarity(const RTC_TypeDef *RTCx)
1245 {
1246 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_POL));
1247 }
1248 #endif /* RTC_CR_POL */
1249
1250 /**
1251 * @brief Enable Bypass the shadow registers
1252 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1253 * @rmtoll RTC_CR BYPSHAD LL_RTC_EnableShadowRegBypass
1254 * @param RTCx RTC Instance
1255 * @retval None
1256 */
LL_RTC_EnableShadowRegBypass(RTC_TypeDef * RTCx)1257 __STATIC_INLINE void LL_RTC_EnableShadowRegBypass(RTC_TypeDef *RTCx)
1258 {
1259 SET_BIT(RTCx->CR, RTC_CR_BYPSHAD);
1260 }
1261
1262 /**
1263 * @brief Disable Bypass the shadow registers
1264 * @rmtoll RTC_CR BYPSHAD LL_RTC_DisableShadowRegBypass
1265 * @param RTCx RTC Instance
1266 * @retval None
1267 */
LL_RTC_DisableShadowRegBypass(RTC_TypeDef * RTCx)1268 __STATIC_INLINE void LL_RTC_DisableShadowRegBypass(RTC_TypeDef *RTCx)
1269 {
1270 CLEAR_BIT(RTCx->CR, RTC_CR_BYPSHAD);
1271 }
1272
1273 /**
1274 * @brief Check if Shadow registers bypass is enabled or not.
1275 * @rmtoll RTC_CR BYPSHAD LL_RTC_IsShadowRegBypassEnabled
1276 * @param RTCx RTC Instance
1277 * @retval State of bit (1 or 0).
1278 */
LL_RTC_IsShadowRegBypassEnabled(const RTC_TypeDef * RTCx)1279 __STATIC_INLINE uint32_t LL_RTC_IsShadowRegBypassEnabled(const RTC_TypeDef *RTCx)
1280 {
1281 return ((READ_BIT(RTCx->CR, RTC_CR_BYPSHAD) == (RTC_CR_BYPSHAD)) ? 1U : 0U);
1282 }
1283
1284 #if defined(RTC_CR_REFCKON)
1285 /**
1286 * @brief Enable RTC_REFIN reference clock detection (50 or 60 Hz)
1287 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1288 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1289 * @rmtoll RTC_CR REFCKON LL_RTC_EnableRefClock
1290 * @param RTCx RTC Instance
1291 * @retval None
1292 */
LL_RTC_EnableRefClock(RTC_TypeDef * RTCx)1293 __STATIC_INLINE void LL_RTC_EnableRefClock(RTC_TypeDef *RTCx)
1294 {
1295 SET_BIT(RTCx->CR, RTC_CR_REFCKON);
1296 }
1297
1298 /**
1299 * @brief Disable RTC_REFIN reference clock detection (50 or 60 Hz)
1300 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1301 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1302 * @rmtoll RTC_CR REFCKON LL_RTC_DisableRefClock
1303 * @param RTCx RTC Instance
1304 * @retval None
1305 */
LL_RTC_DisableRefClock(RTC_TypeDef * RTCx)1306 __STATIC_INLINE void LL_RTC_DisableRefClock(RTC_TypeDef *RTCx)
1307 {
1308 CLEAR_BIT(RTCx->CR, RTC_CR_REFCKON);
1309 }
1310 #endif /* RTC_CR_REFCKON */
1311
1312 /**
1313 * @brief Set Asynchronous prescaler factor
1314 * @rmtoll RTC_PRER PREDIV_A LL_RTC_SetAsynchPrescaler
1315 * @param RTCx RTC Instance
1316 * @param AsynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7F
1317 * @retval None
1318 */
LL_RTC_SetAsynchPrescaler(RTC_TypeDef * RTCx,uint32_t AsynchPrescaler)1319 __STATIC_INLINE void LL_RTC_SetAsynchPrescaler(RTC_TypeDef *RTCx, uint32_t AsynchPrescaler)
1320 {
1321 MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_A, AsynchPrescaler << RTC_PRER_PREDIV_A_Pos);
1322 }
1323
1324 /**
1325 * @brief Set Synchronous prescaler factor
1326 * @rmtoll RTC_PRER PREDIV_S LL_RTC_SetSynchPrescaler
1327 * @param RTCx RTC Instance
1328 * @param SynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7FFF
1329 * @retval None
1330 */
LL_RTC_SetSynchPrescaler(RTC_TypeDef * RTCx,uint32_t SynchPrescaler)1331 __STATIC_INLINE void LL_RTC_SetSynchPrescaler(RTC_TypeDef *RTCx, uint32_t SynchPrescaler)
1332 {
1333 MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_S, SynchPrescaler);
1334 }
1335
1336 /**
1337 * @brief Get Asynchronous prescaler factor
1338 * @rmtoll RTC_PRER PREDIV_A LL_RTC_GetAsynchPrescaler
1339 * @param RTCx RTC Instance
1340 * @retval Value between Min_Data = 0 and Max_Data = 0x7F
1341 */
LL_RTC_GetAsynchPrescaler(const RTC_TypeDef * RTCx)1342 __STATIC_INLINE uint32_t LL_RTC_GetAsynchPrescaler(const RTC_TypeDef *RTCx)
1343 {
1344 return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_A) >> RTC_PRER_PREDIV_A_Pos);
1345 }
1346
1347 /**
1348 * @brief Get Synchronous prescaler factor
1349 * @rmtoll RTC_PRER PREDIV_S LL_RTC_GetSynchPrescaler
1350 * @param RTCx RTC Instance
1351 * @retval Value between Min_Data = 0 and Max_Data = 0x7FFF
1352 */
LL_RTC_GetSynchPrescaler(const RTC_TypeDef * RTCx)1353 __STATIC_INLINE uint32_t LL_RTC_GetSynchPrescaler(const RTC_TypeDef *RTCx)
1354 {
1355 return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_S));
1356 }
1357
1358 /**
1359 * @brief Enable the write protection for RTC registers.
1360 * @rmtoll RTC_WPR KEY LL_RTC_EnableWriteProtection
1361 * @param RTCx RTC Instance
1362 * @retval None
1363 */
LL_RTC_EnableWriteProtection(RTC_TypeDef * RTCx)1364 __STATIC_INLINE void LL_RTC_EnableWriteProtection(RTC_TypeDef *RTCx)
1365 {
1366 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_DISABLE);
1367 }
1368
1369 /**
1370 * @brief Disable the write protection for RTC registers.
1371 * @rmtoll RTC_WPR KEY LL_RTC_DisableWriteProtection
1372 * @param RTCx RTC Instance
1373 * @retval None
1374 */
LL_RTC_DisableWriteProtection(RTC_TypeDef * RTCx)1375 __STATIC_INLINE void LL_RTC_DisableWriteProtection(RTC_TypeDef *RTCx)
1376 {
1377 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_1);
1378 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_2);
1379 }
1380
1381 #ifdef RTC_CR_TAMPOE
1382 /**
1383 * @brief Enable tamper output.
1384 * @note When the tamper output is enabled, all external and internal tamper flags
1385 * are ORed and routed to the TAMPALRM output.
1386 * @rmtoll RTC_CR TAMPOE LL_RTC_EnableTamperOutput
1387 * @param RTCx RTC Instance
1388 * @retval None
1389 */
LL_RTC_EnableTamperOutput(RTC_TypeDef * RTCx)1390 __STATIC_INLINE void LL_RTC_EnableTamperOutput(RTC_TypeDef *RTCx)
1391 {
1392 SET_BIT(RTCx->CR, RTC_CR_TAMPOE);
1393 }
1394
1395 /**
1396 * @brief Disable tamper output.
1397 * @rmtoll RTC_CR TAMPOE LL_RTC_DisableTamperOutput
1398 * @param RTCx RTC Instance
1399 * @retval None
1400 */
LL_RTC_DisableTamperOutput(RTC_TypeDef * RTCx)1401 __STATIC_INLINE void LL_RTC_DisableTamperOutput(RTC_TypeDef *RTCx)
1402 {
1403 CLEAR_BIT(RTCx->CR, RTC_CR_TAMPOE);
1404 }
1405
1406 /**
1407 * @brief Check if tamper output is enabled or not.
1408 * @rmtoll RTC_CR TAMPOE LL_RTC_IsTamperOutputEnabled
1409 * @param RTCx RTC Instance
1410 * @retval State of bit (1 or 0).
1411 */
LL_RTC_IsTamperOutputEnabled(const RTC_TypeDef * RTCx)1412 __STATIC_INLINE uint32_t LL_RTC_IsTamperOutputEnabled(const RTC_TypeDef *RTCx)
1413 {
1414 return ((READ_BIT(RTCx->CR, RTC_CR_TAMPOE) == (RTC_CR_TAMPOE)) ? 1U : 0U);
1415 }
1416
1417 /**
1418 * @brief Enable internal pull-up in output mode.
1419 * @rmtoll RTC_CR TAMPALRM_PU LL_RTC_EnableAlarmPullUp
1420 * @param RTCx RTC Instance
1421 * @retval None
1422 */
LL_RTC_EnableAlarmPullUp(RTC_TypeDef * RTCx)1423 __STATIC_INLINE void LL_RTC_EnableAlarmPullUp(RTC_TypeDef *RTCx)
1424 {
1425 SET_BIT(RTCx->CR, RTC_CR_TAMPALRM_PU);
1426 }
1427 #endif /* RTC_CR_TAMPOE */
1428
1429 #ifdef RTC_CR_TAMPALRM_PU
1430 /**
1431 * @brief Disable internal pull-up in output mode.
1432 * @rmtoll RTC_CR TAMPALRM_PU LL_RTC_EnableAlarmPullUp
1433 * @param RTCx RTC Instance
1434 * @retval None
1435 */
LL_RTC_DisableAlarmPullUp(RTC_TypeDef * RTCx)1436 __STATIC_INLINE void LL_RTC_DisableAlarmPullUp(RTC_TypeDef *RTCx)
1437 {
1438 CLEAR_BIT(RTCx->CR, RTC_CR_TAMPALRM_PU);
1439 }
1440
1441 /**
1442 * @brief Check if internal pull-up in output mode is enabled or not.
1443 * @rmtoll RTC_CR TAMPALRM_PU LL_RTC_IsAlarmPullUpEnabled
1444 * @param RTCx RTC Instance
1445 * @retval State of bit (1 or 0).
1446 */
LL_RTC_IsAlarmPullUpEnabled(const RTC_TypeDef * RTCx)1447 __STATIC_INLINE uint32_t LL_RTC_IsAlarmPullUpEnabled(const RTC_TypeDef *RTCx)
1448 {
1449 return ((READ_BIT(RTCx->CR, RTC_CR_TAMPALRM_PU) == (RTC_CR_TAMPALRM_PU)) ? 1U : 0U);
1450 }
1451 #endif /* RTC_CR_TAMPALRM_PU */
1452
1453 #if defined(RTC_CR_OUT2EN)
1454 /**
1455 * @brief Enable RTC_OUT2 output
1456 * @note RTC_OUT2 mapping depends on both OSEL (@ref LL_RTC_SetAlarmOutEvent)
1457 * and COE (@ref LL_RTC_CAL_SetOutputFreq) settings.
1458 * @note RTC_OUT2 is not available in VBAT mode.
1459 * @rmtoll RTC_CR OUT2EN LL_RTC_EnableOutput2
1460 * @param RTCx RTC Instance
1461 * @retval None
1462 */
LL_RTC_EnableOutput2(RTC_TypeDef * RTCx)1463 __STATIC_INLINE void LL_RTC_EnableOutput2(RTC_TypeDef *RTCx)
1464 {
1465 SET_BIT(RTCx->CR, RTC_CR_OUT2EN);
1466 }
1467
1468 /**
1469 * @brief Disable RTC_OUT2 output
1470 * @rmtoll RTC_CR OUT2EN LL_RTC_DisableOutput2
1471 * @param RTCx RTC Instance
1472 * @retval None
1473 */
LL_RTC_DisableOutput2(RTC_TypeDef * RTCx)1474 __STATIC_INLINE void LL_RTC_DisableOutput2(RTC_TypeDef *RTCx)
1475 {
1476 CLEAR_BIT(RTCx->CR, RTC_CR_OUT2EN);
1477 }
1478
1479 /**
1480 * @brief Check if RTC_OUT2 output is enabled or not.
1481 * @rmtoll RTC_CR OUT2EN LL_RTC_IsOutput2Enabled
1482 * @param RTCx RTC Instance
1483 * @retval State of bit (1 or 0).
1484 */
LL_RTC_IsOutput2Enabled(const RTC_TypeDef * RTCx)1485 __STATIC_INLINE uint32_t LL_RTC_IsOutput2Enabled(const RTC_TypeDef *RTCx)
1486 {
1487 return ((READ_BIT(RTCx->CR, RTC_CR_OUT2EN) == (RTC_CR_OUT2EN)) ? 1U : 0U);
1488 }
1489 #endif /* RTC_CR_OUT2EN */
1490 /**
1491 * @}
1492 */
1493
1494 /** @defgroup RTC_LL_EF_Time Time
1495 * @{
1496 */
1497
1498 /**
1499 * @brief Set time format (AM/24-hour or PM notation)
1500 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1501 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1502 * @rmtoll RTC_TR PM LL_RTC_TIME_SetFormat
1503 * @param RTCx RTC Instance
1504 * @param TimeFormat This parameter can be one of the following values:
1505 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1506 * @arg @ref LL_RTC_TIME_FORMAT_PM
1507 * @retval None
1508 */
LL_RTC_TIME_SetFormat(RTC_TypeDef * RTCx,uint32_t TimeFormat)1509 __STATIC_INLINE void LL_RTC_TIME_SetFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
1510 {
1511 MODIFY_REG(RTCx->TR, RTC_TR_PM, TimeFormat);
1512 }
1513
1514 /**
1515 * @brief Get time format (AM or PM notation)
1516 * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1517 * before reading this bit
1518 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1519 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1520 * @rmtoll RTC_TR PM LL_RTC_TIME_GetFormat
1521 * @param RTCx RTC Instance
1522 * @retval Returned value can be one of the following values:
1523 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1524 * @arg @ref LL_RTC_TIME_FORMAT_PM
1525 */
LL_RTC_TIME_GetFormat(const RTC_TypeDef * RTCx)1526 __STATIC_INLINE uint32_t LL_RTC_TIME_GetFormat(const RTC_TypeDef *RTCx)
1527 {
1528 return (uint32_t)(READ_BIT(RTCx->TR, RTC_TR_PM));
1529 }
1530
1531 /**
1532 * @brief Set Hours in BCD format
1533 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1534 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1535 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert hour from binary to BCD format
1536 * @rmtoll RTC_TR HT LL_RTC_TIME_SetHour\n
1537 * RTC_TR HU LL_RTC_TIME_SetHour
1538 * @param RTCx RTC Instance
1539 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1540 * @retval None
1541 */
LL_RTC_TIME_SetHour(RTC_TypeDef * RTCx,uint32_t Hours)1542 __STATIC_INLINE void LL_RTC_TIME_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
1543 {
1544 MODIFY_REG(RTCx->TR, (RTC_TR_HT | RTC_TR_HU),
1545 (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos)));
1546 }
1547
1548 /**
1549 * @brief Get Hours in BCD format
1550 * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1551 * before reading this bit
1552 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1553 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1554 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert hour from BCD to
1555 * Binary format
1556 * @rmtoll RTC_TR HT LL_RTC_TIME_GetHour\n
1557 * RTC_TR HU LL_RTC_TIME_GetHour
1558 * @param RTCx RTC Instance
1559 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1560 */
LL_RTC_TIME_GetHour(const RTC_TypeDef * RTCx)1561 __STATIC_INLINE uint32_t LL_RTC_TIME_GetHour(const RTC_TypeDef *RTCx)
1562 {
1563 return (uint32_t)((READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU))) >> RTC_TR_HU_Pos);
1564 }
1565
1566 /**
1567 * @brief Set Minutes in BCD format
1568 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1569 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1570 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
1571 * @rmtoll RTC_TR MNT LL_RTC_TIME_SetMinute\n
1572 * RTC_TR MNU LL_RTC_TIME_SetMinute
1573 * @param RTCx RTC Instance
1574 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
1575 * @retval None
1576 */
LL_RTC_TIME_SetMinute(RTC_TypeDef * RTCx,uint32_t Minutes)1577 __STATIC_INLINE void LL_RTC_TIME_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
1578 {
1579 MODIFY_REG(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU),
1580 (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)));
1581 }
1582
1583 /**
1584 * @brief Get Minutes in BCD format
1585 * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1586 * before reading this bit
1587 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1588 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1589 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert minute from BCD
1590 * to Binary format
1591 * @rmtoll RTC_TR MNT LL_RTC_TIME_GetMinute\n
1592 * RTC_TR MNU LL_RTC_TIME_GetMinute
1593 * @param RTCx RTC Instance
1594 * @retval Value between Min_Data=0x00 and Max_Data=0x59
1595 */
LL_RTC_TIME_GetMinute(const RTC_TypeDef * RTCx)1596 __STATIC_INLINE uint32_t LL_RTC_TIME_GetMinute(const RTC_TypeDef *RTCx)
1597 {
1598 return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU)) >> RTC_TR_MNU_Pos);
1599 }
1600
1601 /**
1602 * @brief Set Seconds in BCD format
1603 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1604 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1605 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
1606 * @rmtoll RTC_TR ST LL_RTC_TIME_SetSecond\n
1607 * RTC_TR SU LL_RTC_TIME_SetSecond
1608 * @param RTCx RTC Instance
1609 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
1610 * @retval None
1611 */
LL_RTC_TIME_SetSecond(RTC_TypeDef * RTCx,uint32_t Seconds)1612 __STATIC_INLINE void LL_RTC_TIME_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
1613 {
1614 MODIFY_REG(RTCx->TR, (RTC_TR_ST | RTC_TR_SU),
1615 (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos)));
1616 }
1617
1618 /**
1619 * @brief Get Seconds in BCD format
1620 * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1621 * before reading this bit
1622 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1623 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1624 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD
1625 * to Binary format
1626 * @rmtoll RTC_TR ST LL_RTC_TIME_GetSecond\n
1627 * RTC_TR SU LL_RTC_TIME_GetSecond
1628 * @param RTCx RTC Instance
1629 * @retval Value between Min_Data=0x00 and Max_Data=0x59
1630 */
LL_RTC_TIME_GetSecond(const RTC_TypeDef * RTCx)1631 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSecond(const RTC_TypeDef *RTCx)
1632 {
1633 return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_ST | RTC_TR_SU)) >> RTC_TR_SU_Pos);
1634 }
1635
1636 /**
1637 * @brief Set time (hour, minute and second) in BCD format
1638 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1639 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1640 * @note TimeFormat and Hours should follow the same format
1641 * @rmtoll RTC_TR PM LL_RTC_TIME_Config\n
1642 * RTC_TR HT LL_RTC_TIME_Config\n
1643 * RTC_TR HU LL_RTC_TIME_Config\n
1644 * RTC_TR MNT LL_RTC_TIME_Config\n
1645 * RTC_TR MNU LL_RTC_TIME_Config\n
1646 * RTC_TR ST LL_RTC_TIME_Config\n
1647 * RTC_TR SU LL_RTC_TIME_Config
1648 * @param RTCx RTC Instance
1649 * @param Format12_24 This parameter can be one of the following values:
1650 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1651 * @arg @ref LL_RTC_TIME_FORMAT_PM
1652 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1653 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
1654 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
1655 * @retval None
1656 */
LL_RTC_TIME_Config(RTC_TypeDef * RTCx,uint32_t Format12_24,uint32_t Hours,uint32_t Minutes,uint32_t Seconds)1657 __STATIC_INLINE void LL_RTC_TIME_Config(RTC_TypeDef *RTCx,
1658 uint32_t Format12_24,
1659 uint32_t Hours,
1660 uint32_t Minutes,
1661 uint32_t Seconds)
1662 {
1663 uint32_t temp;
1664
1665 temp = Format12_24 | \
1666 (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos)) | \
1667 (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)) | \
1668 (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos));
1669 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);
1670 }
1671
1672 /**
1673 * @brief Get time (hour, minute and second) in BCD format
1674 * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1675 * before reading this bit
1676 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1677 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1678 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
1679 * are available to get independently each parameter.
1680 * @rmtoll RTC_TR HT LL_RTC_TIME_Get\n
1681 * RTC_TR HU LL_RTC_TIME_Get\n
1682 * RTC_TR MNT LL_RTC_TIME_Get\n
1683 * RTC_TR MNU LL_RTC_TIME_Get\n
1684 * RTC_TR ST LL_RTC_TIME_Get\n
1685 * RTC_TR SU LL_RTC_TIME_Get
1686 * @param RTCx RTC Instance
1687 * @retval Combination of hours, minutes and seconds (Format: 0x00HHMMSS).
1688 */
LL_RTC_TIME_Get(const RTC_TypeDef * RTCx)1689 __STATIC_INLINE uint32_t LL_RTC_TIME_Get(const RTC_TypeDef *RTCx)
1690 {
1691 uint32_t temp;
1692
1693 temp = READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU));
1694 return (uint32_t)((((((temp & RTC_TR_HT) >> RTC_TR_HT_Pos) << 4U) | \
1695 ((temp & RTC_TR_HU) >> RTC_TR_HU_Pos)) << RTC_OFFSET_HOUR) | \
1696 (((((temp & RTC_TR_MNT) >> RTC_TR_MNT_Pos) << 4U) | \
1697 ((temp & RTC_TR_MNU) >> RTC_TR_MNU_Pos)) << RTC_OFFSET_MINUTE) | \
1698 ((((temp & RTC_TR_ST) >> RTC_TR_ST_Pos) << 4U) | ((temp & RTC_TR_SU) >> RTC_TR_SU_Pos)));
1699 }
1700
1701 /**
1702 * @brief Memorize whether the daylight saving time change has been performed
1703 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1704 * @rmtoll RTC_CR BKP LL_RTC_TIME_EnableDayLightStore
1705 * @param RTCx RTC Instance
1706 * @retval None
1707 */
LL_RTC_TIME_EnableDayLightStore(RTC_TypeDef * RTCx)1708 __STATIC_INLINE void LL_RTC_TIME_EnableDayLightStore(RTC_TypeDef *RTCx)
1709 {
1710 SET_BIT(RTCx->CR, RTC_CR_BKP);
1711 }
1712
1713 /**
1714 * @brief Disable memorization whether the daylight saving time change has been performed.
1715 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1716 * @rmtoll RTC_CR BKP LL_RTC_TIME_DisableDayLightStore
1717 * @param RTCx RTC Instance
1718 * @retval None
1719 */
LL_RTC_TIME_DisableDayLightStore(RTC_TypeDef * RTCx)1720 __STATIC_INLINE void LL_RTC_TIME_DisableDayLightStore(RTC_TypeDef *RTCx)
1721 {
1722 CLEAR_BIT(RTCx->CR, RTC_CR_BKP);
1723 }
1724
1725 /**
1726 * @brief Check if RTC Day Light Saving stored operation has been enabled or not
1727 * @rmtoll RTC_CR BKP LL_RTC_TIME_IsDayLightStoreEnabled
1728 * @param RTCx RTC Instance
1729 * @retval State of bit (1 or 0).
1730 */
LL_RTC_TIME_IsDayLightStoreEnabled(const RTC_TypeDef * RTCx)1731 __STATIC_INLINE uint32_t LL_RTC_TIME_IsDayLightStoreEnabled(const RTC_TypeDef *RTCx)
1732 {
1733 return ((READ_BIT(RTCx->CR, RTC_CR_BKP) == (RTC_CR_BKP)) ? 1U : 0U);
1734 }
1735
1736 /**
1737 * @brief Subtract 1 hour (winter time change)
1738 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1739 * @rmtoll RTC_CR SUB1H LL_RTC_TIME_DecHour
1740 * @param RTCx RTC Instance
1741 * @retval None
1742 */
LL_RTC_TIME_DecHour(RTC_TypeDef * RTCx)1743 __STATIC_INLINE void LL_RTC_TIME_DecHour(RTC_TypeDef *RTCx)
1744 {
1745 SET_BIT(RTCx->CR, RTC_CR_SUB1H);
1746 }
1747
1748 /**
1749 * @brief Add 1 hour (summer time change)
1750 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1751 * @rmtoll RTC_CR ADD1H LL_RTC_TIME_IncHour
1752 * @param RTCx RTC Instance
1753 * @retval None
1754 */
LL_RTC_TIME_IncHour(RTC_TypeDef * RTCx)1755 __STATIC_INLINE void LL_RTC_TIME_IncHour(RTC_TypeDef *RTCx)
1756 {
1757 SET_BIT(RTCx->CR, RTC_CR_ADD1H);
1758 }
1759
1760 /**
1761 * @brief Get Sub second value in the synchronous prescaler counter.
1762 * @note You can use both SubSeconds value and SecondFraction (PREDIV_S through
1763 * LL_RTC_GetSynchPrescaler function) terms returned to convert Calendar
1764 * SubSeconds value in second fraction ratio with time unit following
1765 * generic formula:
1766 * ==> Seconds fraction ratio * time_unit= [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit
1767 * This conversion can be performed only if no shift operation is pending
1768 * (ie. SHFP=0) when PREDIV_S >= SS.
1769 * @rmtoll RTC_SSR SS LL_RTC_TIME_GetSubSecond
1770 * @param RTCx RTC Instance
1771 * @retval If binary mode is none, Value between Min_Data=0x0 and Max_Data=0x7FFF
1772 * else Value between Min_Data=0x0 and Max_Data=0xFFFFFFFF
1773 */
LL_RTC_TIME_GetSubSecond(const RTC_TypeDef * RTCx)1774 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSubSecond(const RTC_TypeDef *RTCx)
1775 {
1776 return (uint32_t)(READ_BIT(RTCx->SSR, RTC_SSR_SS));
1777 }
1778
1779 /**
1780 * @brief Synchronize to a remote clock with a high degree of precision.
1781 * @note This operation effectively subtracts from (delays) or advance the clock of a fraction of a second.
1782 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1783 * @note When REFCKON is set, firmware must not write to Shift control register.
1784 * @rmtoll RTC_SHIFTR ADD1S LL_RTC_TIME_Synchronize\n
1785 * RTC_SHIFTR SUBFS LL_RTC_TIME_Synchronize
1786 * @param RTCx RTC Instance
1787 * @param ShiftSecond This parameter can be one of the following values:
1788 * @arg @ref LL_RTC_SHIFT_SECOND_DELAY
1789 * @arg @ref LL_RTC_SHIFT_SECOND_ADVANCE
1790 * @param Fraction Number of Seconds Fractions (any value from 0 to 0x7FFF)
1791 * @retval None
1792 */
LL_RTC_TIME_Synchronize(RTC_TypeDef * RTCx,uint32_t ShiftSecond,uint32_t Fraction)1793 __STATIC_INLINE void LL_RTC_TIME_Synchronize(RTC_TypeDef *RTCx, uint32_t ShiftSecond, uint32_t Fraction)
1794 {
1795 WRITE_REG(RTCx->SHIFTR, ShiftSecond | Fraction);
1796 }
1797
1798 /**
1799 * @}
1800 */
1801
1802 /** @defgroup RTC_LL_EF_Date Date
1803 * @{
1804 */
1805
1806 /**
1807 * @brief Set Year in BCD format
1808 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Year from binary to BCD format
1809 * @rmtoll RTC_DR YT LL_RTC_DATE_SetYear\n
1810 * RTC_DR YU LL_RTC_DATE_SetYear
1811 * @param RTCx RTC Instance
1812 * @param Year Value between Min_Data=0x00 and Max_Data=0x99
1813 * @retval None
1814 */
LL_RTC_DATE_SetYear(RTC_TypeDef * RTCx,uint32_t Year)1815 __STATIC_INLINE void LL_RTC_DATE_SetYear(RTC_TypeDef *RTCx, uint32_t Year)
1816 {
1817 MODIFY_REG(RTCx->DR, (RTC_DR_YT | RTC_DR_YU),
1818 (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos)));
1819 }
1820
1821 /**
1822 * @brief Get Year in BCD format
1823 * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1824 * before reading this bit
1825 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Year from BCD to Binary format
1826 * @rmtoll RTC_DR YT LL_RTC_DATE_GetYear\n
1827 * RTC_DR YU LL_RTC_DATE_GetYear
1828 * @param RTCx RTC Instance
1829 * @retval Value between Min_Data=0x00 and Max_Data=0x99
1830 */
LL_RTC_DATE_GetYear(const RTC_TypeDef * RTCx)1831 __STATIC_INLINE uint32_t LL_RTC_DATE_GetYear(const RTC_TypeDef *RTCx)
1832 {
1833 return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_YT | RTC_DR_YU))) >> RTC_DR_YU_Pos);
1834 }
1835
1836 /**
1837 * @brief Set Week day
1838 * @rmtoll RTC_DR WDU LL_RTC_DATE_SetWeekDay
1839 * @param RTCx RTC Instance
1840 * @param WeekDay This parameter can be one of the following values:
1841 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1842 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1843 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1844 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1845 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1846 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1847 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1848 * @retval None
1849 */
LL_RTC_DATE_SetWeekDay(RTC_TypeDef * RTCx,uint32_t WeekDay)1850 __STATIC_INLINE void LL_RTC_DATE_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
1851 {
1852 MODIFY_REG(RTCx->DR, RTC_DR_WDU, WeekDay << RTC_DR_WDU_Pos);
1853 }
1854
1855 /**
1856 * @brief Get Week day
1857 * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1858 * before reading this bit
1859 * @rmtoll RTC_DR WDU LL_RTC_DATE_GetWeekDay
1860 * @param RTCx RTC Instance
1861 * @retval Returned value can be one of the following values:
1862 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1863 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1864 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1865 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1866 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1867 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1868 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1869 */
LL_RTC_DATE_GetWeekDay(const RTC_TypeDef * RTCx)1870 __STATIC_INLINE uint32_t LL_RTC_DATE_GetWeekDay(const RTC_TypeDef *RTCx)
1871 {
1872 return (uint32_t)(READ_BIT(RTCx->DR, RTC_DR_WDU) >> RTC_DR_WDU_Pos);
1873 }
1874
1875 /**
1876 * @brief Set Month in BCD format
1877 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Month from binary to BCD format
1878 * @rmtoll RTC_DR MT LL_RTC_DATE_SetMonth\n
1879 * RTC_DR MU LL_RTC_DATE_SetMonth
1880 * @param RTCx RTC Instance
1881 * @param Month This parameter can be one of the following values:
1882 * @arg @ref LL_RTC_MONTH_JANUARY
1883 * @arg @ref LL_RTC_MONTH_FEBRUARY
1884 * @arg @ref LL_RTC_MONTH_MARCH
1885 * @arg @ref LL_RTC_MONTH_APRIL
1886 * @arg @ref LL_RTC_MONTH_MAY
1887 * @arg @ref LL_RTC_MONTH_JUNE
1888 * @arg @ref LL_RTC_MONTH_JULY
1889 * @arg @ref LL_RTC_MONTH_AUGUST
1890 * @arg @ref LL_RTC_MONTH_SEPTEMBER
1891 * @arg @ref LL_RTC_MONTH_OCTOBER
1892 * @arg @ref LL_RTC_MONTH_NOVEMBER
1893 * @arg @ref LL_RTC_MONTH_DECEMBER
1894 * @retval None
1895 */
LL_RTC_DATE_SetMonth(RTC_TypeDef * RTCx,uint32_t Month)1896 __STATIC_INLINE void LL_RTC_DATE_SetMonth(RTC_TypeDef *RTCx, uint32_t Month)
1897 {
1898 MODIFY_REG(RTCx->DR, (RTC_DR_MT | RTC_DR_MU),
1899 (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)));
1900 }
1901
1902 /**
1903 * @brief Get Month in BCD format
1904 * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1905 * before reading this bit
1906 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
1907 * @rmtoll RTC_DR MT LL_RTC_DATE_GetMonth\n
1908 * RTC_DR MU LL_RTC_DATE_GetMonth
1909 * @param RTCx RTC Instance
1910 * @retval Returned value can be one of the following values:
1911 * @arg @ref LL_RTC_MONTH_JANUARY
1912 * @arg @ref LL_RTC_MONTH_FEBRUARY
1913 * @arg @ref LL_RTC_MONTH_MARCH
1914 * @arg @ref LL_RTC_MONTH_APRIL
1915 * @arg @ref LL_RTC_MONTH_MAY
1916 * @arg @ref LL_RTC_MONTH_JUNE
1917 * @arg @ref LL_RTC_MONTH_JULY
1918 * @arg @ref LL_RTC_MONTH_AUGUST
1919 * @arg @ref LL_RTC_MONTH_SEPTEMBER
1920 * @arg @ref LL_RTC_MONTH_OCTOBER
1921 * @arg @ref LL_RTC_MONTH_NOVEMBER
1922 * @arg @ref LL_RTC_MONTH_DECEMBER
1923 */
LL_RTC_DATE_GetMonth(const RTC_TypeDef * RTCx)1924 __STATIC_INLINE uint32_t LL_RTC_DATE_GetMonth(const RTC_TypeDef *RTCx)
1925 {
1926 return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_MT | RTC_DR_MU))) >> RTC_DR_MU_Pos);
1927 }
1928
1929 /**
1930 * @brief Set Day in BCD format
1931 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
1932 * @rmtoll RTC_DR DT LL_RTC_DATE_SetDay\n
1933 * RTC_DR DU LL_RTC_DATE_SetDay
1934 * @param RTCx RTC Instance
1935 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
1936 * @retval None
1937 */
LL_RTC_DATE_SetDay(RTC_TypeDef * RTCx,uint32_t Day)1938 __STATIC_INLINE void LL_RTC_DATE_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
1939 {
1940 MODIFY_REG(RTCx->DR, (RTC_DR_DT | RTC_DR_DU),
1941 (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos)));
1942 }
1943
1944 /**
1945 * @brief Get Day in BCD format
1946 * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1947 * before reading this bit
1948 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
1949 * @rmtoll RTC_DR DT LL_RTC_DATE_GetDay\n
1950 * RTC_DR DU LL_RTC_DATE_GetDay
1951 * @param RTCx RTC Instance
1952 * @retval Value between Min_Data=0x01 and Max_Data=0x31
1953 */
LL_RTC_DATE_GetDay(const RTC_TypeDef * RTCx)1954 __STATIC_INLINE uint32_t LL_RTC_DATE_GetDay(const RTC_TypeDef *RTCx)
1955 {
1956 return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_DT | RTC_DR_DU))) >> RTC_DR_DU_Pos);
1957 }
1958
1959 /**
1960 * @brief Set date (WeekDay, Day, Month and Year) in BCD format
1961 * @rmtoll RTC_DR WDU LL_RTC_DATE_Config\n
1962 * RTC_DR MT LL_RTC_DATE_Config\n
1963 * RTC_DR MU LL_RTC_DATE_Config\n
1964 * RTC_DR DT LL_RTC_DATE_Config\n
1965 * RTC_DR DU LL_RTC_DATE_Config\n
1966 * RTC_DR YT LL_RTC_DATE_Config\n
1967 * RTC_DR YU LL_RTC_DATE_Config
1968 * @param RTCx RTC Instance
1969 * @param WeekDay This parameter can be one of the following values:
1970 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1971 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1972 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1973 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1974 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1975 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1976 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1977 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
1978 * @param Month This parameter can be one of the following values:
1979 * @arg @ref LL_RTC_MONTH_JANUARY
1980 * @arg @ref LL_RTC_MONTH_FEBRUARY
1981 * @arg @ref LL_RTC_MONTH_MARCH
1982 * @arg @ref LL_RTC_MONTH_APRIL
1983 * @arg @ref LL_RTC_MONTH_MAY
1984 * @arg @ref LL_RTC_MONTH_JUNE
1985 * @arg @ref LL_RTC_MONTH_JULY
1986 * @arg @ref LL_RTC_MONTH_AUGUST
1987 * @arg @ref LL_RTC_MONTH_SEPTEMBER
1988 * @arg @ref LL_RTC_MONTH_OCTOBER
1989 * @arg @ref LL_RTC_MONTH_NOVEMBER
1990 * @arg @ref LL_RTC_MONTH_DECEMBER
1991 * @param Year Value between Min_Data=0x00 and Max_Data=0x99
1992 * @retval None
1993 */
LL_RTC_DATE_Config(RTC_TypeDef * RTCx,uint32_t WeekDay,uint32_t Day,uint32_t Month,uint32_t Year)1994 __STATIC_INLINE void LL_RTC_DATE_Config(RTC_TypeDef *RTCx,
1995 uint32_t WeekDay,
1996 uint32_t Day,
1997 uint32_t Month,
1998 uint32_t Year)
1999 {
2000 uint32_t temp;
2001
2002 temp = (WeekDay << RTC_DR_WDU_Pos) | \
2003 (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos)) | \
2004 (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)) | \
2005 (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos));
2006
2007 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);
2008 }
2009
2010 /**
2011 * @brief Get date (WeekDay, Day, Month and Year) in BCD format
2012 * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
2013 * before reading this bit
2014 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_YEAR, __LL_RTC_GET_MONTH,
2015 * and __LL_RTC_GET_DAY are available to get independently each parameter.
2016 * @rmtoll RTC_DR WDU LL_RTC_DATE_Get\n
2017 * RTC_DR MT LL_RTC_DATE_Get\n
2018 * RTC_DR MU LL_RTC_DATE_Get\n
2019 * RTC_DR DT LL_RTC_DATE_Get\n
2020 * RTC_DR DU LL_RTC_DATE_Get\n
2021 * RTC_DR YT LL_RTC_DATE_Get\n
2022 * RTC_DR YU LL_RTC_DATE_Get
2023 * @param RTCx RTC Instance
2024 * @retval Combination of WeekDay, Day, Month and Year (Format: 0xWWDDMMYY).
2025 */
LL_RTC_DATE_Get(const RTC_TypeDef * RTCx)2026 __STATIC_INLINE uint32_t LL_RTC_DATE_Get(const RTC_TypeDef *RTCx)
2027 {
2028 uint32_t temp;
2029
2030 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));
2031 return (uint32_t)((((temp & RTC_DR_WDU) >> RTC_DR_WDU_Pos) << RTC_OFFSET_WEEKDAY) | \
2032 (((((temp & RTC_DR_DT) >> RTC_DR_DT_Pos) << 4U) | \
2033 ((temp & RTC_DR_DU) >> RTC_DR_DU_Pos)) << RTC_OFFSET_DAY) | \
2034 (((((temp & RTC_DR_MT) >> RTC_DR_MT_Pos) << 4U) | \
2035 ((temp & RTC_DR_MU) >> RTC_DR_MU_Pos)) << RTC_OFFSET_MONTH) | \
2036 ((((temp & RTC_DR_YT) >> RTC_DR_YT_Pos) << 4U) | ((temp & RTC_DR_YU) >> RTC_DR_YU_Pos)));
2037 }
2038
2039 /**
2040 * @}
2041 */
2042
2043 /** @defgroup RTC_LL_EF_ALARMA ALARMA
2044 * @{
2045 */
2046
2047 /**
2048 * @brief Enable Alarm A
2049 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2050 * @rmtoll RTC_CR ALRAE LL_RTC_ALMA_Enable
2051 * @param RTCx RTC Instance
2052 * @retval None
2053 */
LL_RTC_ALMA_Enable(RTC_TypeDef * RTCx)2054 __STATIC_INLINE void LL_RTC_ALMA_Enable(RTC_TypeDef *RTCx)
2055 {
2056 SET_BIT(RTCx->CR, RTC_CR_ALRAE);
2057 }
2058
2059 /**
2060 * @brief Disable Alarm A
2061 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2062 * @rmtoll RTC_CR ALRAE LL_RTC_ALMA_Disable
2063 * @param RTCx RTC Instance
2064 * @retval None
2065 */
LL_RTC_ALMA_Disable(RTC_TypeDef * RTCx)2066 __STATIC_INLINE void LL_RTC_ALMA_Disable(RTC_TypeDef *RTCx)
2067 {
2068 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAE);
2069 }
2070
2071 /**
2072 * @brief Specify the Alarm A masks.
2073 * @rmtoll RTC_ALRMAR MSK4 LL_RTC_ALMA_SetMask\n
2074 * RTC_ALRMAR MSK3 LL_RTC_ALMA_SetMask\n
2075 * RTC_ALRMAR MSK2 LL_RTC_ALMA_SetMask\n
2076 * RTC_ALRMAR MSK1 LL_RTC_ALMA_SetMask
2077 * @param RTCx RTC Instance
2078 * @param Mask This parameter can be a combination of the following values:
2079 * @arg @ref LL_RTC_ALMA_MASK_NONE
2080 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
2081 * @arg @ref LL_RTC_ALMA_MASK_HOURS
2082 * @arg @ref LL_RTC_ALMA_MASK_MINUTES
2083 * @arg @ref LL_RTC_ALMA_MASK_SECONDS
2084 * @arg @ref LL_RTC_ALMA_MASK_ALL
2085 * @retval None
2086 */
LL_RTC_ALMA_SetMask(RTC_TypeDef * RTCx,uint32_t Mask)2087 __STATIC_INLINE void LL_RTC_ALMA_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
2088 {
2089 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1, Mask);
2090 }
2091
2092 /**
2093 * @brief Get the Alarm A masks.
2094 * @rmtoll RTC_ALRMAR MSK4 LL_RTC_ALMA_GetMask\n
2095 * RTC_ALRMAR MSK3 LL_RTC_ALMA_GetMask\n
2096 * RTC_ALRMAR MSK2 LL_RTC_ALMA_GetMask\n
2097 * RTC_ALRMAR MSK1 LL_RTC_ALMA_GetMask
2098 * @param RTCx RTC Instance
2099 * @retval Returned value can be can be a combination of the following values:
2100 * @arg @ref LL_RTC_ALMA_MASK_NONE
2101 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
2102 * @arg @ref LL_RTC_ALMA_MASK_HOURS
2103 * @arg @ref LL_RTC_ALMA_MASK_MINUTES
2104 * @arg @ref LL_RTC_ALMA_MASK_SECONDS
2105 * @arg @ref LL_RTC_ALMA_MASK_ALL
2106 */
LL_RTC_ALMA_GetMask(const RTC_TypeDef * RTCx)2107 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMask(const RTC_TypeDef *RTCx)
2108 {
2109 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1));
2110 }
2111
2112 /**
2113 * @brief Enable AlarmA Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
2114 * @rmtoll RTC_ALRMAR WDSEL LL_RTC_ALMA_EnableWeekday
2115 * @param RTCx RTC Instance
2116 * @retval None
2117 */
LL_RTC_ALMA_EnableWeekday(RTC_TypeDef * RTCx)2118 __STATIC_INLINE void LL_RTC_ALMA_EnableWeekday(RTC_TypeDef *RTCx)
2119 {
2120 SET_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
2121 }
2122
2123 /**
2124 * @brief Disable AlarmA Week day selection (DU[3:0] represents the date )
2125 * @rmtoll RTC_ALRMAR WDSEL LL_RTC_ALMA_DisableWeekday
2126 * @param RTCx RTC Instance
2127 * @retval None
2128 */
LL_RTC_ALMA_DisableWeekday(RTC_TypeDef * RTCx)2129 __STATIC_INLINE void LL_RTC_ALMA_DisableWeekday(RTC_TypeDef *RTCx)
2130 {
2131 CLEAR_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
2132 }
2133
2134 /**
2135 * @brief Set ALARM A Day in BCD format
2136 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
2137 * @rmtoll RTC_ALRMAR DT LL_RTC_ALMA_SetDay\n
2138 * RTC_ALRMAR DU LL_RTC_ALMA_SetDay
2139 * @param RTCx RTC Instance
2140 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
2141 * @retval None
2142 */
LL_RTC_ALMA_SetDay(RTC_TypeDef * RTCx,uint32_t Day)2143 __STATIC_INLINE void LL_RTC_ALMA_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
2144 {
2145 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU),
2146 (((Day & 0xF0U) << (RTC_ALRMAR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMAR_DU_Pos)));
2147 }
2148
2149 /**
2150 * @brief Get ALARM A Day in BCD format
2151 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2152 * @rmtoll RTC_ALRMAR DT LL_RTC_ALMA_GetDay\n
2153 * RTC_ALRMAR DU LL_RTC_ALMA_GetDay
2154 * @param RTCx RTC Instance
2155 * @retval Value between Min_Data=0x01 and Max_Data=0x31
2156 */
LL_RTC_ALMA_GetDay(const RTC_TypeDef * RTCx)2157 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetDay(const RTC_TypeDef *RTCx)
2158 {
2159 return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU))) >> RTC_ALRMAR_DU_Pos);
2160 }
2161
2162 /**
2163 * @brief Set ALARM A Weekday
2164 * @rmtoll RTC_ALRMAR DU LL_RTC_ALMA_SetWeekDay
2165 * @param RTCx RTC Instance
2166 * @param WeekDay This parameter can be one of the following values:
2167 * @arg @ref LL_RTC_WEEKDAY_MONDAY
2168 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
2169 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2170 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
2171 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
2172 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
2173 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
2174 * @retval None
2175 */
LL_RTC_ALMA_SetWeekDay(RTC_TypeDef * RTCx,uint32_t WeekDay)2176 __STATIC_INLINE void LL_RTC_ALMA_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
2177 {
2178 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_DU, WeekDay << RTC_ALRMAR_DU_Pos);
2179 }
2180
2181 /**
2182 * @brief Get ALARM A Weekday
2183 * @rmtoll RTC_ALRMAR DU LL_RTC_ALMA_GetWeekDay
2184 * @param RTCx RTC Instance
2185 * @retval Returned value can be one of the following values:
2186 * @arg @ref LL_RTC_WEEKDAY_MONDAY
2187 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
2188 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2189 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
2190 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
2191 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
2192 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
2193 */
LL_RTC_ALMA_GetWeekDay(const RTC_TypeDef * RTCx)2194 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetWeekDay(const RTC_TypeDef *RTCx)
2195 {
2196 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_DU) >> RTC_ALRMAR_DU_Pos);
2197 }
2198
2199 /**
2200 * @brief Set Alarm A time format (AM/24-hour or PM notation)
2201 * @rmtoll RTC_ALRMAR PM LL_RTC_ALMA_SetTimeFormat
2202 * @param RTCx RTC Instance
2203 * @param TimeFormat This parameter can be one of the following values:
2204 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
2205 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
2206 * @retval None
2207 */
LL_RTC_ALMA_SetTimeFormat(RTC_TypeDef * RTCx,uint32_t TimeFormat)2208 __STATIC_INLINE void LL_RTC_ALMA_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
2209 {
2210 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM, TimeFormat);
2211 }
2212
2213 /**
2214 * @brief Get Alarm A time format (AM or PM notation)
2215 * @rmtoll RTC_ALRMAR PM LL_RTC_ALMA_GetTimeFormat
2216 * @param RTCx RTC Instance
2217 * @retval Returned value can be one of the following values:
2218 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
2219 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
2220 */
LL_RTC_ALMA_GetTimeFormat(const RTC_TypeDef * RTCx)2221 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTimeFormat(const RTC_TypeDef *RTCx)
2222 {
2223 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_PM));
2224 }
2225
2226 /**
2227 * @brief Set ALARM A Hours in BCD format
2228 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
2229 * @rmtoll RTC_ALRMAR HT LL_RTC_ALMA_SetHour\n
2230 * RTC_ALRMAR HU LL_RTC_ALMA_SetHour
2231 * @param RTCx RTC Instance
2232 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2233 * @retval None
2234 */
LL_RTC_ALMA_SetHour(RTC_TypeDef * RTCx,uint32_t Hours)2235 __STATIC_INLINE void LL_RTC_ALMA_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
2236 {
2237 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU),
2238 (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos)));
2239 }
2240
2241 /**
2242 * @brief Get ALARM A Hours in BCD format
2243 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2244 * @rmtoll RTC_ALRMAR HT LL_RTC_ALMA_GetHour\n
2245 * RTC_ALRMAR HU LL_RTC_ALMA_GetHour
2246 * @param RTCx RTC Instance
2247 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2248 */
LL_RTC_ALMA_GetHour(const RTC_TypeDef * RTCx)2249 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetHour(const RTC_TypeDef *RTCx)
2250 {
2251 return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU))) >> RTC_ALRMAR_HU_Pos);
2252 }
2253
2254 /**
2255 * @brief Set ALARM A Minutes in BCD format
2256 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
2257 * @rmtoll RTC_ALRMAR MNT LL_RTC_ALMA_SetMinute\n
2258 * RTC_ALRMAR MNU LL_RTC_ALMA_SetMinute
2259 * @param RTCx RTC Instance
2260 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
2261 * @retval None
2262 */
LL_RTC_ALMA_SetMinute(RTC_TypeDef * RTCx,uint32_t Minutes)2263 __STATIC_INLINE void LL_RTC_ALMA_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
2264 {
2265 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU),
2266 (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)));
2267 }
2268
2269 /**
2270 * @brief Get ALARM A Minutes in BCD format
2271 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2272 * @rmtoll RTC_ALRMAR MNT LL_RTC_ALMA_GetMinute\n
2273 * RTC_ALRMAR MNU LL_RTC_ALMA_GetMinute
2274 * @param RTCx RTC Instance
2275 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2276 */
LL_RTC_ALMA_GetMinute(const RTC_TypeDef * RTCx)2277 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMinute(const RTC_TypeDef *RTCx)
2278 {
2279 return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU))) >> RTC_ALRMAR_MNU_Pos);
2280 }
2281
2282 /**
2283 * @brief Set ALARM A Seconds in BCD format
2284 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
2285 * @rmtoll RTC_ALRMAR ST LL_RTC_ALMA_SetSecond\n
2286 * RTC_ALRMAR SU LL_RTC_ALMA_SetSecond
2287 * @param RTCx RTC Instance
2288 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
2289 * @retval None
2290 */
LL_RTC_ALMA_SetSecond(RTC_TypeDef * RTCx,uint32_t Seconds)2291 __STATIC_INLINE void LL_RTC_ALMA_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
2292 {
2293 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU),
2294 (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos)));
2295 }
2296
2297 /**
2298 * @brief Get ALARM A Seconds in BCD format
2299 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2300 * @rmtoll RTC_ALRMAR ST LL_RTC_ALMA_GetSecond\n
2301 * RTC_ALRMAR SU LL_RTC_ALMA_GetSecond
2302 * @param RTCx RTC Instance
2303 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2304 */
LL_RTC_ALMA_GetSecond(const RTC_TypeDef * RTCx)2305 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSecond(const RTC_TypeDef *RTCx)
2306 {
2307 return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU))) >> RTC_ALRMAR_SU_Pos);
2308 }
2309
2310 /**
2311 * @brief Set Alarm A Time (hour, minute and second) in BCD format
2312 * @rmtoll RTC_ALRMAR PM LL_RTC_ALMA_ConfigTime\n
2313 * RTC_ALRMAR HT LL_RTC_ALMA_ConfigTime\n
2314 * RTC_ALRMAR HU LL_RTC_ALMA_ConfigTime\n
2315 * RTC_ALRMAR MNT LL_RTC_ALMA_ConfigTime\n
2316 * RTC_ALRMAR MNU LL_RTC_ALMA_ConfigTime\n
2317 * RTC_ALRMAR ST LL_RTC_ALMA_ConfigTime\n
2318 * RTC_ALRMAR SU LL_RTC_ALMA_ConfigTime
2319 * @param RTCx RTC Instance
2320 * @param Format12_24 This parameter can be one of the following values:
2321 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
2322 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
2323 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2324 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
2325 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
2326 * @retval None
2327 */
LL_RTC_ALMA_ConfigTime(RTC_TypeDef * RTCx,uint32_t Format12_24,uint32_t Hours,uint32_t Minutes,uint32_t Seconds)2328 __STATIC_INLINE void LL_RTC_ALMA_ConfigTime(RTC_TypeDef *RTCx,
2329 uint32_t Format12_24,
2330 uint32_t Hours,
2331 uint32_t Minutes,
2332 uint32_t Seconds)
2333 {
2334 uint32_t temp;
2335
2336 temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos)) | \
2337 (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)) | \
2338 (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos));
2339
2340 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM | RTC_ALRMAR_HT | RTC_ALRMAR_HU | RTC_ALRMAR_MNT | RTC_ALRMAR_MNU | \
2341 RTC_ALRMAR_ST | RTC_ALRMAR_SU, temp);
2342 }
2343
2344 /**
2345 * @brief Get Alarm B Time (hour, minute and second) in BCD format
2346 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2347 * are available to get independently each parameter.
2348 * @rmtoll RTC_ALRMAR HT LL_RTC_ALMA_GetTime\n
2349 * RTC_ALRMAR HU LL_RTC_ALMA_GetTime\n
2350 * RTC_ALRMAR MNT LL_RTC_ALMA_GetTime\n
2351 * RTC_ALRMAR MNU LL_RTC_ALMA_GetTime\n
2352 * RTC_ALRMAR ST LL_RTC_ALMA_GetTime\n
2353 * RTC_ALRMAR SU LL_RTC_ALMA_GetTime
2354 * @param RTCx RTC Instance
2355 * @retval Combination of hours, minutes and seconds.
2356 */
LL_RTC_ALMA_GetTime(const RTC_TypeDef * RTCx)2357 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTime(const RTC_TypeDef *RTCx)
2358 {
2359 return (uint32_t)((LL_RTC_ALMA_GetHour(RTCx) << RTC_OFFSET_HOUR) |
2360 (LL_RTC_ALMA_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMA_GetSecond(RTCx));
2361 }
2362
2363 /**
2364 * @brief Set Alarm A Mask the most-significant bits starting at this bit
2365 * @note This register can be written only when ALRAE is reset in RTC_CR register,
2366 * or in initialization mode.
2367 * @rmtoll RTC_ALRMASSR MASKSS LL_RTC_ALMA_SetSubSecondMask
2368 * @param RTCx RTC Instance
2369 * @param Mask If binary mode is none, Value between Min_Data=0x0 and Max_Data=0xF
2370 * else Value between Min_Data=0x0 and Max_Data=0x3F
2371 * @retval None
2372 */
LL_RTC_ALMA_SetSubSecondMask(RTC_TypeDef * RTCx,uint32_t Mask)2373 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
2374 {
2375 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS, Mask << RTC_ALRMASSR_MASKSS_Pos);
2376 }
2377
2378 /**
2379 * @brief Get Alarm A Mask the most-significant bits starting at this bit
2380 * @rmtoll RTC_ALRMASSR MASKSS LL_RTC_ALMA_GetSubSecondMask
2381 * @param RTCx RTC Instance
2382 * @retval If binary mode is none, Value between Min_Data=0x0 and Max_Data=0xF
2383 * else Value between Min_Data=0x0 and Max_Data=0x3F
2384 */
LL_RTC_ALMA_GetSubSecondMask(const RTC_TypeDef * RTCx)2385 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecondMask(const RTC_TypeDef *RTCx)
2386 {
2387 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS) >> RTC_ALRMASSR_MASKSS_Pos);
2388 }
2389
2390 /**
2391 * @brief Set Alarm A Binary mode auto clear
2392 * @note This register can be written only when ALRAE is reset in RTC_CR register,
2393 * or in initialization mode.
2394 * @rmtoll RTC_ALRABINR SSCLR LL_RTC_ALMA_SetBinAutoClr
2395 * @param RTCx RTC Instance
2396 * @param BinaryAutoClr This parameter can be one of the following values:
2397 * @arg @ref LL_RTC_ALMA_SUBSECONDBIN_AUTOCLR_NO
2398 * @arg @ref LL_RTC_ALMA_SUBSECONDBIN_AUTOCLR_YES
2399 * @retval None
2400 */
LL_RTC_ALMA_SetBinAutoClr(RTC_TypeDef * RTCx,uint32_t BinaryAutoClr)2401 __STATIC_INLINE void LL_RTC_ALMA_SetBinAutoClr(RTC_TypeDef *RTCx, uint32_t BinaryAutoClr)
2402 {
2403 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_SSCLR, BinaryAutoClr);
2404 }
2405
2406 /**
2407 * @brief Get Alarm A Binary mode auto clear
2408 * @rmtoll RTC_ALRABINR SSCLR LL_RTC_ALMA_GetBinAutoClr
2409 * @param RTCx RTC Instance
2410 * @retval It can be one of the following values:
2411 * @arg @ref LL_RTC_ALMA_SUBSECONDBIN_AUTOCLR_NO
2412 * @arg @ref LL_RTC_ALMA_SUBSECONDBIN_AUTOCLR_YES
2413 */
LL_RTC_ALMA_GetBinAutoClr(const RTC_TypeDef * RTCx)2414 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetBinAutoClr(const RTC_TypeDef *RTCx)
2415 {
2416 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_SSCLR));
2417 }
2418
2419 /**
2420 * @brief Set Alarm A Sub seconds value
2421 * @rmtoll RCT_ALRMASSR SS LL_RTC_ALMA_SetSubSecond
2422 * @param RTCx RTC Instance
2423 * @param Subsecond If binary mode is none, Value between Min_Data=0x0 and Max_Data=0x7FFF
2424 * else Value between Min_Data=0x0 and Max_Data=0xFFFFFFFF
2425 * @retval None
2426 */
LL_RTC_ALMA_SetSubSecond(RTC_TypeDef * RTCx,uint32_t Subsecond)2427 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
2428 {
2429 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_SS, Subsecond);
2430 }
2431
2432 /**
2433 * @brief Get Alarm A Sub seconds value
2434 * @rmtoll RCT_ALRMASSR SS LL_RTC_ALMA_GetSubSecond
2435 * @param RTCx RTC Instance
2436 * @retval If binary mode is none, Value between Min_Data=0x0 and Max_Data=0x7FFF
2437 * else Value between Min_Data=0x0 and Max_Data=0xFFFFFFFF
2438 */
LL_RTC_ALMA_GetSubSecond(const RTC_TypeDef * RTCx)2439 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecond(const RTC_TypeDef *RTCx)
2440 {
2441 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_SS));
2442 }
2443
2444 /**
2445 * @}
2446 */
2447
2448 /** @defgroup RTC_LL_EF_ALARMB ALARMB
2449 * @{
2450 */
2451
2452 /**
2453 * @brief Enable Alarm B
2454 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2455 * @rmtoll RTC_CR ALRBE LL_RTC_ALMB_Enable
2456 * @param RTCx RTC Instance
2457 * @retval None
2458 */
LL_RTC_ALMB_Enable(RTC_TypeDef * RTCx)2459 __STATIC_INLINE void LL_RTC_ALMB_Enable(RTC_TypeDef *RTCx)
2460 {
2461 SET_BIT(RTCx->CR, RTC_CR_ALRBE);
2462 }
2463
2464 /**
2465 * @brief Disable Alarm B
2466 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2467 * @rmtoll RTC_CR ALRBE LL_RTC_ALMB_Disable
2468 * @param RTCx RTC Instance
2469 * @retval None
2470 */
LL_RTC_ALMB_Disable(RTC_TypeDef * RTCx)2471 __STATIC_INLINE void LL_RTC_ALMB_Disable(RTC_TypeDef *RTCx)
2472 {
2473 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBE);
2474 }
2475
2476 /**
2477 * @brief Specify the Alarm B masks.
2478 * @rmtoll RTC_ALRMBR MSK4 LL_RTC_ALMB_SetMask\n
2479 * RTC_ALRMBR MSK3 LL_RTC_ALMB_SetMask\n
2480 * RTC_ALRMBR MSK2 LL_RTC_ALMB_SetMask\n
2481 * RTC_ALRMBR MSK1 LL_RTC_ALMB_SetMask
2482 * @param RTCx RTC Instance
2483 * @param Mask This parameter can be a combination of the following values:
2484 * @arg @ref LL_RTC_ALMB_MASK_NONE
2485 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
2486 * @arg @ref LL_RTC_ALMB_MASK_HOURS
2487 * @arg @ref LL_RTC_ALMB_MASK_MINUTES
2488 * @arg @ref LL_RTC_ALMB_MASK_SECONDS
2489 * @arg @ref LL_RTC_ALMB_MASK_ALL
2490 * @retval None
2491 */
LL_RTC_ALMB_SetMask(RTC_TypeDef * RTCx,uint32_t Mask)2492 __STATIC_INLINE void LL_RTC_ALMB_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
2493 {
2494 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1, Mask);
2495 }
2496
2497 /**
2498 * @brief Get the Alarm B masks.
2499 * @rmtoll RTC_ALRMBR MSK4 LL_RTC_ALMB_GetMask\n
2500 * RTC_ALRMBR MSK3 LL_RTC_ALMB_GetMask\n
2501 * RTC_ALRMBR MSK2 LL_RTC_ALMB_GetMask\n
2502 * RTC_ALRMBR MSK1 LL_RTC_ALMB_GetMask
2503 * @param RTCx RTC Instance
2504 * @retval Returned value can be can be a combination of the following values:
2505 * @arg @ref LL_RTC_ALMB_MASK_NONE
2506 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
2507 * @arg @ref LL_RTC_ALMB_MASK_HOURS
2508 * @arg @ref LL_RTC_ALMB_MASK_MINUTES
2509 * @arg @ref LL_RTC_ALMB_MASK_SECONDS
2510 * @arg @ref LL_RTC_ALMB_MASK_ALL
2511 */
LL_RTC_ALMB_GetMask(const RTC_TypeDef * RTCx)2512 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMask(const RTC_TypeDef *RTCx)
2513 {
2514 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1));
2515 }
2516
2517 /**
2518 * @brief Enable AlarmB Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
2519 * @rmtoll RTC_ALRMBR WDSEL LL_RTC_ALMB_EnableWeekday
2520 * @param RTCx RTC Instance
2521 * @retval None
2522 */
LL_RTC_ALMB_EnableWeekday(RTC_TypeDef * RTCx)2523 __STATIC_INLINE void LL_RTC_ALMB_EnableWeekday(RTC_TypeDef *RTCx)
2524 {
2525 SET_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
2526 }
2527
2528 /**
2529 * @brief Disable AlarmB Week day selection (DU[3:0] represents the date )
2530 * @rmtoll RTC_ALRMBR WDSEL LL_RTC_ALMB_DisableWeekday
2531 * @param RTCx RTC Instance
2532 * @retval None
2533 */
LL_RTC_ALMB_DisableWeekday(RTC_TypeDef * RTCx)2534 __STATIC_INLINE void LL_RTC_ALMB_DisableWeekday(RTC_TypeDef *RTCx)
2535 {
2536 CLEAR_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
2537 }
2538
2539 /**
2540 * @brief Set ALARM B Day in BCD format
2541 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
2542 * @rmtoll RTC_ALRMBR DT LL_RTC_ALMB_SetDay\n
2543 * RTC_ALRMBR DU LL_RTC_ALMB_SetDay
2544 * @param RTCx RTC Instance
2545 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
2546 * @retval None
2547 */
LL_RTC_ALMB_SetDay(RTC_TypeDef * RTCx,uint32_t Day)2548 __STATIC_INLINE void LL_RTC_ALMB_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
2549 {
2550 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU),
2551 (((Day & 0xF0U) << (RTC_ALRMBR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMBR_DU_Pos)));
2552 }
2553
2554 /**
2555 * @brief Get ALARM B Day in BCD format
2556 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2557 * @rmtoll RTC_ALRMBR DT LL_RTC_ALMB_GetDay\n
2558 * RTC_ALRMBR DU LL_RTC_ALMB_GetDay
2559 * @param RTCx RTC Instance
2560 * @retval Value between Min_Data=0x01 and Max_Data=0x31
2561 */
LL_RTC_ALMB_GetDay(const RTC_TypeDef * RTCx)2562 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetDay(const RTC_TypeDef *RTCx)
2563 {
2564 return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU))) >> RTC_ALRMBR_DU_Pos);
2565 }
2566
2567 /**
2568 * @brief Set ALARM B Weekday
2569 * @rmtoll RTC_ALRMBR DU LL_RTC_ALMB_SetWeekDay
2570 * @param RTCx RTC Instance
2571 * @param WeekDay This parameter can be one of the following values:
2572 * @arg @ref LL_RTC_WEEKDAY_MONDAY
2573 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
2574 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2575 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
2576 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
2577 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
2578 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
2579 * @retval None
2580 */
LL_RTC_ALMB_SetWeekDay(RTC_TypeDef * RTCx,uint32_t WeekDay)2581 __STATIC_INLINE void LL_RTC_ALMB_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
2582 {
2583 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_DU, WeekDay << RTC_ALRMBR_DU_Pos);
2584 }
2585
2586 /**
2587 * @brief Get ALARM B Weekday
2588 * @rmtoll RTC_ALRMBR DU LL_RTC_ALMB_GetWeekDay
2589 * @param RTCx RTC Instance
2590 * @retval Returned value can be one of the following values:
2591 * @arg @ref LL_RTC_WEEKDAY_MONDAY
2592 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
2593 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2594 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
2595 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
2596 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
2597 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
2598 */
LL_RTC_ALMB_GetWeekDay(const RTC_TypeDef * RTCx)2599 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetWeekDay(const RTC_TypeDef *RTCx)
2600 {
2601 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_DU) >> RTC_ALRMBR_DU_Pos);
2602 }
2603
2604 /**
2605 * @brief Set ALARM B time format (AM/24-hour or PM notation)
2606 * @rmtoll RTC_ALRMBR PM LL_RTC_ALMB_SetTimeFormat
2607 * @param RTCx RTC Instance
2608 * @param TimeFormat This parameter can be one of the following values:
2609 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2610 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2611 * @retval None
2612 */
LL_RTC_ALMB_SetTimeFormat(RTC_TypeDef * RTCx,uint32_t TimeFormat)2613 __STATIC_INLINE void LL_RTC_ALMB_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
2614 {
2615 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM, TimeFormat);
2616 }
2617
2618 /**
2619 * @brief Get ALARM B time format (AM or PM notation)
2620 * @rmtoll RTC_ALRMBR PM LL_RTC_ALMB_GetTimeFormat
2621 * @param RTCx RTC Instance
2622 * @retval Returned value can be one of the following values:
2623 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2624 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2625 */
LL_RTC_ALMB_GetTimeFormat(const RTC_TypeDef * RTCx)2626 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTimeFormat(const RTC_TypeDef *RTCx)
2627 {
2628 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_PM));
2629 }
2630
2631 /**
2632 * @brief Set ALARM B Hours in BCD format
2633 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
2634 * @rmtoll RTC_ALRMBR HT LL_RTC_ALMB_SetHour\n
2635 * RTC_ALRMBR HU LL_RTC_ALMB_SetHour
2636 * @param RTCx RTC Instance
2637 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2638 * @retval None
2639 */
LL_RTC_ALMB_SetHour(RTC_TypeDef * RTCx,uint32_t Hours)2640 __STATIC_INLINE void LL_RTC_ALMB_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
2641 {
2642 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU),
2643 (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos)));
2644 }
2645
2646 /**
2647 * @brief Get ALARM B Hours in BCD format
2648 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2649 * @rmtoll RTC_ALRMBR HT LL_RTC_ALMB_GetHour\n
2650 * RTC_ALRMBR HU LL_RTC_ALMB_GetHour
2651 * @param RTCx RTC Instance
2652 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2653 */
LL_RTC_ALMB_GetHour(const RTC_TypeDef * RTCx)2654 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetHour(const RTC_TypeDef *RTCx)
2655 {
2656 return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU))) >> RTC_ALRMBR_HU_Pos);
2657 }
2658
2659 /**
2660 * @brief Set ALARM B Minutes in BCD format
2661 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
2662 * @rmtoll RTC_ALRMBR MNT LL_RTC_ALMB_SetMinute\n
2663 * RTC_ALRMBR MNU LL_RTC_ALMB_SetMinute
2664 * @param RTCx RTC Instance
2665 * @param Minutes between Min_Data=0x00 and Max_Data=0x59
2666 * @retval None
2667 */
LL_RTC_ALMB_SetMinute(RTC_TypeDef * RTCx,uint32_t Minutes)2668 __STATIC_INLINE void LL_RTC_ALMB_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
2669 {
2670 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU),
2671 (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)));
2672 }
2673
2674 /**
2675 * @brief Get ALARM B Minutes in BCD format
2676 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2677 * @rmtoll RTC_ALRMBR MNT LL_RTC_ALMB_GetMinute\n
2678 * RTC_ALRMBR MNU LL_RTC_ALMB_GetMinute
2679 * @param RTCx RTC Instance
2680 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2681 */
LL_RTC_ALMB_GetMinute(const RTC_TypeDef * RTCx)2682 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMinute(const RTC_TypeDef *RTCx)
2683 {
2684 return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU))) >> RTC_ALRMBR_MNU_Pos);
2685 }
2686
2687 /**
2688 * @brief Set ALARM B Seconds in BCD format
2689 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
2690 * @rmtoll RTC_ALRMBR ST LL_RTC_ALMB_SetSecond\n
2691 * RTC_ALRMBR SU LL_RTC_ALMB_SetSecond
2692 * @param RTCx RTC Instance
2693 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
2694 * @retval None
2695 */
LL_RTC_ALMB_SetSecond(RTC_TypeDef * RTCx,uint32_t Seconds)2696 __STATIC_INLINE void LL_RTC_ALMB_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
2697 {
2698 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU),
2699 (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos)));
2700 }
2701
2702 /**
2703 * @brief Get ALARM B Seconds in BCD format
2704 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2705 * @rmtoll RTC_ALRMBR ST LL_RTC_ALMB_GetSecond\n
2706 * RTC_ALRMBR SU LL_RTC_ALMB_GetSecond
2707 * @param RTCx RTC Instance
2708 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2709 */
LL_RTC_ALMB_GetSecond(const RTC_TypeDef * RTCx)2710 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSecond(const RTC_TypeDef *RTCx)
2711 {
2712 return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU))) >> RTC_ALRMBR_SU_Pos);
2713 }
2714
2715 /**
2716 * @brief Set Alarm B Time (hour, minute and second) in BCD format
2717 * @rmtoll RTC_ALRMBR PM LL_RTC_ALMB_ConfigTime\n
2718 * RTC_ALRMBR HT LL_RTC_ALMB_ConfigTime\n
2719 * RTC_ALRMBR HU LL_RTC_ALMB_ConfigTime\n
2720 * RTC_ALRMBR MNT LL_RTC_ALMB_ConfigTime\n
2721 * RTC_ALRMBR MNU LL_RTC_ALMB_ConfigTime\n
2722 * RTC_ALRMBR ST LL_RTC_ALMB_ConfigTime\n
2723 * RTC_ALRMBR SU LL_RTC_ALMB_ConfigTime
2724 * @param RTCx RTC Instance
2725 * @param Format12_24 This parameter can be one of the following values:
2726 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2727 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2728 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2729 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
2730 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
2731 * @retval None
2732 */
LL_RTC_ALMB_ConfigTime(RTC_TypeDef * RTCx,uint32_t Format12_24,uint32_t Hours,uint32_t Minutes,uint32_t Seconds)2733 __STATIC_INLINE void LL_RTC_ALMB_ConfigTime(RTC_TypeDef *RTCx,
2734 uint32_t Format12_24,
2735 uint32_t Hours,
2736 uint32_t Minutes,
2737 uint32_t Seconds)
2738 {
2739 uint32_t temp;
2740
2741 temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos)) | \
2742 (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)) | \
2743 (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos));
2744
2745 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM | RTC_ALRMBR_HT | RTC_ALRMBR_HU | RTC_ALRMBR_MNT | RTC_ALRMBR_MNU | \
2746 RTC_ALRMBR_ST | RTC_ALRMBR_SU, temp);
2747 }
2748
2749 /**
2750 * @brief Get Alarm B Time (hour, minute and second) in BCD format
2751 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2752 * are available to get independently each parameter.
2753 * @rmtoll RTC_ALRMBR HT LL_RTC_ALMB_GetTime\n
2754 * RTC_ALRMBR HU LL_RTC_ALMB_GetTime\n
2755 * RTC_ALRMBR MNT LL_RTC_ALMB_GetTime\n
2756 * RTC_ALRMBR MNU LL_RTC_ALMB_GetTime\n
2757 * RTC_ALRMBR ST LL_RTC_ALMB_GetTime\n
2758 * RTC_ALRMBR SU LL_RTC_ALMB_GetTime
2759 * @param RTCx RTC Instance
2760 * @retval Combination of hours, minutes and seconds.
2761 */
LL_RTC_ALMB_GetTime(const RTC_TypeDef * RTCx)2762 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTime(const RTC_TypeDef *RTCx)
2763 {
2764 return (uint32_t)((LL_RTC_ALMB_GetHour(RTCx) << RTC_OFFSET_HOUR) | \
2765 (LL_RTC_ALMB_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMB_GetSecond(RTCx));
2766 }
2767
2768 /**
2769 * @brief Set Alarm B Mask the most-significant bits starting at this bit
2770 * @note This register can be written only when ALRBE is reset in RTC_CR register,
2771 * or in initialization mode.
2772 * @rmtoll RTC_ALRMBSSR MASKSS LL_RTC_ALMB_SetSubSecondMask
2773 * @param RTCx RTC Instance
2774 * @param Mask If binary mode is none, Value between Min_Data=0x0 and Max_Data=0xF
2775 * else Value between Min_Data=0x0 and Max_Data=0x3F
2776 * @retval None
2777 */
LL_RTC_ALMB_SetSubSecondMask(RTC_TypeDef * RTCx,uint32_t Mask)2778 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
2779 {
2780 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS, Mask << RTC_ALRMBSSR_MASKSS_Pos);
2781 }
2782
2783 /**
2784 * @brief Get Alarm B Mask the most-significant bits starting at this bit
2785 * @rmtoll RTC_ALRMBSSR MASKSS LL_RTC_ALMB_GetSubSecondMask
2786 * @param RTCx RTC Instance
2787 * @retval If binary mode is none, Value between Min_Data=0x0 and Max_Data=0xF
2788 * else Value between Min_Data=0x0 and Max_Data=0x3F
2789 */
LL_RTC_ALMB_GetSubSecondMask(const RTC_TypeDef * RTCx)2790 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecondMask(const RTC_TypeDef *RTCx)
2791 {
2792 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS) >> RTC_ALRMBSSR_MASKSS_Pos);
2793 }
2794
2795 /**
2796 * @brief Set Alarm B Binary mode auto clear
2797 * @note This register can be written only when ALRBE is reset in RTC_CR register,
2798 * or in initialization mode.
2799 * @rmtoll RTC_ALRBBINR SSCLR LL_RTC_ALMB_SetBinAutoClr
2800 * @param RTCx RTC Instance
2801 * @param BinaryAutoClr This parameter can be one of the following values:
2802 * @arg @ref LL_RTC_ALMB_SUBSECONDBIN_AUTOCLR_NO
2803 * @arg @ref LL_RTC_ALMB_SUBSECONDBIN_AUTOCLR_YES
2804 * @retval None
2805 */
LL_RTC_ALMB_SetBinAutoClr(RTC_TypeDef * RTCx,uint32_t BinaryAutoClr)2806 __STATIC_INLINE void LL_RTC_ALMB_SetBinAutoClr(RTC_TypeDef *RTCx, uint32_t BinaryAutoClr)
2807 {
2808 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_SSCLR, BinaryAutoClr);
2809 }
2810
2811 /**
2812 * @brief Get Alarm B Binary mode auto clear
2813 * @rmtoll RTC_ALRBBINR SSCLR LL_RTC_ALMB_GetBinAutoClr
2814 * @param RTCx RTC Instance
2815 * @retval It can be one of the following values:
2816 * @arg @ref LL_RTC_ALMB_SUBSECONDBIN_AUTOCLR_NO
2817 * @arg @ref LL_RTC_ALMB_SUBSECONDBIN_AUTOCLR_YES
2818 */
LL_RTC_ALMB_GetBinAutoClr(const RTC_TypeDef * RTCx)2819 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetBinAutoClr(const RTC_TypeDef *RTCx)
2820 {
2821 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_SSCLR));
2822 }
2823
2824 /**
2825 * @brief Set Alarm B Sub seconds value
2826 * @rmtoll RTC_ALRMBSSR SS LL_RTC_ALMB_SetSubSecond
2827 * @param RTCx RTC Instance
2828 * @param Subsecond If binary mode is none, Value between Min_Data=0x0 and Max_Data=0x7FFF
2829 * else Value between Min_Data=0x0 and Max_Data=0xFFFFFFFF
2830 * @retval None
2831 */
LL_RTC_ALMB_SetSubSecond(RTC_TypeDef * RTCx,uint32_t Subsecond)2832 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
2833 {
2834 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS, Subsecond);
2835 }
2836
2837 /**
2838 * @brief Get Alarm B Sub seconds value
2839 * @rmtoll RTC_ALRMBSSR SS LL_RTC_ALMB_GetSubSecond
2840 * @param RTCx RTC Instance
2841 * @retval If binary mode is none, Value between Min_Data=0x0 and Max_Data=0x7FFF
2842 * else Value between Min_Data=0x0 and Max_Data=0xFFFFFFFF
2843 */
LL_RTC_ALMB_GetSubSecond(const RTC_TypeDef * RTCx)2844 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecond(const RTC_TypeDef *RTCx)
2845 {
2846 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS));
2847 }
2848
2849 /**
2850 * @}
2851 */
2852
2853 /** @defgroup RTC_LL_EF_Timestamp Timestamp
2854 * @{
2855 */
2856
2857 #ifdef RTC_CR_TSE
2858 /**
2859 * @brief Enable Timestamp
2860 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2861 * @rmtoll RTC_CR TSE LL_RTC_TS_Enable
2862 * @param RTCx RTC Instance
2863 * @retval None
2864 */
LL_RTC_TS_Enable(RTC_TypeDef * RTCx)2865 __STATIC_INLINE void LL_RTC_TS_Enable(RTC_TypeDef *RTCx)
2866 {
2867 SET_BIT(RTCx->CR, RTC_CR_TSE);
2868 }
2869
2870 /**
2871 * @brief Disable Timestamp
2872 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2873 * @rmtoll RTC_CR TSE LL_RTC_TS_Disable
2874 * @param RTCx RTC Instance
2875 * @retval None
2876 */
LL_RTC_TS_Disable(RTC_TypeDef * RTCx)2877 __STATIC_INLINE void LL_RTC_TS_Disable(RTC_TypeDef *RTCx)
2878 {
2879 CLEAR_BIT(RTCx->CR, RTC_CR_TSE);
2880 }
2881 #endif /* RTC_CR_TSE */
2882
2883 #if defined(RTC_CR_TSEDGE)
2884 /**
2885 * @brief Set Time-stamp event active edge
2886 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2887 * @note TSE must be reset when TSEDGE is changed to avoid unwanted TSF setting
2888 * @rmtoll RTC_CR TSEDGE LL_RTC_TS_SetActiveEdge
2889 * @param RTCx RTC Instance
2890 * @param Edge This parameter can be one of the following values:
2891 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
2892 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
2893 * @retval None
2894 */
LL_RTC_TS_SetActiveEdge(RTC_TypeDef * RTCx,uint32_t Edge)2895 __STATIC_INLINE void LL_RTC_TS_SetActiveEdge(RTC_TypeDef *RTCx, uint32_t Edge)
2896 {
2897 MODIFY_REG(RTCx->CR, RTC_CR_TSEDGE, Edge);
2898 }
2899
2900 /**
2901 * @brief Get Time-stamp event active edge
2902 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2903 * @rmtoll RTC_CR TSEDGE LL_RTC_TS_GetActiveEdge
2904 * @param RTCx RTC Instance
2905 * @retval Returned value can be one of the following values:
2906 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
2907 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
2908 */
LL_RTC_TS_GetActiveEdge(const RTC_TypeDef * RTCx)2909 __STATIC_INLINE uint32_t LL_RTC_TS_GetActiveEdge(const RTC_TypeDef *RTCx)
2910 {
2911 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TSEDGE));
2912 }
2913 #endif /* RTC_CR_TSEDGE */
2914
2915 /**
2916 * @brief Get Timestamp AM/PM notation (AM or 24-hour format)
2917 * @rmtoll RTC_TSTR PM LL_RTC_TS_GetTimeFormat
2918 * @param RTCx RTC Instance
2919 * @retval Returned value can be one of the following values:
2920 * @arg @ref LL_RTC_TS_TIME_FORMAT_AM
2921 * @arg @ref LL_RTC_TS_TIME_FORMAT_PM
2922 */
LL_RTC_TS_GetTimeFormat(const RTC_TypeDef * RTCx)2923 __STATIC_INLINE uint32_t LL_RTC_TS_GetTimeFormat(const RTC_TypeDef *RTCx)
2924 {
2925 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_PM));
2926 }
2927
2928 /**
2929 * @brief Get Timestamp Hours in BCD format
2930 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2931 * @rmtoll RTC_TSTR HT LL_RTC_TS_GetHour\n
2932 * RTC_TSTR HU LL_RTC_TS_GetHour
2933 * @param RTCx RTC Instance
2934 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2935 */
LL_RTC_TS_GetHour(const RTC_TypeDef * RTCx)2936 __STATIC_INLINE uint32_t LL_RTC_TS_GetHour(const RTC_TypeDef *RTCx)
2937 {
2938 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_HT | RTC_TSTR_HU) >> RTC_TSTR_HU_Pos);
2939 }
2940
2941 /**
2942 * @brief Get Timestamp Minutes in BCD format
2943 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2944 * @rmtoll RTC_TSTR MNT LL_RTC_TS_GetMinute\n
2945 * RTC_TSTR MNU LL_RTC_TS_GetMinute
2946 * @param RTCx RTC Instance
2947 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2948 */
LL_RTC_TS_GetMinute(const RTC_TypeDef * RTCx)2949 __STATIC_INLINE uint32_t LL_RTC_TS_GetMinute(const RTC_TypeDef *RTCx)
2950 {
2951 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_MNT | RTC_TSTR_MNU) >> RTC_TSTR_MNU_Pos);
2952 }
2953
2954 /**
2955 * @brief Get Timestamp Seconds in BCD format
2956 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2957 * @rmtoll RTC_TSTR ST LL_RTC_TS_GetSecond\n
2958 * RTC_TSTR SU LL_RTC_TS_GetSecond
2959 * @param RTCx RTC Instance
2960 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2961 */
LL_RTC_TS_GetSecond(const RTC_TypeDef * RTCx)2962 __STATIC_INLINE uint32_t LL_RTC_TS_GetSecond(const RTC_TypeDef *RTCx)
2963 {
2964 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_ST | RTC_TSTR_SU));
2965 }
2966
2967 /**
2968 * @brief Get Timestamp time (hour, minute and second) in BCD format
2969 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2970 * are available to get independently each parameter.
2971 * @rmtoll RTC_TSTR HT LL_RTC_TS_GetTime\n
2972 * RTC_TSTR HU LL_RTC_TS_GetTime\n
2973 * RTC_TSTR MNT LL_RTC_TS_GetTime\n
2974 * RTC_TSTR MNU LL_RTC_TS_GetTime\n
2975 * RTC_TSTR ST LL_RTC_TS_GetTime\n
2976 * RTC_TSTR SU LL_RTC_TS_GetTime
2977 * @param RTCx RTC Instance
2978 * @retval Combination of hours, minutes and seconds.
2979 */
LL_RTC_TS_GetTime(const RTC_TypeDef * RTCx)2980 __STATIC_INLINE uint32_t LL_RTC_TS_GetTime(const RTC_TypeDef *RTCx)
2981 {
2982 return (uint32_t)(READ_BIT(RTCx->TSTR,
2983 RTC_TSTR_HT | RTC_TSTR_HU | RTC_TSTR_MNT | RTC_TSTR_MNU | RTC_TSTR_ST | RTC_TSTR_SU));
2984 }
2985
2986 /**
2987 * @brief Get Timestamp Week day
2988 * @rmtoll RTC_TSDR WDU LL_RTC_TS_GetWeekDay
2989 * @param RTCx RTC Instance
2990 * @retval Returned value can be one of the following values:
2991 * @arg @ref LL_RTC_WEEKDAY_MONDAY
2992 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
2993 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2994 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
2995 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
2996 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
2997 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
2998 */
LL_RTC_TS_GetWeekDay(const RTC_TypeDef * RTCx)2999 __STATIC_INLINE uint32_t LL_RTC_TS_GetWeekDay(const RTC_TypeDef *RTCx)
3000 {
3001 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU) >> RTC_TSDR_WDU_Pos);
3002 }
3003
3004 /**
3005 * @brief Get Timestamp Month in BCD format
3006 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
3007 * @rmtoll RTC_TSDR MT LL_RTC_TS_GetMonth\n
3008 * RTC_TSDR MU LL_RTC_TS_GetMonth
3009 * @param RTCx RTC Instance
3010 * @retval Returned value can be one of the following values:
3011 * @arg @ref LL_RTC_MONTH_JANUARY
3012 * @arg @ref LL_RTC_MONTH_FEBRUARY
3013 * @arg @ref LL_RTC_MONTH_MARCH
3014 * @arg @ref LL_RTC_MONTH_APRIL
3015 * @arg @ref LL_RTC_MONTH_MAY
3016 * @arg @ref LL_RTC_MONTH_JUNE
3017 * @arg @ref LL_RTC_MONTH_JULY
3018 * @arg @ref LL_RTC_MONTH_AUGUST
3019 * @arg @ref LL_RTC_MONTH_SEPTEMBER
3020 * @arg @ref LL_RTC_MONTH_OCTOBER
3021 * @arg @ref LL_RTC_MONTH_NOVEMBER
3022 * @arg @ref LL_RTC_MONTH_DECEMBER
3023 */
LL_RTC_TS_GetMonth(const RTC_TypeDef * RTCx)3024 __STATIC_INLINE uint32_t LL_RTC_TS_GetMonth(const RTC_TypeDef *RTCx)
3025 {
3026 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_MT | RTC_TSDR_MU) >> RTC_TSDR_MU_Pos);
3027 }
3028
3029 /**
3030 * @brief Get Timestamp Day in BCD format
3031 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
3032 * @rmtoll RTC_TSDR DT LL_RTC_TS_GetDay\n
3033 * RTC_TSDR DU LL_RTC_TS_GetDay
3034 * @param RTCx RTC Instance
3035 * @retval Value between Min_Data=0x01 and Max_Data=0x31
3036 */
LL_RTC_TS_GetDay(const RTC_TypeDef * RTCx)3037 __STATIC_INLINE uint32_t LL_RTC_TS_GetDay(const RTC_TypeDef *RTCx)
3038 {
3039 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_DT | RTC_TSDR_DU));
3040 }
3041
3042 /**
3043 * @brief Get Timestamp date (WeekDay, Day and Month) in BCD format
3044 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_MONTH,
3045 * and __LL_RTC_GET_DAY are available to get independently each parameter.
3046 * @rmtoll RTC_TSDR WDU LL_RTC_TS_GetDate\n
3047 * RTC_TSDR MT LL_RTC_TS_GetDate\n
3048 * RTC_TSDR MU LL_RTC_TS_GetDate\n
3049 * RTC_TSDR DT LL_RTC_TS_GetDate\n
3050 * RTC_TSDR DU LL_RTC_TS_GetDate
3051 * @param RTCx RTC Instance
3052 * @retval Combination of Weekday, Day and Month
3053 */
LL_RTC_TS_GetDate(const RTC_TypeDef * RTCx)3054 __STATIC_INLINE uint32_t LL_RTC_TS_GetDate(const RTC_TypeDef *RTCx)
3055 {
3056 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU | RTC_TSDR_MT | RTC_TSDR_MU | RTC_TSDR_DT | RTC_TSDR_DU));
3057 }
3058
3059 /**
3060 * @brief Get time-stamp sub second value
3061 * @rmtoll RTC_TSDR SS LL_RTC_TS_GetSubSecond
3062 * @param RTCx RTC Instance
3063 * @retval If binary mode is none, Value between Min_Data=0x0 and Max_Data=0x7FFF
3064 * else Value between Min_Data=0x0 and Max_Data=0xFFFFFFFF
3065 */
LL_RTC_TS_GetSubSecond(const RTC_TypeDef * RTCx)3066 __STATIC_INLINE uint32_t LL_RTC_TS_GetSubSecond(const RTC_TypeDef *RTCx)
3067 {
3068 return (uint32_t)(READ_BIT(RTCx->TSSSR, RTC_TSSSR_SS));
3069 }
3070
3071 /**
3072 * @brief Activate timestamp on tamper detection event
3073 * @rmtoll RTC_CR TAMPTS LL_RTC_TS_EnableOnTamper
3074 * @param RTCx RTC Instance
3075 * @retval None
3076 */
LL_RTC_TS_EnableOnTamper(RTC_TypeDef * RTCx)3077 __STATIC_INLINE void LL_RTC_TS_EnableOnTamper(RTC_TypeDef *RTCx)
3078 {
3079 SET_BIT(RTCx->CR, RTC_CR_TAMPTS);
3080 }
3081
3082 /**
3083 * @brief Disable timestamp on tamper detection event
3084 * @rmtoll RTC_CR TAMPTS LL_RTC_TS_DisableOnTamper
3085 * @param RTCx RTC Instance
3086 * @retval None
3087 */
LL_RTC_TS_DisableOnTamper(RTC_TypeDef * RTCx)3088 __STATIC_INLINE void LL_RTC_TS_DisableOnTamper(RTC_TypeDef *RTCx)
3089 {
3090 CLEAR_BIT(RTCx->CR, RTC_CR_TAMPTS);
3091 }
3092
3093
3094 /**
3095 * @}
3096 */
3097
3098 /** @defgroup RTC_LL_EF_Tamper Tamper
3099 * @{
3100 */
3101
3102 /**
3103 * @brief Enable TAMPx input detection
3104 * @rmtoll TAMP_CR1 TAMP1E LL_RTC_TAMPER_Enable\n
3105 * TAMP_CR1 TAMP2E... LL_RTC_TAMPER_Enable\n
3106 * @param RTCx RTC Instance
3107 * @param Tamper This parameter can be a combination of the following values:
3108 * @arg @ref RTC_LL_EC_TAMPER
3109 *
3110 * @retval None
3111 */
LL_RTC_TAMPER_Enable(const RTC_TypeDef * RTCx,uint32_t Tamper)3112 __STATIC_INLINE void LL_RTC_TAMPER_Enable(const RTC_TypeDef *RTCx, uint32_t Tamper)
3113 {
3114 UNUSED(RTCx);
3115 SET_BIT(TAMP->CR1, Tamper);
3116 }
3117
3118 /**
3119 * @brief Clear TAMPx input detection
3120 * @rmtoll TAMP_CR1 TAMP1E LL_RTC_TAMPER_Disable\n
3121 * TAMP_CR1 TAMP2E... LL_RTC_TAMPER_Disable
3122 * @param RTCx RTC Instance
3123 * @param Tamper This parameter can be a combination of the following values:
3124 * @arg @ref RTC_LL_EC_TAMPER
3125 *
3126 * @retval None
3127 */
LL_RTC_TAMPER_Disable(const RTC_TypeDef * RTCx,uint32_t Tamper)3128 __STATIC_INLINE void LL_RTC_TAMPER_Disable(const RTC_TypeDef *RTCx, uint32_t Tamper)
3129 {
3130 UNUSED(RTCx);
3131 CLEAR_BIT(TAMP->CR1, Tamper);
3132 }
3133
3134 /**
3135 * @brief Enable Tamper mask flag
3136 * @note Associated Tamper IT must not enabled when tamper mask is set.
3137 * @rmtoll TAMP_CR2 TAMP1MF LL_RTC_TAMPER_EnableMask\n
3138 * TAMP_CR2 TAMP2MF... LL_RTC_TAMPER_EnableMask
3139 * @param RTCx RTC Instance
3140 * @param Mask This parameter can be a combination of the following values:
3141 * @arg @ref RTC_LL_EC_TAMPER_MASK
3142 *
3143 * @retval None
3144 */
LL_RTC_TAMPER_EnableMask(const RTC_TypeDef * RTCx,uint32_t Mask)3145 __STATIC_INLINE void LL_RTC_TAMPER_EnableMask(const RTC_TypeDef *RTCx, uint32_t Mask)
3146 {
3147 UNUSED(RTCx);
3148 SET_BIT(TAMP->CR2, Mask);
3149 }
3150
3151 /**
3152 * @brief Disable Tamper mask flag
3153 * @rmtoll TAMP_CR2 TAMP1MF LL_RTC_TAMPER_DisableMask\n
3154 * TAMP_CR2 TAMP2MF... LL_RTC_TAMPER_DisableMask
3155 * @param RTCx RTC Instance
3156 * @param Mask This parameter can be a combination of the following values:
3157 * @arg @ref RTC_LL_EC_TAMPER_MASK
3158 *
3159 * @retval None
3160 */
LL_RTC_TAMPER_DisableMask(const RTC_TypeDef * RTCx,uint32_t Mask)3161 __STATIC_INLINE void LL_RTC_TAMPER_DisableMask(const RTC_TypeDef *RTCx, uint32_t Mask)
3162 {
3163 UNUSED(RTCx);
3164 CLEAR_BIT(TAMP->CR2, Mask);
3165 }
3166
3167 /**
3168 * @brief Enable backup register erase after Tamper event detection
3169 * @rmtoll TAMP_CR2 TAMP1POM LL_RTC_TAMPER_EnableEraseBKP\n
3170 * TAMP_CR2 TAMP2POM... LL_RTC_TAMPER_EnableEraseBKP
3171 * @param RTCx RTC Instance
3172 * @param Tamper This parameter can be a combination of the following values:
3173 * @arg @ref RTC_LL_EC_TAMPER_NOERASE
3174 *
3175 * @retval None
3176 */
LL_RTC_TAMPER_EnableEraseBKP(const RTC_TypeDef * RTCx,uint32_t Tamper)3177 __STATIC_INLINE void LL_RTC_TAMPER_EnableEraseBKP(const RTC_TypeDef *RTCx, uint32_t Tamper)
3178 {
3179 UNUSED(RTCx);
3180 CLEAR_BIT(TAMP->CR2, Tamper);
3181 }
3182
3183 /**
3184 * @brief Disable backup register erase after Tamper event detection
3185 * @rmtoll TAMP_CR2 TAMP1POM LL_RTC_TAMPER_DisableEraseBKP\n
3186 * TAMP_CR2 TAMP2POM... LL_RTC_TAMPER_DisableEraseBKP
3187 * @param RTCx RTC Instance
3188 * @param Tamper This parameter can be a combination of the following values:
3189 * @arg @ref RTC_LL_EC_TAMPER_NOERASE
3190 *
3191 * @retval None
3192 */
LL_RTC_TAMPER_DisableEraseBKP(const RTC_TypeDef * RTCx,uint32_t Tamper)3193 __STATIC_INLINE void LL_RTC_TAMPER_DisableEraseBKP(const RTC_TypeDef *RTCx, uint32_t Tamper)
3194 {
3195 UNUSED(RTCx);
3196 SET_BIT(TAMP->CR2, Tamper);
3197 }
3198
3199 /**
3200 * @brief Disable RTC_TAMPx pull-up disable (Disable precharge of RTC_TAMPx pins)
3201 * @rmtoll TAMP_FLTCR TAMPPUDIS LL_RTC_TAMPER_DisablePullUp
3202 * @param RTCx RTC Instance
3203 * @retval None
3204 */
LL_RTC_TAMPER_DisablePullUp(const RTC_TypeDef * RTCx)3205 __STATIC_INLINE void LL_RTC_TAMPER_DisablePullUp(const RTC_TypeDef *RTCx)
3206 {
3207 UNUSED(RTCx);
3208 SET_BIT(TAMP->FLTCR, TAMP_FLTCR_TAMPPUDIS);
3209 }
3210
3211 /**
3212 * @brief Enable RTC_TAMPx pull-up disable ( Precharge RTC_TAMPx pins before sampling)
3213 * @rmtoll TAMP_FLTCR TAMPPUDIS LL_RTC_TAMPER_EnablePullUp
3214 * @param RTCx RTC Instance
3215 * @retval None
3216 */
LL_RTC_TAMPER_EnablePullUp(const RTC_TypeDef * RTCx)3217 __STATIC_INLINE void LL_RTC_TAMPER_EnablePullUp(const RTC_TypeDef *RTCx)
3218 {
3219 UNUSED(RTCx);
3220 CLEAR_BIT(TAMP->FLTCR, TAMP_FLTCR_TAMPPUDIS);
3221 }
3222
3223 /**
3224 * @brief Set RTC_TAMPx precharge duration
3225 * @rmtoll TAMP_FLTCR TAMPPRCH LL_RTC_TAMPER_SetPrecharge
3226 * @param RTCx RTC Instance
3227 * @param Duration This parameter can be one of the following values:
3228 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
3229 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
3230 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
3231 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
3232 * @retval None
3233 */
LL_RTC_TAMPER_SetPrecharge(const RTC_TypeDef * RTCx,uint32_t Duration)3234 __STATIC_INLINE void LL_RTC_TAMPER_SetPrecharge(const RTC_TypeDef *RTCx, uint32_t Duration)
3235 {
3236 UNUSED(RTCx);
3237 MODIFY_REG(TAMP->FLTCR, TAMP_FLTCR_TAMPPRCH, Duration);
3238 }
3239
3240 /**
3241 * @brief Get RTC_TAMPx precharge duration
3242 * @rmtoll TAMP_FLTCR TAMPPRCH LL_RTC_TAMPER_GetPrecharge
3243 * @param RTCx RTC Instance
3244 * @retval Returned value can be one of the following values:
3245 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
3246 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
3247 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
3248 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
3249 */
LL_RTC_TAMPER_GetPrecharge(const RTC_TypeDef * RTCx)3250 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPrecharge(const RTC_TypeDef *RTCx)
3251 {
3252 UNUSED(RTCx);
3253 return (uint32_t)(READ_BIT(TAMP->FLTCR, TAMP_FLTCR_TAMPPRCH));
3254 }
3255
3256 /**
3257 * @brief Set RTC_TAMPx filter count
3258 * @rmtoll TAMP_FLTCR TAMPFLT LL_RTC_TAMPER_SetFilterCount
3259 * @param RTCx RTC Instance
3260 * @param FilterCount This parameter can be one of the following values:
3261 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
3262 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
3263 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
3264 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
3265 * @retval None
3266 */
LL_RTC_TAMPER_SetFilterCount(const RTC_TypeDef * RTCx,uint32_t FilterCount)3267 __STATIC_INLINE void LL_RTC_TAMPER_SetFilterCount(const RTC_TypeDef *RTCx, uint32_t FilterCount)
3268 {
3269 UNUSED(RTCx);
3270 MODIFY_REG(TAMP->FLTCR, TAMP_FLTCR_TAMPFLT, FilterCount);
3271 }
3272
3273 /**
3274 * @brief Get RTC_TAMPx filter count
3275 * @rmtoll TAMP_FLTCR TAMPFLT LL_RTC_TAMPER_GetFilterCount
3276 * @param RTCx RTC Instance
3277 * @retval Returned value can be one of the following values:
3278 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
3279 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
3280 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
3281 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
3282 */
LL_RTC_TAMPER_GetFilterCount(const RTC_TypeDef * RTCx)3283 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetFilterCount(const RTC_TypeDef *RTCx)
3284 {
3285 UNUSED(RTCx);
3286 return (uint32_t)(READ_BIT(TAMP->FLTCR, TAMP_FLTCR_TAMPFLT));
3287 }
3288
3289 /**
3290 * @brief Set Tamper sampling frequency
3291 * @rmtoll TAMP_FLTCR TAMPFREQ LL_RTC_TAMPER_SetSamplingFreq
3292 * @param RTCx RTC Instance
3293 * @param SamplingFreq This parameter can be one of the following values:
3294 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
3295 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
3296 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
3297 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
3298 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
3299 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
3300 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
3301 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
3302 * @retval None
3303 */
LL_RTC_TAMPER_SetSamplingFreq(const RTC_TypeDef * RTCx,uint32_t SamplingFreq)3304 __STATIC_INLINE void LL_RTC_TAMPER_SetSamplingFreq(const RTC_TypeDef *RTCx, uint32_t SamplingFreq)
3305 {
3306 UNUSED(RTCx);
3307 MODIFY_REG(TAMP->FLTCR, TAMP_FLTCR_TAMPFREQ, SamplingFreq);
3308 }
3309
3310 /**
3311 * @brief Get Tamper sampling frequency
3312 * @rmtoll TAMP_FLTCR TAMPFREQ LL_RTC_TAMPER_GetSamplingFreq
3313 * @param RTCx RTC Instance
3314 * @retval Returned value can be one of the following values:
3315 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
3316 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
3317 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
3318 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
3319 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
3320 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
3321 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
3322 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
3323 */
LL_RTC_TAMPER_GetSamplingFreq(const RTC_TypeDef * RTCx)3324 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetSamplingFreq(const RTC_TypeDef *RTCx)
3325 {
3326 UNUSED(RTCx);
3327 return (uint32_t)(READ_BIT(TAMP->FLTCR, TAMP_FLTCR_TAMPFREQ));
3328 }
3329
3330 /**
3331 * @brief Enable Active level for Tamper input
3332 * @rmtoll TAMP_CR2 TAMP1TRG LL_RTC_TAMPER_EnableActiveLevel\n
3333 * TAMP_CR2 TAMP2TRG LL_RTC_TAMPER_EnableActiveLevel\n
3334 * TAMP_CR2 TAMPxTRG LL_RTC_TAMPER_EnableActiveLevel\n
3335 * @param RTCx RTC Instance
3336 * @param Tamper This parameter can be a combination of the following values:
3337 * @arg @ref RTC_LL_EC_TAMPER_ACTIVELEVEL
3338 *
3339 * @retval None
3340 */
LL_RTC_TAMPER_EnableActiveLevel(const RTC_TypeDef * RTCx,uint32_t Tamper)3341 __STATIC_INLINE void LL_RTC_TAMPER_EnableActiveLevel(const RTC_TypeDef *RTCx, uint32_t Tamper)
3342 {
3343 UNUSED(RTCx);
3344 SET_BIT(TAMP->CR2, Tamper);
3345 }
3346
3347 /**
3348 * @brief Disable Active level for Tamper input
3349 * @rmtoll TAMP_CR2 TAMP1TRG LL_RTC_TAMPER_DisableActiveLevel\n
3350 * TAMP_CR2 TAMP2TRG LL_RTC_TAMPER_DisableActiveLevel\n
3351 * TAMP_CR2 TAMPxTRG LL_RTC_TAMPER_DisableActiveLevel\n
3352 * @param RTCx RTC Instance
3353 * @param Tamper This parameter can be a combination of the following values:
3354 * @arg @ref RTC_LL_EC_TAMPER_ACTIVELEVEL
3355 *
3356 * @retval None
3357 */
LL_RTC_TAMPER_DisableActiveLevel(const RTC_TypeDef * RTCx,uint32_t Tamper)3358 __STATIC_INLINE void LL_RTC_TAMPER_DisableActiveLevel(const RTC_TypeDef *RTCx, uint32_t Tamper)
3359 {
3360 UNUSED(RTCx);
3361 CLEAR_BIT(TAMP->CR2, Tamper);
3362 }
3363
3364 /**
3365 * @}
3366 */
3367
3368 /** @defgroup RTC_LL_EF_Internal_Tamper Internal Tamper
3369 * @{
3370 */
3371
3372 /**
3373 * @brief Enable internal tamper detection.
3374 * @rmtoll TAMP_CR1 ITAMP1E LL_RTC_TAMPER_ITAMP_Enable\n
3375 * TAMP_CR1 ITAMP2E LL_RTC_TAMPER_ITAMP_Enable\n
3376 * TAMP_CR1 ITAMPxE.. LL_RTC_TAMPER_ITAMP_Enable\n
3377 * @param RTCx RTC Instance
3378 * @param InternalTamper This parameter can be a combination of the following values:
3379 * @arg @ref RTC_LL_EC_INTERNAL
3380 *
3381 * @retval None
3382 */
LL_RTC_TAMPER_ITAMP_Enable(const RTC_TypeDef * RTCx,uint32_t InternalTamper)3383 __STATIC_INLINE void LL_RTC_TAMPER_ITAMP_Enable(const RTC_TypeDef *RTCx, uint32_t InternalTamper)
3384 {
3385 UNUSED(RTCx);
3386 SET_BIT(TAMP->CR1, InternalTamper);
3387 }
3388
3389 /**
3390 * @brief Disable internal tamper detection.
3391 * @rmtoll TAMP_CR1 ITAMP1E LL_RTC_TAMPER_ITAMP_Disable\n
3392 * TAMP_CR1 ITAMP2E LL_RTC_TAMPER_ITAMP_Disable\n
3393 * TAMP_CR1 ITAMPxE LL_RTC_TAMPER_ITAMP_Disable\n
3394 * @param RTCx RTC Instance
3395 * @param InternalTamper This parameter can be a combination of the following values:
3396 * @arg @ref RTC_LL_EC_INTERNAL
3397 *
3398 * @retval None
3399 */
LL_RTC_TAMPER_ITAMP_Disable(const RTC_TypeDef * RTCx,uint32_t InternalTamper)3400 __STATIC_INLINE void LL_RTC_TAMPER_ITAMP_Disable(const RTC_TypeDef *RTCx, uint32_t InternalTamper)
3401 {
3402 UNUSED(RTCx);
3403 CLEAR_BIT(TAMP->CR1, InternalTamper);
3404 }
3405
3406 /**
3407 * @brief Enable backup register erase after internal tamper event detection
3408 * @rmtoll TAMP_CR3 ITAMP3POM LL_RTC_TAMPER_ITAMP_EnableEraseBKP
3409 * TAMP_CR3 ITAMP5POM... LL_RTC_TAMPER_ITAMP_EnableEraseBKP
3410 * @param RTCx RTC Instance
3411 * @param InternalTamper This parameter can be a combination of the following values:
3412 * @arg @ref RTC_LL_EC_ITAMPER_NOERASE
3413 *
3414 * @retval None
3415 */
LL_RTC_TAMPER_ITAMP_EnableEraseBKP(const RTC_TypeDef * RTCx,uint32_t InternalTamper)3416 __STATIC_INLINE void LL_RTC_TAMPER_ITAMP_EnableEraseBKP(const RTC_TypeDef *RTCx, uint32_t InternalTamper)
3417 {
3418 UNUSED(RTCx);
3419 CLEAR_BIT(TAMP->CR3, InternalTamper);
3420 }
3421
3422 /**
3423 * @brief Disable backup register erase after internal tamper event detection
3424 * @rmtoll TAMP_CR3 ITAMP3POM LL_RTC_TAMPER_ITAMP_DisableEraseBKP
3425 * TAMP_CR3 ITAMP5POM... LL_RTC_TAMPER_ITAMP_DisableEraseBKP
3426 * @param RTCx RTC Instance
3427 * @param InternalTamper This parameter can be a combination of the following values:
3428 * @arg @ref RTC_LL_EC_ITAMPER_NOERASE
3429 *
3430 * @retval None
3431 */
LL_RTC_TAMPER_ITAMP_DisableEraseBKP(const RTC_TypeDef * RTCx,uint32_t InternalTamper)3432 __STATIC_INLINE void LL_RTC_TAMPER_ITAMP_DisableEraseBKP(const RTC_TypeDef *RTCx, uint32_t InternalTamper)
3433 {
3434 UNUSED(RTCx);
3435 SET_BIT(TAMP->CR3, InternalTamper);
3436 }
3437
3438 /**
3439 * @}
3440 */
3441
3442 /** @defgroup RTC_LL_EF_Active_Tamper Active Tamper
3443 * @{
3444 */
3445 /**
3446 * @brief Enable tamper active mode.
3447 * @rmtoll TAMP_ATCR1 TAMP1AM LL_RTC_TAMPER_ATAMP_EnableActiveMode\n
3448 * @rmtoll TAMP_ATCR1 TAMP2AM LL_RTC_TAMPER_ATAMP_EnableActiveMode\n
3449 * @rmtoll TAMP_ATCR1 TAMPxAM LL_RTC_TAMPER_ATAMP_EnableActiveMode\n
3450 * @param Tamper to configure as active. This parameter can be a combination of the following values:
3451 * @arg @ref RTC_LL_EC_ACTIVE_MODE
3452 *
3453 * @retval None
3454 */
LL_RTC_TAMPER_ATAMP_EnableActiveMode(uint32_t Tamper)3455 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_EnableActiveMode(uint32_t Tamper)
3456 {
3457 SET_BIT(TAMP->ATCR1, Tamper);
3458 }
3459
3460 /**
3461 * @brief Disable tamper active mode.
3462 * @rmtoll TAMP_ATCR1 TAMP1AM LL_RTC_TAMPER_ATAMP_DisableActiveMode\n
3463 * @rmtoll TAMP_ATCR1 TAMP2AM LL_RTC_TAMPER_ATAMP_DisableActiveMode\n
3464 * @rmtoll TAMP_ATCR1 TAMPxAM LL_RTC_TAMPER_ATAMP_DisableActiveMode\n
3465 * @param Tamper to configure as active. This parameter can be a combination of the following values:
3466 * @arg @ref RTC_LL_EC_ACTIVE_MODE
3467 *
3468 * @retval None
3469 */
LL_RTC_TAMPER_ATAMP_DisableActiveMode(uint32_t Tamper)3470 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_DisableActiveMode(uint32_t Tamper)
3471 {
3472 CLEAR_BIT(TAMP->ATCR1, Tamper);
3473 }
3474
3475 /**
3476 * @brief Enable active tamper filter.
3477 * @rmtoll TAMP_ATCR1 FLTEN LL_RTC_TAMPER_ATAMP_EnableFilter\n
3478 * @retval None
3479 */
LL_RTC_TAMPER_ATAMP_EnableFilter(void)3480 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_EnableFilter(void)
3481 {
3482 SET_BIT(TAMP->ATCR1, TAMP_ATCR1_FLTEN);
3483 }
3484
3485 /**
3486 * @brief Disable active tamper filter.
3487 * @rmtoll TAMP_ATCR1 FLTEN LL_RTC_TAMPER_ATAMP_DisableFilter\n
3488 * @retval None
3489 */
LL_RTC_TAMPER_ATAMP_DisableFilter(void)3490 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_DisableFilter(void)
3491 {
3492 CLEAR_BIT(TAMP->ATCR1, TAMP_ATCR1_FLTEN);
3493 }
3494
3495 /**
3496 * @brief Set Active tamper output change period.
3497 * @rmtoll TAMP_ATCR1 ATPER LL_RTC_TAMPER_ATAMP_SetOutputChangePeriod\n
3498 * @param ActiveOutputChangePeriod This parameter can be a value from 0 to 7
3499 * @retval None
3500 */
LL_RTC_TAMPER_ATAMP_SetOutputChangePeriod(uint32_t ActiveOutputChangePeriod)3501 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_SetOutputChangePeriod(uint32_t ActiveOutputChangePeriod)
3502 {
3503 MODIFY_REG(TAMP->ATCR1, TAMP_ATCR1_ATPER, (ActiveOutputChangePeriod << TAMP_ATCR1_ATPER_Pos));
3504 }
3505
3506 /**
3507 * @brief Get Active tamper output change period.
3508 * @rmtoll TAMP_ATCR1 ATPER LL_RTC_TAMPER_ATAMP_GetOutputChangePeriod\n
3509 * @retval Output change period. This parameter can be a value from 0 to 7.
3510 */
LL_RTC_TAMPER_ATAMP_GetOutputChangePeriod(void)3511 __STATIC_INLINE uint32_t LL_RTC_TAMPER_ATAMP_GetOutputChangePeriod(void)
3512 {
3513 return (READ_BIT(TAMP->ATCR1, TAMP_ATCR1_ATPER) >> TAMP_ATCR1_ATPER_Pos);
3514 }
3515
3516 /**
3517 * @brief Set Active tamper asynchronous prescaler clock selection.
3518 * @rmtoll TAMP_ATCR1 ATCKSEL LL_RTC_TAMPER_ATAMP_SetAsyncPrescaler\n
3519 * @param ActiveAsynvPrescaler Specifies the Active Tamper asynchronous Prescaler clock.
3520 This parameter can be a value of the following values:
3521 * @arg @ref RTC_LL_EC_ACTIVE_ASYNC_PRESCALER
3522 * @retval None
3523 */
LL_RTC_TAMPER_ATAMP_SetAsyncPrescaler(uint32_t ActiveAsynvPrescaler)3524 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_SetAsyncPrescaler(uint32_t ActiveAsynvPrescaler)
3525 {
3526 MODIFY_REG(TAMP->ATCR1, TAMP_ATCR1_ATCKSEL, ActiveAsynvPrescaler);
3527 }
3528
3529 /**
3530 * @brief Get Active tamper asynchronous prescaler clock selection.
3531 * @rmtoll TAMP_ATCR1 ATCKSEL LL_RTC_TAMPER_ATAMP_GetAsyncPrescaler\n
3532 * @retval One of @arg @ref RTC_LL_EC_ACTIVE_ASYNC_PRESCALER
3533 */
LL_RTC_TAMPER_ATAMP_GetAsyncPrescaler(void)3534 __STATIC_INLINE uint32_t LL_RTC_TAMPER_ATAMP_GetAsyncPrescaler(void)
3535 {
3536 return (READ_BIT(TAMP->ATCR1, TAMP_ATCR1_ATCKSEL));
3537 }
3538
3539 /**
3540 * @brief Enable active tamper output sharing.
3541 * @rmtoll TAMP_ATCR1 ATOSHARE LL_RTC_TAMPER_ATAMP_EnableOutputSharing\n
3542 * @retval None
3543 */
LL_RTC_TAMPER_ATAMP_EnableOutputSharing(void)3544 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_EnableOutputSharing(void)
3545 {
3546 SET_BIT(TAMP->ATCR1, TAMP_ATCR1_ATOSHARE);
3547 }
3548
3549 /**
3550 * @brief Disable active tamper output sharing.
3551 * @rmtoll TAMP_ATCR1 ATOSHARE LL_RTC_TAMPER_ATAMP_DisableOutputSharing\n
3552 * @retval None
3553 */
LL_RTC_TAMPER_ATAMP_DisableOutputSharing(void)3554 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_DisableOutputSharing(void)
3555 {
3556 CLEAR_BIT(TAMP->ATCR1, TAMP_ATCR1_ATOSHARE);
3557 }
3558
3559 /**
3560 * @brief Set Active tamper shared output selection.
3561 * @rmtoll TAMP_ATCR2 ATOSELx LL_RTC_TAMPER_ATAMP_SetSharedOuputSelection\n
3562 * @param OutputSelection Specifies all the output selection of the Active Tamper.
3563 This parameter is a combinasation of the following values:
3564 * One of @arg @ref RTC_LL_EC_ACTIVE_OUTPUT_SELECTION
3565 * @retval None
3566 */
LL_RTC_TAMPER_ATAMP_SetSharedOuputSelection(uint32_t OutputSelection)3567 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_SetSharedOuputSelection(uint32_t OutputSelection)
3568 {
3569 #if (RTC_TAMP_NB == 3U)
3570 MODIFY_REG(TAMP->ATCR2, (TAMP_ATCR2_ATOSEL1 | TAMP_ATCR2_ATOSEL2 | TAMP_ATCR2_ATOSEL3), OutputSelection);
3571 #else
3572 MODIFY_REG(TAMP->ATCR2, (TAMP_ATCR2_ATOSEL1 | TAMP_ATCR2_ATOSEL2 | TAMP_ATCR2_ATOSEL3 | TAMP_ATCR2_ATOSEL4 | \
3573 TAMP_ATCR2_ATOSEL5 | TAMP_ATCR2_ATOSEL6), \
3574 OutputSelection);
3575 #endif /* RTC_TAMP_NB */
3576
3577 }
3578
3579 /**
3580 * @brief Get Active tamper shared output selection.
3581 * @rmtoll TAMP_ATCR2 ATOSELx LL_RTC_TAMPER_ATAMP_GetSharedOuputSelection\n
3582 * @retval A combination of @arg @ref RTC_LL_EC_ACTIVE_OUTPUT_SELECTION
3583 */
LL_RTC_TAMPER_ATAMP_GetSharedOuputSelection(void)3584 __STATIC_INLINE uint32_t LL_RTC_TAMPER_ATAMP_GetSharedOuputSelection(void)
3585 {
3586 #if (RTC_TAMP_NB == 3U)
3587 return (READ_BIT(TAMP->ATCR2, (TAMP_ATCR2_ATOSEL1 | TAMP_ATCR2_ATOSEL2 | TAMP_ATCR2_ATOSEL3)));
3588 #else
3589 return (READ_BIT(TAMP->ATCR2, (TAMP_ATCR2_ATOSEL1 | TAMP_ATCR2_ATOSEL2 | TAMP_ATCR2_ATOSEL3 | TAMP_ATCR2_ATOSEL4 | \
3590 TAMP_ATCR2_ATOSEL5 | TAMP_ATCR2_ATOSEL6)));
3591 #endif /* RTC_TAMP_NB */
3592 }
3593
3594 /**
3595 * @brief Write active tamper seed.
3596 * @rmtoll TAMP_ATSEEDR SEED LL_RTC_TAMPER_ATAMP_WriteSeed\n
3597 * @param Seed
3598 * @retval None
3599 */
LL_RTC_TAMPER_ATAMP_WriteSeed(uint32_t Seed)3600 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_WriteSeed(uint32_t Seed)
3601 {
3602 WRITE_REG(TAMP->ATSEEDR, Seed);
3603 }
3604
3605 /**
3606 * @brief Get active tamper initialization status flag.
3607 * @rmtoll TAMP_ATOR INITS LL_RTC_IsActiveFlag_ATAMP_INITS
3608 * @retval State of bit (1 or 0).
3609 */
LL_RTC_IsActiveFlag_ATAMP_INITS(void)3610 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ATAMP_INITS(void)
3611 {
3612 return ((READ_BIT(TAMP->ATOR, TAMP_ATOR_INITS) == (TAMP_ATOR_INITS)) ? 1U : 0U);
3613 }
3614
3615 /**
3616 * @brief Get active tamper seed running status flag.
3617 * @rmtoll TAMP_ATOR SEEDF LL_RTC_IsActiveFlag_ATAMP_SEEDF
3618 * @retval State of bit (1 or 0).
3619 */
LL_RTC_IsActiveFlag_ATAMP_SEEDF(void)3620 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ATAMP_SEEDF(void)
3621 {
3622 return ((READ_BIT(TAMP->ATOR, TAMP_ATOR_SEEDF) == (TAMP_ATOR_SEEDF)) ? 1U : 0U);
3623 }
3624
3625 /**
3626 * @}
3627 */
3628
3629 /** @defgroup RTC_LL_EF_Wakeup Wakeup
3630 * @{
3631 */
3632
3633 /**
3634 * @brief Enable Wakeup timer
3635 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3636 * @rmtoll RTC_CR WUTE LL_RTC_WAKEUP_Enable
3637 * @param RTCx RTC Instance
3638 * @retval None
3639 */
LL_RTC_WAKEUP_Enable(RTC_TypeDef * RTCx)3640 __STATIC_INLINE void LL_RTC_WAKEUP_Enable(RTC_TypeDef *RTCx)
3641 {
3642 SET_BIT(RTCx->CR, RTC_CR_WUTE);
3643 }
3644
3645 /**
3646 * @brief Disable Wakeup timer
3647 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3648 * @rmtoll RTC_CR WUTE LL_RTC_WAKEUP_Disable
3649 * @param RTCx RTC Instance
3650 * @retval None
3651 */
LL_RTC_WAKEUP_Disable(RTC_TypeDef * RTCx)3652 __STATIC_INLINE void LL_RTC_WAKEUP_Disable(RTC_TypeDef *RTCx)
3653 {
3654 CLEAR_BIT(RTCx->CR, RTC_CR_WUTE);
3655 }
3656
3657 /**
3658 * @brief Check if Wakeup timer is enabled or not
3659 * @rmtoll RTC_CR WUTE LL_RTC_WAKEUP_IsEnabled
3660 * @param RTCx RTC Instance
3661 * @retval State of bit (1 or 0).
3662 */
LL_RTC_WAKEUP_IsEnabled(const RTC_TypeDef * RTCx)3663 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_IsEnabled(const RTC_TypeDef *RTCx)
3664 {
3665 return ((READ_BIT(RTCx->CR, RTC_CR_WUTE) == (RTC_CR_WUTE)) ? 1U : 0U);
3666 }
3667
3668 /**
3669 * @brief Select Wakeup clock
3670 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3671 * @note Bit can be written only when RTC_CR WUTE bit = 0 and RTC_ICSR WUTWF bit = 1
3672 * @rmtoll RTC_CR WUCKSEL LL_RTC_WAKEUP_SetClock
3673 * @param RTCx RTC Instance
3674 * @param WakeupClock This parameter can be one of the following values:
3675 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
3676 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
3677 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
3678 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
3679 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
3680 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
3681 * @retval None
3682 */
LL_RTC_WAKEUP_SetClock(RTC_TypeDef * RTCx,uint32_t WakeupClock)3683 __STATIC_INLINE void LL_RTC_WAKEUP_SetClock(RTC_TypeDef *RTCx, uint32_t WakeupClock)
3684 {
3685 MODIFY_REG(RTCx->CR, RTC_CR_WUCKSEL, WakeupClock);
3686 }
3687
3688 /**
3689 * @brief Get Wakeup clock
3690 * @rmtoll RTC_CR WUCKSEL LL_RTC_WAKEUP_GetClock
3691 * @param RTCx RTC Instance
3692 * @retval Returned value can be one of the following values:
3693 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
3694 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
3695 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
3696 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
3697 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
3698 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
3699 */
LL_RTC_WAKEUP_GetClock(const RTC_TypeDef * RTCx)3700 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetClock(const RTC_TypeDef *RTCx)
3701 {
3702 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_WUCKSEL));
3703 }
3704
3705 /**
3706 * @brief Set Wakeup auto-reload value
3707 * @note Bit can be written only when WUTWF is set to 1 in RTC_ICSR
3708 * @rmtoll RTC_WUTR WUT LL_RTC_WAKEUP_SetAutoReload
3709 * @param RTCx RTC Instance
3710 * @param Value Value between Min_Data=0x00 and Max_Data=0xFFFF
3711 * @retval None
3712 */
LL_RTC_WAKEUP_SetAutoReload(RTC_TypeDef * RTCx,uint32_t Value)3713 __STATIC_INLINE void LL_RTC_WAKEUP_SetAutoReload(RTC_TypeDef *RTCx, uint32_t Value)
3714 {
3715 MODIFY_REG(RTCx->WUTR, RTC_WUTR_WUT, Value);
3716 }
3717
3718 /**
3719 * @brief Get Wakeup auto-reload value
3720 * @rmtoll RTC_WUTR WUT LL_RTC_WAKEUP_GetAutoReload
3721 * @param RTCx RTC Instance
3722 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
3723 */
LL_RTC_WAKEUP_GetAutoReload(const RTC_TypeDef * RTCx)3724 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetAutoReload(const RTC_TypeDef *RTCx)
3725 {
3726 return (uint32_t)(READ_BIT(RTCx->WUTR, RTC_WUTR_WUT));
3727 }
3728
3729 /**
3730 * @}
3731 */
3732
3733 /** @defgroup RTC_LL_EF_Backup_Registers Backup_Registers
3734 * @{
3735 */
3736
3737 /**
3738 * @brief Writes a data in a specified Backup data register.
3739 * @rmtoll TAMP_BKPxR BKP LL_RTC_BKP_SetRegister
3740 * @param RTCx RTC Instance
3741 * @param BackupRegister This parameter can be one of the following values:
3742 * @arg @ref LL_RTC_BKP_DR0
3743 * @arg @ref LL_RTC_BKP_DR1
3744 * @arg @ref LL_RTC_BKP_DR2
3745 * @arg @ref LL_RTC_BKP_DR3
3746 * @arg @ref LL_RTC_BKP_DR4
3747 * @arg LL_RTC_BKP_DRx ...
3748 * @param Data Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
3749 * @retval None
3750 */
LL_RTC_BKP_SetRegister(const RTC_TypeDef * RTCx,uint32_t BackupRegister,uint32_t Data)3751 __STATIC_INLINE void LL_RTC_BKP_SetRegister(const RTC_TypeDef *RTCx, uint32_t BackupRegister, uint32_t Data)
3752 {
3753 __IO uint32_t tmp;
3754
3755 UNUSED(RTCx);
3756
3757 tmp = (uint32_t)(&(TAMP->BKP0R));
3758 tmp += (BackupRegister * 4U);
3759
3760 /* Write the specified register */
3761 *(__IO uint32_t *)tmp = (uint32_t)Data;
3762 }
3763
3764 /**
3765 * @brief Reads data from the specified RTC Backup data Register.
3766 * @rmtoll TAMP_BKPxR BKP LL_RTC_BKP_GetRegister
3767 * @param RTCx RTC Instance
3768 * @param BackupRegister This parameter can be one of the following values:
3769 * @arg @ref LL_RTC_BKP_DR0
3770 * @arg @ref LL_RTC_BKP_DR1
3771 * @arg @ref LL_RTC_BKP_DR2
3772 * @arg @ref LL_RTC_BKP_DR3
3773 * @arg @ref LL_RTC_BKP_DR4
3774 * @arg LL_RTC_BKP_DRx ...
3775 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
3776 */
LL_RTC_BKP_GetRegister(const RTC_TypeDef * RTCx,uint32_t BackupRegister)3777 __STATIC_INLINE uint32_t LL_RTC_BKP_GetRegister(const RTC_TypeDef *RTCx, uint32_t BackupRegister)
3778 {
3779 uint32_t tmp;
3780
3781 UNUSED(RTCx);
3782
3783 tmp = (uint32_t)(&(TAMP->BKP0R));
3784 tmp += (BackupRegister * 4U);
3785
3786 /* Read the specified register */
3787 return (*(__IO uint32_t *)tmp);
3788 }
3789
3790 /**
3791 * @}
3792 */
3793
3794 /** @defgroup RTC_LL_EF_Calibration Calibration
3795 * @{
3796 */
3797
3798 #if defined(RTC_CR_COE)
3799 /**
3800 * @brief Set Calibration output frequency (1 Hz or 512 Hz)
3801 * @note Bits are write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3802 * @rmtoll RTC_CR COE LL_RTC_CAL_SetOutputFreq\n
3803 * RTC_CR COSEL LL_RTC_CAL_SetOutputFreq
3804 * @param RTCx RTC Instance
3805 * @param Frequency This parameter can be one of the following values:
3806 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE
3807 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ
3808 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
3809 * @retval None
3810 */
LL_RTC_CAL_SetOutputFreq(RTC_TypeDef * RTCx,uint32_t Frequency)3811 __STATIC_INLINE void LL_RTC_CAL_SetOutputFreq(RTC_TypeDef *RTCx, uint32_t Frequency)
3812 {
3813 MODIFY_REG(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL, Frequency);
3814 }
3815
3816 /**
3817 * @brief Get Calibration output frequency (1 Hz or 512 Hz)
3818 * @rmtoll RTC_CR COE LL_RTC_CAL_GetOutputFreq\n
3819 * RTC_CR COSEL LL_RTC_CAL_GetOutputFreq
3820 * @param RTCx RTC Instance
3821 * @retval Returned value can be one of the following values:
3822 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE
3823 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ
3824 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
3825 */
LL_RTC_CAL_GetOutputFreq(const RTC_TypeDef * RTCx)3826 __STATIC_INLINE uint32_t LL_RTC_CAL_GetOutputFreq(const RTC_TypeDef *RTCx)
3827 {
3828 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL));
3829 }
3830 #endif /* RTC_CR_COE */
3831
3832 /**
3833 * @brief Insert or not One RTCCLK pulse every 2exp11 pulses (frequency increased by 488.5 ppm)
3834 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3835 * @note Bit can be written only when RECALPF is set to 0 in RTC_ICSR
3836 * @rmtoll RTC_CALR CALP LL_RTC_CAL_SetPulse
3837 * @param RTCx RTC Instance
3838 * @param Pulse This parameter can be one of the following values:
3839 * @arg @ref LL_RTC_CALIB_INSERTPULSE_NONE
3840 * @arg @ref LL_RTC_CALIB_INSERTPULSE_SET
3841 * @retval None
3842 */
LL_RTC_CAL_SetPulse(RTC_TypeDef * RTCx,uint32_t Pulse)3843 __STATIC_INLINE void LL_RTC_CAL_SetPulse(RTC_TypeDef *RTCx, uint32_t Pulse)
3844 {
3845 MODIFY_REG(RTCx->CALR, RTC_CALR_CALP, Pulse);
3846 }
3847
3848 /**
3849 * @brief Check if one RTCCLK has been inserted or not every 2exp11 pulses (frequency increased by 488.5 ppm)
3850 * @rmtoll RTC_CALR CALP LL_RTC_CAL_IsPulseInserted
3851 * @param RTCx RTC Instance
3852 * @retval State of bit (1 or 0).
3853 */
LL_RTC_CAL_IsPulseInserted(const RTC_TypeDef * RTCx)3854 __STATIC_INLINE uint32_t LL_RTC_CAL_IsPulseInserted(const RTC_TypeDef *RTCx)
3855 {
3856 return ((READ_BIT(RTCx->CALR, RTC_CALR_CALP) == (RTC_CALR_CALP)) ? 1U : 0U);
3857 }
3858
3859 /**
3860 * @brief Set the calibration cycle period
3861 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3862 * @note Bit can be written only when RECALPF is set to 0 in RTC_ICSR
3863 * @rmtoll RTC_CALR CALW8 LL_RTC_CAL_SetPeriod\n
3864 * RTC_CALR CALW16 LL_RTC_CAL_SetPeriod
3865 * @param RTCx RTC Instance
3866 * @param Period This parameter can be one of the following values:
3867 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC
3868 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC
3869 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC
3870 * @retval None
3871 */
LL_RTC_CAL_SetPeriod(RTC_TypeDef * RTCx,uint32_t Period)3872 __STATIC_INLINE void LL_RTC_CAL_SetPeriod(RTC_TypeDef *RTCx, uint32_t Period)
3873 {
3874 MODIFY_REG(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16, Period);
3875 }
3876
3877 /**
3878 * @brief Get the calibration cycle period
3879 * @rmtoll RTC_CALR CALW8 LL_RTC_CAL_GetPeriod\n
3880 * RTC_CALR CALW16 LL_RTC_CAL_GetPeriod
3881 * @param RTCx RTC Instance
3882 * @retval Returned value can be one of the following values:
3883 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC
3884 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC
3885 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC
3886 */
LL_RTC_CAL_GetPeriod(const RTC_TypeDef * RTCx)3887 __STATIC_INLINE uint32_t LL_RTC_CAL_GetPeriod(const RTC_TypeDef *RTCx)
3888 {
3889 return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16));
3890 }
3891
3892 /**
3893 * @brief Set Calibration minus
3894 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3895 * @note Bit can be written only when RECALPF is set to 0 in RTC_ICSR
3896 * @rmtoll RTC_CALR CALM LL_RTC_CAL_SetMinus
3897 * @param RTCx RTC Instance
3898 * @param CalibMinus Value between Min_Data=0x00 and Max_Data=0x1FF
3899 * @retval None
3900 */
LL_RTC_CAL_SetMinus(RTC_TypeDef * RTCx,uint32_t CalibMinus)3901 __STATIC_INLINE void LL_RTC_CAL_SetMinus(RTC_TypeDef *RTCx, uint32_t CalibMinus)
3902 {
3903 MODIFY_REG(RTCx->CALR, RTC_CALR_CALM, CalibMinus);
3904 }
3905
3906 /**
3907 * @brief Get Calibration minus
3908 * @rmtoll RTC_CALR CALM LL_RTC_CAL_GetMinus
3909 * @param RTCx RTC Instance
3910 * @retval Value between Min_Data=0x00 and Max_Data= 0x1FF
3911 */
LL_RTC_CAL_GetMinus(const RTC_TypeDef * RTCx)3912 __STATIC_INLINE uint32_t LL_RTC_CAL_GetMinus(const RTC_TypeDef *RTCx)
3913 {
3914 return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALM));
3915 }
3916
3917 /**
3918 * @brief Enable Calibration Low Power
3919 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3920 * @note Bit can be written only when RECALPF is set to 0
3921 * @rmtoll RTC_CALR LPCAL LL_RTC_CAL_LowPower_Enable
3922 * @param RTCx RTC Instance
3923 * @retval None
3924 */
LL_RTC_CAL_LowPower_Enable(RTC_TypeDef * RTCx)3925 __STATIC_INLINE void LL_RTC_CAL_LowPower_Enable(RTC_TypeDef *RTCx)
3926 {
3927 SET_BIT(RTCx->CALR, RTC_CALR_LPCAL);
3928 }
3929
3930 /**
3931 * @brief Disable Calibration Low Power
3932 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3933 * @note Bit can be written only when RECALPF is set to 0
3934 * @rmtoll RTC_CALR LPCAL LL_RTC_CAL_LowPower_Disable
3935 * @param RTCx RTC Instance
3936 * @retval None
3937 */
LL_RTC_CAL_LowPower_Disable(RTC_TypeDef * RTCx)3938 __STATIC_INLINE void LL_RTC_CAL_LowPower_Disable(RTC_TypeDef *RTCx)
3939 {
3940 CLEAR_BIT(RTCx->CALR, RTC_CALR_LPCAL);
3941 }
3942
3943 /**
3944 * @brief Check if Calibration Low Power is enabled or not
3945 * @rmtoll RTC_CALR LPCAL LL_RTC_CAL_LowPower_IsEnabled
3946 * @param RTCx RTC Instance
3947 * @retval State of bit (1 or 0).
3948 */
LL_RTC_CAL_LowPower_IsEnabled(const RTC_TypeDef * RTCx)3949 __STATIC_INLINE uint32_t LL_RTC_CAL_LowPower_IsEnabled(const RTC_TypeDef *RTCx)
3950 {
3951 return ((READ_BIT(RTCx->CALR, RTC_CALR_LPCAL) == (RTC_CALR_LPCAL)) ? 1U : 0U);
3952 }
3953
3954 /**
3955 * @}
3956 */
3957
3958 /** @defgroup RTC_LL_EF_FLAG_Management FLAG_Management
3959 * @{
3960 */
3961
3962 /**
3963 * @brief Get Recalibration pending Flag
3964 * @rmtoll RTC_ICSR RECALPF LL_RTC_IsActiveFlag_RECALP
3965 * @param RTCx RTC Instance
3966 * @retval State of bit (1 or 0).
3967 */
LL_RTC_IsActiveFlag_RECALP(const RTC_TypeDef * RTCx)3968 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RECALP(const RTC_TypeDef *RTCx)
3969 {
3970 return ((READ_BIT(RTCx->ICSR, RTC_ICSR_RECALPF) == (RTC_ICSR_RECALPF)) ? 1U : 0U);
3971 }
3972
3973 /**
3974 * @brief Get Time-stamp overflow flag
3975 * @rmtoll RTC_SR TSOVF LL_RTC_IsActiveFlag_TSOV
3976 * @param RTCx RTC Instance
3977 * @retval State of bit (1 or 0).
3978 */
LL_RTC_IsActiveFlag_TSOV(const RTC_TypeDef * RTCx)3979 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOV(const RTC_TypeDef *RTCx)
3980 {
3981 return ((READ_BIT(RTCx->SR, RTC_SR_TSOVF) == (RTC_SR_TSOVF)) ? 1U : 0U);
3982 }
3983
3984 /**
3985 * @brief Get Time-stamp flag
3986 * @rmtoll RTC_SR TSF LL_RTC_IsActiveFlag_TS
3987 * @param RTCx RTC Instance
3988 * @retval State of bit (1 or 0).
3989 */
LL_RTC_IsActiveFlag_TS(const RTC_TypeDef * RTCx)3990 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TS(const RTC_TypeDef *RTCx)
3991 {
3992 return ((READ_BIT(RTCx->SR, RTC_SR_TSF) == (RTC_SR_TSF)) ? 1U : 0U);
3993 }
3994
3995 /**
3996 * @brief Get Wakeup timer flag
3997 * @rmtoll RTC_SR WUTF LL_RTC_IsActiveFlag_WUT
3998 * @param RTCx RTC Instance
3999 * @retval State of bit (1 or 0).
4000 */
LL_RTC_IsActiveFlag_WUT(const RTC_TypeDef * RTCx)4001 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUT(const RTC_TypeDef *RTCx)
4002 {
4003 return ((READ_BIT(RTCx->SR, RTC_SR_WUTF) == (RTC_SR_WUTF)) ? 1U : 0U);
4004 }
4005
4006 /**
4007 * @brief Get Alarm B flag
4008 * @rmtoll RTC_SR ALRBF LL_RTC_IsActiveFlag_ALRB
4009 * @param RTCx RTC Instance
4010 * @retval State of bit (1 or 0).
4011 */
LL_RTC_IsActiveFlag_ALRB(const RTC_TypeDef * RTCx)4012 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRB(const RTC_TypeDef *RTCx)
4013 {
4014 return ((READ_BIT(RTCx->SR, RTC_SR_ALRBF) == (RTC_SR_ALRBF)) ? 1U : 0U);
4015 }
4016
4017 /**
4018 * @brief Get Alarm A flag
4019 * @rmtoll RTC_SR ALRAF LL_RTC_IsActiveFlag_ALRA
4020 * @param RTCx RTC Instance
4021 * @retval State of bit (1 or 0).
4022 */
LL_RTC_IsActiveFlag_ALRA(const RTC_TypeDef * RTCx)4023 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRA(const RTC_TypeDef *RTCx)
4024 {
4025 return ((READ_BIT(RTCx->SR, RTC_SR_ALRAF) == (RTC_SR_ALRAF)) ? 1U : 0U);
4026 }
4027
4028 /**
4029 * @brief Get SSR Underflow flag
4030 * @rmtoll RTC_SR SSRUF LL_RTC_IsActiveFlag_SSRU
4031 * @param RTCx RTC Instance
4032 * @retval State of bit (1 or 0).
4033 */
LL_RTC_IsActiveFlag_SSRU(const RTC_TypeDef * RTCx)4034 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SSRU(const RTC_TypeDef *RTCx)
4035 {
4036 return ((READ_BIT(RTCx->SR, RTC_SR_SSRUF) == (RTC_SR_SSRUF)) ? 1U : 0U);
4037 }
4038
4039 /**
4040 * @brief Clear Time-stamp overflow flag
4041 * @rmtoll RTC_SCR CTSOVF LL_RTC_ClearFlag_TSOV
4042 * @param RTCx RTC Instance
4043 * @retval None
4044 */
LL_RTC_ClearFlag_TSOV(RTC_TypeDef * RTCx)4045 __STATIC_INLINE void LL_RTC_ClearFlag_TSOV(RTC_TypeDef *RTCx)
4046 {
4047 WRITE_REG(RTCx->SCR, RTC_SCR_CTSOVF);
4048 }
4049
4050 /**
4051 * @brief Clear Time-stamp flag
4052 * @rmtoll RTC_SCR CTSF LL_RTC_ClearFlag_TS
4053 * @param RTCx RTC Instance
4054 * @retval None
4055 */
LL_RTC_ClearFlag_TS(RTC_TypeDef * RTCx)4056 __STATIC_INLINE void LL_RTC_ClearFlag_TS(RTC_TypeDef *RTCx)
4057 {
4058 WRITE_REG(RTCx->SCR, RTC_SCR_CTSF);
4059 }
4060
4061 /**
4062 * @brief Clear Wakeup timer flag
4063 * @rmtoll RTC_SCR CWUTF LL_RTC_ClearFlag_WUT
4064 * @param RTCx RTC Instance
4065 * @retval None
4066 */
LL_RTC_ClearFlag_WUT(RTC_TypeDef * RTCx)4067 __STATIC_INLINE void LL_RTC_ClearFlag_WUT(RTC_TypeDef *RTCx)
4068 {
4069 WRITE_REG(RTCx->SCR, RTC_SCR_CWUTF);
4070 }
4071
4072 /**
4073 * @brief Clear Alarm B flag
4074 * @rmtoll RTC_SCR CALRBF LL_RTC_ClearFlag_ALRB
4075 * @param RTCx RTC Instance
4076 * @retval None
4077 */
LL_RTC_ClearFlag_ALRB(RTC_TypeDef * RTCx)4078 __STATIC_INLINE void LL_RTC_ClearFlag_ALRB(RTC_TypeDef *RTCx)
4079 {
4080 WRITE_REG(RTCx->SCR, RTC_SCR_CALRBF);
4081 }
4082
4083 /**
4084 * @brief Clear Alarm A flag
4085 * @rmtoll RTC_SCR CALRAF LL_RTC_ClearFlag_ALRA
4086 * @param RTCx RTC Instance
4087 * @retval None
4088 */
LL_RTC_ClearFlag_ALRA(RTC_TypeDef * RTCx)4089 __STATIC_INLINE void LL_RTC_ClearFlag_ALRA(RTC_TypeDef *RTCx)
4090 {
4091 WRITE_REG(RTCx->SCR, RTC_SCR_CALRAF);
4092 }
4093
4094 /**
4095 * @brief Clear SSR Underflow flag
4096 * @rmtoll RTC_SCR CSSRUF LL_RTC_ClearFlag_SSRU
4097 * @param RTCx RTC Instance
4098 * @retval None
4099 */
LL_RTC_ClearFlag_SSRU(RTC_TypeDef * RTCx)4100 __STATIC_INLINE void LL_RTC_ClearFlag_SSRU(RTC_TypeDef *RTCx)
4101 {
4102 WRITE_REG(RTCx->SCR, RTC_SCR_CSSRUF);
4103 }
4104
4105 /**
4106 * @brief Get Initialization flag
4107 * @rmtoll RTC_ICSR INITF LL_RTC_IsActiveFlag_INIT
4108 * @param RTCx RTC Instance
4109 * @retval State of bit (1 or 0).
4110 */
LL_RTC_IsActiveFlag_INIT(const RTC_TypeDef * RTCx)4111 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INIT(const RTC_TypeDef *RTCx)
4112 {
4113 return ((READ_BIT(RTCx->ICSR, RTC_ICSR_INITF) == (RTC_ICSR_INITF)) ? 1U : 0U);
4114 }
4115
4116 /**
4117 * @brief Get Registers synchronization flag
4118 * @rmtoll RTC_ICSR RSF LL_RTC_IsActiveFlag_RS
4119 * @param RTCx RTC Instance
4120 * @retval State of bit (1 or 0).
4121 */
LL_RTC_IsActiveFlag_RS(const RTC_TypeDef * RTCx)4122 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RS(const RTC_TypeDef *RTCx)
4123 {
4124 return ((READ_BIT(RTCx->ICSR, RTC_ICSR_RSF) == (RTC_ICSR_RSF)) ? 1U : 0U);
4125 }
4126
4127 /**
4128 * @brief Clear Registers synchronization flag
4129 * @rmtoll RTC_ICSR RSF LL_RTC_ClearFlag_RS
4130 * @param RTCx RTC Instance
4131 * @retval None
4132 */
LL_RTC_ClearFlag_RS(RTC_TypeDef * RTCx)4133 __STATIC_INLINE void LL_RTC_ClearFlag_RS(RTC_TypeDef *RTCx)
4134 {
4135 WRITE_REG(RTCx->ICSR, (~((RTC_ICSR_RSF | RTC_ICSR_INIT) & 0x000000FFU) | (RTCx->ICSR & RTC_ICSR_INIT)));
4136 }
4137
4138 /**
4139 * @brief Get Initialization status flag
4140 * @rmtoll RTC_ICSR INITS LL_RTC_IsActiveFlag_INITS
4141 * @param RTCx RTC Instance
4142 * @retval State of bit (1 or 0).
4143 */
LL_RTC_IsActiveFlag_INITS(const RTC_TypeDef * RTCx)4144 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INITS(const RTC_TypeDef *RTCx)
4145 {
4146 return ((READ_BIT(RTCx->ICSR, RTC_ICSR_INITS) == (RTC_ICSR_INITS)) ? 1U : 0U);
4147 }
4148
4149 /**
4150 * @brief Get Shift operation pending flag
4151 * @rmtoll RTC_ICSR SHPF LL_RTC_IsActiveFlag_SHP
4152 * @param RTCx RTC Instance
4153 * @retval State of bit (1 or 0).
4154 */
LL_RTC_IsActiveFlag_SHP(const RTC_TypeDef * RTCx)4155 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SHP(const RTC_TypeDef *RTCx)
4156 {
4157 return ((READ_BIT(RTCx->ICSR, RTC_ICSR_SHPF) == (RTC_ICSR_SHPF)) ? 1U : 0U);
4158 }
4159
4160 /**
4161 * @brief Get Wakeup timer write flag
4162 * @rmtoll RTC_ICSR WUTWF LL_RTC_IsActiveFlag_WUTW
4163 * @param RTCx RTC Instance
4164 * @retval State of bit (1 or 0).
4165 */
LL_RTC_IsActiveFlag_WUTW(const RTC_TypeDef * RTCx)4166 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTW(const RTC_TypeDef *RTCx)
4167 {
4168 return ((READ_BIT(RTCx->ICSR, RTC_ICSR_WUTWF) == (RTC_ICSR_WUTWF)) ? 1U : 0U);
4169 }
4170
4171 /**
4172 * @brief Get Alarm A masked flag.
4173 * @rmtoll RTC_MISR ALRAMF LL_RTC_IsActiveFlag_ALRAM
4174 * @param RTCx RTC Instance
4175 * @retval State of bit (1 or 0).
4176 */
LL_RTC_IsActiveFlag_ALRAM(const RTC_TypeDef * RTCx)4177 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAM(const RTC_TypeDef *RTCx)
4178 {
4179 return ((READ_BIT(RTCx->MISR, RTC_MISR_ALRAMF) == (RTC_MISR_ALRAMF)) ? 1U : 0U);
4180 }
4181
4182 /**
4183 * @brief Get SSR Underflow masked flag.
4184 * @rmtoll RTC_MISR SSRUMF LL_RTC_IsActiveFlag_SSRUM
4185 * @param RTCx RTC Instance
4186 * @retval State of bit (1 or 0).
4187 */
LL_RTC_IsActiveFlag_SSRUM(const RTC_TypeDef * RTCx)4188 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SSRUM(const RTC_TypeDef *RTCx)
4189 {
4190 return ((READ_BIT(RTCx->MISR, RTC_MISR_SSRUMF) == (RTC_MISR_SSRUMF)) ? 1U : 0U);
4191 }
4192
4193 /**
4194 * @brief Get Alarm B masked flag.
4195 * @rmtoll RTC_MISR ALRBMF LL_RTC_IsActiveFlag_ALRBM
4196 * @param RTCx RTC Instance
4197 * @retval State of bit (1 or 0).
4198 */
LL_RTC_IsActiveFlag_ALRBM(const RTC_TypeDef * RTCx)4199 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBM(const RTC_TypeDef *RTCx)
4200 {
4201 return ((READ_BIT(RTCx->MISR, RTC_MISR_ALRBMF) == (RTC_MISR_ALRBMF)) ? 1U : 0U);
4202 }
4203
4204 /**
4205 * @brief Get Wakeup timer masked flag.
4206 * @rmtoll RTC_MISR WUTMF LL_RTC_IsActiveFlag_WUTM
4207 * @param RTCx RTC Instance
4208 * @retval State of bit (1 or 0).
4209 */
LL_RTC_IsActiveFlag_WUTM(const RTC_TypeDef * RTCx)4210 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTM(const RTC_TypeDef *RTCx)
4211 {
4212 return ((READ_BIT(RTCx->MISR, RTC_MISR_WUTMF) == (RTC_MISR_WUTMF)) ? 1U : 0U);
4213 }
4214
4215 /**
4216 * @brief Get Time-stamp masked flag.
4217 * @rmtoll RTC_MISR TSMF LL_RTC_IsActiveFlag_TSM
4218 * @param RTCx RTC Instance
4219 * @retval State of bit (1 or 0).
4220 */
LL_RTC_IsActiveFlag_TSM(const RTC_TypeDef * RTCx)4221 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSM(const RTC_TypeDef *RTCx)
4222 {
4223 return ((READ_BIT(RTCx->MISR, RTC_MISR_TSMF) == (RTC_MISR_TSMF)) ? 1U : 0U);
4224 }
4225
4226 /**
4227 * @brief Get Time-stamp overflow masked flag.
4228 * @rmtoll RTC_MISR TSOVMF LL_RTC_IsActiveFlag_TSOVM
4229 * @param RTCx RTC Instance
4230 * @retval State of bit (1 or 0).
4231 */
LL_RTC_IsActiveFlag_TSOVM(const RTC_TypeDef * RTCx)4232 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOVM(const RTC_TypeDef *RTCx)
4233 {
4234 return ((READ_BIT(RTCx->MISR, RTC_MISR_TSOVMF) == (RTC_MISR_TSOVMF)) ? 1U : 0U);
4235 }
4236
4237 /**
4238 * @brief Get tamper 1 detection flag.
4239 * @rmtoll TAMP_SR TAMP1F LL_RTC_IsActiveFlag_TAMP1
4240 * @param RTCx RTC Instance
4241 * @retval State of bit (1 or 0).
4242 */
LL_RTC_IsActiveFlag_TAMP1(const RTC_TypeDef * RTCx)4243 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1(const RTC_TypeDef *RTCx)
4244 {
4245 UNUSED(RTCx);
4246 return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP1F) == (TAMP_SR_TAMP1F)) ? 1U : 0U);
4247 }
4248
4249 /**
4250 * @brief Get tamper 2 detection flag.
4251 * @rmtoll TAMP_SR TAMP2F LL_RTC_IsActiveFlag_TAMP2
4252 * @param RTCx RTC Instance
4253 * @retval State of bit (1 or 0).
4254 */
LL_RTC_IsActiveFlag_TAMP2(const RTC_TypeDef * RTCx)4255 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2(const RTC_TypeDef *RTCx)
4256 {
4257 UNUSED(RTCx);
4258 return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP2F) == (TAMP_SR_TAMP2F)) ? 1U : 0U);
4259 }
4260
4261 /**
4262 * @brief Get tamper 3 detection flag.
4263 * @rmtoll TAMP_SR TAMP3F LL_RTC_IsActiveFlag_TAMP3
4264 * @param RTCx RTC Instance
4265 * @retval State of bit (1 or 0).
4266 */
LL_RTC_IsActiveFlag_TAMP3(const RTC_TypeDef * RTCx)4267 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3(const RTC_TypeDef *RTCx)
4268 {
4269 UNUSED(RTCx);
4270 return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP3F) == (TAMP_SR_TAMP3F)) ? 1U : 0U);
4271 }
4272
4273 #ifdef TAMP_SR_TAMP4F
4274 /**
4275 * @brief Get tamper 4 detection flag.
4276 * @rmtoll TAMP_SR TAMP4F LL_RTC_IsActiveFlag_TAMP4
4277 * @param RTCx RTC Instance
4278 * @retval State of bit (1 or 0).
4279 */
LL_RTC_IsActiveFlag_TAMP4(const RTC_TypeDef * RTCx)4280 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP4(const RTC_TypeDef *RTCx)
4281 {
4282 UNUSED(RTCx);
4283 return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP4F) == (TAMP_SR_TAMP4F)) ? 1U : 0U);
4284 }
4285
4286 /**
4287 * @brief Get tamper 5 detection flag.
4288 * @rmtoll TAMP_SR TAMP5F LL_RTC_IsActiveFlag_TAMP5
4289 * @param RTCx RTC Instance
4290 * @retval State of bit (1 or 0).
4291 */
LL_RTC_IsActiveFlag_TAMP5(const RTC_TypeDef * RTCx)4292 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP5(const RTC_TypeDef *RTCx)
4293 {
4294 UNUSED(RTCx);
4295 return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP5F) == (TAMP_SR_TAMP5F)) ? 1U : 0U);
4296 }
4297
4298 /**
4299 * @brief Get tamper 6 detection flag.
4300 * @rmtoll TAMP_SR TAMP6F LL_RTC_IsActiveFlag_TAMP6
4301 * @param RTCx RTC Instance
4302 * @retval State of bit (1 or 0).
4303 */
LL_RTC_IsActiveFlag_TAMP6(const RTC_TypeDef * RTCx)4304 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP6(const RTC_TypeDef *RTCx)
4305 {
4306 UNUSED(RTCx);
4307 return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP6F) == (TAMP_SR_TAMP6F)) ? 1U : 0U);
4308 }
4309 #endif /* TAMP_SR_TAMP4F */
4310
4311 /**
4312 * @brief Get internal tamper 3 detection flag.
4313 * @rmtoll TAMP_SR ITAMP3F LL_RTC_IsActiveFlag_ITAMP3
4314 * @param RTCx RTC Instance
4315 * @retval State of bit (1 or 0).
4316 */
LL_RTC_IsActiveFlag_ITAMP3(const RTC_TypeDef * RTCx)4317 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP3(const RTC_TypeDef *RTCx)
4318 {
4319 UNUSED(RTCx);
4320 return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP3F) == (TAMP_SR_ITAMP3F)) ? 1U : 0U);
4321 }
4322
4323 /**
4324 * @brief Get internal tamper 5 detection flag.
4325 * @rmtoll TAMP_SR ITAMP5F LL_RTC_IsActiveFlag_ITAMP5
4326 * @param RTCx RTC Instance
4327 * @retval State of bit (1 or 0).
4328 */
LL_RTC_IsActiveFlag_ITAMP5(const RTC_TypeDef * RTCx)4329 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP5(const RTC_TypeDef *RTCx)
4330 {
4331 UNUSED(RTCx);
4332 return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP5F) == (TAMP_SR_ITAMP5F)) ? 1U : 0U);
4333 }
4334
4335 /**
4336 * @brief Get internal tamper 6 detection flag.
4337 * @rmtoll TAMP_SR ITAMP6F LL_RTC_IsActiveFlag_ITAMP6
4338 * @param RTCx RTC Instance
4339 * @retval State of bit (1 or 0).
4340 */
LL_RTC_IsActiveFlag_ITAMP6(const RTC_TypeDef * RTCx)4341 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP6(const RTC_TypeDef *RTCx)
4342 {
4343 UNUSED(RTCx);
4344 return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP6F) == (TAMP_SR_ITAMP6F)) ? 1U : 0U);
4345 }
4346
4347 /**
4348 * @brief Get internal tamper 7 detection flag.
4349 * @rmtoll TAMP_SR ITAMP7F LL_RTC_IsActiveFlag_ITAMP7
4350 * @param RTCx RTC Instance
4351 * @retval State of bit (1 or 0).
4352 */
LL_RTC_IsActiveFlag_ITAMP7(const RTC_TypeDef * RTCx)4353 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP7(const RTC_TypeDef *RTCx)
4354 {
4355 UNUSED(RTCx);
4356 return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP7F) == (TAMP_SR_ITAMP7F)) ? 1U : 0U);
4357 }
4358
4359 /**
4360 * @brief Get internal tamper 8 detection flag.
4361 * @rmtoll TAMP_SR ITAMP8F LL_RTC_IsActiveFlag_ITAMP8
4362 * @param RTCx RTC Instance
4363 * @retval State of bit (1 or 0).
4364 */
LL_RTC_IsActiveFlag_ITAMP8(const RTC_TypeDef * RTCx)4365 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP8(const RTC_TypeDef *RTCx)
4366 {
4367 UNUSED(RTCx);
4368 return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP8F) == (TAMP_SR_ITAMP8F)) ? 1U : 0U);
4369 }
4370
4371 /**
4372 * @brief Get internal tamper 9 detection flag.
4373 * @rmtoll TAMP_SR ITAMP9F LL_RTC_IsActiveFlag_ITAMP9
4374 * @param RTCx RTC Instance
4375 * @retval State of bit (1 or 0).
4376 */
LL_RTC_IsActiveFlag_ITAMP9(const RTC_TypeDef * RTCx)4377 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP9(const RTC_TypeDef *RTCx)
4378 {
4379 UNUSED(RTCx);
4380 return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP9F) == (TAMP_SR_ITAMP9F)) ? 1U : 0U);
4381 }
4382
4383 /**
4384 * @brief Get internal tamper 11 detection flag.
4385 * @rmtoll TAMP_SR ITAMP11F LL_RTC_IsActiveFlag_ITAMP11
4386 * @param RTCx RTC Instance
4387 * @retval State of bit (1 or 0).
4388 */
LL_RTC_IsActiveFlag_ITAMP11(const RTC_TypeDef * RTCx)4389 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP11(const RTC_TypeDef *RTCx)
4390 {
4391 UNUSED(RTCx);
4392 return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP11F) == (TAMP_SR_ITAMP11F)) ? 1U : 0U);
4393 }
4394
4395 /**
4396 * @brief Get internal tamper 12 detection flag.
4397 * @rmtoll TAMP_SR ITAMP12F LL_RTC_IsActiveFlag_ITAMP12
4398 * @param RTCx RTC Instance
4399 * @retval State of bit (1 or 0).
4400 */
LL_RTC_IsActiveFlag_ITAMP12(const RTC_TypeDef * RTCx)4401 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP12(const RTC_TypeDef *RTCx)
4402 {
4403 UNUSED(RTCx);
4404 return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP12F) == (TAMP_SR_ITAMP12F)) ? 1U : 0U);
4405 }
4406
4407 /**
4408 * @brief Get internal tamper 13 detection flag.
4409 * @rmtoll TAMP_SR ITAMP13F LL_RTC_IsActiveFlag_ITAMP13
4410 * @param RTCx RTC Instance
4411 * @retval State of bit (1 or 0).
4412 */
LL_RTC_IsActiveFlag_ITAMP13(const RTC_TypeDef * RTCx)4413 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP13(const RTC_TypeDef *RTCx)
4414 {
4415 UNUSED(RTCx);
4416 return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP13F) == (TAMP_SR_ITAMP13F)) ? 1U : 0U);
4417 }
4418
4419 /**
4420 * @brief Get tamper 1 interrupt masked flag.
4421 * @rmtoll TAMP_MISR TAMP1MF LL_RTC_IsActiveFlag_TAMP1M
4422 * @param RTCx RTC Instance
4423 * @retval State of bit (1 or 0).
4424 */
LL_RTC_IsActiveFlag_TAMP1M(const RTC_TypeDef * RTCx)4425 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1M(const RTC_TypeDef *RTCx)
4426 {
4427 UNUSED(RTCx);
4428 return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP1MF) == (TAMP_MISR_TAMP1MF)) ? 1U : 0U);
4429 }
4430
4431 /**
4432 * @brief Get tamper 2 interrupt masked flag.
4433 * @rmtoll TAMP_MISR TAMP2MF LL_RTC_IsActiveFlag_TAMP2M
4434 * @param RTCx RTC Instance
4435 * @retval State of bit (1 or 0).
4436 */
LL_RTC_IsActiveFlag_TAMP2M(const RTC_TypeDef * RTCx)4437 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2M(const RTC_TypeDef *RTCx)
4438 {
4439 UNUSED(RTCx);
4440 return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP2MF) == (TAMP_MISR_TAMP2MF)) ? 1U : 0U);
4441 }
4442
4443 /**
4444 * @brief Get tamper 3 interrupt masked flag.
4445 * @rmtoll TAMP_MISR TAMP3MF LL_RTC_IsActiveFlag_TAMP3M
4446 * @param RTCx RTC Instance
4447 * @retval State of bit (1 or 0).
4448 */
LL_RTC_IsActiveFlag_TAMP3M(const RTC_TypeDef * RTCx)4449 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3M(const RTC_TypeDef *RTCx)
4450 {
4451 UNUSED(RTCx);
4452 return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP3MF) == (TAMP_MISR_TAMP3MF)) ? 1U : 0U);
4453 }
4454
4455 #ifdef TAMP_MISR_TAMP4MF
4456 /**
4457 * @brief Get tamper 4 interrupt masked flag.
4458 * @rmtoll TAMP_MISR TAMP4MF LL_RTC_IsActiveFlag_TAMP4M
4459 * @param RTCx RTC Instance
4460 * @retval State of bit (1 or 0).
4461 */
LL_RTC_IsActiveFlag_TAMP4M(const RTC_TypeDef * RTCx)4462 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP4M(const RTC_TypeDef *RTCx)
4463 {
4464 UNUSED(RTCx);
4465 return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP4MF) == (TAMP_MISR_TAMP4MF)) ? 1U : 0U);
4466 }
4467
4468 /**
4469 * @brief Get tamper 5 interrupt masked flag.
4470 * @rmtoll TAMP_MISR TAMP5MF LL_RTC_IsActiveFlag_TAMP5M
4471 * @param RTCx RTC Instance
4472 * @retval State of bit (1 or 0).
4473 */
LL_RTC_IsActiveFlag_TAMP5M(const RTC_TypeDef * RTCx)4474 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP5M(const RTC_TypeDef *RTCx)
4475 {
4476 UNUSED(RTCx);
4477 return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP5MF) == (TAMP_MISR_TAMP5MF)) ? 1U : 0U);
4478 }
4479
4480 /**
4481 * @brief Get tamper 6 interrupt masked flag.
4482 * @rmtoll TAMP_MISR TAMP6MF LL_RTC_IsActiveFlag_TAMP6M
4483 * @param RTCx RTC Instance
4484 * @retval State of bit (1 or 0).
4485 */
LL_RTC_IsActiveFlag_TAMP6M(const RTC_TypeDef * RTCx)4486 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP6M(const RTC_TypeDef *RTCx)
4487 {
4488 UNUSED(RTCx);
4489 return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP6MF) == (TAMP_MISR_TAMP6MF)) ? 1U : 0U);
4490 }
4491 #endif /* TAMP_MISR_TAMP4MF */
4492
4493 /**
4494 * @brief Get internal tamper 3 interrupt masked flag.
4495 * @rmtoll TAMP_MISR ITAMP3MF LL_RTC_IsActiveFlag_ITAMP3M
4496 * @param RTCx RTC Instance
4497 * @retval State of bit (1 or 0).
4498 */
LL_RTC_IsActiveFlag_ITAMP3M(const RTC_TypeDef * RTCx)4499 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP3M(const RTC_TypeDef *RTCx)
4500 {
4501 UNUSED(RTCx);
4502 return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP3MF) == (TAMP_MISR_ITAMP3MF)) ? 1U : 0U);
4503 }
4504
4505 /**
4506 * @brief Get internal tamper 5 interrupt masked flag.
4507 * @rmtoll TAMP_MISR ITAMP5MF LL_RTC_IsActiveFlag_ITAMP5M
4508 * @param RTCx RTC Instance
4509 * @retval State of bit (1 or 0).
4510 */
LL_RTC_IsActiveFlag_ITAMP5M(const RTC_TypeDef * RTCx)4511 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP5M(const RTC_TypeDef *RTCx)
4512 {
4513 UNUSED(RTCx);
4514 return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP5MF) == (TAMP_MISR_ITAMP5MF)) ? 1U : 0U);
4515 }
4516
4517 /**
4518 * @brief Get internal tamper 6 interrupt masked flag.
4519 * @rmtoll TAMP_MISR ITAMP6MF LL_RTC_IsActiveFlag_ITAMP6M
4520 * @param RTCx RTC Instance
4521 * @retval State of bit (1 or 0).
4522 */
LL_RTC_IsActiveFlag_ITAMP6M(const RTC_TypeDef * RTCx)4523 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP6M(const RTC_TypeDef *RTCx)
4524 {
4525 UNUSED(RTCx);
4526 return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP6MF) == (TAMP_MISR_ITAMP6MF)) ? 1U : 0U);
4527 }
4528
4529 /**
4530 * @brief Get internal tamper 7 interrupt masked flag.
4531 * @rmtoll TAMP_MISR ITAMP7MF LL_RTC_IsActiveFlag_ITAMP7M
4532 * @param RTCx RTC Instance
4533 * @retval State of bit (1 or 0).
4534 */
LL_RTC_IsActiveFlag_ITAMP7M(const RTC_TypeDef * RTCx)4535 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP7M(const RTC_TypeDef *RTCx)
4536 {
4537 UNUSED(RTCx);
4538 return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP7MF) == (TAMP_MISR_ITAMP7MF)) ? 1U : 0U);
4539 }
4540
4541 /**
4542 * @brief Get internal tamper 8 interrupt masked flag.
4543 * @rmtoll TAMP_MISR ITAMP8MF LL_RTC_IsActiveFlag_ITAMP8M
4544 * @param RTCx RTC Instance
4545 * @retval State of bit (1 or 0).
4546 */
LL_RTC_IsActiveFlag_ITAMP8M(const RTC_TypeDef * RTCx)4547 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP8M(const RTC_TypeDef *RTCx)
4548 {
4549 UNUSED(RTCx);
4550 return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP8MF) == (TAMP_MISR_ITAMP8MF)) ? 1U : 0U);
4551 }
4552
4553 /**
4554 * @brief Get internal tamper 9 interrupt masked flag.
4555 * @rmtoll TAMP_MISR ITAMP9MF LL_RTC_IsActiveFlag_ITAMP9M
4556 * @param RTCx RTC Instance
4557 * @retval State of bit (1 or 0).
4558 */
LL_RTC_IsActiveFlag_ITAMP9M(const RTC_TypeDef * RTCx)4559 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP9M(const RTC_TypeDef *RTCx)
4560 {
4561 UNUSED(RTCx);
4562 return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP9MF) == (TAMP_MISR_ITAMP9MF)) ? 1U : 0U);
4563 }
4564
4565 /**
4566 * @brief Get internal tamper 11 interrupt masked flag.
4567 * @rmtoll TAMP_MISR ITAMP11MF LL_RTC_IsActiveFlag_ITAMP11M
4568 * @param RTCx RTC Instance
4569 * @retval State of bit (1 or 0).
4570 */
LL_RTC_IsActiveFlag_ITAMP11M(const RTC_TypeDef * RTCx)4571 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP11M(const RTC_TypeDef *RTCx)
4572 {
4573 UNUSED(RTCx);
4574 return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP11MF) == (TAMP_MISR_ITAMP11MF)) ? 1U : 0U);
4575 }
4576
4577 /**
4578 * @brief Get internal tamper 12 interrupt masked flag.
4579 * @rmtoll TAMP_MISR ITAMP12MF LL_RTC_IsActiveFlag_ITAMP12M
4580 * @param RTCx RTC Instance
4581 * @retval State of bit (1 or 0).
4582 */
LL_RTC_IsActiveFlag_ITAMP12M(const RTC_TypeDef * RTCx)4583 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP12M(const RTC_TypeDef *RTCx)
4584 {
4585 UNUSED(RTCx);
4586 return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP12MF) == (TAMP_MISR_ITAMP12MF)) ? 1U : 0U);
4587 }
4588
4589 /**
4590 * @brief Get internal tamper 13 interrupt masked flag.
4591 * @rmtoll TAMP_MISR ITAMP13MF LL_RTC_IsActiveFlag_ITAMP13M
4592 * @param RTCx RTC Instance
4593 * @retval State of bit (1 or 0).
4594 */
LL_RTC_IsActiveFlag_ITAMP13M(const RTC_TypeDef * RTCx)4595 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP13M(const RTC_TypeDef *RTCx)
4596 {
4597 UNUSED(RTCx);
4598 return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP13MF) == (TAMP_MISR_ITAMP13MF)) ? 1U : 0U);
4599 }
4600
4601 /**
4602 * @brief Clear tamper 1 detection flag.
4603 * @rmtoll TAMP_SCR CTAMP1F LL_RTC_ClearFlag_TAMP1
4604 * @param RTCx RTC Instance
4605 * @retval None
4606 */
LL_RTC_ClearFlag_TAMP1(const RTC_TypeDef * RTCx)4607 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP1(const RTC_TypeDef *RTCx)
4608 {
4609 UNUSED(RTCx);
4610 WRITE_REG(TAMP->SCR, TAMP_SCR_CTAMP1F);
4611 }
4612
4613 /**
4614 * @brief Clear tamper 2 detection flag.
4615 * @rmtoll TAMP_SCR CTAMP2F LL_RTC_ClearFlag_TAMP2
4616 * @param RTCx RTC Instance
4617 * @retval None
4618 */
LL_RTC_ClearFlag_TAMP2(const RTC_TypeDef * RTCx)4619 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP2(const RTC_TypeDef *RTCx)
4620 {
4621 UNUSED(RTCx);
4622 WRITE_REG(TAMP->SCR, TAMP_SCR_CTAMP2F);
4623 }
4624
4625 /**
4626 * @brief Clear tamper 3 detection flag.
4627 * @rmtoll TAMP_SCR CTAMP3F LL_RTC_ClearFlag_TAMP3
4628 * @param RTCx RTC Instance
4629 * @retval None
4630 */
LL_RTC_ClearFlag_TAMP3(const RTC_TypeDef * RTCx)4631 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP3(const RTC_TypeDef *RTCx)
4632 {
4633 UNUSED(RTCx);
4634 WRITE_REG(TAMP->SCR, TAMP_SCR_CTAMP3F);
4635 }
4636
4637 #ifdef TAMP_SCR_CTAMP4F
4638 /**
4639 * @brief Clear tamper 4 detection flag.
4640 * @rmtoll TAMP_SCR CTAMP4F LL_RTC_ClearFlag_TAMP4
4641 * @param RTCx RTC Instance
4642 * @retval None
4643 */
LL_RTC_ClearFlag_TAMP4(const RTC_TypeDef * RTCx)4644 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP4(const RTC_TypeDef *RTCx)
4645 {
4646 UNUSED(RTCx);
4647 WRITE_REG(TAMP->SCR, TAMP_SCR_CTAMP4F);
4648 }
4649
4650 /**
4651 * @brief Clear tamper 5 detection flag.
4652 * @rmtoll TAMP_SCR CTAMP5F LL_RTC_ClearFlag_TAMP5
4653 * @param RTCx RTC Instance
4654 * @retval None
4655 */
LL_RTC_ClearFlag_TAMP5(const RTC_TypeDef * RTCx)4656 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP5(const RTC_TypeDef *RTCx)
4657 {
4658 UNUSED(RTCx);
4659 WRITE_REG(TAMP->SCR, TAMP_SCR_CTAMP5F);
4660 }
4661
4662 /**
4663 * @brief Clear tamper 6 detection flag.
4664 * @rmtoll TAMP_SCR CTAMP6F LL_RTC_ClearFlag_TAMP6
4665 * @param RTCx RTC Instance
4666 * @retval None
4667 */
LL_RTC_ClearFlag_TAMP6(const RTC_TypeDef * RTCx)4668 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP6(const RTC_TypeDef *RTCx)
4669 {
4670 UNUSED(RTCx);
4671 WRITE_REG(TAMP->SCR, TAMP_SCR_CTAMP6F);
4672 }
4673 #endif /* TAMP_SCR_CTAMP4F */
4674
4675 /**
4676 * @brief Clear internal tamper 3 detection flag.
4677 * @rmtoll TAMP_SCR CITAMP3F LL_RTC_ClearFlag_ITAMP3
4678 * @param RTCx RTC Instance
4679 * @retval None
4680 */
LL_RTC_ClearFlag_ITAMP3(const RTC_TypeDef * RTCx)4681 __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP3(const RTC_TypeDef *RTCx)
4682 {
4683 UNUSED(RTCx);
4684 WRITE_REG(TAMP->SCR, TAMP_SCR_CITAMP3F);
4685 }
4686
4687 /**
4688 * @brief Clear internal tamper 5 detection flag.
4689 * @rmtoll TAMP_SCR CITAMP5F LL_RTC_ClearFlag_ITAMP5
4690 * @param RTCx RTC Instance
4691 * @retval None
4692 */
LL_RTC_ClearFlag_ITAMP5(const RTC_TypeDef * RTCx)4693 __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP5(const RTC_TypeDef *RTCx)
4694 {
4695 UNUSED(RTCx);
4696 WRITE_REG(TAMP->SCR, TAMP_SCR_CITAMP5F);
4697 }
4698
4699 /**
4700 * @brief Clear internal tamper 6 detection flag.
4701 * @rmtoll TAMP_SCR CITAMP6F LL_RTC_ClearFlag_ITAMP6
4702 * @param RTCx RTC Instance
4703 * @retval None
4704 */
LL_RTC_ClearFlag_ITAMP6(const RTC_TypeDef * RTCx)4705 __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP6(const RTC_TypeDef *RTCx)
4706 {
4707 UNUSED(RTCx);
4708 WRITE_REG(TAMP->SCR, TAMP_SCR_CITAMP6F);
4709 }
4710
4711 /**
4712 * @brief Clear internal tamper 7 detection flag.
4713 * @rmtoll TAMP_SCR CITAMP7F LL_RTC_ClearFlag_ITAMP7
4714 * @param RTCx RTC Instance
4715 * @retval None
4716 */
LL_RTC_ClearFlag_ITAMP7(const RTC_TypeDef * RTCx)4717 __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP7(const RTC_TypeDef *RTCx)
4718 {
4719 UNUSED(RTCx);
4720 WRITE_REG(TAMP->SCR, TAMP_SCR_CITAMP7F);
4721 }
4722
4723 /**
4724 * @brief Clear internal tamper 8 detection flag.
4725 * @rmtoll TAMP_SCR CITAMP8F LL_RTC_ClearFlag_ITAMP8
4726 * @param RTCx RTC Instance
4727 * @retval None
4728 */
LL_RTC_ClearFlag_ITAMP8(const RTC_TypeDef * RTCx)4729 __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP8(const RTC_TypeDef *RTCx)
4730 {
4731 UNUSED(RTCx);
4732 WRITE_REG(TAMP->SCR, TAMP_SCR_CITAMP8F);
4733 }
4734
4735 /**
4736 * @brief Clear internal tamper 9 detection flag.
4737 * @rmtoll TAMP_SCR CITAMP9F LL_RTC_ClearFlag_ITAMP9
4738 * @param RTCx RTC Instance
4739 * @retval None
4740 */
LL_RTC_ClearFlag_ITAMP9(const RTC_TypeDef * RTCx)4741 __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP9(const RTC_TypeDef *RTCx)
4742 {
4743 UNUSED(RTCx);
4744 WRITE_REG(TAMP->SCR, TAMP_SCR_CITAMP9F);
4745 }
4746
4747 /**
4748 * @brief Clear internal tamper 11 detection flag.
4749 * @rmtoll TAMP_SCR CITAMP11F LL_RTC_ClearFlag_ITAMP11
4750 * @param RTCx RTC Instance
4751 * @retval None
4752 */
LL_RTC_ClearFlag_ITAMP11(const RTC_TypeDef * RTCx)4753 __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP11(const RTC_TypeDef *RTCx)
4754 {
4755 UNUSED(RTCx);
4756 WRITE_REG(TAMP->SCR, TAMP_SCR_CITAMP11F);
4757 }
4758
4759 /**
4760 * @brief Clear internal tamper 12 detection flag.
4761 * @rmtoll TAMP_SCR CITAMP12F LL_RTC_ClearFlag_ITAMP12
4762 * @param RTCx RTC Instance
4763 * @retval None
4764 */
LL_RTC_ClearFlag_ITAMP12(const RTC_TypeDef * RTCx)4765 __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP12(const RTC_TypeDef *RTCx)
4766 {
4767 UNUSED(RTCx);
4768 WRITE_REG(TAMP->SCR, TAMP_SCR_CITAMP12F);
4769 }
4770
4771 /**
4772 * @brief Clear internal tamper 13 detection flag.
4773 * @rmtoll TAMP_SCR CITAMP13F LL_RTC_ClearFlag_ITAMP13
4774 * @param RTCx RTC Instance
4775 * @retval None
4776 */
LL_RTC_ClearFlag_ITAMP13(const RTC_TypeDef * RTCx)4777 __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP13(const RTC_TypeDef *RTCx)
4778 {
4779 UNUSED(RTCx);
4780 WRITE_REG(TAMP->SCR, TAMP_SCR_CITAMP13F);
4781 }
4782
4783 /**
4784 * @}
4785 */
4786
4787 #if defined(RTC_SECCFGR_SEC)
4788 /** @defgroup RTC_LL_EF_SECURITY SECURITY_Management
4789 * @{
4790 */
4791
4792 #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
4793 /**
4794 * @brief Set RTC secure level.
4795 * @note secure features are relevant if LL_RTC_SECURE_FULL_NO.
4796 * @rmtoll RTC_SECCFGR SEC LL_RTC_SetRtcSecure
4797 * @rmtoll RTC_SECCFGR INITSEC LL_RTC_SetRtcSecure
4798 * @rmtoll RTC_SECCFGR CALSEC LL_RTC_SetRtcSecure
4799 * @rmtoll RTC_SECCFGR TSSEC LL_RTC_SetRtcSecure
4800 * @rmtoll RTC_SECCFGR WUTSEC LL_RTC_SetRtcSecure
4801 * @rmtoll RTC_SECCFGR ALRASEC LL_RTC_SetRtcSecure
4802 * @rmtoll RTC_SECCFGR ALRBSEC LL_RTC_SetRtcSecure
4803 * @param RTCx RTC Instance
4804 * @param rtcSecure This parameter can be a combination of the following values:
4805 * @arg @ref LL_RTC_SECURE_FULL_YES
4806 * @arg @ref LL_RTC_SECURE_FULL_NO
4807 * @arg @ref LL_RTC_SECURE_FEATURE_INIT
4808 * @arg @ref LL_RTC_SECURE_FEATURE_CAL
4809 * @arg @ref LL_RTC_SECURE_FEATURE_TS
4810 * @arg @ref LL_RTC_SECURE_FEATURE_WUT
4811 * @arg @ref LL_RTC_SECURE_FEATURE_ALRA
4812 * @arg @ref LL_RTC_SECURE_FEATURE_ALRB
4813
4814 * @retval None
4815 */
LL_RTC_SetRtcSecure(RTC_TypeDef * RTCx,uint32_t rtcSecure)4816 __STATIC_INLINE void LL_RTC_SetRtcSecure(RTC_TypeDef *RTCx, uint32_t rtcSecure)
4817 {
4818 MODIFY_REG(RTCx->SECCFGR, RTC_SECCFGR_SEC | RTC_SECCFGR_INITSEC | RTC_SECCFGR_CALSEC | RTC_SECCFGR_TSSEC | \
4819 RTC_SECCFGR_WUTSEC | RTC_SECCFGR_ALRASEC | RTC_SECCFGR_ALRBSEC, rtcSecure);
4820 }
4821 #endif /* #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
4822
4823 /**
4824 * @brief Get RTC secure level.
4825 * @note Secure features is relevant if LL_RTC_SECURE_FULL_NO.
4826 * @rmtoll RTC_SECCFGR SEC LL_RTC_SetRtcSecure
4827 * @rmtoll RTC_SECCFGR INISEC LL_RTC_SetRtcSecure
4828 * @rmtoll RTC_SECCFGR CALSEC LL_RTC_SetRtcSecure
4829 * @rmtoll RTC_SECCFGR TSSEC LL_RTC_SetRtcSecure
4830 * @rmtoll RTC_SECCFGR WUTSEC LL_RTC_SetRtcSecure
4831 * @rmtoll RTC_SECCFGR ALRASEC LL_RTC_SetRtcSecure
4832 * @rmtoll RTC_SECCFGR ALRBSEC LL_RTC_SetRtcSecure
4833 * @param RTCx RTC Instance
4834 * @retval Combination of the following values:
4835 * @arg @ref LL_RTC_SECURE_FULL_YES
4836 * @arg @ref LL_RTC_SECURE_FULL_NO
4837 * @arg @ref LL_RTC_SECURE_FEATURE_INIT
4838 * @arg @ref LL_RTC_SECURE_FEATURE_CAL
4839 * @arg @ref LL_RTC_SECURE_FEATURE_TS
4840 * @arg @ref LL_RTC_SECURE_FEATURE_WUT
4841 * @arg @ref LL_RTC_SECURE_FEATURE_ALRA
4842 * @arg @ref LL_RTC_SECURE_FEATURE_ALRB
4843 */
LL_RTC_GetRtcSecure(const RTC_TypeDef * RTCx)4844 __STATIC_INLINE uint32_t LL_RTC_GetRtcSecure(const RTC_TypeDef *RTCx)
4845 {
4846 return READ_BIT(RTCx->SECCFGR, RTC_SECCFGR_SEC | RTC_SECCFGR_INITSEC | RTC_SECCFGR_CALSEC | RTC_SECCFGR_TSSEC | \
4847 RTC_SECCFGR_WUTSEC | RTC_SECCFGR_ALRASEC | RTC_SECCFGR_ALRBSEC);
4848 }
4849
4850 #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
4851 /**
4852 * @brief Set TAMPER secure level.
4853 * @rmtoll TAMP_SECCFGR TAMPSEC LL_RTC_SetTampSecure
4854 * @param RTCx RTC Instance
4855 * @param tampSecure This parameter can be one of the following values:
4856 * @arg @ref LL_TAMP_SECURE_FULL_YES
4857 * @arg @ref LL_TAMP_SECURE_FULL_NO
4858 * @retval None
4859 */
LL_RTC_SetTampSecure(const RTC_TypeDef * RTCx,uint32_t tampSecure)4860 __STATIC_INLINE void LL_RTC_SetTampSecure(const RTC_TypeDef *RTCx, uint32_t tampSecure)
4861 {
4862 UNUSED(RTCx);
4863 MODIFY_REG(TAMP->SECCFGR, TAMP_SECCFGR_TAMPSEC, tampSecure);
4864 }
4865 #endif /* #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
4866
4867 /**
4868 * @brief Get TAMPER secure level.
4869 * @rmtoll TAMP_SECCFGR TAMPSEC LL_RTC_GetTampSecure
4870 * @param RTCx RTC Instance
4871 * @retval This parameter can be one of the following values:
4872 * @arg @ref LL_TAMP_SECURE_FULL_YES
4873 * @arg @ref LL_TAMP_SECURE_FULL_NO
4874 */
LL_RTC_GetTampSecure(const RTC_TypeDef * RTCx)4875 __STATIC_INLINE uint32_t LL_RTC_GetTampSecure(const RTC_TypeDef *RTCx)
4876 {
4877 UNUSED(RTCx);
4878 return READ_BIT(TAMP->SECCFGR, TAMP_SECCFGR_TAMPSEC);
4879 }
4880
4881 /**
4882 * @}
4883 */
4884 #endif /* RTC_SECCFGR_SEC */
4885
4886 #if defined(RTC_PRIVCFGR_PRIV)
4887 /** @defgroup RTC_LL_EF_PRIVILEGE PRIVILEGE_Management
4888 * @{
4889 */
4890
4891 /**
4892 * @brief Set RTC privilege level.
4893 * @note Privilege features are relevant if LL_RTC_PRIVILEGE_FULL_NO.
4894 * @rmtoll RTC_PRIVCFGR PRIV LL_RTC_SetRtcPrivilege
4895 * @rmtoll RTC_PRIVCFGR INITPRIV LL_RTC_SetRtcPrivilege
4896 * @rmtoll RTC_PRIVCFGR CALPRIV LL_RTC_SetRtcPrivilege
4897 * @rmtoll RTC_PRIVCFGR TSPRIV LL_RTC_SetRtcPrivilege
4898 * @rmtoll RTC_PRIVCFGR WUTPRIV LL_RTC_SetRtcPrivilege
4899 * @rmtoll RTC_PRIVCFGR ALRAPRIV LL_RTC_SetRtcPrivilege
4900 * @rmtoll RTC_PRIVCFGR ALRBPRIV LL_RTC_SetRtcPrivilege
4901 * @param RTCx RTC Instance
4902 * @param rtcPrivilege This parameter can be a combination of the following values:
4903 * @arg @ref LL_RTC_PRIVILEGE_FULL_YES
4904 * @arg @ref LL_RTC_PRIVILEGE_FULL_NO
4905 * @arg @ref LL_RTC_PRIVILEGE_FEATURE_INIT
4906 * @arg @ref LL_RTC_PRIVILEGE_FEATURE_CAL
4907 * @arg @ref LL_RTC_PRIVILEGE_FEATURE_TS
4908 * @arg @ref LL_RTC_PRIVILEGE_FEATURE_WUT
4909 * @arg @ref LL_RTC_PRIVILEGE_FEATURE_ALRA
4910 * @arg @ref LL_RTC_PRIVILEGE_FEATURE_ALRB
4911 * @retval None
4912 */
LL_RTC_SetRtcPrivilege(RTC_TypeDef * RTCx,uint32_t rtcPrivilege)4913 __STATIC_INLINE void LL_RTC_SetRtcPrivilege(RTC_TypeDef *RTCx, uint32_t rtcPrivilege)
4914 {
4915 MODIFY_REG(RTCx->PRIVCFGR, RTC_PRIVCFGR_PRIV | RTC_PRIVCFGR_INITPRIV | RTC_PRIVCFGR_CALPRIV | RTC_PRIVCFGR_TSPRIV | \
4916 RTC_PRIVCFGR_WUTPRIV | RTC_PRIVCFGR_ALRAPRIV | RTC_PRIVCFGR_ALRBPRIV, rtcPrivilege);
4917 }
4918
4919 /**
4920 * @brief Get RTC privilege level.
4921 * @note Privilege features are relevant if LL_RTC_PRIVILEGE_FULL_NO.
4922 * @rmtoll RTC_PRIVCFGR PRIV LL_RTC_SetRtcPrivilege
4923 * @rmtoll RTC_PRIVCFGR INITPRIV LL_RTC_SetRtcPrivilege
4924 * @rmtoll RTC_PRIVCFGR CALPRIV LL_RTC_SetRtcPrivilege
4925 * @rmtoll RTC_PRIVCFGR TSPRIV LL_RTC_SetRtcPrivilege
4926 * @rmtoll RTC_PRIVCFGR WUTPRIV LL_RTC_SetRtcPrivilege
4927 * @rmtoll RTC_PRIVCFGR ALRAPRIV LL_RTC_SetRtcPrivilege
4928 * @rmtoll RTC_PRIVCFGR ALRBPRIV LL_RTC_SetRtcPrivilege
4929 * @param RTCx RTC Instance
4930 * @retval Combination of the following values:
4931 * @arg @ref LL_RTC_PRIVILEGE_FULL_YES
4932 * @arg @ref LL_RTC_PRIVILEGE_FULL_NO
4933 * @arg @ref LL_RTC_PRIVILEGE_FEATURE_INIT
4934 * @arg @ref LL_RTC_PRIVILEGE_FEATURE_CAL
4935 * @arg @ref LL_RTC_PRIVILEGE_FEATURE_TS
4936 * @arg @ref LL_RTC_PRIVILEGE_FEATURE_WUT
4937 * @arg @ref LL_RTC_PRIVILEGE_FEATURE_ALRA
4938 * @arg @ref LL_RTC_PRIVILEGE_FEATURE_ALRB
4939 */
LL_RTC_GetRtcPrivilege(const RTC_TypeDef * RTCx)4940 __STATIC_INLINE uint32_t LL_RTC_GetRtcPrivilege(const RTC_TypeDef *RTCx)
4941 {
4942 return READ_BIT(RTCx->PRIVCFGR, RTC_PRIVCFGR_PRIV | RTC_PRIVCFGR_INITPRIV | RTC_PRIVCFGR_CALPRIV | \
4943 RTC_PRIVCFGR_TSPRIV | RTC_PRIVCFGR_WUTPRIV | RTC_PRIVCFGR_ALRAPRIV | \
4944 RTC_PRIVCFGR_ALRBPRIV);
4945 }
4946
4947 /**
4948 * @brief Set TAMPER privilege level.
4949 * @rmtoll TAMP_PRIVCFGR TAMPPRIV LL_RTC_SetTampPrivilege
4950 * @param RTCx RTC Instance
4951 * @param tampPrivilege This parameter can be one of the following values:
4952 * @arg @ref LL_TAMP_PRIVILEGE_FULL_YES
4953 * @arg @ref LL_TAMP_PRIVILEGE_FULL_NO
4954 * @retval None
4955 */
LL_RTC_SetTampPrivilege(const RTC_TypeDef * RTCx,uint32_t tampPrivilege)4956 __STATIC_INLINE void LL_RTC_SetTampPrivilege(const RTC_TypeDef *RTCx, uint32_t tampPrivilege)
4957 {
4958 UNUSED(RTCx);
4959 MODIFY_REG(TAMP->PRIVCFGR, TAMP_PRIVCFGR_TAMPPRIV, tampPrivilege);
4960 }
4961
4962 /**
4963 * @brief Get TAMPER privilege level.
4964 * @rmtoll TAMP_PRIVCFGR TAMPPRIV LL_RTC_GetTampPrivilege
4965 * @param RTCx RTC Instance
4966 * @retval This parameter can be one of the following values:
4967 * @arg @ref LL_TAMP_PRIVILEGE_FULL_YES
4968 * @arg @ref LL_TAMP_PRIVILEGE_FULL_NO
4969 */
LL_RTC_GetTampPrivilege(const RTC_TypeDef * RTCx)4970 __STATIC_INLINE uint32_t LL_RTC_GetTampPrivilege(const RTC_TypeDef *RTCx)
4971 {
4972 UNUSED(RTCx);
4973 return READ_BIT(TAMP->PRIVCFGR, TAMP_PRIVCFGR_TAMPPRIV);
4974 }
4975
4976 /**
4977 * @brief Set Backup Registers privilege level.
4978 * @note bckupRegisterPrivilege is only writable in secure mode or if trustzone is disabled
4979 * @rmtoll TAMP_PRIVCFGR BKPWPRIV LL_RTC_SetBackupRegisterPrivilege
4980 * @rmtoll TAMP_PRIVCFGR BKPRWPRIV LL_RTC_SetBackupRegisterPrivilege
4981 * @param RTCx RTC Instance
4982 * @param bckupRegisterPrivilege This parameter can be one of the following values:
4983 * @arg @ref LL_RTC_PRIVILEGE_BKUP_ZONE_NONE
4984 * @arg @ref LL_RTC_PRIVILEGE_BKUP_ZONE_1
4985 * @arg @ref LL_RTC_PRIVILEGE_BKUP_ZONE_2
4986 * @arg @ref LL_RTC_PRIVILEGE_BKUP_ZONE_ALL
4987 * @retval None
4988 */
LL_RTC_SetBackupRegisterPrivilege(const RTC_TypeDef * RTCx,uint32_t bckupRegisterPrivilege)4989 __STATIC_INLINE void LL_RTC_SetBackupRegisterPrivilege(const RTC_TypeDef *RTCx, uint32_t bckupRegisterPrivilege)
4990 {
4991 UNUSED(RTCx);
4992 MODIFY_REG(TAMP->PRIVCFGR, (TAMP_PRIVCFGR_BKPWPRIV | TAMP_PRIVCFGR_BKPRWPRIV), bckupRegisterPrivilege);
4993 }
4994
4995 /**
4996 * @brief Get Backup Registers privilege level.
4997 * @rmtoll TAMP_PRIVCFGR BKPWPRIV LL_RTC_GetBackupRegisterPrivilege
4998 * @rmtoll TAMP_PRIVCFGR BKPRWPRIV LL_RTC_GetBackupRegisterPrivilege
4999 * @param RTCx RTC Instance
5000 * @retval This parameter can be one of the following values:
5001 * @arg @ref LL_RTC_PRIVILEGE_BKUP_ZONE_NONE
5002 * @arg @ref LL_RTC_PRIVILEGE_BKUP_ZONE_1
5003 * @arg @ref LL_RTC_PRIVILEGE_BKUP_ZONE_2
5004 * @arg @ref LL_RTC_PRIVILEGE_BKUP_ZONE_ALL
5005 */
LL_RTC_GetBackupRegisterPrivilege(const RTC_TypeDef * RTCx)5006 __STATIC_INLINE uint32_t LL_RTC_GetBackupRegisterPrivilege(const RTC_TypeDef *RTCx)
5007 {
5008 UNUSED(RTCx);
5009 return READ_BIT(TAMP->PRIVCFGR, (TAMP_PRIVCFGR_BKPWPRIV | TAMP_PRIVCFGR_BKPRWPRIV));
5010 }
5011 /**
5012 * @}
5013 */
5014 #endif /* RTC_PRIVCFGR_PRIV */
5015
5016 #if defined(TAMP_SECCFGR_TAMPSEC)
5017 /** @defgroup RTC_LL_EF_BACKUP_REG_PROTECTION PROTECTION_BACKUP_REG_Management
5018 * @brief Backup register protection is common to security and privilege.
5019 * @{
5020 */
5021
5022 /**
5023 * @brief Set Backup registers protection level.
5024 * @note Zone 1 : read protection write protection
5025 * @note Zone 2 : read non-protection write protection
5026 * @note Zone 3 : read non-protection write non-protection
5027 * @note zone 1 : start from 0 to startZone2 start value
5028 * @note zone 2 : start from startZone2 start value to startZone3 start value
5029 * @note zone 3 : start from to startZone3 to the end of BACKUPREG
5030 * @note Warning : this parameter is only writable in secure mode or if trustzone is disabled
5031 * @rmtoll TAMP_SECCFGR BKPWSEC LL_RTC_SetBackupRegProtection
5032 * @rmtoll TAMP_SECCFGR BKPRWSEC LL_RTC_SetBackupRegProtection
5033 * @param RTCx RTC Instance
5034 * @param startZone2 This parameter can be one of the following values:
5035 * @arg @ref LL_RTC_BKP_DR0
5036 * @arg @ref LL_RTC_BKP_DR1
5037 * @arg @ref LL_RTC_BKP_DR2
5038 * @arg @ref LL_RTC_BKP_DR3
5039 * @arg @ref LL_RTC_BKP_DR4
5040 * @arg LL_RTC_BKP_DRx ...
5041 * @param startZone3 This parameter can be one of the following values:
5042 * @arg @ref LL_RTC_BKP_DR0
5043 * @arg @ref LL_RTC_BKP_DR1
5044 * @arg @ref LL_RTC_BKP_DR2
5045 * @arg @ref LL_RTC_BKP_DR3
5046 * @arg @ref LL_RTC_BKP_DR4
5047 * @arg LL_RTC_BKP_DRx ...
5048 * @retval None
5049 */
LL_RTC_SetBackupRegProtection(const RTC_TypeDef * RTCx,uint32_t startZone2,uint32_t startZone3)5050 __STATIC_INLINE void LL_RTC_SetBackupRegProtection(const RTC_TypeDef *RTCx, uint32_t startZone2, uint32_t startZone3)
5051 {
5052 UNUSED(RTCx);
5053 MODIFY_REG(TAMP->SECCFGR, (TAMP_SECCFGR_BKPRWSEC_Msk | TAMP_SECCFGR_BKPWSEC_Msk),
5054 (startZone2 << TAMP_SECCFGR_BKPRWSEC_Pos) | (startZone3 << TAMP_SECCFGR_BKPWSEC_Pos));
5055 }
5056
5057 /**
5058 * @brief Get Backup registers protection level start zone 2.
5059 * @note Zone 1 : read protection write protection
5060 * @note Zone 2 : read non-protection/non-privile write protection
5061 * @note Zone 3 : read non-protection write non-protection
5062 * @rmtoll TAMP_SECCFGR BKPRWSEC LL_RTC_GetBackupRegProtectionStartZone2
5063 * @param RTCx RTC Instance
5064 * @retval Start zone 2
5065 */
LL_RTC_GetBackupRegProtectionStartZone2(const RTC_TypeDef * RTCx)5066 __STATIC_INLINE uint32_t LL_RTC_GetBackupRegProtectionStartZone2(const RTC_TypeDef *RTCx)
5067 {
5068 UNUSED(RTCx);
5069 return READ_BIT(TAMP->SECCFGR, TAMP_SECCFGR_BKPRWSEC_Msk) >> TAMP_SECCFGR_BKPRWSEC_Pos;
5070 }
5071
5072 /**
5073 * @brief Get Backup registers protection level start zone 3.
5074 * @note Zone 1 : read protection write protection
5075 * @note Zone 2 : read non-protection write protection
5076 * @note Zone 3 : read non-protection write non-protection
5077 * @rmtoll TAMP_SECCFGR BKPWSEC LL_RTC_GetBackupRegProtectionStartZone3
5078 * @param RTCx RTC Instance
5079 * @retval Start zone 2
5080 */
LL_RTC_GetBackupRegProtectionStartZone3(const RTC_TypeDef * RTCx)5081 __STATIC_INLINE uint32_t LL_RTC_GetBackupRegProtectionStartZone3(const RTC_TypeDef *RTCx)
5082 {
5083 UNUSED(RTCx);
5084 return READ_BIT(TAMP->SECCFGR, TAMP_SECCFGR_BKPWSEC_Msk) >> TAMP_SECCFGR_BKPWSEC_Pos;
5085 }
5086 /**
5087 * @}
5088 */
5089 #endif /* TAMP_SECCFGR_TAMPSEC */
5090
5091 /** @defgroup RTC_LL_EF_IT_Management IT_Management
5092 * @{
5093 */
5094
5095 /**
5096 * @brief Enable Time-stamp interrupt
5097 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
5098 * @rmtoll RTC_CR TSIE LL_RTC_EnableIT_TS
5099 * @param RTCx RTC Instance
5100 * @retval None
5101 */
LL_RTC_EnableIT_TS(RTC_TypeDef * RTCx)5102 __STATIC_INLINE void LL_RTC_EnableIT_TS(RTC_TypeDef *RTCx)
5103 {
5104 SET_BIT(RTCx->CR, RTC_CR_TSIE);
5105 }
5106
5107 /**
5108 * @brief Disable Time-stamp interrupt
5109 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
5110 * @rmtoll RTC_CR TSIE LL_RTC_DisableIT_TS
5111 * @param RTCx RTC Instance
5112 * @retval None
5113 */
LL_RTC_DisableIT_TS(RTC_TypeDef * RTCx)5114 __STATIC_INLINE void LL_RTC_DisableIT_TS(RTC_TypeDef *RTCx)
5115 {
5116 CLEAR_BIT(RTCx->CR, RTC_CR_TSIE);
5117 }
5118
5119 /**
5120 * @brief Enable Wakeup timer interrupt
5121 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
5122 * @rmtoll RTC_CR WUTIE LL_RTC_EnableIT_WUT
5123 * @param RTCx RTC Instance
5124 * @retval None
5125 */
LL_RTC_EnableIT_WUT(RTC_TypeDef * RTCx)5126 __STATIC_INLINE void LL_RTC_EnableIT_WUT(RTC_TypeDef *RTCx)
5127 {
5128 SET_BIT(RTCx->CR, RTC_CR_WUTIE);
5129 }
5130
5131 /**
5132 * @brief Disable Wakeup timer interrupt
5133 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
5134 * @rmtoll RTC_CR WUTIE LL_RTC_DisableIT_WUT
5135 * @param RTCx RTC Instance
5136 * @retval None
5137 */
LL_RTC_DisableIT_WUT(RTC_TypeDef * RTCx)5138 __STATIC_INLINE void LL_RTC_DisableIT_WUT(RTC_TypeDef *RTCx)
5139 {
5140 CLEAR_BIT(RTCx->CR, RTC_CR_WUTIE);
5141 }
5142
5143 /**
5144 * @brief Enable Alarm B interrupt
5145 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
5146 * @rmtoll RTC_CR ALRBIE LL_RTC_EnableIT_ALRB
5147 * @param RTCx RTC Instance
5148 * @retval None
5149 */
LL_RTC_EnableIT_ALRB(RTC_TypeDef * RTCx)5150 __STATIC_INLINE void LL_RTC_EnableIT_ALRB(RTC_TypeDef *RTCx)
5151 {
5152 SET_BIT(RTCx->CR, RTC_CR_ALRBIE);
5153 }
5154
5155 /**
5156 * @brief Disable Alarm B interrupt
5157 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
5158 * @rmtoll RTC_CR ALRBIE LL_RTC_DisableIT_ALRB
5159 * @param RTCx RTC Instance
5160 * @retval None
5161 */
LL_RTC_DisableIT_ALRB(RTC_TypeDef * RTCx)5162 __STATIC_INLINE void LL_RTC_DisableIT_ALRB(RTC_TypeDef *RTCx)
5163 {
5164 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBIE);
5165 }
5166
5167 /**
5168 * @brief Enable Alarm A interrupt
5169 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
5170 * @rmtoll RTC_CR ALRAIE LL_RTC_EnableIT_ALRA
5171 * @param RTCx RTC Instance
5172 * @retval None
5173 */
LL_RTC_EnableIT_ALRA(RTC_TypeDef * RTCx)5174 __STATIC_INLINE void LL_RTC_EnableIT_ALRA(RTC_TypeDef *RTCx)
5175 {
5176 SET_BIT(RTCx->CR, RTC_CR_ALRAIE);
5177 }
5178
5179 /**
5180 * @brief Disable Alarm A interrupt
5181 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
5182 * @rmtoll RTC_CR ALRAIE LL_RTC_DisableIT_ALRA
5183 * @param RTCx RTC Instance
5184 * @retval None
5185 */
LL_RTC_DisableIT_ALRA(RTC_TypeDef * RTCx)5186 __STATIC_INLINE void LL_RTC_DisableIT_ALRA(RTC_TypeDef *RTCx)
5187 {
5188 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAIE);
5189 }
5190
5191 /**
5192 * @brief Enable SSR Underflow interrupt
5193 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
5194 * @rmtoll RTC_CR SSRUIE LL_RTC_EnableIT_SSRU
5195 * @param RTCx RTC Instance
5196 * @retval None
5197 */
LL_RTC_EnableIT_SSRU(RTC_TypeDef * RTCx)5198 __STATIC_INLINE void LL_RTC_EnableIT_SSRU(RTC_TypeDef *RTCx)
5199 {
5200 SET_BIT(RTCx->CR, RTC_CR_SSRUIE);
5201 }
5202
5203 /**
5204 * @brief Disable SSR Underflow interrupt
5205 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
5206 * @rmtoll RTC_CR SSRUIE LL_RTC_DisableIT_SSRU
5207 * @param RTCx RTC Instance
5208 * @retval None
5209 */
LL_RTC_DisableIT_SSRU(RTC_TypeDef * RTCx)5210 __STATIC_INLINE void LL_RTC_DisableIT_SSRU(RTC_TypeDef *RTCx)
5211 {
5212 CLEAR_BIT(RTCx->CR, RTC_CR_SSRUIE);
5213 }
5214
5215 /**
5216 * @brief Check if Time-stamp interrupt is enabled or not
5217 * @rmtoll RTC_CR TSIE LL_RTC_IsEnabledIT_TS
5218 * @param RTCx RTC Instance
5219 * @retval State of bit (1 or 0).
5220 */
LL_RTC_IsEnabledIT_TS(const RTC_TypeDef * RTCx)5221 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TS(const RTC_TypeDef *RTCx)
5222 {
5223 return ((READ_BIT(RTCx->CR, RTC_CR_TSIE) == (RTC_CR_TSIE)) ? 1U : 0U);
5224 }
5225
5226 /**
5227 * @brief Check if Wakeup timer interrupt is enabled or not
5228 * @rmtoll RTC_CR WUTIE LL_RTC_IsEnabledIT_WUT
5229 * @param RTCx RTC Instance
5230 * @retval State of bit (1 or 0).
5231 */
LL_RTC_IsEnabledIT_WUT(const RTC_TypeDef * RTCx)5232 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_WUT(const RTC_TypeDef *RTCx)
5233 {
5234 return ((READ_BIT(RTCx->CR, RTC_CR_WUTIE) == (RTC_CR_WUTIE)) ? 1U : 0U);
5235 }
5236
5237 /**
5238 * @brief Check if Alarm B interrupt is enabled or not
5239 * @rmtoll RTC_CR ALRBIE LL_RTC_IsEnabledIT_ALRB
5240 * @param RTCx RTC Instance
5241 * @retval State of bit (1 or 0).
5242 */
LL_RTC_IsEnabledIT_ALRB(const RTC_TypeDef * RTCx)5243 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRB(const RTC_TypeDef *RTCx)
5244 {
5245 return ((READ_BIT(RTCx->CR, RTC_CR_ALRBIE) == (RTC_CR_ALRBIE)) ? 1U : 0U);
5246 }
5247
5248 /**
5249 * @brief Check if Alarm A interrupt is enabled or not
5250 * @rmtoll RTC_CR ALRAIE LL_RTC_IsEnabledIT_ALRA
5251 * @param RTCx RTC Instance
5252 * @retval State of bit (1 or 0).
5253 */
LL_RTC_IsEnabledIT_ALRA(const RTC_TypeDef * RTCx)5254 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRA(const RTC_TypeDef *RTCx)
5255 {
5256 return ((READ_BIT(RTCx->CR, RTC_CR_ALRAIE) == (RTC_CR_ALRAIE)) ? 1U : 0U);
5257 }
5258
5259 /**
5260 * @brief Check if SSR Underflow interrupt is enabled or not
5261 * @rmtoll RTC_CR SSRUIE LL_RTC_IsEnabledIT_SSRU
5262 * @param RTCx RTC Instance
5263 * @retval State of bit (1 or 0).
5264 */
LL_RTC_IsEnabledIT_SSRU(const RTC_TypeDef * RTCx)5265 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_SSRU(const RTC_TypeDef *RTCx)
5266 {
5267 return ((READ_BIT(RTCx->CR, RTC_CR_SSRUIE) == (RTC_CR_SSRUIE)) ? 1U : 0U);
5268 }
5269
5270 /**
5271 * @brief Enable tamper 1 interrupt.
5272 * @rmtoll TAMP_IER TAMP1IE LL_RTC_EnableIT_TAMP1
5273 * @param RTCx RTC Instance
5274 * @retval None
5275 */
LL_RTC_EnableIT_TAMP1(const RTC_TypeDef * RTCx)5276 __STATIC_INLINE void LL_RTC_EnableIT_TAMP1(const RTC_TypeDef *RTCx)
5277 {
5278 UNUSED(RTCx);
5279 SET_BIT(TAMP->IER, TAMP_IER_TAMP1IE);
5280 }
5281
5282 /**
5283 * @brief Disable tamper 1 interrupt.
5284 * @rmtoll TAMP_IER TAMP1IE LL_RTC_DisableIT_TAMP1
5285 * @param RTCx RTC Instance
5286 * @retval None
5287 */
LL_RTC_DisableIT_TAMP1(const RTC_TypeDef * RTCx)5288 __STATIC_INLINE void LL_RTC_DisableIT_TAMP1(const RTC_TypeDef *RTCx)
5289 {
5290 UNUSED(RTCx);
5291 CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP1IE);
5292 }
5293
5294 /**
5295 * @brief Enable tamper 2 interrupt.
5296 * @rmtoll TAMP_IER TAMP2IE LL_RTC_EnableIT_TAMP2
5297 * @param RTCx RTC Instance
5298 * @retval None
5299 */
LL_RTC_EnableIT_TAMP2(const RTC_TypeDef * RTCx)5300 __STATIC_INLINE void LL_RTC_EnableIT_TAMP2(const RTC_TypeDef *RTCx)
5301 {
5302 UNUSED(RTCx);
5303 SET_BIT(TAMP->IER, TAMP_IER_TAMP2IE);
5304 }
5305
5306 /**
5307 * @brief Disable tamper 2 interrupt.
5308 * @rmtoll TAMP_IER TAMP2IE LL_RTC_DisableIT_TAMP2
5309 * @param RTCx RTC Instance
5310 * @retval None
5311 */
LL_RTC_DisableIT_TAMP2(const RTC_TypeDef * RTCx)5312 __STATIC_INLINE void LL_RTC_DisableIT_TAMP2(const RTC_TypeDef *RTCx)
5313 {
5314 UNUSED(RTCx);
5315 CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP2IE);
5316 }
5317
5318 /**
5319 * @brief Enable tamper 3 interrupt.
5320 * @rmtoll TAMP_IER TAMP3IE LL_RTC_EnableIT_TAMP3
5321 * @param RTCx RTC Instance
5322 * @retval None
5323 */
LL_RTC_EnableIT_TAMP3(const RTC_TypeDef * RTCx)5324 __STATIC_INLINE void LL_RTC_EnableIT_TAMP3(const RTC_TypeDef *RTCx)
5325 {
5326 UNUSED(RTCx);
5327 SET_BIT(TAMP->IER, TAMP_IER_TAMP3IE);
5328 }
5329
5330 /**
5331 * @brief Disable tamper 3 interrupt.
5332 * @rmtoll TAMP_IER TAMP3IE LL_RTC_DisableIT_TAMP3
5333 * @param RTCx RTC Instance
5334 * @retval None
5335 */
LL_RTC_DisableIT_TAMP3(const RTC_TypeDef * RTCx)5336 __STATIC_INLINE void LL_RTC_DisableIT_TAMP3(const RTC_TypeDef *RTCx)
5337 {
5338 UNUSED(RTCx);
5339 CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP3IE);
5340 }
5341
5342 #ifdef TAMP_IER_TAMP4IE
5343 /**
5344 * @brief Enable tamper 4 interrupt.
5345 * @rmtoll TAMP_IER TAMP4IE LL_RTC_EnableIT_TAMP4
5346 * @param RTCx RTC Instance
5347 * @retval None
5348 */
LL_RTC_EnableIT_TAMP4(const RTC_TypeDef * RTCx)5349 __STATIC_INLINE void LL_RTC_EnableIT_TAMP4(const RTC_TypeDef *RTCx)
5350 {
5351 UNUSED(RTCx);
5352 SET_BIT(TAMP->IER, TAMP_IER_TAMP4IE);
5353 }
5354
5355 /**
5356 * @brief Disable tamper 4 interrupt.
5357 * @rmtoll TAMP_IER TAMP4IE LL_RTC_DisableIT_TAMP4
5358 * @param RTCx RTC Instance
5359 * @retval None
5360 */
LL_RTC_DisableIT_TAMP4(const RTC_TypeDef * RTCx)5361 __STATIC_INLINE void LL_RTC_DisableIT_TAMP4(const RTC_TypeDef *RTCx)
5362 {
5363 UNUSED(RTCx);
5364 CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP4IE);
5365 }
5366
5367 /**
5368 * @brief Enable tamper 5 interrupt.
5369 * @rmtoll TAMP_IER TAMP5IE LL_RTC_EnableIT_TAMP5
5370 * @param RTCx RTC Instance
5371 * @retval None
5372 */
LL_RTC_EnableIT_TAMP5(const RTC_TypeDef * RTCx)5373 __STATIC_INLINE void LL_RTC_EnableIT_TAMP5(const RTC_TypeDef *RTCx)
5374 {
5375 UNUSED(RTCx);
5376 SET_BIT(TAMP->IER, TAMP_IER_TAMP5IE);
5377 }
5378
5379 /**
5380 * @brief Disable tamper 5 interrupt.
5381 * @rmtoll TAMP_IER TAMP5IE LL_RTC_DisableIT_TAMP5
5382 * @param RTCx RTC Instance
5383 * @retval None
5384 */
LL_RTC_DisableIT_TAMP5(const RTC_TypeDef * RTCx)5385 __STATIC_INLINE void LL_RTC_DisableIT_TAMP5(const RTC_TypeDef *RTCx)
5386 {
5387 UNUSED(RTCx);
5388 CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP5IE);
5389 }
5390
5391 /**
5392 * @brief Enable tamper 6 interrupt.
5393 * @rmtoll TAMP_IER TAMP6IE LL_RTC_EnableIT_TAMP6
5394 * @param RTCx RTC Instance
5395 * @retval None
5396 */
LL_RTC_EnableIT_TAMP6(const RTC_TypeDef * RTCx)5397 __STATIC_INLINE void LL_RTC_EnableIT_TAMP6(const RTC_TypeDef *RTCx)
5398 {
5399 UNUSED(RTCx);
5400 SET_BIT(TAMP->IER, TAMP_IER_TAMP6IE);
5401 }
5402
5403 /**
5404 * @brief Disable tamper 6 interrupt.
5405 * @rmtoll TAMP_IER TAMP6IE LL_RTC_DisableIT_TAMP6
5406 * @param RTCx RTC Instance
5407 * @retval None
5408 */
LL_RTC_DisableIT_TAMP6(const RTC_TypeDef * RTCx)5409 __STATIC_INLINE void LL_RTC_DisableIT_TAMP6(const RTC_TypeDef *RTCx)
5410 {
5411 UNUSED(RTCx);
5412 CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP6IE);
5413 }
5414 #endif /* TAMP_IER_TAMP4IE */
5415
5416 /**
5417 * @brief Enable internal tamper 3 interrupt.
5418 * @rmtoll TAMP_IER ITAMP3IE LL_RTC_EnableIT_ITAMP3
5419 * @param RTCx RTC Instance
5420 * @retval None
5421 */
LL_RTC_EnableIT_ITAMP3(const RTC_TypeDef * RTCx)5422 __STATIC_INLINE void LL_RTC_EnableIT_ITAMP3(const RTC_TypeDef *RTCx)
5423 {
5424 UNUSED(RTCx);
5425 SET_BIT(TAMP->IER, TAMP_IER_ITAMP3IE);
5426 }
5427
5428 /**
5429 * @brief Disable internal tamper 3 interrupt.
5430 * @rmtoll TAMP_IER ITAMP3IE LL_RTC_DisableIT_ITAMP3
5431 * @param RTCx RTC Instance
5432 * @retval None
5433 */
LL_RTC_DisableIT_ITAMP3(const RTC_TypeDef * RTCx)5434 __STATIC_INLINE void LL_RTC_DisableIT_ITAMP3(const RTC_TypeDef *RTCx)
5435 {
5436 UNUSED(RTCx);
5437 CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP3IE);
5438 }
5439
5440 /**
5441 * @brief Enable internal tamper 5 interrupt.
5442 * @rmtoll TAMP_IER ITAMP5IE LL_RTC_EnableIT_ITAMP5
5443 * @param RTCx RTC Instance
5444 * @retval None
5445 */
LL_RTC_EnableIT_ITAMP5(const RTC_TypeDef * RTCx)5446 __STATIC_INLINE void LL_RTC_EnableIT_ITAMP5(const RTC_TypeDef *RTCx)
5447 {
5448 UNUSED(RTCx);
5449 SET_BIT(TAMP->IER, TAMP_IER_ITAMP5IE);
5450 }
5451
5452 /**
5453 * @brief Disable internal tamper 5 interrupt.
5454 * @rmtoll TAMP_IER ITAMP5IE LL_RTC_DisableIT_ITAMP5
5455 * @param RTCx RTC Instance
5456 * @retval None
5457 */
LL_RTC_DisableIT_ITAMP5(const RTC_TypeDef * RTCx)5458 __STATIC_INLINE void LL_RTC_DisableIT_ITAMP5(const RTC_TypeDef *RTCx)
5459 {
5460 UNUSED(RTCx);
5461 CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP5IE);
5462 }
5463
5464 /**
5465 * @brief Enable internal tamper 6 interrupt.
5466 * @rmtoll TAMP_IER ITAMP6IE LL_RTC_EnableIT_ITAMP6
5467 * @param RTCx RTC Instance
5468 * @retval None
5469 */
LL_RTC_EnableIT_ITAMP6(const RTC_TypeDef * RTCx)5470 __STATIC_INLINE void LL_RTC_EnableIT_ITAMP6(const RTC_TypeDef *RTCx)
5471 {
5472 UNUSED(RTCx);
5473 SET_BIT(TAMP->IER, TAMP_IER_ITAMP6IE);
5474 }
5475
5476 /**
5477 * @brief Disable internal tamper 6 interrupt.
5478 * @rmtoll TAMP_IER ITAMP6IE LL_RTC_DisableIT_ITAMP6
5479 * @param RTCx RTC Instance
5480 * @retval None
5481 */
LL_RTC_DisableIT_ITAMP6(const RTC_TypeDef * RTCx)5482 __STATIC_INLINE void LL_RTC_DisableIT_ITAMP6(const RTC_TypeDef *RTCx)
5483 {
5484 UNUSED(RTCx);
5485 CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP6IE);
5486 }
5487
5488 /**
5489 * @brief Enable internal tamper 7 interrupt.
5490 * @rmtoll TAMP_IER ITAMP7IE LL_RTC_EnableIT_ITAMP7
5491 * @param RTCx RTC Instance
5492 * @retval None
5493 */
LL_RTC_EnableIT_ITAMP7(const RTC_TypeDef * RTCx)5494 __STATIC_INLINE void LL_RTC_EnableIT_ITAMP7(const RTC_TypeDef *RTCx)
5495 {
5496 UNUSED(RTCx);
5497 SET_BIT(TAMP->IER, TAMP_IER_ITAMP7IE);
5498 }
5499
5500 /**
5501 * @brief Disable internal tamper 7 interrupt.
5502 * @rmtoll TAMP_IER ITAMP7IE LL_RTC_DisableIT_ITAMP7
5503 * @param RTCx RTC Instance
5504 * @retval None
5505 */
LL_RTC_DisableIT_ITAMP7(const RTC_TypeDef * RTCx)5506 __STATIC_INLINE void LL_RTC_DisableIT_ITAMP7(const RTC_TypeDef *RTCx)
5507 {
5508 UNUSED(RTCx);
5509 CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP7IE);
5510 }
5511
5512 /**
5513 * @brief Enable internal tamper 8 interrupt.
5514 * @rmtoll TAMP_IER ITAMP8IE LL_RTC_EnableIT_ITAMP8
5515 * @param RTCx RTC Instance
5516 * @retval None
5517 */
LL_RTC_EnableIT_ITAMP8(const RTC_TypeDef * RTCx)5518 __STATIC_INLINE void LL_RTC_EnableIT_ITAMP8(const RTC_TypeDef *RTCx)
5519 {
5520 UNUSED(RTCx);
5521 SET_BIT(TAMP->IER, TAMP_IER_ITAMP8IE);
5522 }
5523
5524 /**
5525 * @brief Disable internal tamper 8 interrupt.
5526 * @rmtoll TAMP_IER ITAMP8IE LL_RTC_DisableIT_ITAMP8
5527 * @param RTCx RTC Instance
5528 * @retval None
5529 */
LL_RTC_DisableIT_ITAMP8(const RTC_TypeDef * RTCx)5530 __STATIC_INLINE void LL_RTC_DisableIT_ITAMP8(const RTC_TypeDef *RTCx)
5531 {
5532 UNUSED(RTCx);
5533 CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP8IE);
5534 }
5535
5536 /**
5537 * @brief Enable internal tamper 9 interrupt.
5538 * @rmtoll TAMP_IER ITAMP9IE LL_RTC_EnableIT_ITAMP9
5539 * @param RTCx RTC Instance
5540 * @retval None
5541 */
LL_RTC_EnableIT_ITAMP9(const RTC_TypeDef * RTCx)5542 __STATIC_INLINE void LL_RTC_EnableIT_ITAMP9(const RTC_TypeDef *RTCx)
5543 {
5544 UNUSED(RTCx);
5545 SET_BIT(TAMP->IER, TAMP_IER_ITAMP9IE);
5546 }
5547
5548 /**
5549 * @brief Disable internal tamper 9 interrupt.
5550 * @rmtoll TAMP_IER ITAMP9IE LL_RTC_DisableIT_ITAMP9
5551 * @param RTCx RTC Instance
5552 * @retval None
5553 */
LL_RTC_DisableIT_ITAMP9(const RTC_TypeDef * RTCx)5554 __STATIC_INLINE void LL_RTC_DisableIT_ITAMP9(const RTC_TypeDef *RTCx)
5555 {
5556 UNUSED(RTCx);
5557 CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP9IE);
5558 }
5559
5560 /**
5561 * @brief Enable internal tamper 11 interrupt.
5562 * @rmtoll TAMP_IER ITAMP11IE LL_RTC_EnableIT_ITAMP11
5563 * @param RTCx RTC Instance
5564 * @retval None
5565 */
LL_RTC_EnableIT_ITAMP11(const RTC_TypeDef * RTCx)5566 __STATIC_INLINE void LL_RTC_EnableIT_ITAMP11(const RTC_TypeDef *RTCx)
5567 {
5568 UNUSED(RTCx);
5569 SET_BIT(TAMP->IER, TAMP_IER_ITAMP11IE);
5570 }
5571
5572 /**
5573 * @brief Disable internal tamper 11 interrupt.
5574 * @rmtoll TAMP_IER ITAMP11IE LL_RTC_DisableIT_ITAMP11
5575 * @param RTCx RTC Instance
5576 * @retval None
5577 */
LL_RTC_DisableIT_ITAMP11(const RTC_TypeDef * RTCx)5578 __STATIC_INLINE void LL_RTC_DisableIT_ITAMP11(const RTC_TypeDef *RTCx)
5579 {
5580 UNUSED(RTCx);
5581 CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP11IE);
5582 }
5583
5584 /**
5585 * @brief Enable internal tamper 12 interrupt.
5586 * @rmtoll TAMP_IER ITAMP12IE LL_RTC_EnableIT_ITAMP12
5587 * @param RTCx RTC Instance
5588 * @retval None
5589 */
LL_RTC_EnableIT_ITAMP12(const RTC_TypeDef * RTCx)5590 __STATIC_INLINE void LL_RTC_EnableIT_ITAMP12(const RTC_TypeDef *RTCx)
5591 {
5592 UNUSED(RTCx);
5593 SET_BIT(TAMP->IER, TAMP_IER_ITAMP12IE);
5594 }
5595
5596 /**
5597 * @brief Disable internal tamper 12 interrupt.
5598 * @rmtoll TAMP_IER ITAMP12IE LL_RTC_DisableIT_ITAMP12
5599 * @param RTCx RTC Instance
5600 * @retval None
5601 */
LL_RTC_DisableIT_ITAMP12(const RTC_TypeDef * RTCx)5602 __STATIC_INLINE void LL_RTC_DisableIT_ITAMP12(const RTC_TypeDef *RTCx)
5603 {
5604 UNUSED(RTCx);
5605 CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP12IE);
5606 }
5607
5608 /**
5609 * @brief Enable internal tamper 13 interrupt.
5610 * @rmtoll TAMP_IER ITAMP13IE LL_RTC_EnableIT_ITAMP13
5611 * @param RTCx RTC Instance
5612 * @retval None
5613 */
LL_RTC_EnableIT_ITAMP13(const RTC_TypeDef * RTCx)5614 __STATIC_INLINE void LL_RTC_EnableIT_ITAMP13(const RTC_TypeDef *RTCx)
5615 {
5616 UNUSED(RTCx);
5617 SET_BIT(TAMP->IER, TAMP_IER_ITAMP13IE);
5618 }
5619
5620 /**
5621 * @brief Disable internal tamper 13 interrupt.
5622 * @rmtoll TAMP_IER ITAMP13IE LL_RTC_DisableIT_ITAMP13
5623 * @param RTCx RTC Instance
5624 * @retval None
5625 */
LL_RTC_DisableIT_ITAMP13(const RTC_TypeDef * RTCx)5626 __STATIC_INLINE void LL_RTC_DisableIT_ITAMP13(const RTC_TypeDef *RTCx)
5627 {
5628 UNUSED(RTCx);
5629 CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP13IE);
5630 }
5631
5632 /**
5633 * @brief Check if tamper 1 interrupt is enabled or not.
5634 * @rmtoll TAMP_IER TAMP1IE LL_RTC_IsEnabledIT_TAMP1
5635 * @param RTCx RTC Instance
5636 * @retval State of bit (1 or 0).
5637 */
LL_RTC_IsEnabledIT_TAMP1(const RTC_TypeDef * RTCx)5638 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP1(const RTC_TypeDef *RTCx)
5639 {
5640 UNUSED(RTCx);
5641 return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP1IE) == (TAMP_IER_TAMP1IE)) ? 1U : 0U);
5642 }
5643
5644 /**
5645 * @brief Check if tamper 2 interrupt is enabled or not.
5646 * @rmtoll TAMP_IER TAMP2IE LL_RTC_IsEnabledIT_TAMP2
5647 * @param RTCx RTC Instance
5648 * @retval State of bit (1 or 0).
5649 */
LL_RTC_IsEnabledIT_TAMP2(const RTC_TypeDef * RTCx)5650 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP2(const RTC_TypeDef *RTCx)
5651 {
5652 UNUSED(RTCx);
5653 return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP2IE) == (TAMP_IER_TAMP2IE)) ? 1U : 0U);
5654 }
5655
5656 /**
5657 * @brief Check if tamper 3 interrupt is enabled or not.
5658 * @rmtoll TAMP_IER TAMP3IE LL_RTC_IsEnabledIT_TAMP3
5659 * @param RTCx RTC Instance
5660 * @retval State of bit (1 or 0).
5661 */
LL_RTC_IsEnabledIT_TAMP3(const RTC_TypeDef * RTCx)5662 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP3(const RTC_TypeDef *RTCx)
5663 {
5664 UNUSED(RTCx);
5665 return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP3IE) == (TAMP_IER_TAMP3IE)) ? 1U : 0U);
5666 }
5667
5668 #ifdef TAMP_IER_TAMP4IE
5669 /**
5670 * @brief Check if tamper 4 interrupt is enabled or not.
5671 * @rmtoll TAMP_IER TAMP4IE LL_RTC_IsEnabledIT_TAMP4
5672 * @param RTCx RTC Instance
5673 * @retval State of bit (1 or 0).
5674 */
LL_RTC_IsEnabledIT_TAMP4(const RTC_TypeDef * RTCx)5675 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP4(const RTC_TypeDef *RTCx)
5676 {
5677 UNUSED(RTCx);
5678 return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP4IE) == (TAMP_IER_TAMP4IE)) ? 1U : 0U);
5679 }
5680
5681 /**
5682 * @brief Check if tamper 5 interrupt is enabled or not.
5683 * @rmtoll TAMP_IER TAMP5IE LL_RTC_IsEnabledIT_TAMP5
5684 * @param RTCx RTC Instance
5685 * @retval State of bit (1 or 0).
5686 */
LL_RTC_IsEnabledIT_TAMP5(const RTC_TypeDef * RTCx)5687 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP5(const RTC_TypeDef *RTCx)
5688 {
5689 UNUSED(RTCx);
5690 return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP5IE) == (TAMP_IER_TAMP5IE)) ? 1U : 0U);
5691 }
5692
5693 /**
5694 * @brief Check if tamper 6 interrupt is enabled or not.
5695 * @rmtoll TAMP_IER TAMP6IE LL_RTC_IsEnabledIT_TAMP6
5696 * @param RTCx RTC Instance
5697 * @retval State of bit (1 or 0).
5698 */
LL_RTC_IsEnabledIT_TAMP6(const RTC_TypeDef * RTCx)5699 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP6(const RTC_TypeDef *RTCx)
5700 {
5701 UNUSED(RTCx);
5702 return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP6IE) == (TAMP_IER_TAMP6IE)) ? 1U : 0U);
5703 }
5704 #endif /* TAMP_IER_TAMP4IE */
5705
5706 /**
5707 * @brief Check if internal tamper 3 interrupt is enabled or not.
5708 * @rmtoll TAMP_IER ITAMP3IE LL_RTC_IsEnabledIT_ITAMP3
5709 * @param RTCx RTC Instance
5710 * @retval State of bit (1 or 0).
5711 */
LL_RTC_IsEnabledIT_ITAMP3(const RTC_TypeDef * RTCx)5712 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP3(const RTC_TypeDef *RTCx)
5713 {
5714 UNUSED(RTCx);
5715 return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP3IE) == (TAMP_IER_ITAMP3IE)) ? 1U : 0U);
5716 }
5717
5718 /**
5719 * @brief Check if internal tamper 5 interrupt is enabled or not.
5720 * @rmtoll TAMP_IER ITAMP5IE LL_RTC_IsEnabledIT_ITAMP5
5721 * @param RTCx RTC Instance
5722 * @retval State of bit (1 or 0).
5723 */
LL_RTC_IsEnabledIT_ITAMP5(const RTC_TypeDef * RTCx)5724 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP5(const RTC_TypeDef *RTCx)
5725 {
5726 UNUSED(RTCx);
5727 return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP5IE) == (TAMP_IER_ITAMP5IE)) ? 1U : 0U);
5728 }
5729
5730 /**
5731 * @brief Check if internal tamper 6 interrupt is enabled or not.
5732 * @rmtoll TAMP_IER ITAMP6IE LL_RTC_IsEnabledIT_ITAMP6
5733 * @param RTCx RTC Instance
5734 * @retval State of bit (1 or 0).
5735 */
LL_RTC_IsEnabledIT_ITAMP6(const RTC_TypeDef * RTCx)5736 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP6(const RTC_TypeDef *RTCx)
5737 {
5738 UNUSED(RTCx);
5739 return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP6IE) == (TAMP_IER_ITAMP6IE)) ? 1U : 0U);
5740 }
5741
5742 /**
5743 * @brief Check if internal tamper 7 interrupt is enabled or not.
5744 * @rmtoll TAMP_IER ITAMP7IE LL_RTC_IsEnabledIT_ITAMP7
5745 * @param RTCx RTC Instance
5746 * @retval State of bit (1 or 0).
5747 */
LL_RTC_IsEnabledIT_ITAMP7(const RTC_TypeDef * RTCx)5748 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP7(const RTC_TypeDef *RTCx)
5749 {
5750 UNUSED(RTCx);
5751 return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP7IE) == (TAMP_IER_ITAMP7IE)) ? 1U : 0U);
5752 }
5753
5754 /**
5755 * @brief Check if internal tamper 8 interrupt is enabled or not.
5756 * @rmtoll TAMP_IER ITAMP8IE LL_RTC_IsEnabledIT_ITAMP8
5757 * @param RTCx RTC Instance
5758 * @retval State of bit (1 or 0).
5759 */
LL_RTC_IsEnabledIT_ITAMP8(const RTC_TypeDef * RTCx)5760 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP8(const RTC_TypeDef *RTCx)
5761 {
5762 UNUSED(RTCx);
5763 return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP8IE) == (TAMP_IER_ITAMP8IE)) ? 1U : 0U);
5764 }
5765
5766 /**
5767 * @brief Check if internal tamper 9 interrupt is enabled or not.
5768 * @rmtoll TAMP_IER ITAMP9IE LL_RTC_IsEnabledIT_ITAMP9
5769 * @param RTCx RTC Instance
5770 * @retval State of bit (1 or 0).
5771 */
LL_RTC_IsEnabledIT_ITAMP9(const RTC_TypeDef * RTCx)5772 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP9(const RTC_TypeDef *RTCx)
5773 {
5774 UNUSED(RTCx);
5775 return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP9IE) == (TAMP_IER_ITAMP9IE)) ? 1U : 0U);
5776 }
5777
5778 /**
5779 * @brief Check if internal tamper 11 interrupt is enabled or not.
5780 * @rmtoll TAMP_IER ITAMP11IE LL_RTC_IsEnabledIT_ITAMP11
5781 * @param RTCx RTC Instance
5782 * @retval State of bit (1 or 0).
5783 */
LL_RTC_IsEnabledIT_ITAMP11(const RTC_TypeDef * RTCx)5784 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP11(const RTC_TypeDef *RTCx)
5785 {
5786 UNUSED(RTCx);
5787 return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP11IE) == (TAMP_IER_ITAMP11IE)) ? 1U : 0U);
5788 }
5789
5790 /**
5791 * @brief Check if internal tamper 12 interrupt is enabled or not.
5792 * @rmtoll TAMP_IER ITAMP12IE LL_RTC_IsEnabledIT_ITAMP12
5793 * @param RTCx RTC Instance
5794 * @retval State of bit (1 or 0).
5795 */
LL_RTC_IsEnabledIT_ITAMP12(const RTC_TypeDef * RTCx)5796 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP12(const RTC_TypeDef *RTCx)
5797 {
5798 UNUSED(RTCx);
5799 return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP12IE) == (TAMP_IER_ITAMP12IE)) ? 1U : 0U);
5800 }
5801
5802 /**
5803 * @brief Check if internal tamper 13 interrupt is enabled or not.
5804 * @rmtoll TAMP_IER ITAMP13IE LL_RTC_IsEnabledIT_ITAMP13
5805 * @param RTCx RTC Instance
5806 * @retval State of bit (1 or 0).
5807 */
LL_RTC_IsEnabledIT_ITAMP13(const RTC_TypeDef * RTCx)5808 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP13(const RTC_TypeDef *RTCx)
5809 {
5810 UNUSED(RTCx);
5811 return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP13IE) == (TAMP_IER_ITAMP13IE)) ? 1U : 0U);
5812 }
5813
5814 /**
5815 * @brief Increment Monotonic counter.
5816 * @rmtoll TAMP_COUNT1R COUNT LL_RTC_IncrementMonotonicCounter
5817 * @param RTCx RTC Instance
5818 * @retval None.
5819 */
LL_RTC_IncrementMonotonicCounter(const RTC_TypeDef * RTCx)5820 __STATIC_INLINE void LL_RTC_IncrementMonotonicCounter(const RTC_TypeDef *RTCx)
5821 {
5822 UNUSED(RTCx);
5823 WRITE_REG(TAMP->COUNT1R, 0U);
5824 }
5825
5826 /**
5827 * @brief Increment Monotonic counter.
5828 * @rmtoll TAMP_COUNT1R COUNT LL_RTC_GetMonotonicCounter
5829 * @param RTCx RTC Instance
5830 * @retval Monotonic counter value.
5831 */
LL_RTC_GetMonotonicCounter(const RTC_TypeDef * RTCx)5832 __STATIC_INLINE uint32_t LL_RTC_GetMonotonicCounter(const RTC_TypeDef *RTCx)
5833 {
5834 UNUSED(RTCx);
5835 return READ_REG(TAMP->COUNT1R);
5836 }
5837
5838 /**
5839 * @}
5840 */
5841
5842 #if defined(USE_FULL_LL_DRIVER)
5843 /** @defgroup RTC_LL_EF_Init Initialization and de-initialization functions
5844 * @{
5845 */
5846
5847 ErrorStatus LL_RTC_DeInit(RTC_TypeDef *RTCx);
5848 ErrorStatus LL_RTC_Init(RTC_TypeDef *RTCx, LL_RTC_InitTypeDef *RTC_InitStruct);
5849 void LL_RTC_StructInit(LL_RTC_InitTypeDef *RTC_InitStruct);
5850 ErrorStatus LL_RTC_TIME_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_TimeTypeDef *RTC_TimeStruct);
5851 void LL_RTC_TIME_StructInit(LL_RTC_TimeTypeDef *RTC_TimeStruct);
5852 ErrorStatus LL_RTC_DATE_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_DateTypeDef *RTC_DateStruct);
5853 void LL_RTC_DATE_StructInit(LL_RTC_DateTypeDef *RTC_DateStruct);
5854 ErrorStatus LL_RTC_ALMA_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
5855 ErrorStatus LL_RTC_ALMB_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
5856 void LL_RTC_ALMA_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
5857 void LL_RTC_ALMB_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
5858 ErrorStatus LL_RTC_EnterInitMode(RTC_TypeDef *RTCx);
5859 ErrorStatus LL_RTC_ExitInitMode(RTC_TypeDef *RTCx);
5860 ErrorStatus LL_RTC_WaitForSynchro(RTC_TypeDef *RTCx);
5861
5862 /**
5863 * @}
5864 */
5865 #endif /* USE_FULL_LL_DRIVER */
5866
5867 /**
5868 * @}
5869 */
5870
5871 /**
5872 * @}
5873 */
5874
5875 #endif /* defined(RTC) */
5876
5877 /**
5878 * @}
5879 */
5880
5881 #ifdef __cplusplus
5882 }
5883 #endif
5884
5885 #endif /* STM32WBAxx_LL_RTC_H */
5886
5887