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