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