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