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