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