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