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