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