1 /**
2 ******************************************************************************
3 * @file stm32l0xx_ll_rtc.h
4 * @author MCD Application Team
5 * @brief Header file of RTC LL module.
6 ******************************************************************************
7 * @attention
8 *
9 * Copyright (c) 2016 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 STM32L0xx_LL_RTC_H
21 #define STM32L0xx_LL_RTC_H
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32l0xx.h"
29
30 /** @addtogroup STM32L0xx_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_INIT_MASK 0xFFFFFFFFU
48 #define RTC_RSF_MASK ((uint32_t)~(RTC_ISR_INIT | RTC_ISR_RSF))
49
50 /* Write protection defines */
51 #define RTC_WRITE_PROTECTION_DISABLE ((uint8_t)0xFFU)
52 #define RTC_WRITE_PROTECTION_ENABLE_1 ((uint8_t)0xCAU)
53 #define RTC_WRITE_PROTECTION_ENABLE_2 ((uint8_t)0x53U)
54
55 /* Defines used to combine date & time */
56 #define RTC_OFFSET_WEEKDAY 24U
57 #define RTC_OFFSET_DAY 16U
58 #define RTC_OFFSET_MONTH 8U
59 #define RTC_OFFSET_HOUR 16U
60 #define RTC_OFFSET_MINUTE 8U
61
62 /**
63 * @}
64 */
65
66 /* Private macros ------------------------------------------------------------*/
67 #if defined(USE_FULL_LL_DRIVER)
68 /** @defgroup RTC_LL_Private_Macros RTC Private Macros
69 * @{
70 */
71 /**
72 * @}
73 */
74 #endif /*USE_FULL_LL_DRIVER*/
75
76 /* Exported types ------------------------------------------------------------*/
77 #if defined(USE_FULL_LL_DRIVER)
78 /** @defgroup RTC_LL_ES_INIT RTC Exported Init structure
79 * @{
80 */
81
82 /**
83 * @brief RTC Init structures definition
84 */
85 typedef struct
86 {
87 uint32_t HourFormat; /*!< Specifies the RTC Hours Format.
88 This parameter can be a value of @ref RTC_LL_EC_HOURFORMAT
89
90 This feature can be modified afterwards using unitary function
91 @ref LL_RTC_SetHourFormat(). */
92
93 uint32_t AsynchPrescaler; /*!< Specifies the RTC Asynchronous Predivider value.
94 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F
95
96 This feature can be modified afterwards using unitary function
97 @ref LL_RTC_SetAsynchPrescaler(). */
98
99 uint32_t SynchPrescaler; /*!< Specifies the RTC Synchronous Predivider value.
100 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF
101
102 This feature can be modified afterwards using unitary function
103 @ref LL_RTC_SetSynchPrescaler(). */
104 } LL_RTC_InitTypeDef;
105
106 /**
107 * @brief RTC Time structure definition
108 */
109 typedef struct
110 {
111 uint32_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
112 This parameter can be a value of @ref RTC_LL_EC_TIME_FORMAT
113
114 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetFormat(). */
115
116 uint8_t Hours; /*!< Specifies the RTC Time Hours.
117 This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the @ref LL_RTC_TIME_FORMAT_PM is selected.
118 This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the @ref LL_RTC_TIME_FORMAT_AM_OR_24 is selected.
119
120 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetHour(). */
121
122 uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
123 This parameter must be a number between Min_Data = 0 and Max_Data = 59
124
125 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetMinute(). */
126
127 uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
128 This parameter must be a number between Min_Data = 0 and Max_Data = 59
129
130 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetSecond(). */
131 } LL_RTC_TimeTypeDef;
132
133 /**
134 * @brief RTC Date structure definition
135 */
136 typedef struct
137 {
138 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay.
139 This parameter can be a value of @ref RTC_LL_EC_WEEKDAY
140
141 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetWeekDay(). */
142
143 uint8_t Month; /*!< Specifies the RTC Date Month.
144 This parameter can be a value of @ref RTC_LL_EC_MONTH
145
146 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetMonth(). */
147
148 uint8_t Day; /*!< Specifies the RTC Date Day.
149 This parameter must be a number between Min_Data = 1 and Max_Data = 31
150
151 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetDay(). */
152
153 uint8_t Year; /*!< Specifies the RTC Date Year.
154 This parameter must be a number between Min_Data = 0 and Max_Data = 99
155
156 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetYear(). */
157 } LL_RTC_DateTypeDef;
158
159 /**
160 * @brief RTC Alarm structure definition
161 */
162 typedef struct
163 {
164 LL_RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members. */
165
166 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks.
167 This parameter can be a value of @ref RTC_LL_EC_ALMA_MASK for ALARM A or @ref RTC_LL_EC_ALMB_MASK for ALARM B.
168
169 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetMask() for ALARM A
170 or @ref LL_RTC_ALMB_SetMask() for ALARM B.
171 */
172
173 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on day or WeekDay.
174 This parameter can be a value of @ref RTC_LL_EC_ALMA_WEEKDAY_SELECTION for ALARM A or @ref RTC_LL_EC_ALMB_WEEKDAY_SELECTION for ALARM B
175
176 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_EnableWeekday() or @ref LL_RTC_ALMA_DisableWeekday()
177 for ALARM A or @ref LL_RTC_ALMB_EnableWeekday() or @ref LL_RTC_ALMB_DisableWeekday() for ALARM B
178 */
179
180 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Day/WeekDay.
181 If AlarmDateWeekDaySel set to day, this parameter must be a number between Min_Data = 1 and Max_Data = 31.
182
183 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetDay()
184 for ALARM A or @ref LL_RTC_ALMB_SetDay() for ALARM B.
185
186 If AlarmDateWeekDaySel set to Weekday, this parameter can be a value of @ref RTC_LL_EC_WEEKDAY.
187
188 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetWeekDay()
189 for ALARM A or @ref LL_RTC_ALMB_SetWeekDay() for ALARM B.
190 */
191 } LL_RTC_AlarmTypeDef;
192
193 /**
194 * @}
195 */
196 #endif /* USE_FULL_LL_DRIVER */
197
198 /* Exported constants --------------------------------------------------------*/
199 /** @defgroup RTC_LL_Exported_Constants RTC Exported Constants
200 * @{
201 */
202
203 #if defined(USE_FULL_LL_DRIVER)
204 /** @defgroup RTC_LL_EC_FORMAT FORMAT
205 * @{
206 */
207 #define LL_RTC_FORMAT_BIN 0x00000000U /*!< Binary data format */
208 #define LL_RTC_FORMAT_BCD 0x00000001U /*!< BCD data format */
209 /**
210 * @}
211 */
212
213 /** @defgroup RTC_LL_EC_ALMA_WEEKDAY_SELECTION RTC Alarm A Date WeekDay
214 * @{
215 */
216 #define LL_RTC_ALMA_DATEWEEKDAYSEL_DATE 0x00000000U /*!< Alarm A Date is selected */
217 #define LL_RTC_ALMA_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMAR_WDSEL /*!< Alarm A WeekDay is selected */
218 /**
219 * @}
220 */
221
222 /** @defgroup RTC_LL_EC_ALMB_WEEKDAY_SELECTION RTC Alarm B Date WeekDay
223 * @{
224 */
225 #define LL_RTC_ALMB_DATEWEEKDAYSEL_DATE 0x00000000U /*!< Alarm B Date is selected */
226 #define LL_RTC_ALMB_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMBR_WDSEL /*!< Alarm B WeekDay is selected */
227 /**
228 * @}
229 */
230
231 #endif /* USE_FULL_LL_DRIVER */
232
233 /** @defgroup RTC_LL_EC_GET_FLAG Get Flags Defines
234 * @brief Flags defines which can be used with LL_RTC_ReadReg function
235 * @{
236 */
237 #define LL_RTC_ISR_RECALPF RTC_ISR_RECALPF
238 #if defined(RTC_TAMPER3_SUPPORT)
239 #define LL_RTC_ISR_TAMP3F RTC_ISR_TAMP3F
240 #endif /* RTC_TAMPER3_SUPPORT */
241 #define LL_RTC_ISR_TAMP2F RTC_ISR_TAMP2F
242 #if defined(RTC_TAMPER1_SUPPORT)
243 #define LL_RTC_ISR_TAMP1F RTC_ISR_TAMP1F
244 #endif /* RTC_TAMPER1_SUPPORT */
245 #define LL_RTC_ISR_TSOVF RTC_ISR_TSOVF
246 #define LL_RTC_ISR_TSF RTC_ISR_TSF
247 #define LL_RTC_ISR_WUTF RTC_ISR_WUTF
248 #define LL_RTC_ISR_ALRBF RTC_ISR_ALRBF
249 #define LL_RTC_ISR_ALRAF RTC_ISR_ALRAF
250 #define LL_RTC_ISR_INITF RTC_ISR_INITF
251 #define LL_RTC_ISR_RSF RTC_ISR_RSF
252 #define LL_RTC_ISR_INITS RTC_ISR_INITS
253 #define LL_RTC_ISR_SHPF RTC_ISR_SHPF
254 #define LL_RTC_ISR_WUTWF RTC_ISR_WUTWF
255 #define LL_RTC_ISR_ALRBWF RTC_ISR_ALRBWF
256 #define LL_RTC_ISR_ALRAWF RTC_ISR_ALRAWF
257 /**
258 * @}
259 */
260
261 /** @defgroup RTC_LL_EC_IT IT Defines
262 * @brief IT defines which can be used with LL_RTC_ReadReg and LL_RTC_WriteReg functions
263 * @{
264 */
265 #define LL_RTC_CR_TSIE RTC_CR_TSIE
266 #define LL_RTC_CR_WUTIE RTC_CR_WUTIE
267 #define LL_RTC_CR_ALRBIE RTC_CR_ALRBIE
268 #define LL_RTC_CR_ALRAIE RTC_CR_ALRAIE
269 #if defined(RTC_TAMPER3_SUPPORT)
270 #define LL_RTC_TAMPCR_TAMP3IE RTC_TAMPCR_TAMP3IE
271 #endif /* RTC_TAMPER3_SUPPORT */
272 #define LL_RTC_TAMPCR_TAMP2IE RTC_TAMPCR_TAMP2IE
273 #if defined(RTC_TAMPER1_SUPPORT)
274 #define LL_RTC_TAMPCR_TAMP1IE RTC_TAMPCR_TAMP1IE
275 #endif /* RTC_TAMPER1_SUPPORT */
276 #define LL_RTC_TAMPCR_TAMPIE RTC_TAMPCR_TAMPIE
277 /**
278 * @}
279 */
280
281 /** @defgroup RTC_LL_EC_WEEKDAY WEEK DAY
282 * @{
283 */
284 #define LL_RTC_WEEKDAY_MONDAY ((uint8_t)0x01U) /*!< Monday */
285 #define LL_RTC_WEEKDAY_TUESDAY ((uint8_t)0x02U) /*!< Tuesday */
286 #define LL_RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03U) /*!< Wednesday */
287 #define LL_RTC_WEEKDAY_THURSDAY ((uint8_t)0x04U) /*!< Thrusday */
288 #define LL_RTC_WEEKDAY_FRIDAY ((uint8_t)0x05U) /*!< Friday */
289 #define LL_RTC_WEEKDAY_SATURDAY ((uint8_t)0x06U) /*!< Saturday */
290 #define LL_RTC_WEEKDAY_SUNDAY ((uint8_t)0x07U) /*!< Sunday */
291 /**
292 * @}
293 */
294
295 /** @defgroup RTC_LL_EC_MONTH MONTH
296 * @{
297 */
298 #define LL_RTC_MONTH_JANUARY ((uint8_t)0x01U) /*!< January */
299 #define LL_RTC_MONTH_FEBRUARY ((uint8_t)0x02U) /*!< February */
300 #define LL_RTC_MONTH_MARCH ((uint8_t)0x03U) /*!< March */
301 #define LL_RTC_MONTH_APRIL ((uint8_t)0x04U) /*!< April */
302 #define LL_RTC_MONTH_MAY ((uint8_t)0x05U) /*!< May */
303 #define LL_RTC_MONTH_JUNE ((uint8_t)0x06U) /*!< June */
304 #define LL_RTC_MONTH_JULY ((uint8_t)0x07U) /*!< July */
305 #define LL_RTC_MONTH_AUGUST ((uint8_t)0x08U) /*!< August */
306 #define LL_RTC_MONTH_SEPTEMBER ((uint8_t)0x09U) /*!< September */
307 #define LL_RTC_MONTH_OCTOBER ((uint8_t)0x10U) /*!< October */
308 #define LL_RTC_MONTH_NOVEMBER ((uint8_t)0x11U) /*!< November */
309 #define LL_RTC_MONTH_DECEMBER ((uint8_t)0x12U) /*!< December */
310 /**
311 * @}
312 */
313
314 /** @defgroup RTC_LL_EC_HOURFORMAT HOUR FORMAT
315 * @{
316 */
317 #define LL_RTC_HOURFORMAT_24HOUR 0x00000000U /*!< 24 hour/day format */
318 #define LL_RTC_HOURFORMAT_AMPM RTC_CR_FMT /*!< AM/PM hour format */
319 /**
320 * @}
321 */
322
323 /** @defgroup RTC_LL_EC_ALARMOUT ALARM OUTPUT
324 * @{
325 */
326 #define LL_RTC_ALARMOUT_DISABLE 0x00000000U /*!< Output disabled */
327 #define LL_RTC_ALARMOUT_ALMA RTC_CR_OSEL_0 /*!< Alarm A output enabled */
328 #define LL_RTC_ALARMOUT_ALMB RTC_CR_OSEL_1 /*!< Alarm B output enabled */
329 #define LL_RTC_ALARMOUT_WAKEUP RTC_CR_OSEL /*!< Wakeup output enabled */
330 /**
331 * @}
332 */
333
334 /** @defgroup RTC_LL_EC_ALARM_OUTPUTTYPE ALARM OUTPUT TYPE
335 * @{
336 */
337 #define LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN 0x00000000U /*!< RTC_ALARM, when mapped on PC13, is open-drain output */
338 #define LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL RTC_OR_ALARMOUTTYPE /*!< RTC_ALARM, when mapped on PC13, is push-pull output */
339 /**
340 * @}
341 */
342
343 /** @defgroup RTC_LL_EC_OUTPUTPOLARITY_PIN OUTPUT POLARITY PIN
344 * @{
345 */
346 #define LL_RTC_OUTPUTPOLARITY_PIN_HIGH 0x00000000U /*!< Pin is high when ALRAF/ALRBF/WUTF is asserted (depending on OSEL)*/
347 #define LL_RTC_OUTPUTPOLARITY_PIN_LOW RTC_CR_POL /*!< Pin is low when ALRAF/ALRBF/WUTF is asserted (depending on OSEL) */
348 /**
349 * @}
350 */
351
352 /** @defgroup RTC_LL_EC_TIME_FORMAT TIME FORMAT
353 * @{
354 */
355 #define LL_RTC_TIME_FORMAT_AM_OR_24 0x00000000U /*!< AM or 24-hour format */
356 #define LL_RTC_TIME_FORMAT_PM RTC_TR_PM /*!< PM */
357 /**
358 * @}
359 */
360
361 /** @defgroup RTC_LL_EC_SHIFT_SECOND SHIFT SECOND
362 * @{
363 */
364 #define LL_RTC_SHIFT_SECOND_DELAY 0x00000000U /* Delay (seconds) = SUBFS / (PREDIV_S + 1) */
365 #define LL_RTC_SHIFT_SECOND_ADVANCE RTC_SHIFTR_ADD1S /* Advance (seconds) = (1 - (SUBFS / (PREDIV_S + 1))) */
366 /**
367 * @}
368 */
369
370 /** @defgroup RTC_LL_EC_ALMA_MASK ALARMA MASK
371 * @{
372 */
373 #define LL_RTC_ALMA_MASK_NONE 0x00000000U /*!< No masks applied on Alarm A*/
374 #define LL_RTC_ALMA_MASK_DATEWEEKDAY RTC_ALRMAR_MSK4 /*!< Date/day do not care in Alarm A comparison */
375 #define LL_RTC_ALMA_MASK_HOURS RTC_ALRMAR_MSK3 /*!< Hours do not care in Alarm A comparison */
376 #define LL_RTC_ALMA_MASK_MINUTES RTC_ALRMAR_MSK2 /*!< Minutes do not care in Alarm A comparison */
377 #define LL_RTC_ALMA_MASK_SECONDS RTC_ALRMAR_MSK1 /*!< Seconds do not care in Alarm A comparison */
378 #define LL_RTC_ALMA_MASK_ALL (RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1) /*!< Masks all */
379 /**
380 * @}
381 */
382
383 /** @defgroup RTC_LL_EC_ALMA_TIME_FORMAT ALARMA TIME FORMAT
384 * @{
385 */
386 #define LL_RTC_ALMA_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */
387 #define LL_RTC_ALMA_TIME_FORMAT_PM RTC_ALRMAR_PM /*!< PM */
388 /**
389 * @}
390 */
391
392 /** @defgroup RTC_LL_EC_ALMB_MASK ALARMB MASK
393 * @{
394 */
395 #define LL_RTC_ALMB_MASK_NONE 0x00000000U /*!< No masks applied on Alarm B */
396 #define LL_RTC_ALMB_MASK_DATEWEEKDAY RTC_ALRMBR_MSK4 /*!< Date/day do not care in Alarm B comparison */
397 #define LL_RTC_ALMB_MASK_HOURS RTC_ALRMBR_MSK3 /*!< Hours do not care in Alarm B comparison */
398 #define LL_RTC_ALMB_MASK_MINUTES RTC_ALRMBR_MSK2 /*!< Minutes do not care in Alarm B comparison */
399 #define LL_RTC_ALMB_MASK_SECONDS RTC_ALRMBR_MSK1 /*!< Seconds do not care in Alarm B comparison */
400 #define LL_RTC_ALMB_MASK_ALL (RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1) /*!< Masks all */
401 /**
402 * @}
403 */
404
405 /** @defgroup RTC_LL_EC_ALMB_TIME_FORMAT ALARMB TIME FORMAT
406 * @{
407 */
408 #define LL_RTC_ALMB_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */
409 #define LL_RTC_ALMB_TIME_FORMAT_PM RTC_ALRMBR_PM /*!< PM */
410 /**
411 * @}
412 */
413
414 /** @defgroup RTC_LL_EC_TIMESTAMP_EDGE TIMESTAMP EDGE
415 * @{
416 */
417 #define LL_RTC_TIMESTAMP_EDGE_RISING 0x00000000U /*!< RTC_TS input rising edge generates a time-stamp event */
418 #define LL_RTC_TIMESTAMP_EDGE_FALLING RTC_CR_TSEDGE /*!< RTC_TS input falling edge generates a time-stamp even */
419 /**
420 * @}
421 */
422
423 /** @defgroup RTC_LL_EC_TS_TIME_FORMAT TIMESTAMP TIME FORMAT
424 * @{
425 */
426 #define LL_RTC_TS_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */
427 #define LL_RTC_TS_TIME_FORMAT_PM RTC_TSTR_PM /*!< PM */
428 /**
429 * @}
430 */
431
432 /** @defgroup RTC_LL_EC_TAMPER TAMPER
433 * @{
434 */
435 #if defined(RTC_TAMPER1_SUPPORT)
436 #define LL_RTC_TAMPER_1 RTC_TAMPCR_TAMP1E /*!< RTC_TAMP1 input detection */
437 #endif /* RTC_TAMPER1_SUPPORT */
438 #define LL_RTC_TAMPER_2 RTC_TAMPCR_TAMP2E /*!< RTC_TAMP2 input detection */
439 #if defined(RTC_TAMPER3_SUPPORT)
440 #define LL_RTC_TAMPER_3 RTC_TAMPCR_TAMP3E /*!< RTC_TAMP3 input detection */
441 #endif /* RTC_TAMPER3_SUPPORT */
442 /**
443 * @}
444 */
445
446 /** @defgroup RTC_LL_EC_TAMPER_MASK TAMPER MASK
447 * @{
448 */
449 #if defined(RTC_TAMPER1_SUPPORT)
450 #define LL_RTC_TAMPER_MASK_TAMPER1 RTC_TAMPCR_TAMP1MF /*!< Tamper 1 event generates a trigger event. TAMP1F is masked and internally cleared by hardware.The backup registers are not erased */
451 #endif /* RTC_TAMPER1_SUPPORT */
452 #define LL_RTC_TAMPER_MASK_TAMPER2 RTC_TAMPCR_TAMP2MF /*!< Tamper 2 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */
453 #if defined(RTC_TAMPER3_SUPPORT)
454 #define LL_RTC_TAMPER_MASK_TAMPER3 RTC_TAMPCR_TAMP3MF /*!< Tamper 3 event generates a trigger event. TAMP3F is masked and internally cleared by hardware. The backup registers are not erased */
455 #endif /* RTC_TAMPER3_SUPPORT */
456 /**
457 * @}
458 */
459
460 /** @defgroup RTC_LL_EC_TAMPER_NOERASE TAMPER NO ERASE
461 * @{
462 */
463 #if defined(RTC_TAMPER1_SUPPORT)
464 #define LL_RTC_TAMPER_NOERASE_TAMPER1 RTC_TAMPCR_TAMP1NOERASE /*!< Tamper 1 event does not erase the backup registers. */
465 #endif /* RTC_TAMPER1_SUPPORT */
466 #define LL_RTC_TAMPER_NOERASE_TAMPER2 RTC_TAMPCR_TAMP2NOERASE /*!< Tamper 2 event does not erase the backup registers. */
467 #if defined(RTC_TAMPER3_SUPPORT)
468 #define LL_RTC_TAMPER_NOERASE_TAMPER3 RTC_TAMPCR_TAMP3NOERASE /*!< Tamper 3 event does not erase the backup registers. */
469 #endif /* RTC_TAMPER3_SUPPORT */
470 /**
471 * @}
472 */
473
474 /** @defgroup RTC_LL_EC_TAMPER_DURATION TAMPER DURATION
475 * @{
476 */
477 #define LL_RTC_TAMPER_DURATION_1RTCCLK 0x00000000U /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle */
478 #define LL_RTC_TAMPER_DURATION_2RTCCLK RTC_TAMPCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */
479 #define LL_RTC_TAMPER_DURATION_4RTCCLK RTC_TAMPCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */
480 #define LL_RTC_TAMPER_DURATION_8RTCCLK RTC_TAMPCR_TAMPPRCH /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */
481 /**
482 * @}
483 */
484
485 /** @defgroup RTC_LL_EC_TAMPER_FILTER TAMPER FILTER
486 * @{
487 */
488 #define LL_RTC_TAMPER_FILTER_DISABLE 0x00000000U /*!< Tamper filter is disabled */
489 #define LL_RTC_TAMPER_FILTER_2SAMPLE RTC_TAMPCR_TAMPFLT_0 /*!< Tamper is activated after 2 consecutive samples at the active level */
490 #define LL_RTC_TAMPER_FILTER_4SAMPLE RTC_TAMPCR_TAMPFLT_1 /*!< Tamper is activated after 4 consecutive samples at the active level */
491 #define LL_RTC_TAMPER_FILTER_8SAMPLE RTC_TAMPCR_TAMPFLT /*!< Tamper is activated after 8 consecutive samples at the active level. */
492 /**
493 * @}
494 */
495
496 /** @defgroup RTC_LL_EC_TAMPER_SAMPLFREQDIV TAMPER SAMPLING FREQUENCY DIVIDER
497 * @{
498 */
499 #define LL_RTC_TAMPER_SAMPLFREQDIV_32768 0x00000000U /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 32768 */
500 #define LL_RTC_TAMPER_SAMPLFREQDIV_16384 RTC_TAMPCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 16384 */
501 #define LL_RTC_TAMPER_SAMPLFREQDIV_8192 RTC_TAMPCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 8192 */
502 #define LL_RTC_TAMPER_SAMPLFREQDIV_4096 (RTC_TAMPCR_TAMPFREQ_1 | RTC_TAMPCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 4096 */
503 #define LL_RTC_TAMPER_SAMPLFREQDIV_2048 RTC_TAMPCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 2048 */
504 #define LL_RTC_TAMPER_SAMPLFREQDIV_1024 (RTC_TAMPCR_TAMPFREQ_2 | RTC_TAMPCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 1024 */
505 #define LL_RTC_TAMPER_SAMPLFREQDIV_512 (RTC_TAMPCR_TAMPFREQ_2 | RTC_TAMPCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 512 */
506 #define LL_RTC_TAMPER_SAMPLFREQDIV_256 RTC_TAMPCR_TAMPFREQ /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 256 */
507 /**
508 * @}
509 */
510
511 /** @defgroup RTC_LL_EC_TAMPER_ACTIVELEVEL TAMPER ACTIVE LEVEL
512 * @{
513 */
514 #if defined(RTC_TAMPER1_SUPPORT)
515 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 RTC_TAMPCR_TAMP1TRG /*!< RTC_TAMP1 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
516 #endif /* RTC_TAMPER1_SUPPORT */
517 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 RTC_TAMPCR_TAMP2TRG /*!< RTC_TAMP2 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
518 #if defined(RTC_TAMPER3_SUPPORT)
519 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 RTC_TAMPCR_TAMP3TRG /*!< RTC_TAMP3 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
520 #endif /* RTC_TAMPER3_SUPPORT */
521 /**
522 * @}
523 */
524
525 /** @defgroup RTC_LL_EC_WAKEUPCLOCK_DIV WAKEUP CLOCK DIV
526 * @{
527 */
528 #define LL_RTC_WAKEUPCLOCK_DIV_16 0x00000000U /*!< RTC/16 clock is selected */
529 #define LL_RTC_WAKEUPCLOCK_DIV_8 (RTC_CR_WUCKSEL_0) /*!< RTC/8 clock is selected */
530 #define LL_RTC_WAKEUPCLOCK_DIV_4 (RTC_CR_WUCKSEL_1) /*!< RTC/4 clock is selected */
531 #define LL_RTC_WAKEUPCLOCK_DIV_2 (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_0) /*!< RTC/2 clock is selected */
532 #define LL_RTC_WAKEUPCLOCK_CKSPRE (RTC_CR_WUCKSEL_2) /*!< ck_spre (usually 1 Hz) clock is selected */
533 #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*/
534 /**
535 * @}
536 */
537
538 /** @defgroup RTC_LL_EC_BKP BACKUP
539 * @{
540 */
541 #define LL_RTC_BKP_DR0 0x00000000U
542 #define LL_RTC_BKP_DR1 0x00000001U
543 #define LL_RTC_BKP_DR2 0x00000002U
544 #define LL_RTC_BKP_DR3 0x00000003U
545 #define LL_RTC_BKP_DR4 0x00000004U
546 /**
547 * @}
548 */
549
550 /** @defgroup RTC_LL_EC_CALIB_OUTPUT Calibration output
551 * @{
552 */
553 #define LL_RTC_CALIB_OUTPUT_NONE 0x00000000U /*!< Calibration output disabled */
554 #define LL_RTC_CALIB_OUTPUT_1HZ (RTC_CR_COE | RTC_CR_COSEL) /*!< Calibration output is 1 Hz */
555 #define LL_RTC_CALIB_OUTPUT_512HZ (RTC_CR_COE) /*!< Calibration output is 512 Hz */
556 /**
557 * @}
558 */
559
560 /** @defgroup RTC_LL_EC_CALIB_INSERTPULSE Calibration pulse insertion
561 * @{
562 */
563 #define LL_RTC_CALIB_INSERTPULSE_NONE 0x00000000U /*!< No RTCCLK pulses are added */
564 #define LL_RTC_CALIB_INSERTPULSE_SET RTC_CALR_CALP /*!< One RTCCLK pulse is effectively inserted every 2exp11 pulses (frequency increased by 488.5 ppm) */
565 /**
566 * @}
567 */
568
569 /** @defgroup RTC_LL_EC_CALIB_PERIOD Calibration period
570 * @{
571 */
572 #define LL_RTC_CALIB_PERIOD_32SEC 0x00000000U /*!< Use a 32-second calibration cycle period */
573 #define LL_RTC_CALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< Use a 16-second calibration cycle period */
574 #define LL_RTC_CALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< Use a 8-second calibration cycle period */
575 /**
576 * @}
577 */
578
579 /**
580 * @}
581 */
582
583 /* Exported macro ------------------------------------------------------------*/
584 /** @defgroup RTC_LL_Exported_Macros RTC Exported Macros
585 * @{
586 */
587
588 /** @defgroup RTC_LL_EM_WRITE_READ Common Write and read registers Macros
589 * @{
590 */
591
592 /**
593 * @brief Write a value in RTC register
594 * @param __INSTANCE__ RTC Instance
595 * @param __REG__ Register to be written
596 * @param __VALUE__ Value to be written in the register
597 * @retval None
598 */
599 #define LL_RTC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
600
601 /**
602 * @brief Read a value in RTC register
603 * @param __INSTANCE__ RTC Instance
604 * @param __REG__ Register to be read
605 * @retval Register value
606 */
607 #define LL_RTC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
608 /**
609 * @}
610 */
611
612 /** @defgroup RTC_LL_EM_Convert Convert helper Macros
613 * @{
614 */
615
616 /**
617 * @brief Helper macro to convert a value from 2 digit decimal format to BCD format
618 * @param __VALUE__ Byte to be converted
619 * @retval Converted byte
620 */
621 #define __LL_RTC_CONVERT_BIN2BCD(__VALUE__) (uint8_t)((((__VALUE__) / 10U) << 4U) | ((__VALUE__) % 10U))
622
623 /**
624 * @brief Helper macro to convert a value from BCD format to 2 digit decimal format
625 * @param __VALUE__ BCD value to be converted
626 * @retval Converted byte
627 */
628 #define __LL_RTC_CONVERT_BCD2BIN(__VALUE__) (uint8_t)(((uint8_t)((__VALUE__) & (uint8_t)0xF0U) >> (uint8_t)0x4U) * 10U + ((__VALUE__) & (uint8_t)0x0FU))
629
630 /**
631 * @}
632 */
633
634 /** @defgroup RTC_LL_EM_Date Date helper Macros
635 * @{
636 */
637
638 /**
639 * @brief Helper macro to retrieve weekday.
640 * @param __RTC_DATE__ Date returned by @ref LL_RTC_DATE_Get function.
641 * @retval Returned value can be one of the following values:
642 * @arg @ref LL_RTC_WEEKDAY_MONDAY
643 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
644 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
645 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
646 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
647 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
648 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
649 */
650 #define __LL_RTC_GET_WEEKDAY(__RTC_DATE__) (((__RTC_DATE__) >> RTC_OFFSET_WEEKDAY) & 0x000000FFU)
651
652 /**
653 * @brief Helper macro to retrieve Year in BCD format
654 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
655 * @retval Year in BCD format (0x00 . . . 0x99)
656 */
657 #define __LL_RTC_GET_YEAR(__RTC_DATE__) ((__RTC_DATE__) & 0x000000FFU)
658
659 /**
660 * @brief Helper macro to retrieve Month in BCD format
661 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
662 * @retval Returned value can be one of the following values:
663 * @arg @ref LL_RTC_MONTH_JANUARY
664 * @arg @ref LL_RTC_MONTH_FEBRUARY
665 * @arg @ref LL_RTC_MONTH_MARCH
666 * @arg @ref LL_RTC_MONTH_APRIL
667 * @arg @ref LL_RTC_MONTH_MAY
668 * @arg @ref LL_RTC_MONTH_JUNE
669 * @arg @ref LL_RTC_MONTH_JULY
670 * @arg @ref LL_RTC_MONTH_AUGUST
671 * @arg @ref LL_RTC_MONTH_SEPTEMBER
672 * @arg @ref LL_RTC_MONTH_OCTOBER
673 * @arg @ref LL_RTC_MONTH_NOVEMBER
674 * @arg @ref LL_RTC_MONTH_DECEMBER
675 */
676 #define __LL_RTC_GET_MONTH(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_MONTH) & 0x000000FFU)
677
678 /**
679 * @brief Helper macro to retrieve Day in BCD format
680 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
681 * @retval Day in BCD format (0x01 . . . 0x31)
682 */
683 #define __LL_RTC_GET_DAY(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_DAY) & 0x000000FFU)
684
685 /**
686 * @}
687 */
688
689 /** @defgroup RTC_LL_EM_Time Time helper Macros
690 * @{
691 */
692
693 /**
694 * @brief Helper macro to retrieve hour in BCD format
695 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
696 * @retval Hours in BCD format (0x01. . .0x12 or between Min_Data=0x00 and Max_Data=0x23)
697 */
698 #define __LL_RTC_GET_HOUR(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_HOUR) & 0x000000FFU)
699
700 /**
701 * @brief Helper macro to retrieve minute in BCD format
702 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
703 * @retval Minutes in BCD format (0x00. . .0x59)
704 */
705 #define __LL_RTC_GET_MINUTE(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_MINUTE) & 0x000000FFU)
706
707 /**
708 * @brief Helper macro to retrieve second in BCD format
709 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
710 * @retval Seconds in format (0x00. . .0x59)
711 */
712 #define __LL_RTC_GET_SECOND(__RTC_TIME__) ((__RTC_TIME__) & 0x000000FFU)
713
714 /**
715 * @}
716 */
717
718 /**
719 * @}
720 */
721
722 /* Exported functions --------------------------------------------------------*/
723 /** @defgroup RTC_LL_Exported_Functions RTC Exported Functions
724 * @{
725 */
726
727 /** @defgroup RTC_LL_EF_Configuration Configuration
728 * @{
729 */
730
731 /**
732 * @brief Set Hours format (24 hour/day or AM/PM hour format)
733 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
734 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
735 * @rmtoll CR FMT LL_RTC_SetHourFormat
736 * @param RTCx RTC Instance
737 * @param HourFormat This parameter can be one of the following values:
738 * @arg @ref LL_RTC_HOURFORMAT_24HOUR
739 * @arg @ref LL_RTC_HOURFORMAT_AMPM
740 * @retval None
741 */
LL_RTC_SetHourFormat(RTC_TypeDef * RTCx,uint32_t HourFormat)742 __STATIC_INLINE void LL_RTC_SetHourFormat(RTC_TypeDef *RTCx, uint32_t HourFormat)
743 {
744 MODIFY_REG(RTCx->CR, RTC_CR_FMT, HourFormat);
745 }
746
747 /**
748 * @brief Get Hours format (24 hour/day or AM/PM hour format)
749 * @rmtoll CR FMT LL_RTC_GetHourFormat
750 * @param RTCx RTC Instance
751 * @retval Returned value can be one of the following values:
752 * @arg @ref LL_RTC_HOURFORMAT_24HOUR
753 * @arg @ref LL_RTC_HOURFORMAT_AMPM
754 */
LL_RTC_GetHourFormat(RTC_TypeDef * RTCx)755 __STATIC_INLINE uint32_t LL_RTC_GetHourFormat(RTC_TypeDef *RTCx)
756 {
757 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_FMT));
758 }
759
760 /**
761 * @brief Select the flag to be routed to RTC_ALARM output
762 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
763 * @rmtoll CR OSEL LL_RTC_SetAlarmOutEvent
764 * @param RTCx RTC Instance
765 * @param AlarmOutput This parameter can be one of the following values:
766 * @arg @ref LL_RTC_ALARMOUT_DISABLE
767 * @arg @ref LL_RTC_ALARMOUT_ALMA
768 * @arg @ref LL_RTC_ALARMOUT_ALMB
769 * @arg @ref LL_RTC_ALARMOUT_WAKEUP
770 * @retval None
771 */
LL_RTC_SetAlarmOutEvent(RTC_TypeDef * RTCx,uint32_t AlarmOutput)772 __STATIC_INLINE void LL_RTC_SetAlarmOutEvent(RTC_TypeDef *RTCx, uint32_t AlarmOutput)
773 {
774 MODIFY_REG(RTCx->CR, RTC_CR_OSEL, AlarmOutput);
775 }
776
777 /**
778 * @brief Get the flag to be routed to RTC_ALARM output
779 * @rmtoll CR OSEL LL_RTC_GetAlarmOutEvent
780 * @param RTCx RTC Instance
781 * @retval Returned value can be one of the following values:
782 * @arg @ref LL_RTC_ALARMOUT_DISABLE
783 * @arg @ref LL_RTC_ALARMOUT_ALMA
784 * @arg @ref LL_RTC_ALARMOUT_ALMB
785 * @arg @ref LL_RTC_ALARMOUT_WAKEUP
786 */
LL_RTC_GetAlarmOutEvent(RTC_TypeDef * RTCx)787 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutEvent(RTC_TypeDef *RTCx)
788 {
789 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_OSEL));
790 }
791
792 /**
793 * @brief Set RTC_ALARM output type (ALARM in push-pull or open-drain output)
794 * @note Used only when RTC_ALARM is mapped on PC13
795 * @rmtoll OR ALARMOUTTYPE LL_RTC_SetAlarmOutputType
796 * @param RTCx RTC Instance
797 * @param Output This parameter can be one of the following values:
798 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
799 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
800 * @retval None
801 */
LL_RTC_SetAlarmOutputType(RTC_TypeDef * RTCx,uint32_t Output)802 __STATIC_INLINE void LL_RTC_SetAlarmOutputType(RTC_TypeDef *RTCx, uint32_t Output)
803 {
804 MODIFY_REG(RTCx->OR, RTC_OR_ALARMOUTTYPE, Output);
805 }
806
807 /**
808 * @brief Get RTC_ALARM output type (ALARM in push-pull or open-drain output)
809 * @note used only when RTC_ALARM is mapped on PC13
810 * @rmtoll OR ALARMOUTTYPE LL_RTC_GetAlarmOutputType
811 * @param RTCx RTC Instance
812 * @retval Returned value can be one of the following values:
813 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
814 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
815 */
LL_RTC_GetAlarmOutputType(RTC_TypeDef * RTCx)816 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutputType(RTC_TypeDef *RTCx)
817 {
818 return (uint32_t)(READ_BIT(RTCx->OR, RTC_OR_ALARMOUTTYPE));
819 }
820
821 /**
822 * @brief Enable initialization mode
823 * @note Initialization mode is used to program time and date register (RTC_TR and RTC_DR)
824 * and prescaler register (RTC_PRER).
825 * Counters are stopped and start counting from the new value when INIT is reset.
826 * @rmtoll ISR INIT LL_RTC_EnableInitMode
827 * @param RTCx RTC Instance
828 * @retval None
829 */
LL_RTC_EnableInitMode(RTC_TypeDef * RTCx)830 __STATIC_INLINE void LL_RTC_EnableInitMode(RTC_TypeDef *RTCx)
831 {
832 /* Set the Initialization mode */
833 WRITE_REG(RTCx->ISR, RTC_INIT_MASK);
834 }
835
836 /**
837 * @brief Disable initialization mode (Free running mode)
838 * @rmtoll ISR INIT LL_RTC_DisableInitMode
839 * @param RTCx RTC Instance
840 * @retval None
841 */
LL_RTC_DisableInitMode(RTC_TypeDef * RTCx)842 __STATIC_INLINE void LL_RTC_DisableInitMode(RTC_TypeDef *RTCx)
843 {
844 /* Exit Initialization mode */
845 WRITE_REG(RTCx->ISR, (uint32_t)~RTC_ISR_INIT);
846 }
847
848 /**
849 * @brief Set Output polarity (pin is low when ALRAF/ALRBF/WUTF is asserted)
850 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
851 * @rmtoll CR POL LL_RTC_SetOutputPolarity
852 * @param RTCx RTC Instance
853 * @param Polarity This parameter can be one of the following values:
854 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
855 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
856 * @retval None
857 */
LL_RTC_SetOutputPolarity(RTC_TypeDef * RTCx,uint32_t Polarity)858 __STATIC_INLINE void LL_RTC_SetOutputPolarity(RTC_TypeDef *RTCx, uint32_t Polarity)
859 {
860 MODIFY_REG(RTCx->CR, RTC_CR_POL, Polarity);
861 }
862
863 /**
864 * @brief Get Output polarity
865 * @rmtoll CR POL LL_RTC_GetOutputPolarity
866 * @param RTCx RTC Instance
867 * @retval Returned value can be one of the following values:
868 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
869 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
870 */
LL_RTC_GetOutputPolarity(RTC_TypeDef * RTCx)871 __STATIC_INLINE uint32_t LL_RTC_GetOutputPolarity(RTC_TypeDef *RTCx)
872 {
873 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_POL));
874 }
875
876 /**
877 * @brief Enable Bypass the shadow registers
878 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
879 * @rmtoll CR BYPSHAD LL_RTC_EnableShadowRegBypass
880 * @param RTCx RTC Instance
881 * @retval None
882 */
LL_RTC_EnableShadowRegBypass(RTC_TypeDef * RTCx)883 __STATIC_INLINE void LL_RTC_EnableShadowRegBypass(RTC_TypeDef *RTCx)
884 {
885 SET_BIT(RTCx->CR, RTC_CR_BYPSHAD);
886 }
887
888 /**
889 * @brief Disable Bypass the shadow registers
890 * @rmtoll CR BYPSHAD LL_RTC_DisableShadowRegBypass
891 * @param RTCx RTC Instance
892 * @retval None
893 */
LL_RTC_DisableShadowRegBypass(RTC_TypeDef * RTCx)894 __STATIC_INLINE void LL_RTC_DisableShadowRegBypass(RTC_TypeDef *RTCx)
895 {
896 CLEAR_BIT(RTCx->CR, RTC_CR_BYPSHAD);
897 }
898
899 /**
900 * @brief Check if Shadow registers bypass is enabled or not.
901 * @rmtoll CR BYPSHAD LL_RTC_IsShadowRegBypassEnabled
902 * @param RTCx RTC Instance
903 * @retval State of bit (1 or 0).
904 */
LL_RTC_IsShadowRegBypassEnabled(RTC_TypeDef * RTCx)905 __STATIC_INLINE uint32_t LL_RTC_IsShadowRegBypassEnabled(RTC_TypeDef *RTCx)
906 {
907 return ((READ_BIT(RTCx->CR, RTC_CR_BYPSHAD) == (RTC_CR_BYPSHAD)) ? 1UL : 0UL);
908 }
909
910 /**
911 * @brief Enable RTC_REFIN reference clock detection (50 or 60 Hz)
912 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
913 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
914 * @rmtoll CR REFCKON LL_RTC_EnableRefClock
915 * @param RTCx RTC Instance
916 * @retval None
917 */
LL_RTC_EnableRefClock(RTC_TypeDef * RTCx)918 __STATIC_INLINE void LL_RTC_EnableRefClock(RTC_TypeDef *RTCx)
919 {
920 SET_BIT(RTCx->CR, RTC_CR_REFCKON);
921 }
922
923 /**
924 * @brief Disable RTC_REFIN reference clock detection (50 or 60 Hz)
925 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
926 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
927 * @rmtoll CR REFCKON LL_RTC_DisableRefClock
928 * @param RTCx RTC Instance
929 * @retval None
930 */
LL_RTC_DisableRefClock(RTC_TypeDef * RTCx)931 __STATIC_INLINE void LL_RTC_DisableRefClock(RTC_TypeDef *RTCx)
932 {
933 CLEAR_BIT(RTCx->CR, RTC_CR_REFCKON);
934 }
935
936 /**
937 * @brief Set Asynchronous prescaler factor
938 * @rmtoll PRER PREDIV_A LL_RTC_SetAsynchPrescaler
939 * @param RTCx RTC Instance
940 * @param AsynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7F
941 * @retval None
942 */
LL_RTC_SetAsynchPrescaler(RTC_TypeDef * RTCx,uint32_t AsynchPrescaler)943 __STATIC_INLINE void LL_RTC_SetAsynchPrescaler(RTC_TypeDef *RTCx, uint32_t AsynchPrescaler)
944 {
945 MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_A, AsynchPrescaler << RTC_PRER_PREDIV_A_Pos);
946 }
947
948 /**
949 * @brief Set Synchronous prescaler factor
950 * @rmtoll PRER PREDIV_S LL_RTC_SetSynchPrescaler
951 * @param RTCx RTC Instance
952 * @param SynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7FFF
953 * @retval None
954 */
LL_RTC_SetSynchPrescaler(RTC_TypeDef * RTCx,uint32_t SynchPrescaler)955 __STATIC_INLINE void LL_RTC_SetSynchPrescaler(RTC_TypeDef *RTCx, uint32_t SynchPrescaler)
956 {
957 MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_S, SynchPrescaler);
958 }
959
960 /**
961 * @brief Get Asynchronous prescaler factor
962 * @rmtoll PRER PREDIV_A LL_RTC_GetAsynchPrescaler
963 * @param RTCx RTC Instance
964 * @retval Value between Min_Data = 0 and Max_Data = 0x7F
965 */
LL_RTC_GetAsynchPrescaler(RTC_TypeDef * RTCx)966 __STATIC_INLINE uint32_t LL_RTC_GetAsynchPrescaler(RTC_TypeDef *RTCx)
967 {
968 return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_A) >> RTC_PRER_PREDIV_A_Pos);
969 }
970
971 /**
972 * @brief Get Synchronous prescaler factor
973 * @rmtoll PRER PREDIV_S LL_RTC_GetSynchPrescaler
974 * @param RTCx RTC Instance
975 * @retval Value between Min_Data = 0 and Max_Data = 0x7FFF
976 */
LL_RTC_GetSynchPrescaler(RTC_TypeDef * RTCx)977 __STATIC_INLINE uint32_t LL_RTC_GetSynchPrescaler(RTC_TypeDef *RTCx)
978 {
979 return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_S));
980 }
981
982 /**
983 * @brief Enable the write protection for RTC registers.
984 * @rmtoll WPR KEY LL_RTC_EnableWriteProtection
985 * @param RTCx RTC Instance
986 * @retval None
987 */
LL_RTC_EnableWriteProtection(RTC_TypeDef * RTCx)988 __STATIC_INLINE void LL_RTC_EnableWriteProtection(RTC_TypeDef *RTCx)
989 {
990 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_DISABLE);
991 }
992
993 /**
994 * @brief Disable the write protection for RTC registers.
995 * @rmtoll WPR KEY LL_RTC_DisableWriteProtection
996 * @param RTCx RTC Instance
997 * @retval None
998 */
LL_RTC_DisableWriteProtection(RTC_TypeDef * RTCx)999 __STATIC_INLINE void LL_RTC_DisableWriteProtection(RTC_TypeDef *RTCx)
1000 {
1001 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_1);
1002 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_2);
1003 }
1004
1005 /**
1006 * @brief Enable RTC_OUT remap
1007 * @rmtoll OR OUT_RMP LL_RTC_EnableOutRemap
1008 * @param RTCx RTC Instance
1009 * @retval None
1010 */
LL_RTC_EnableOutRemap(RTC_TypeDef * RTCx)1011 __STATIC_INLINE void LL_RTC_EnableOutRemap(RTC_TypeDef *RTCx)
1012 {
1013 SET_BIT(RTCx->OR, RTC_OR_OUT_RMP);
1014 }
1015
1016 /**
1017 * @brief Disable RTC_OUT remap
1018 * @rmtoll OR OUT_RMP LL_RTC_DisableOutRemap
1019 * @param RTCx RTC Instance
1020 * @retval None
1021 */
LL_RTC_DisableOutRemap(RTC_TypeDef * RTCx)1022 __STATIC_INLINE void LL_RTC_DisableOutRemap(RTC_TypeDef *RTCx)
1023 {
1024 CLEAR_BIT(RTCx->OR, RTC_OR_OUT_RMP);
1025 }
1026
1027 /**
1028 * @}
1029 */
1030
1031 /** @defgroup RTC_LL_EF_Time Time
1032 * @{
1033 */
1034
1035 /**
1036 * @brief Set time format (AM/24-hour or PM notation)
1037 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1038 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1039 * @rmtoll TR PM LL_RTC_TIME_SetFormat
1040 * @param RTCx RTC Instance
1041 * @param TimeFormat This parameter can be one of the following values:
1042 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1043 * @arg @ref LL_RTC_TIME_FORMAT_PM
1044 * @retval None
1045 */
LL_RTC_TIME_SetFormat(RTC_TypeDef * RTCx,uint32_t TimeFormat)1046 __STATIC_INLINE void LL_RTC_TIME_SetFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
1047 {
1048 MODIFY_REG(RTCx->TR, RTC_TR_PM, TimeFormat);
1049 }
1050
1051 /**
1052 * @brief Get time format (AM or PM notation)
1053 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1054 * before reading this bit
1055 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1056 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1057 * @rmtoll TR PM LL_RTC_TIME_GetFormat
1058 * @param RTCx RTC Instance
1059 * @retval Returned value can be one of the following values:
1060 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1061 * @arg @ref LL_RTC_TIME_FORMAT_PM
1062 */
LL_RTC_TIME_GetFormat(RTC_TypeDef * RTCx)1063 __STATIC_INLINE uint32_t LL_RTC_TIME_GetFormat(RTC_TypeDef *RTCx)
1064 {
1065 return (uint32_t)(READ_BIT(RTCx->TR, RTC_TR_PM));
1066 }
1067
1068 /**
1069 * @brief Set Hours in BCD format
1070 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1071 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1072 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert hour from binary to BCD format
1073 * @rmtoll TR HT LL_RTC_TIME_SetHour\n
1074 * TR HU LL_RTC_TIME_SetHour
1075 * @param RTCx RTC Instance
1076 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1077 * @retval None
1078 */
LL_RTC_TIME_SetHour(RTC_TypeDef * RTCx,uint32_t Hours)1079 __STATIC_INLINE void LL_RTC_TIME_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
1080 {
1081 MODIFY_REG(RTCx->TR, (RTC_TR_HT | RTC_TR_HU),
1082 (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos)));
1083 }
1084
1085 /**
1086 * @brief Get Hours in BCD format
1087 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1088 * before reading this bit
1089 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1090 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1091 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert hour from BCD to
1092 * Binary format
1093 * @rmtoll TR HT LL_RTC_TIME_GetHour\n
1094 * TR HU LL_RTC_TIME_GetHour
1095 * @param RTCx RTC Instance
1096 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1097 */
LL_RTC_TIME_GetHour(RTC_TypeDef * RTCx)1098 __STATIC_INLINE uint32_t LL_RTC_TIME_GetHour(RTC_TypeDef *RTCx)
1099 {
1100 return (uint32_t)((READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU))) >> RTC_TR_HU_Pos);
1101 }
1102
1103 /**
1104 * @brief Set Minutes in BCD format
1105 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1106 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1107 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
1108 * @rmtoll TR MNT LL_RTC_TIME_SetMinute\n
1109 * TR MNU LL_RTC_TIME_SetMinute
1110 * @param RTCx RTC Instance
1111 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
1112 * @retval None
1113 */
LL_RTC_TIME_SetMinute(RTC_TypeDef * RTCx,uint32_t Minutes)1114 __STATIC_INLINE void LL_RTC_TIME_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
1115 {
1116 MODIFY_REG(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU),
1117 (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)));
1118 }
1119
1120 /**
1121 * @brief Get Minutes in BCD format
1122 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1123 * before reading this bit
1124 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1125 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1126 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert minute from BCD
1127 * to Binary format
1128 * @rmtoll TR MNT LL_RTC_TIME_GetMinute\n
1129 * TR MNU LL_RTC_TIME_GetMinute
1130 * @param RTCx RTC Instance
1131 * @retval Value between Min_Data=0x00 and Max_Data=0x59
1132 */
LL_RTC_TIME_GetMinute(RTC_TypeDef * RTCx)1133 __STATIC_INLINE uint32_t LL_RTC_TIME_GetMinute(RTC_TypeDef *RTCx)
1134 {
1135 return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU)) >> RTC_TR_MNU_Pos);
1136 }
1137
1138 /**
1139 * @brief Set Seconds in BCD format
1140 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1141 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1142 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
1143 * @rmtoll TR ST LL_RTC_TIME_SetSecond\n
1144 * TR SU LL_RTC_TIME_SetSecond
1145 * @param RTCx RTC Instance
1146 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
1147 * @retval None
1148 */
LL_RTC_TIME_SetSecond(RTC_TypeDef * RTCx,uint32_t Seconds)1149 __STATIC_INLINE void LL_RTC_TIME_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
1150 {
1151 MODIFY_REG(RTCx->TR, (RTC_TR_ST | RTC_TR_SU),
1152 (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos)));
1153 }
1154
1155 /**
1156 * @brief Get Seconds in BCD format
1157 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1158 * before reading this bit
1159 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1160 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1161 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD
1162 * to Binary format
1163 * @rmtoll TR ST LL_RTC_TIME_GetSecond\n
1164 * TR SU LL_RTC_TIME_GetSecond
1165 * @param RTCx RTC Instance
1166 * @retval Value between Min_Data=0x00 and Max_Data=0x59
1167 */
LL_RTC_TIME_GetSecond(RTC_TypeDef * RTCx)1168 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSecond(RTC_TypeDef *RTCx)
1169 {
1170 return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_ST | RTC_TR_SU)) >> RTC_TR_SU_Pos);
1171 }
1172
1173 /**
1174 * @brief Set time (hour, minute and second) in BCD format
1175 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1176 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1177 * @note TimeFormat and Hours should follow the same format
1178 * @rmtoll TR PM LL_RTC_TIME_Config\n
1179 * TR HT LL_RTC_TIME_Config\n
1180 * TR HU LL_RTC_TIME_Config\n
1181 * TR MNT LL_RTC_TIME_Config\n
1182 * TR MNU LL_RTC_TIME_Config\n
1183 * TR ST LL_RTC_TIME_Config\n
1184 * TR SU LL_RTC_TIME_Config
1185 * @param RTCx RTC Instance
1186 * @param Format12_24 This parameter can be one of the following values:
1187 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1188 * @arg @ref LL_RTC_TIME_FORMAT_PM
1189 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1190 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
1191 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
1192 * @retval None
1193 */
LL_RTC_TIME_Config(RTC_TypeDef * RTCx,uint32_t Format12_24,uint32_t Hours,uint32_t Minutes,uint32_t Seconds)1194 __STATIC_INLINE void LL_RTC_TIME_Config(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
1195 {
1196 uint32_t temp;
1197
1198 temp = Format12_24 | \
1199 (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos)) | \
1200 (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)) | \
1201 (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos));
1202 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);
1203 }
1204
1205 /**
1206 * @brief Get time (hour, minute and second) in BCD format
1207 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1208 * before reading this bit
1209 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1210 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1211 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
1212 * are available to get independently each parameter.
1213 * @rmtoll TR HT LL_RTC_TIME_Get\n
1214 * TR HU LL_RTC_TIME_Get\n
1215 * TR MNT LL_RTC_TIME_Get\n
1216 * TR MNU LL_RTC_TIME_Get\n
1217 * TR ST LL_RTC_TIME_Get\n
1218 * TR SU LL_RTC_TIME_Get
1219 * @param RTCx RTC Instance
1220 * @retval Combination of hours, minutes and seconds (Format: 0x00HHMMSS).
1221 */
LL_RTC_TIME_Get(RTC_TypeDef * RTCx)1222 __STATIC_INLINE uint32_t LL_RTC_TIME_Get(RTC_TypeDef *RTCx)
1223 {
1224 return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU)));
1225 }
1226
1227 /**
1228 * @brief Memorize whether the daylight saving time change has been performed
1229 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1230 * @rmtoll CR BKP LL_RTC_TIME_EnableDayLightStore
1231 * @param RTCx RTC Instance
1232 * @retval None
1233 */
LL_RTC_TIME_EnableDayLightStore(RTC_TypeDef * RTCx)1234 __STATIC_INLINE void LL_RTC_TIME_EnableDayLightStore(RTC_TypeDef *RTCx)
1235 {
1236 SET_BIT(RTCx->CR, RTC_CR_BKP);
1237 }
1238
1239 /**
1240 * @brief Disable memorization whether the daylight saving time change has been performed.
1241 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1242 * @rmtoll CR BKP LL_RTC_TIME_DisableDayLightStore
1243 * @param RTCx RTC Instance
1244 * @retval None
1245 */
LL_RTC_TIME_DisableDayLightStore(RTC_TypeDef * RTCx)1246 __STATIC_INLINE void LL_RTC_TIME_DisableDayLightStore(RTC_TypeDef *RTCx)
1247 {
1248 CLEAR_BIT(RTCx->CR, RTC_CR_BKP);
1249 }
1250
1251 /**
1252 * @brief Check if RTC Day Light Saving stored operation has been enabled or not
1253 * @rmtoll CR BKP LL_RTC_TIME_IsDayLightStoreEnabled
1254 * @param RTCx RTC Instance
1255 * @retval State of bit (1 or 0).
1256 */
LL_RTC_TIME_IsDayLightStoreEnabled(RTC_TypeDef * RTCx)1257 __STATIC_INLINE uint32_t LL_RTC_TIME_IsDayLightStoreEnabled(RTC_TypeDef *RTCx)
1258 {
1259 return ((READ_BIT(RTCx->CR, RTC_CR_BKP) == (RTC_CR_BKP)) ? 1UL : 0UL);
1260 }
1261
1262 /**
1263 * @brief Subtract 1 hour (winter time change)
1264 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1265 * @rmtoll CR SUB1H LL_RTC_TIME_DecHour
1266 * @param RTCx RTC Instance
1267 * @retval None
1268 */
LL_RTC_TIME_DecHour(RTC_TypeDef * RTCx)1269 __STATIC_INLINE void LL_RTC_TIME_DecHour(RTC_TypeDef *RTCx)
1270 {
1271 SET_BIT(RTCx->CR, RTC_CR_SUB1H);
1272 }
1273
1274 /**
1275 * @brief Add 1 hour (summer time change)
1276 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1277 * @rmtoll CR ADD1H LL_RTC_TIME_IncHour
1278 * @param RTCx RTC Instance
1279 * @retval None
1280 */
LL_RTC_TIME_IncHour(RTC_TypeDef * RTCx)1281 __STATIC_INLINE void LL_RTC_TIME_IncHour(RTC_TypeDef *RTCx)
1282 {
1283 SET_BIT(RTCx->CR, RTC_CR_ADD1H);
1284 }
1285
1286 /**
1287 * @brief Get subseconds value in the synchronous prescaler counter.
1288 * @note You can use both SubSeconds value and SecondFraction (PREDIV_S through
1289 * LL_RTC_GetSynchPrescaler function) terms returned to convert Calendar
1290 * SubSeconds value in second fraction ratio with time unit following
1291 * generic formula:
1292 * ==> Seconds fraction ratio * time_unit =
1293 * [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit
1294 * This conversion can be performed only if no shift operation is pending
1295 * (ie. SHFP=0) when PREDIV_S >= SS.
1296 * @rmtoll SSR SS LL_RTC_TIME_GetSubSecond
1297 * @param RTCx RTC Instance
1298 * @retval Subseconds value (number between 0 and 65535)
1299 */
LL_RTC_TIME_GetSubSecond(RTC_TypeDef * RTCx)1300 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSubSecond(RTC_TypeDef *RTCx)
1301 {
1302 return (uint32_t)(READ_BIT(RTCx->SSR, RTC_SSR_SS));
1303 }
1304
1305 /**
1306 * @brief Synchronize to a remote clock with a high degree of precision.
1307 * @note This operation effectively subtracts from (delays) or advance the clock of a fraction of a second.
1308 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1309 * @note When REFCKON is set, firmware must not write to Shift control register.
1310 * @rmtoll SHIFTR ADD1S LL_RTC_TIME_Synchronize\n
1311 * SHIFTR SUBFS LL_RTC_TIME_Synchronize
1312 * @param RTCx RTC Instance
1313 * @param ShiftSecond This parameter can be one of the following values:
1314 * @arg @ref LL_RTC_SHIFT_SECOND_DELAY
1315 * @arg @ref LL_RTC_SHIFT_SECOND_ADVANCE
1316 * @param Fraction Number of Seconds Fractions (any value from 0 to 0x7FFF)
1317 * @retval None
1318 */
LL_RTC_TIME_Synchronize(RTC_TypeDef * RTCx,uint32_t ShiftSecond,uint32_t Fraction)1319 __STATIC_INLINE void LL_RTC_TIME_Synchronize(RTC_TypeDef *RTCx, uint32_t ShiftSecond, uint32_t Fraction)
1320 {
1321 WRITE_REG(RTCx->SHIFTR, ShiftSecond | Fraction);
1322 }
1323
1324 /**
1325 * @}
1326 */
1327
1328 /** @defgroup RTC_LL_EF_Date Date
1329 * @{
1330 */
1331
1332 /**
1333 * @brief Set Year in BCD format
1334 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Year from binary to BCD format
1335 * @rmtoll DR YT LL_RTC_DATE_SetYear\n
1336 * DR YU LL_RTC_DATE_SetYear
1337 * @param RTCx RTC Instance
1338 * @param Year Value between Min_Data=0x00 and Max_Data=0x99
1339 * @retval None
1340 */
LL_RTC_DATE_SetYear(RTC_TypeDef * RTCx,uint32_t Year)1341 __STATIC_INLINE void LL_RTC_DATE_SetYear(RTC_TypeDef *RTCx, uint32_t Year)
1342 {
1343 MODIFY_REG(RTCx->DR, (RTC_DR_YT | RTC_DR_YU),
1344 (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos)));
1345 }
1346
1347 /**
1348 * @brief Get Year in BCD format
1349 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1350 * before reading this bit
1351 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Year from BCD to Binary format
1352 * @rmtoll DR YT LL_RTC_DATE_GetYear\n
1353 * DR YU LL_RTC_DATE_GetYear
1354 * @param RTCx RTC Instance
1355 * @retval Value between Min_Data=0x00 and Max_Data=0x99
1356 */
LL_RTC_DATE_GetYear(RTC_TypeDef * RTCx)1357 __STATIC_INLINE uint32_t LL_RTC_DATE_GetYear(RTC_TypeDef *RTCx)
1358 {
1359 return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_YT | RTC_DR_YU))) >> RTC_DR_YU_Pos);
1360 }
1361
1362 /**
1363 * @brief Set Week day
1364 * @rmtoll DR WDU LL_RTC_DATE_SetWeekDay
1365 * @param RTCx RTC Instance
1366 * @param WeekDay This parameter can be one of the following values:
1367 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1368 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1369 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1370 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1371 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1372 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1373 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1374 * @retval None
1375 */
LL_RTC_DATE_SetWeekDay(RTC_TypeDef * RTCx,uint32_t WeekDay)1376 __STATIC_INLINE void LL_RTC_DATE_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
1377 {
1378 MODIFY_REG(RTCx->DR, RTC_DR_WDU, WeekDay << RTC_DR_WDU_Pos);
1379 }
1380
1381 /**
1382 * @brief Get Week day
1383 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1384 * before reading this bit
1385 * @rmtoll DR WDU LL_RTC_DATE_GetWeekDay
1386 * @param RTCx RTC Instance
1387 * @retval Returned value can be one of the following values:
1388 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1389 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1390 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1391 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1392 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1393 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1394 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1395 */
LL_RTC_DATE_GetWeekDay(RTC_TypeDef * RTCx)1396 __STATIC_INLINE uint32_t LL_RTC_DATE_GetWeekDay(RTC_TypeDef *RTCx)
1397 {
1398 return (uint32_t)(READ_BIT(RTCx->DR, RTC_DR_WDU) >> RTC_DR_WDU_Pos);
1399 }
1400
1401 /**
1402 * @brief Set Month in BCD format
1403 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Month from binary to BCD format
1404 * @rmtoll DR MT LL_RTC_DATE_SetMonth\n
1405 * DR MU LL_RTC_DATE_SetMonth
1406 * @param RTCx RTC Instance
1407 * @param Month This parameter can be one of the following values:
1408 * @arg @ref LL_RTC_MONTH_JANUARY
1409 * @arg @ref LL_RTC_MONTH_FEBRUARY
1410 * @arg @ref LL_RTC_MONTH_MARCH
1411 * @arg @ref LL_RTC_MONTH_APRIL
1412 * @arg @ref LL_RTC_MONTH_MAY
1413 * @arg @ref LL_RTC_MONTH_JUNE
1414 * @arg @ref LL_RTC_MONTH_JULY
1415 * @arg @ref LL_RTC_MONTH_AUGUST
1416 * @arg @ref LL_RTC_MONTH_SEPTEMBER
1417 * @arg @ref LL_RTC_MONTH_OCTOBER
1418 * @arg @ref LL_RTC_MONTH_NOVEMBER
1419 * @arg @ref LL_RTC_MONTH_DECEMBER
1420 * @retval None
1421 */
LL_RTC_DATE_SetMonth(RTC_TypeDef * RTCx,uint32_t Month)1422 __STATIC_INLINE void LL_RTC_DATE_SetMonth(RTC_TypeDef *RTCx, uint32_t Month)
1423 {
1424 MODIFY_REG(RTCx->DR, (RTC_DR_MT | RTC_DR_MU),
1425 (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)));
1426 }
1427
1428 /**
1429 * @brief Get Month in BCD format
1430 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1431 * before reading this bit
1432 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
1433 * @rmtoll DR MT LL_RTC_DATE_GetMonth\n
1434 * DR MU LL_RTC_DATE_GetMonth
1435 * @param RTCx RTC Instance
1436 * @retval Returned value can be one of the following values:
1437 * @arg @ref LL_RTC_MONTH_JANUARY
1438 * @arg @ref LL_RTC_MONTH_FEBRUARY
1439 * @arg @ref LL_RTC_MONTH_MARCH
1440 * @arg @ref LL_RTC_MONTH_APRIL
1441 * @arg @ref LL_RTC_MONTH_MAY
1442 * @arg @ref LL_RTC_MONTH_JUNE
1443 * @arg @ref LL_RTC_MONTH_JULY
1444 * @arg @ref LL_RTC_MONTH_AUGUST
1445 * @arg @ref LL_RTC_MONTH_SEPTEMBER
1446 * @arg @ref LL_RTC_MONTH_OCTOBER
1447 * @arg @ref LL_RTC_MONTH_NOVEMBER
1448 * @arg @ref LL_RTC_MONTH_DECEMBER
1449 */
LL_RTC_DATE_GetMonth(RTC_TypeDef * RTCx)1450 __STATIC_INLINE uint32_t LL_RTC_DATE_GetMonth(RTC_TypeDef *RTCx)
1451 {
1452 return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_MT | RTC_DR_MU))) >> RTC_DR_MU_Pos);
1453 }
1454
1455 /**
1456 * @brief Set Day in BCD format
1457 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
1458 * @rmtoll DR DT LL_RTC_DATE_SetDay\n
1459 * DR DU LL_RTC_DATE_SetDay
1460 * @param RTCx RTC Instance
1461 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
1462 * @retval None
1463 */
LL_RTC_DATE_SetDay(RTC_TypeDef * RTCx,uint32_t Day)1464 __STATIC_INLINE void LL_RTC_DATE_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
1465 {
1466 MODIFY_REG(RTCx->DR, (RTC_DR_DT | RTC_DR_DU),
1467 (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos)));
1468 }
1469
1470 /**
1471 * @brief Get Day in BCD format
1472 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1473 * before reading this bit
1474 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
1475 * @rmtoll DR DT LL_RTC_DATE_GetDay\n
1476 * DR DU LL_RTC_DATE_GetDay
1477 * @param RTCx RTC Instance
1478 * @retval Value between Min_Data=0x01 and Max_Data=0x31
1479 */
LL_RTC_DATE_GetDay(RTC_TypeDef * RTCx)1480 __STATIC_INLINE uint32_t LL_RTC_DATE_GetDay(RTC_TypeDef *RTCx)
1481 {
1482 return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_DT | RTC_DR_DU))) >> RTC_DR_DU_Pos);
1483 }
1484
1485 /**
1486 * @brief Set date (WeekDay, Day, Month and Year) in BCD format
1487 * @rmtoll DR WDU LL_RTC_DATE_Config\n
1488 * DR MT LL_RTC_DATE_Config\n
1489 * DR MU LL_RTC_DATE_Config\n
1490 * DR DT LL_RTC_DATE_Config\n
1491 * DR DU LL_RTC_DATE_Config\n
1492 * DR YT LL_RTC_DATE_Config\n
1493 * DR YU LL_RTC_DATE_Config
1494 * @param RTCx RTC Instance
1495 * @param WeekDay This parameter can be one of the following values:
1496 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1497 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1498 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1499 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1500 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1501 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1502 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1503 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
1504 * @param Month This parameter can be one of the following values:
1505 * @arg @ref LL_RTC_MONTH_JANUARY
1506 * @arg @ref LL_RTC_MONTH_FEBRUARY
1507 * @arg @ref LL_RTC_MONTH_MARCH
1508 * @arg @ref LL_RTC_MONTH_APRIL
1509 * @arg @ref LL_RTC_MONTH_MAY
1510 * @arg @ref LL_RTC_MONTH_JUNE
1511 * @arg @ref LL_RTC_MONTH_JULY
1512 * @arg @ref LL_RTC_MONTH_AUGUST
1513 * @arg @ref LL_RTC_MONTH_SEPTEMBER
1514 * @arg @ref LL_RTC_MONTH_OCTOBER
1515 * @arg @ref LL_RTC_MONTH_NOVEMBER
1516 * @arg @ref LL_RTC_MONTH_DECEMBER
1517 * @param Year Value between Min_Data=0x00 and Max_Data=0x99
1518 * @retval None
1519 */
LL_RTC_DATE_Config(RTC_TypeDef * RTCx,uint32_t WeekDay,uint32_t Day,uint32_t Month,uint32_t Year)1520 __STATIC_INLINE void LL_RTC_DATE_Config(RTC_TypeDef *RTCx, uint32_t WeekDay, uint32_t Day, uint32_t Month, uint32_t Year)
1521 {
1522 uint32_t temp;
1523
1524 temp = ( WeekDay << RTC_DR_WDU_Pos) | \
1525 (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos)) | \
1526 (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)) | \
1527 (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos));
1528
1529 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);
1530 }
1531
1532 /**
1533 * @brief Get date (WeekDay, Day, Month and Year) in BCD format
1534 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1535 * before reading this bit
1536 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_YEAR, __LL_RTC_GET_MONTH,
1537 * and __LL_RTC_GET_DAY are available to get independently each parameter.
1538 * @rmtoll DR WDU LL_RTC_DATE_Get\n
1539 * DR MT LL_RTC_DATE_Get\n
1540 * DR MU LL_RTC_DATE_Get\n
1541 * DR DT LL_RTC_DATE_Get\n
1542 * DR DU LL_RTC_DATE_Get\n
1543 * DR YT LL_RTC_DATE_Get\n
1544 * DR YU LL_RTC_DATE_Get
1545 * @param RTCx RTC Instance
1546 * @retval Combination of WeekDay, Day, Month and Year (Format: 0xWWDDMMYY).
1547 */
LL_RTC_DATE_Get(RTC_TypeDef * RTCx)1548 __STATIC_INLINE uint32_t LL_RTC_DATE_Get(RTC_TypeDef *RTCx)
1549 {
1550 uint32_t temp;
1551
1552 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));
1553
1554 return (uint32_t)((((temp & RTC_DR_WDU) >> RTC_DR_WDU_Pos) << RTC_OFFSET_WEEKDAY) | \
1555 (((temp & (RTC_DR_DT | RTC_DR_DU)) >> RTC_DR_DU_Pos) << RTC_OFFSET_DAY) | \
1556 (((temp & (RTC_DR_MT | RTC_DR_MU)) >> RTC_DR_MU_Pos) << RTC_OFFSET_MONTH) | \
1557 ((temp & (RTC_DR_YT | RTC_DR_YU)) >> RTC_DR_YU_Pos));
1558 }
1559
1560 /**
1561 * @}
1562 */
1563
1564 /** @defgroup RTC_LL_EF_ALARMA ALARMA
1565 * @{
1566 */
1567
1568 /**
1569 * @brief Enable Alarm A
1570 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1571 * @rmtoll CR ALRAE LL_RTC_ALMA_Enable
1572 * @param RTCx RTC Instance
1573 * @retval None
1574 */
LL_RTC_ALMA_Enable(RTC_TypeDef * RTCx)1575 __STATIC_INLINE void LL_RTC_ALMA_Enable(RTC_TypeDef *RTCx)
1576 {
1577 SET_BIT(RTCx->CR, RTC_CR_ALRAE);
1578 }
1579
1580 /**
1581 * @brief Disable Alarm A
1582 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1583 * @rmtoll CR ALRAE LL_RTC_ALMA_Disable
1584 * @param RTCx RTC Instance
1585 * @retval None
1586 */
LL_RTC_ALMA_Disable(RTC_TypeDef * RTCx)1587 __STATIC_INLINE void LL_RTC_ALMA_Disable(RTC_TypeDef *RTCx)
1588 {
1589 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAE);
1590 }
1591
1592 /**
1593 * @brief Specify the Alarm A masks.
1594 * @rmtoll ALRMAR MSK4 LL_RTC_ALMA_SetMask\n
1595 * ALRMAR MSK3 LL_RTC_ALMA_SetMask\n
1596 * ALRMAR MSK2 LL_RTC_ALMA_SetMask\n
1597 * ALRMAR MSK1 LL_RTC_ALMA_SetMask
1598 * @param RTCx RTC Instance
1599 * @param Mask This parameter can be a combination of the following values:
1600 * @arg @ref LL_RTC_ALMA_MASK_NONE
1601 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
1602 * @arg @ref LL_RTC_ALMA_MASK_HOURS
1603 * @arg @ref LL_RTC_ALMA_MASK_MINUTES
1604 * @arg @ref LL_RTC_ALMA_MASK_SECONDS
1605 * @arg @ref LL_RTC_ALMA_MASK_ALL
1606 * @retval None
1607 */
LL_RTC_ALMA_SetMask(RTC_TypeDef * RTCx,uint32_t Mask)1608 __STATIC_INLINE void LL_RTC_ALMA_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
1609 {
1610 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1, Mask);
1611 }
1612
1613 /**
1614 * @brief Get the Alarm A masks.
1615 * @rmtoll ALRMAR MSK4 LL_RTC_ALMA_GetMask\n
1616 * ALRMAR MSK3 LL_RTC_ALMA_GetMask\n
1617 * ALRMAR MSK2 LL_RTC_ALMA_GetMask\n
1618 * ALRMAR MSK1 LL_RTC_ALMA_GetMask
1619 * @param RTCx RTC Instance
1620 * @retval Returned value can be can be a combination of the following values:
1621 * @arg @ref LL_RTC_ALMA_MASK_NONE
1622 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
1623 * @arg @ref LL_RTC_ALMA_MASK_HOURS
1624 * @arg @ref LL_RTC_ALMA_MASK_MINUTES
1625 * @arg @ref LL_RTC_ALMA_MASK_SECONDS
1626 * @arg @ref LL_RTC_ALMA_MASK_ALL
1627 */
LL_RTC_ALMA_GetMask(RTC_TypeDef * RTCx)1628 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMask(RTC_TypeDef *RTCx)
1629 {
1630 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1));
1631 }
1632
1633 /**
1634 * @brief Enable AlarmA Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
1635 * @rmtoll ALRMAR WDSEL LL_RTC_ALMA_EnableWeekday
1636 * @param RTCx RTC Instance
1637 * @retval None
1638 */
LL_RTC_ALMA_EnableWeekday(RTC_TypeDef * RTCx)1639 __STATIC_INLINE void LL_RTC_ALMA_EnableWeekday(RTC_TypeDef *RTCx)
1640 {
1641 SET_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
1642 }
1643
1644 /**
1645 * @brief Disable AlarmA Week day selection (DU[3:0] represents the date )
1646 * @rmtoll ALRMAR WDSEL LL_RTC_ALMA_DisableWeekday
1647 * @param RTCx RTC Instance
1648 * @retval None
1649 */
LL_RTC_ALMA_DisableWeekday(RTC_TypeDef * RTCx)1650 __STATIC_INLINE void LL_RTC_ALMA_DisableWeekday(RTC_TypeDef *RTCx)
1651 {
1652 CLEAR_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
1653 }
1654
1655 /**
1656 * @brief Set ALARM A Day in BCD format
1657 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
1658 * @rmtoll ALRMAR DT LL_RTC_ALMA_SetDay\n
1659 * ALRMAR DU LL_RTC_ALMA_SetDay
1660 * @param RTCx RTC Instance
1661 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
1662 * @retval None
1663 */
LL_RTC_ALMA_SetDay(RTC_TypeDef * RTCx,uint32_t Day)1664 __STATIC_INLINE void LL_RTC_ALMA_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
1665 {
1666 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU),
1667 (((Day & 0xF0U) << (RTC_ALRMAR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMAR_DU_Pos)));
1668 }
1669
1670 /**
1671 * @brief Get ALARM A Day in BCD format
1672 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
1673 * @rmtoll ALRMAR DT LL_RTC_ALMA_GetDay\n
1674 * ALRMAR DU LL_RTC_ALMA_GetDay
1675 * @param RTCx RTC Instance
1676 * @retval Value between Min_Data=0x01 and Max_Data=0x31
1677 */
LL_RTC_ALMA_GetDay(RTC_TypeDef * RTCx)1678 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetDay(RTC_TypeDef *RTCx)
1679 {
1680 return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU))) >> RTC_ALRMAR_DU_Pos);
1681 }
1682
1683 /**
1684 * @brief Set ALARM A Weekday
1685 * @rmtoll ALRMAR DU LL_RTC_ALMA_SetWeekDay
1686 * @param RTCx RTC Instance
1687 * @param WeekDay This parameter can be one of the following values:
1688 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1689 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1690 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1691 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1692 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1693 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1694 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1695 * @retval None
1696 */
LL_RTC_ALMA_SetWeekDay(RTC_TypeDef * RTCx,uint32_t WeekDay)1697 __STATIC_INLINE void LL_RTC_ALMA_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
1698 {
1699 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_DU, WeekDay << RTC_ALRMAR_DU_Pos);
1700 }
1701
1702 /**
1703 * @brief Get ALARM A Weekday
1704 * @rmtoll ALRMAR DU LL_RTC_ALMA_GetWeekDay
1705 * @param RTCx RTC Instance
1706 * @retval Returned value can be one of the following values:
1707 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1708 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1709 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1710 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1711 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1712 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1713 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1714 */
LL_RTC_ALMA_GetWeekDay(RTC_TypeDef * RTCx)1715 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetWeekDay(RTC_TypeDef *RTCx)
1716 {
1717 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_DU) >> RTC_ALRMAR_DU_Pos);
1718 }
1719
1720 /**
1721 * @brief Set Alarm A time format (AM/24-hour or PM notation)
1722 * @rmtoll ALRMAR PM LL_RTC_ALMA_SetTimeFormat
1723 * @param RTCx RTC Instance
1724 * @param TimeFormat This parameter can be one of the following values:
1725 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1726 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1727 * @retval None
1728 */
LL_RTC_ALMA_SetTimeFormat(RTC_TypeDef * RTCx,uint32_t TimeFormat)1729 __STATIC_INLINE void LL_RTC_ALMA_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
1730 {
1731 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM, TimeFormat);
1732 }
1733
1734 /**
1735 * @brief Get Alarm A time format (AM or PM notation)
1736 * @rmtoll ALRMAR PM LL_RTC_ALMA_GetTimeFormat
1737 * @param RTCx RTC Instance
1738 * @retval Returned value can be one of the following values:
1739 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1740 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1741 */
LL_RTC_ALMA_GetTimeFormat(RTC_TypeDef * RTCx)1742 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTimeFormat(RTC_TypeDef *RTCx)
1743 {
1744 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_PM));
1745 }
1746
1747 /**
1748 * @brief Set ALARM A Hours in BCD format
1749 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
1750 * @rmtoll ALRMAR HT LL_RTC_ALMA_SetHour\n
1751 * ALRMAR HU LL_RTC_ALMA_SetHour
1752 * @param RTCx RTC Instance
1753 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1754 * @retval None
1755 */
LL_RTC_ALMA_SetHour(RTC_TypeDef * RTCx,uint32_t Hours)1756 __STATIC_INLINE void LL_RTC_ALMA_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
1757 {
1758 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU),
1759 (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos)));
1760 }
1761
1762 /**
1763 * @brief Get ALARM A Hours in BCD format
1764 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
1765 * @rmtoll ALRMAR HT LL_RTC_ALMA_GetHour\n
1766 * ALRMAR HU LL_RTC_ALMA_GetHour
1767 * @param RTCx RTC Instance
1768 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1769 */
LL_RTC_ALMA_GetHour(RTC_TypeDef * RTCx)1770 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetHour(RTC_TypeDef *RTCx)
1771 {
1772 return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU))) >> RTC_ALRMAR_HU_Pos);
1773 }
1774
1775 /**
1776 * @brief Set ALARM A Minutes in BCD format
1777 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
1778 * @rmtoll ALRMAR MNT LL_RTC_ALMA_SetMinute\n
1779 * ALRMAR MNU LL_RTC_ALMA_SetMinute
1780 * @param RTCx RTC Instance
1781 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
1782 * @retval None
1783 */
LL_RTC_ALMA_SetMinute(RTC_TypeDef * RTCx,uint32_t Minutes)1784 __STATIC_INLINE void LL_RTC_ALMA_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
1785 {
1786 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU),
1787 (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)));
1788 }
1789
1790 /**
1791 * @brief Get ALARM A Minutes in BCD format
1792 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
1793 * @rmtoll ALRMAR MNT LL_RTC_ALMA_GetMinute\n
1794 * ALRMAR MNU LL_RTC_ALMA_GetMinute
1795 * @param RTCx RTC Instance
1796 * @retval Value between Min_Data=0x00 and Max_Data=0x59
1797 */
LL_RTC_ALMA_GetMinute(RTC_TypeDef * RTCx)1798 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMinute(RTC_TypeDef *RTCx)
1799 {
1800 return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU))) >> RTC_ALRMAR_MNU_Pos);
1801 }
1802
1803 /**
1804 * @brief Set ALARM A Seconds in BCD format
1805 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
1806 * @rmtoll ALRMAR ST LL_RTC_ALMA_SetSecond\n
1807 * ALRMAR SU LL_RTC_ALMA_SetSecond
1808 * @param RTCx RTC Instance
1809 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
1810 * @retval None
1811 */
LL_RTC_ALMA_SetSecond(RTC_TypeDef * RTCx,uint32_t Seconds)1812 __STATIC_INLINE void LL_RTC_ALMA_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
1813 {
1814 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU),
1815 (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos)));
1816 }
1817
1818 /**
1819 * @brief Get ALARM A Seconds in BCD format
1820 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
1821 * @rmtoll ALRMAR ST LL_RTC_ALMA_GetSecond\n
1822 * ALRMAR SU LL_RTC_ALMA_GetSecond
1823 * @param RTCx RTC Instance
1824 * @retval Value between Min_Data=0x00 and Max_Data=0x59
1825 */
LL_RTC_ALMA_GetSecond(RTC_TypeDef * RTCx)1826 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSecond(RTC_TypeDef *RTCx)
1827 {
1828 return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU))) >> RTC_ALRMAR_SU_Pos);
1829 }
1830
1831 /**
1832 * @brief Set Alarm A Time (hour, minute and second) in BCD format
1833 * @rmtoll ALRMAR PM LL_RTC_ALMA_ConfigTime\n
1834 * ALRMAR HT LL_RTC_ALMA_ConfigTime\n
1835 * ALRMAR HU LL_RTC_ALMA_ConfigTime\n
1836 * ALRMAR MNT LL_RTC_ALMA_ConfigTime\n
1837 * ALRMAR MNU LL_RTC_ALMA_ConfigTime\n
1838 * ALRMAR ST LL_RTC_ALMA_ConfigTime\n
1839 * ALRMAR SU LL_RTC_ALMA_ConfigTime
1840 * @param RTCx RTC Instance
1841 * @param Format12_24 This parameter can be one of the following values:
1842 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1843 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1844 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1845 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
1846 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
1847 * @retval None
1848 */
LL_RTC_ALMA_ConfigTime(RTC_TypeDef * RTCx,uint32_t Format12_24,uint32_t Hours,uint32_t Minutes,uint32_t Seconds)1849 __STATIC_INLINE void LL_RTC_ALMA_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
1850 {
1851 uint32_t temp;
1852
1853 temp = Format12_24 | \
1854 (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos)) | \
1855 (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)) | \
1856 (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos));
1857
1858 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM | RTC_ALRMAR_HT | RTC_ALRMAR_HU | RTC_ALRMAR_MNT | RTC_ALRMAR_MNU | RTC_ALRMAR_ST | RTC_ALRMAR_SU, temp);
1859 }
1860
1861 /**
1862 * @brief Get Alarm B Time (hour, minute and second) in BCD format
1863 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
1864 * are available to get independently each parameter.
1865 * @rmtoll ALRMAR HT LL_RTC_ALMA_GetTime\n
1866 * ALRMAR HU LL_RTC_ALMA_GetTime\n
1867 * ALRMAR MNT LL_RTC_ALMA_GetTime\n
1868 * ALRMAR MNU LL_RTC_ALMA_GetTime\n
1869 * ALRMAR ST LL_RTC_ALMA_GetTime\n
1870 * ALRMAR SU LL_RTC_ALMA_GetTime
1871 * @param RTCx RTC Instance
1872 * @retval Combination of hours, minutes and seconds.
1873 */
LL_RTC_ALMA_GetTime(RTC_TypeDef * RTCx)1874 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTime(RTC_TypeDef *RTCx)
1875 {
1876 return (uint32_t)((LL_RTC_ALMA_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMA_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMA_GetSecond(RTCx));
1877 }
1878
1879 /**
1880 * @brief Mask the most-significant bits of the subseconds field starting from
1881 * the bit specified in parameter Mask
1882 * @note This register can be written only when ALRAE is reset in RTC_CR register,
1883 * or in initialization mode.
1884 * @rmtoll ALRMASSR MASKSS LL_RTC_ALMA_SetSubSecondMask
1885 * @param RTCx RTC Instance
1886 * @param Mask Value between Min_Data=0x00 and Max_Data=0xF
1887 * @retval None
1888 */
LL_RTC_ALMA_SetSubSecondMask(RTC_TypeDef * RTCx,uint32_t Mask)1889 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
1890 {
1891 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS, Mask << RTC_ALRMASSR_MASKSS_Pos);
1892 }
1893
1894 /**
1895 * @brief Get Alarm A subseconds mask
1896 * @rmtoll ALRMASSR MASKSS LL_RTC_ALMA_GetSubSecondMask
1897 * @param RTCx RTC Instance
1898 * @retval Value between Min_Data=0x00 and Max_Data=0xF
1899 */
LL_RTC_ALMA_GetSubSecondMask(RTC_TypeDef * RTCx)1900 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecondMask(RTC_TypeDef *RTCx)
1901 {
1902 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS) >> RTC_ALRMASSR_MASKSS_Pos);
1903 }
1904
1905 /**
1906 * @brief Set Alarm A subseconds value
1907 * @rmtoll ALRMASSR SS LL_RTC_ALMA_SetSubSecond
1908 * @param RTCx RTC Instance
1909 * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
1910 * @retval None
1911 */
LL_RTC_ALMA_SetSubSecond(RTC_TypeDef * RTCx,uint32_t Subsecond)1912 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
1913 {
1914 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_SS, Subsecond);
1915 }
1916
1917 /**
1918 * @brief Get Alarm A subseconds value
1919 * @rmtoll ALRMASSR SS LL_RTC_ALMA_GetSubSecond
1920 * @param RTCx RTC Instance
1921 * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
1922 */
LL_RTC_ALMA_GetSubSecond(RTC_TypeDef * RTCx)1923 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecond(RTC_TypeDef *RTCx)
1924 {
1925 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_SS));
1926 }
1927
1928 /**
1929 * @}
1930 */
1931
1932 /** @defgroup RTC_LL_EF_ALARMB ALARMB
1933 * @{
1934 */
1935
1936 /**
1937 * @brief Enable Alarm B
1938 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1939 * @rmtoll CR ALRBE LL_RTC_ALMB_Enable
1940 * @param RTCx RTC Instance
1941 * @retval None
1942 */
LL_RTC_ALMB_Enable(RTC_TypeDef * RTCx)1943 __STATIC_INLINE void LL_RTC_ALMB_Enable(RTC_TypeDef *RTCx)
1944 {
1945 SET_BIT(RTCx->CR, RTC_CR_ALRBE);
1946 }
1947
1948 /**
1949 * @brief Disable Alarm B
1950 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1951 * @rmtoll CR ALRBE LL_RTC_ALMB_Disable
1952 * @param RTCx RTC Instance
1953 * @retval None
1954 */
LL_RTC_ALMB_Disable(RTC_TypeDef * RTCx)1955 __STATIC_INLINE void LL_RTC_ALMB_Disable(RTC_TypeDef *RTCx)
1956 {
1957 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBE);
1958 }
1959
1960 /**
1961 * @brief Specify the Alarm B masks.
1962 * @rmtoll ALRMBR MSK4 LL_RTC_ALMB_SetMask\n
1963 * ALRMBR MSK3 LL_RTC_ALMB_SetMask\n
1964 * ALRMBR MSK2 LL_RTC_ALMB_SetMask\n
1965 * ALRMBR MSK1 LL_RTC_ALMB_SetMask
1966 * @param RTCx RTC Instance
1967 * @param Mask This parameter can be a combination of the following values:
1968 * @arg @ref LL_RTC_ALMB_MASK_NONE
1969 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
1970 * @arg @ref LL_RTC_ALMB_MASK_HOURS
1971 * @arg @ref LL_RTC_ALMB_MASK_MINUTES
1972 * @arg @ref LL_RTC_ALMB_MASK_SECONDS
1973 * @arg @ref LL_RTC_ALMB_MASK_ALL
1974 * @retval None
1975 */
LL_RTC_ALMB_SetMask(RTC_TypeDef * RTCx,uint32_t Mask)1976 __STATIC_INLINE void LL_RTC_ALMB_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
1977 {
1978 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1, Mask);
1979 }
1980
1981 /**
1982 * @brief Get the Alarm B masks.
1983 * @rmtoll ALRMBR MSK4 LL_RTC_ALMB_GetMask\n
1984 * ALRMBR MSK3 LL_RTC_ALMB_GetMask\n
1985 * ALRMBR MSK2 LL_RTC_ALMB_GetMask\n
1986 * ALRMBR MSK1 LL_RTC_ALMB_GetMask
1987 * @param RTCx RTC Instance
1988 * @retval Returned value can be can be a combination of the following values:
1989 * @arg @ref LL_RTC_ALMB_MASK_NONE
1990 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
1991 * @arg @ref LL_RTC_ALMB_MASK_HOURS
1992 * @arg @ref LL_RTC_ALMB_MASK_MINUTES
1993 * @arg @ref LL_RTC_ALMB_MASK_SECONDS
1994 * @arg @ref LL_RTC_ALMB_MASK_ALL
1995 */
LL_RTC_ALMB_GetMask(RTC_TypeDef * RTCx)1996 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMask(RTC_TypeDef *RTCx)
1997 {
1998 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1));
1999 }
2000
2001 /**
2002 * @brief Enable AlarmB Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
2003 * @rmtoll ALRMBR WDSEL LL_RTC_ALMB_EnableWeekday
2004 * @param RTCx RTC Instance
2005 * @retval None
2006 */
LL_RTC_ALMB_EnableWeekday(RTC_TypeDef * RTCx)2007 __STATIC_INLINE void LL_RTC_ALMB_EnableWeekday(RTC_TypeDef *RTCx)
2008 {
2009 SET_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
2010 }
2011
2012 /**
2013 * @brief Disable AlarmB Week day selection (DU[3:0] represents the date )
2014 * @rmtoll ALRMBR WDSEL LL_RTC_ALMB_DisableWeekday
2015 * @param RTCx RTC Instance
2016 * @retval None
2017 */
LL_RTC_ALMB_DisableWeekday(RTC_TypeDef * RTCx)2018 __STATIC_INLINE void LL_RTC_ALMB_DisableWeekday(RTC_TypeDef *RTCx)
2019 {
2020 CLEAR_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
2021 }
2022
2023 /**
2024 * @brief Set ALARM B Day in BCD format
2025 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
2026 * @rmtoll ALRMBR DT LL_RTC_ALMB_SetDay\n
2027 * ALRMBR DU LL_RTC_ALMB_SetDay
2028 * @param RTCx RTC Instance
2029 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
2030 * @retval None
2031 */
LL_RTC_ALMB_SetDay(RTC_TypeDef * RTCx,uint32_t Day)2032 __STATIC_INLINE void LL_RTC_ALMB_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
2033 {
2034 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU),
2035 (((Day & 0xF0U) << (RTC_ALRMBR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMBR_DU_Pos)));
2036 }
2037
2038 /**
2039 * @brief Get ALARM B Day in BCD format
2040 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2041 * @rmtoll ALRMBR DT LL_RTC_ALMB_GetDay\n
2042 * ALRMBR DU LL_RTC_ALMB_GetDay
2043 * @param RTCx RTC Instance
2044 * @retval Value between Min_Data=0x01 and Max_Data=0x31
2045 */
LL_RTC_ALMB_GetDay(RTC_TypeDef * RTCx)2046 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetDay(RTC_TypeDef *RTCx)
2047 {
2048 return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU))) >> RTC_ALRMBR_DU_Pos);
2049 }
2050
2051 /**
2052 * @brief Set ALARM B Weekday
2053 * @rmtoll ALRMBR DU LL_RTC_ALMB_SetWeekDay
2054 * @param RTCx RTC Instance
2055 * @param WeekDay This parameter can be one of the following values:
2056 * @arg @ref LL_RTC_WEEKDAY_MONDAY
2057 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
2058 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2059 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
2060 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
2061 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
2062 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
2063 * @retval None
2064 */
LL_RTC_ALMB_SetWeekDay(RTC_TypeDef * RTCx,uint32_t WeekDay)2065 __STATIC_INLINE void LL_RTC_ALMB_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
2066 {
2067 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_DU, WeekDay << RTC_ALRMBR_DU_Pos);
2068 }
2069
2070 /**
2071 * @brief Get ALARM B Weekday
2072 * @rmtoll ALRMBR DU LL_RTC_ALMB_GetWeekDay
2073 * @param RTCx RTC Instance
2074 * @retval Returned value can be one of the following values:
2075 * @arg @ref LL_RTC_WEEKDAY_MONDAY
2076 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
2077 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2078 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
2079 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
2080 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
2081 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
2082 */
LL_RTC_ALMB_GetWeekDay(RTC_TypeDef * RTCx)2083 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetWeekDay(RTC_TypeDef *RTCx)
2084 {
2085 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_DU) >> RTC_ALRMBR_DU_Pos);
2086 }
2087
2088 /**
2089 * @brief Set ALARM B time format (AM/24-hour or PM notation)
2090 * @rmtoll ALRMBR PM LL_RTC_ALMB_SetTimeFormat
2091 * @param RTCx RTC Instance
2092 * @param TimeFormat This parameter can be one of the following values:
2093 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2094 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2095 * @retval None
2096 */
LL_RTC_ALMB_SetTimeFormat(RTC_TypeDef * RTCx,uint32_t TimeFormat)2097 __STATIC_INLINE void LL_RTC_ALMB_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
2098 {
2099 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM, TimeFormat);
2100 }
2101
2102 /**
2103 * @brief Get ALARM B time format (AM or PM notation)
2104 * @rmtoll ALRMBR PM LL_RTC_ALMB_GetTimeFormat
2105 * @param RTCx RTC Instance
2106 * @retval Returned value can be one of the following values:
2107 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2108 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2109 */
LL_RTC_ALMB_GetTimeFormat(RTC_TypeDef * RTCx)2110 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTimeFormat(RTC_TypeDef *RTCx)
2111 {
2112 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_PM));
2113 }
2114
2115 /**
2116 * @brief Set ALARM B Hours in BCD format
2117 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
2118 * @rmtoll ALRMBR HT LL_RTC_ALMB_SetHour\n
2119 * ALRMBR HU LL_RTC_ALMB_SetHour
2120 * @param RTCx RTC Instance
2121 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2122 * @retval None
2123 */
LL_RTC_ALMB_SetHour(RTC_TypeDef * RTCx,uint32_t Hours)2124 __STATIC_INLINE void LL_RTC_ALMB_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
2125 {
2126 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU),
2127 (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos)));
2128 }
2129
2130 /**
2131 * @brief Get ALARM B Hours in BCD format
2132 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2133 * @rmtoll ALRMBR HT LL_RTC_ALMB_GetHour\n
2134 * ALRMBR HU LL_RTC_ALMB_GetHour
2135 * @param RTCx RTC Instance
2136 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2137 */
LL_RTC_ALMB_GetHour(RTC_TypeDef * RTCx)2138 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetHour(RTC_TypeDef *RTCx)
2139 {
2140 return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU))) >> RTC_ALRMBR_HU_Pos);
2141 }
2142
2143 /**
2144 * @brief Set ALARM B Minutes in BCD format
2145 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
2146 * @rmtoll ALRMBR MNT LL_RTC_ALMB_SetMinute\n
2147 * ALRMBR MNU LL_RTC_ALMB_SetMinute
2148 * @param RTCx RTC Instance
2149 * @param Minutes between Min_Data=0x00 and Max_Data=0x59
2150 * @retval None
2151 */
LL_RTC_ALMB_SetMinute(RTC_TypeDef * RTCx,uint32_t Minutes)2152 __STATIC_INLINE void LL_RTC_ALMB_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
2153 {
2154 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU),
2155 (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)));
2156 }
2157
2158 /**
2159 * @brief Get ALARM B Minutes in BCD format
2160 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2161 * @rmtoll ALRMBR MNT LL_RTC_ALMB_GetMinute\n
2162 * ALRMBR MNU LL_RTC_ALMB_GetMinute
2163 * @param RTCx RTC Instance
2164 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2165 */
LL_RTC_ALMB_GetMinute(RTC_TypeDef * RTCx)2166 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMinute(RTC_TypeDef *RTCx)
2167 {
2168 return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU))) >> RTC_ALRMBR_MNU_Pos);
2169 }
2170
2171 /**
2172 * @brief Set ALARM B Seconds in BCD format
2173 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
2174 * @rmtoll ALRMBR ST LL_RTC_ALMB_SetSecond\n
2175 * ALRMBR SU LL_RTC_ALMB_SetSecond
2176 * @param RTCx RTC Instance
2177 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
2178 * @retval None
2179 */
LL_RTC_ALMB_SetSecond(RTC_TypeDef * RTCx,uint32_t Seconds)2180 __STATIC_INLINE void LL_RTC_ALMB_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
2181 {
2182 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU),
2183 (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos)));
2184 }
2185
2186 /**
2187 * @brief Get ALARM B Seconds in BCD format
2188 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2189 * @rmtoll ALRMBR ST LL_RTC_ALMB_GetSecond\n
2190 * ALRMBR SU LL_RTC_ALMB_GetSecond
2191 * @param RTCx RTC Instance
2192 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2193 */
LL_RTC_ALMB_GetSecond(RTC_TypeDef * RTCx)2194 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSecond(RTC_TypeDef *RTCx)
2195 {
2196 return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU))) >> RTC_ALRMBR_SU_Pos);
2197 }
2198
2199 /**
2200 * @brief Set Alarm B Time (hour, minute and second) in BCD format
2201 * @rmtoll ALRMBR PM LL_RTC_ALMB_ConfigTime\n
2202 * ALRMBR HT LL_RTC_ALMB_ConfigTime\n
2203 * ALRMBR HU LL_RTC_ALMB_ConfigTime\n
2204 * ALRMBR MNT LL_RTC_ALMB_ConfigTime\n
2205 * ALRMBR MNU LL_RTC_ALMB_ConfigTime\n
2206 * ALRMBR ST LL_RTC_ALMB_ConfigTime\n
2207 * ALRMBR SU LL_RTC_ALMB_ConfigTime
2208 * @param RTCx RTC Instance
2209 * @param Format12_24 This parameter can be one of the following values:
2210 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2211 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2212 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2213 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
2214 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
2215 * @retval None
2216 */
LL_RTC_ALMB_ConfigTime(RTC_TypeDef * RTCx,uint32_t Format12_24,uint32_t Hours,uint32_t Minutes,uint32_t Seconds)2217 __STATIC_INLINE void LL_RTC_ALMB_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
2218 {
2219 uint32_t temp;
2220
2221 temp = Format12_24 | \
2222 (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos)) | \
2223 (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)) | \
2224 (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos));
2225
2226 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM | RTC_ALRMBR_HT | RTC_ALRMBR_HU | RTC_ALRMBR_MNT | RTC_ALRMBR_MNU | RTC_ALRMBR_ST | RTC_ALRMBR_SU, temp);
2227 }
2228
2229 /**
2230 * @brief Get Alarm B Time (hour, minute and second) in BCD format
2231 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2232 * are available to get independently each parameter.
2233 * @rmtoll ALRMBR HT LL_RTC_ALMB_GetTime\n
2234 * ALRMBR HU LL_RTC_ALMB_GetTime\n
2235 * ALRMBR MNT LL_RTC_ALMB_GetTime\n
2236 * ALRMBR MNU LL_RTC_ALMB_GetTime\n
2237 * ALRMBR ST LL_RTC_ALMB_GetTime\n
2238 * ALRMBR SU LL_RTC_ALMB_GetTime
2239 * @param RTCx RTC Instance
2240 * @retval Combination of hours, minutes and seconds.
2241 */
LL_RTC_ALMB_GetTime(RTC_TypeDef * RTCx)2242 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTime(RTC_TypeDef *RTCx)
2243 {
2244 return (uint32_t)((LL_RTC_ALMB_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMB_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMB_GetSecond(RTCx));
2245 }
2246
2247 /**
2248 * @brief Mask the most-significant bits of the subseconds field starting from
2249 * the bit specified in parameter Mask
2250 * @note This register can be written only when ALRBE is reset in RTC_CR register,
2251 * or in initialization mode.
2252 * @rmtoll ALRMBSSR MASKSS LL_RTC_ALMB_SetSubSecondMask
2253 * @param RTCx RTC Instance
2254 * @param Mask Value between Min_Data=0x00 and Max_Data=0xF
2255 * @retval None
2256 */
LL_RTC_ALMB_SetSubSecondMask(RTC_TypeDef * RTCx,uint32_t Mask)2257 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
2258 {
2259 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS, Mask << RTC_ALRMBSSR_MASKSS_Pos);
2260 }
2261
2262 /**
2263 * @brief Get Alarm B subseconds mask
2264 * @rmtoll ALRMBSSR MASKSS LL_RTC_ALMB_GetSubSecondMask
2265 * @param RTCx RTC Instance
2266 * @retval Value between Min_Data=0x00 and Max_Data=0xF
2267 */
LL_RTC_ALMB_GetSubSecondMask(RTC_TypeDef * RTCx)2268 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecondMask(RTC_TypeDef *RTCx)
2269 {
2270 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS) >> RTC_ALRMBSSR_MASKSS_Pos);
2271 }
2272
2273 /**
2274 * @brief Set Alarm B subseconds value
2275 * @rmtoll ALRMBSSR SS LL_RTC_ALMB_SetSubSecond
2276 * @param RTCx RTC Instance
2277 * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
2278 * @retval None
2279 */
LL_RTC_ALMB_SetSubSecond(RTC_TypeDef * RTCx,uint32_t Subsecond)2280 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
2281 {
2282 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS, Subsecond);
2283 }
2284
2285 /**
2286 * @brief Get Alarm B subseconds value
2287 * @rmtoll ALRMBSSR SS LL_RTC_ALMB_GetSubSecond
2288 * @param RTCx RTC Instance
2289 * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
2290 */
LL_RTC_ALMB_GetSubSecond(RTC_TypeDef * RTCx)2291 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecond(RTC_TypeDef *RTCx)
2292 {
2293 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS));
2294 }
2295
2296 /**
2297 * @}
2298 */
2299
2300 /** @defgroup RTC_LL_EF_Timestamp Timestamp
2301 * @{
2302 */
2303
2304 /**
2305 * @brief Enable Timestamp
2306 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2307 * @rmtoll CR TSE LL_RTC_TS_Enable
2308 * @param RTCx RTC Instance
2309 * @retval None
2310 */
LL_RTC_TS_Enable(RTC_TypeDef * RTCx)2311 __STATIC_INLINE void LL_RTC_TS_Enable(RTC_TypeDef *RTCx)
2312 {
2313 SET_BIT(RTCx->CR, RTC_CR_TSE);
2314 }
2315
2316 /**
2317 * @brief Disable Timestamp
2318 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2319 * @rmtoll CR TSE LL_RTC_TS_Disable
2320 * @param RTCx RTC Instance
2321 * @retval None
2322 */
LL_RTC_TS_Disable(RTC_TypeDef * RTCx)2323 __STATIC_INLINE void LL_RTC_TS_Disable(RTC_TypeDef *RTCx)
2324 {
2325 CLEAR_BIT(RTCx->CR, RTC_CR_TSE);
2326 }
2327
2328 /**
2329 * @brief Set Time-stamp event active edge
2330 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2331 * @note TSE must be reset when TSEDGE is changed to avoid unwanted TSF setting
2332 * @rmtoll CR TSEDGE LL_RTC_TS_SetActiveEdge
2333 * @param RTCx RTC Instance
2334 * @param Edge This parameter can be one of the following values:
2335 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
2336 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
2337 * @retval None
2338 */
LL_RTC_TS_SetActiveEdge(RTC_TypeDef * RTCx,uint32_t Edge)2339 __STATIC_INLINE void LL_RTC_TS_SetActiveEdge(RTC_TypeDef *RTCx, uint32_t Edge)
2340 {
2341 MODIFY_REG(RTCx->CR, RTC_CR_TSEDGE, Edge);
2342 }
2343
2344 /**
2345 * @brief Get Time-stamp event active edge
2346 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2347 * @rmtoll CR TSEDGE LL_RTC_TS_GetActiveEdge
2348 * @param RTCx RTC Instance
2349 * @retval Returned value can be one of the following values:
2350 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
2351 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
2352 */
LL_RTC_TS_GetActiveEdge(RTC_TypeDef * RTCx)2353 __STATIC_INLINE uint32_t LL_RTC_TS_GetActiveEdge(RTC_TypeDef *RTCx)
2354 {
2355 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TSEDGE));
2356 }
2357
2358 /**
2359 * @brief Get Timestamp AM/PM notation (AM or 24-hour format)
2360 * @rmtoll TSTR PM LL_RTC_TS_GetTimeFormat
2361 * @param RTCx RTC Instance
2362 * @retval Returned value can be one of the following values:
2363 * @arg @ref LL_RTC_TS_TIME_FORMAT_AM
2364 * @arg @ref LL_RTC_TS_TIME_FORMAT_PM
2365 */
LL_RTC_TS_GetTimeFormat(RTC_TypeDef * RTCx)2366 __STATIC_INLINE uint32_t LL_RTC_TS_GetTimeFormat(RTC_TypeDef *RTCx)
2367 {
2368 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_PM));
2369 }
2370
2371 /**
2372 * @brief Get Timestamp Hours in BCD format
2373 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2374 * @rmtoll TSTR HT LL_RTC_TS_GetHour\n
2375 * TSTR HU LL_RTC_TS_GetHour
2376 * @param RTCx RTC Instance
2377 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2378 */
LL_RTC_TS_GetHour(RTC_TypeDef * RTCx)2379 __STATIC_INLINE uint32_t LL_RTC_TS_GetHour(RTC_TypeDef *RTCx)
2380 {
2381 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_HT | RTC_TSTR_HU) >> RTC_TSTR_HU_Pos);
2382 }
2383
2384 /**
2385 * @brief Get Timestamp Minutes in BCD format
2386 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2387 * @rmtoll TSTR MNT LL_RTC_TS_GetMinute\n
2388 * TSTR MNU LL_RTC_TS_GetMinute
2389 * @param RTCx RTC Instance
2390 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2391 */
LL_RTC_TS_GetMinute(RTC_TypeDef * RTCx)2392 __STATIC_INLINE uint32_t LL_RTC_TS_GetMinute(RTC_TypeDef *RTCx)
2393 {
2394 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_MNT | RTC_TSTR_MNU) >> RTC_TSTR_MNU_Pos);
2395 }
2396
2397 /**
2398 * @brief Get Timestamp Seconds in BCD format
2399 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2400 * @rmtoll TSTR ST LL_RTC_TS_GetSecond\n
2401 * TSTR SU LL_RTC_TS_GetSecond
2402 * @param RTCx RTC Instance
2403 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2404 */
LL_RTC_TS_GetSecond(RTC_TypeDef * RTCx)2405 __STATIC_INLINE uint32_t LL_RTC_TS_GetSecond(RTC_TypeDef *RTCx)
2406 {
2407 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_ST | RTC_TSTR_SU));
2408 }
2409
2410 /**
2411 * @brief Get Timestamp time (hour, minute and second) in BCD format
2412 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2413 * are available to get independently each parameter.
2414 * @rmtoll TSTR HT LL_RTC_TS_GetTime\n
2415 * TSTR HU LL_RTC_TS_GetTime\n
2416 * TSTR MNT LL_RTC_TS_GetTime\n
2417 * TSTR MNU LL_RTC_TS_GetTime\n
2418 * TSTR ST LL_RTC_TS_GetTime\n
2419 * TSTR SU LL_RTC_TS_GetTime
2420 * @param RTCx RTC Instance
2421 * @retval Combination of hours, minutes and seconds.
2422 */
LL_RTC_TS_GetTime(RTC_TypeDef * RTCx)2423 __STATIC_INLINE uint32_t LL_RTC_TS_GetTime(RTC_TypeDef *RTCx)
2424 {
2425 return (uint32_t)(READ_BIT(RTCx->TSTR,
2426 RTC_TSTR_HT | RTC_TSTR_HU | RTC_TSTR_MNT | RTC_TSTR_MNU | RTC_TSTR_ST | RTC_TSTR_SU));
2427 }
2428
2429 /**
2430 * @brief Get Timestamp Week day
2431 * @rmtoll TSDR WDU LL_RTC_TS_GetWeekDay
2432 * @param RTCx RTC Instance
2433 * @retval Returned value can be one of the following values:
2434 * @arg @ref LL_RTC_WEEKDAY_MONDAY
2435 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
2436 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2437 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
2438 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
2439 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
2440 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
2441 */
LL_RTC_TS_GetWeekDay(RTC_TypeDef * RTCx)2442 __STATIC_INLINE uint32_t LL_RTC_TS_GetWeekDay(RTC_TypeDef *RTCx)
2443 {
2444 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU) >> RTC_TSDR_WDU_Pos);
2445 }
2446
2447 /**
2448 * @brief Get Timestamp Month in BCD format
2449 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
2450 * @rmtoll TSDR MT LL_RTC_TS_GetMonth\n
2451 * TSDR MU LL_RTC_TS_GetMonth
2452 * @param RTCx RTC Instance
2453 * @retval Returned value can be one of the following values:
2454 * @arg @ref LL_RTC_MONTH_JANUARY
2455 * @arg @ref LL_RTC_MONTH_FEBRUARY
2456 * @arg @ref LL_RTC_MONTH_MARCH
2457 * @arg @ref LL_RTC_MONTH_APRIL
2458 * @arg @ref LL_RTC_MONTH_MAY
2459 * @arg @ref LL_RTC_MONTH_JUNE
2460 * @arg @ref LL_RTC_MONTH_JULY
2461 * @arg @ref LL_RTC_MONTH_AUGUST
2462 * @arg @ref LL_RTC_MONTH_SEPTEMBER
2463 * @arg @ref LL_RTC_MONTH_OCTOBER
2464 * @arg @ref LL_RTC_MONTH_NOVEMBER
2465 * @arg @ref LL_RTC_MONTH_DECEMBER
2466 */
LL_RTC_TS_GetMonth(RTC_TypeDef * RTCx)2467 __STATIC_INLINE uint32_t LL_RTC_TS_GetMonth(RTC_TypeDef *RTCx)
2468 {
2469 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_MT | RTC_TSDR_MU) >> RTC_TSDR_MU_Pos);
2470 }
2471
2472 /**
2473 * @brief Get Timestamp Day in BCD format
2474 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2475 * @rmtoll TSDR DT LL_RTC_TS_GetDay\n
2476 * TSDR DU LL_RTC_TS_GetDay
2477 * @param RTCx RTC Instance
2478 * @retval Value between Min_Data=0x01 and Max_Data=0x31
2479 */
LL_RTC_TS_GetDay(RTC_TypeDef * RTCx)2480 __STATIC_INLINE uint32_t LL_RTC_TS_GetDay(RTC_TypeDef *RTCx)
2481 {
2482 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_DT | RTC_TSDR_DU));
2483 }
2484
2485 /**
2486 * @brief Get Timestamp date (WeekDay, Day and Month) in BCD format
2487 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_MONTH,
2488 * and __LL_RTC_GET_DAY are available to get independently each parameter.
2489 * @rmtoll TSDR WDU LL_RTC_TS_GetDate\n
2490 * TSDR MT LL_RTC_TS_GetDate\n
2491 * TSDR MU LL_RTC_TS_GetDate\n
2492 * TSDR DT LL_RTC_TS_GetDate\n
2493 * TSDR DU LL_RTC_TS_GetDate
2494 * @param RTCx RTC Instance
2495 * @retval Combination of Weekday, Day and Month
2496 */
LL_RTC_TS_GetDate(RTC_TypeDef * RTCx)2497 __STATIC_INLINE uint32_t LL_RTC_TS_GetDate(RTC_TypeDef *RTCx)
2498 {
2499 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU | RTC_TSDR_MT | RTC_TSDR_MU | RTC_TSDR_DT | RTC_TSDR_DU));
2500 }
2501
2502 /**
2503 * @brief Get time-stamp subseconds value
2504 * @rmtoll TSSSR SS LL_RTC_TS_GetSubSecond
2505 * @param RTCx RTC Instance
2506 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
2507 */
LL_RTC_TS_GetSubSecond(RTC_TypeDef * RTCx)2508 __STATIC_INLINE uint32_t LL_RTC_TS_GetSubSecond(RTC_TypeDef *RTCx)
2509 {
2510 return (uint32_t)(READ_BIT(RTCx->TSSSR, RTC_TSSSR_SS));
2511 }
2512
2513 #if defined(RTC_TAMPCR_TAMPTS)
2514 /**
2515 * @brief Activate timestamp on tamper detection event
2516 * @rmtoll TAMPCR TAMPTS LL_RTC_TS_EnableOnTamper
2517 * @param RTCx RTC Instance
2518 * @retval None
2519 */
LL_RTC_TS_EnableOnTamper(RTC_TypeDef * RTCx)2520 __STATIC_INLINE void LL_RTC_TS_EnableOnTamper(RTC_TypeDef *RTCx)
2521 {
2522 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPTS);
2523 }
2524
2525 /**
2526 * @brief Disable timestamp on tamper detection event
2527 * @rmtoll TAMPCR TAMPTS LL_RTC_TS_DisableOnTamper
2528 * @param RTCx RTC Instance
2529 * @retval None
2530 */
LL_RTC_TS_DisableOnTamper(RTC_TypeDef * RTCx)2531 __STATIC_INLINE void LL_RTC_TS_DisableOnTamper(RTC_TypeDef *RTCx)
2532 {
2533 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPTS);
2534 }
2535 #endif /* RTC_TAMPCR_TAMPTS */
2536
2537 /**
2538 * @}
2539 */
2540
2541 /** @defgroup RTC_LL_EF_Tamper Tamper
2542 * @{
2543 */
2544
2545 /**
2546 * @brief Enable RTC_TAMPx input detection
2547 * @rmtoll TAMPCR TAMP1E LL_RTC_TAMPER_Enable\n
2548 * TAMPCR TAMP2E LL_RTC_TAMPER_Enable\n
2549 * TAMPCR TAMP3E LL_RTC_TAMPER_Enable
2550 * @param RTCx RTC Instance
2551 * @param Tamper This parameter can be a combination of the following values:
2552 * @arg @ref LL_RTC_TAMPER_1 (*)
2553 * @arg @ref LL_RTC_TAMPER_2
2554 * @arg @ref LL_RTC_TAMPER_3 (*)
2555 *
2556 * (*) value not applicable to all devices.
2557 * @retval None
2558 */
LL_RTC_TAMPER_Enable(RTC_TypeDef * RTCx,uint32_t Tamper)2559 __STATIC_INLINE void LL_RTC_TAMPER_Enable(RTC_TypeDef *RTCx, uint32_t Tamper)
2560 {
2561 SET_BIT(RTCx->TAMPCR, Tamper);
2562 }
2563
2564 /**
2565 * @brief Clear RTC_TAMPx input detection
2566 * @rmtoll TAMPCR TAMP1E LL_RTC_TAMPER_Disable\n
2567 * TAMPCR TAMP2E LL_RTC_TAMPER_Disable\n
2568 * TAMPCR TAMP3E LL_RTC_TAMPER_Disable
2569 * @param RTCx RTC Instance
2570 * @param Tamper This parameter can be a combination of the following values:
2571 * @arg @ref LL_RTC_TAMPER_1 (*)
2572 * @arg @ref LL_RTC_TAMPER_2
2573 * @arg @ref LL_RTC_TAMPER_3 (*)
2574 *
2575 * (*) value not applicable to all devices.
2576 * @retval None
2577 */
LL_RTC_TAMPER_Disable(RTC_TypeDef * RTCx,uint32_t Tamper)2578 __STATIC_INLINE void LL_RTC_TAMPER_Disable(RTC_TypeDef *RTCx, uint32_t Tamper)
2579 {
2580 CLEAR_BIT(RTCx->TAMPCR, Tamper);
2581 }
2582
2583 /**
2584 * @brief Enable Tamper mask flag
2585 * @note Associated Tamper IT must not enabled when tamper mask is set.
2586 * @rmtoll TAMPCR TAMP1MF LL_RTC_TAMPER_EnableMask\n
2587 * TAMPCR TAMP2MF LL_RTC_TAMPER_EnableMask\n
2588 * TAMPCR TAMP3MF LL_RTC_TAMPER_EnableMask
2589 * @param RTCx RTC Instance
2590 * @param Mask This parameter can be a combination of the following values:
2591 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER1 (*)
2592 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER2
2593 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER3 (*)
2594 *
2595 * (*) value not applicable to all devices.
2596 * @retval None
2597 */
LL_RTC_TAMPER_EnableMask(RTC_TypeDef * RTCx,uint32_t Mask)2598 __STATIC_INLINE void LL_RTC_TAMPER_EnableMask(RTC_TypeDef *RTCx, uint32_t Mask)
2599 {
2600 SET_BIT(RTCx->TAMPCR, Mask);
2601 }
2602
2603 /**
2604 * @brief Disable Tamper mask flag
2605 * @rmtoll TAMPCR TAMP1MF LL_RTC_TAMPER_DisableMask\n
2606 * TAMPCR TAMP2MF LL_RTC_TAMPER_DisableMask\n
2607 * TAMPCR TAMP3MF LL_RTC_TAMPER_DisableMask
2608 * @param RTCx RTC Instance
2609 * @param Mask This parameter can be a combination of the following values:
2610 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER1 (*)
2611 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER2
2612 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER3 (*)
2613 *
2614 * (*) value not applicable to all devices.
2615 * @retval None
2616 */
LL_RTC_TAMPER_DisableMask(RTC_TypeDef * RTCx,uint32_t Mask)2617 __STATIC_INLINE void LL_RTC_TAMPER_DisableMask(RTC_TypeDef *RTCx, uint32_t Mask)
2618 {
2619 CLEAR_BIT(RTCx->TAMPCR, Mask);
2620 }
2621
2622 /**
2623 * @brief Enable backup register erase after Tamper event detection
2624 * @rmtoll TAMPCR TAMP1NOERASE LL_RTC_TAMPER_EnableEraseBKP\n
2625 * TAMPCR TAMP2NOERASE LL_RTC_TAMPER_EnableEraseBKP\n
2626 * TAMPCR TAMP3NOERASE LL_RTC_TAMPER_EnableEraseBKP
2627 * @param RTCx RTC Instance
2628 * @param Tamper This parameter can be a combination of the following values:
2629 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1 (*)
2630 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2
2631 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER3 (*)
2632 *
2633 * (*) value not applicable to all devices.
2634 * @retval None
2635 */
LL_RTC_TAMPER_EnableEraseBKP(RTC_TypeDef * RTCx,uint32_t Tamper)2636 __STATIC_INLINE void LL_RTC_TAMPER_EnableEraseBKP(RTC_TypeDef *RTCx, uint32_t Tamper)
2637 {
2638 CLEAR_BIT(RTCx->TAMPCR, Tamper);
2639 }
2640
2641 /**
2642 * @brief Disable backup register erase after Tamper event detection
2643 * @rmtoll TAMPCR TAMP1NOERASE LL_RTC_TAMPER_DisableEraseBKP\n
2644 * TAMPCR TAMP2NOERASE LL_RTC_TAMPER_DisableEraseBKP\n
2645 * TAMPCR TAMP3NOERASE LL_RTC_TAMPER_DisableEraseBKP
2646 * @param RTCx RTC Instance
2647 * @param Tamper This parameter can be a combination of the following values:
2648 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1 (*)
2649 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2
2650 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER3 (*)
2651 *
2652 * (*) value not applicable to all devices.
2653 * @retval None
2654 */
LL_RTC_TAMPER_DisableEraseBKP(RTC_TypeDef * RTCx,uint32_t Tamper)2655 __STATIC_INLINE void LL_RTC_TAMPER_DisableEraseBKP(RTC_TypeDef *RTCx, uint32_t Tamper)
2656 {
2657 SET_BIT(RTCx->TAMPCR, Tamper);
2658 }
2659
2660 /**
2661 * @brief Disable RTC_TAMPx pull-up disable (Disable precharge of RTC_TAMPx pins)
2662 * @rmtoll TAMPCR TAMPPUDIS LL_RTC_TAMPER_DisablePullUp
2663 * @param RTCx RTC Instance
2664 * @retval None
2665 */
LL_RTC_TAMPER_DisablePullUp(RTC_TypeDef * RTCx)2666 __STATIC_INLINE void LL_RTC_TAMPER_DisablePullUp(RTC_TypeDef *RTCx)
2667 {
2668 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPPUDIS);
2669 }
2670
2671 /**
2672 * @brief Enable RTC_TAMPx pull-up disable ( Precharge RTC_TAMPx pins before sampling)
2673 * @rmtoll TAMPCR TAMPPUDIS LL_RTC_TAMPER_EnablePullUp
2674 * @param RTCx RTC Instance
2675 * @retval None
2676 */
LL_RTC_TAMPER_EnablePullUp(RTC_TypeDef * RTCx)2677 __STATIC_INLINE void LL_RTC_TAMPER_EnablePullUp(RTC_TypeDef *RTCx)
2678 {
2679 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPPUDIS);
2680 }
2681
2682 /**
2683 * @brief Set RTC_TAMPx precharge duration
2684 * @rmtoll TAMPCR TAMPPRCH LL_RTC_TAMPER_SetPrecharge
2685 * @param RTCx RTC Instance
2686 * @param Duration This parameter can be one of the following values:
2687 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
2688 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
2689 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
2690 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
2691 * @retval None
2692 */
LL_RTC_TAMPER_SetPrecharge(RTC_TypeDef * RTCx,uint32_t Duration)2693 __STATIC_INLINE void LL_RTC_TAMPER_SetPrecharge(RTC_TypeDef *RTCx, uint32_t Duration)
2694 {
2695 MODIFY_REG(RTCx->TAMPCR, RTC_TAMPCR_TAMPPRCH, Duration);
2696 }
2697
2698 /**
2699 * @brief Get RTC_TAMPx precharge duration
2700 * @rmtoll TAMPCR TAMPPRCH LL_RTC_TAMPER_GetPrecharge
2701 * @param RTCx RTC Instance
2702 * @retval Returned value can be one of the following values:
2703 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
2704 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
2705 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
2706 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
2707 */
LL_RTC_TAMPER_GetPrecharge(RTC_TypeDef * RTCx)2708 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPrecharge(RTC_TypeDef *RTCx)
2709 {
2710 return (uint32_t)(READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPPRCH));
2711 }
2712
2713 /**
2714 * @brief Set RTC_TAMPx filter count
2715 * @rmtoll TAMPCR TAMPFLT LL_RTC_TAMPER_SetFilterCount
2716 * @param RTCx RTC Instance
2717 * @param FilterCount This parameter can be one of the following values:
2718 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
2719 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
2720 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
2721 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
2722 * @retval None
2723 */
LL_RTC_TAMPER_SetFilterCount(RTC_TypeDef * RTCx,uint32_t FilterCount)2724 __STATIC_INLINE void LL_RTC_TAMPER_SetFilterCount(RTC_TypeDef *RTCx, uint32_t FilterCount)
2725 {
2726 MODIFY_REG(RTCx->TAMPCR, RTC_TAMPCR_TAMPFLT, FilterCount);
2727 }
2728
2729 /**
2730 * @brief Get RTC_TAMPx filter count
2731 * @rmtoll TAMPCR TAMPFLT LL_RTC_TAMPER_GetFilterCount
2732 * @param RTCx RTC Instance
2733 * @retval Returned value can be one of the following values:
2734 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
2735 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
2736 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
2737 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
2738 */
LL_RTC_TAMPER_GetFilterCount(RTC_TypeDef * RTCx)2739 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetFilterCount(RTC_TypeDef *RTCx)
2740 {
2741 return (uint32_t)(READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPFLT));
2742 }
2743
2744 /**
2745 * @brief Set Tamper sampling frequency
2746 * @rmtoll TAMPCR TAMPFREQ LL_RTC_TAMPER_SetSamplingFreq
2747 * @param RTCx RTC Instance
2748 * @param SamplingFreq This parameter can be one of the following values:
2749 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
2750 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
2751 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
2752 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
2753 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
2754 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
2755 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
2756 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
2757 * @retval None
2758 */
LL_RTC_TAMPER_SetSamplingFreq(RTC_TypeDef * RTCx,uint32_t SamplingFreq)2759 __STATIC_INLINE void LL_RTC_TAMPER_SetSamplingFreq(RTC_TypeDef *RTCx, uint32_t SamplingFreq)
2760 {
2761 MODIFY_REG(RTCx->TAMPCR, RTC_TAMPCR_TAMPFREQ, SamplingFreq);
2762 }
2763
2764 /**
2765 * @brief Get Tamper sampling frequency
2766 * @rmtoll TAMPCR TAMPFREQ LL_RTC_TAMPER_GetSamplingFreq
2767 * @param RTCx RTC Instance
2768 * @retval Returned value can be one of the following values:
2769 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
2770 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
2771 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
2772 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
2773 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
2774 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
2775 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
2776 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
2777 */
LL_RTC_TAMPER_GetSamplingFreq(RTC_TypeDef * RTCx)2778 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetSamplingFreq(RTC_TypeDef *RTCx)
2779 {
2780 return (uint32_t)(READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPFREQ));
2781 }
2782
2783 /**
2784 * @brief Enable Active level for Tamper input
2785 * @rmtoll TAMPCR TAMP1TRG LL_RTC_TAMPER_EnableActiveLevel\n
2786 * TAMPCR TAMP2TRG LL_RTC_TAMPER_EnableActiveLevel\n
2787 * TAMPCR TAMP3TRG LL_RTC_TAMPER_EnableActiveLevel
2788 * @param RTCx RTC Instance
2789 * @param Tamper This parameter can be a combination of the following values:
2790 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 (*)
2791 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2
2792 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 (*)
2793 *
2794 * (*) value not applicable to all devices.
2795 * @retval None
2796 */
LL_RTC_TAMPER_EnableActiveLevel(RTC_TypeDef * RTCx,uint32_t Tamper)2797 __STATIC_INLINE void LL_RTC_TAMPER_EnableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper)
2798 {
2799 SET_BIT(RTCx->TAMPCR, Tamper);
2800 }
2801
2802 /**
2803 * @brief Disable Active level for Tamper input
2804 * @rmtoll TAMPCR TAMP1TRG LL_RTC_TAMPER_DisableActiveLevel\n
2805 * TAMPCR TAMP2TRG LL_RTC_TAMPER_DisableActiveLevel\n
2806 * TAMPCR TAMP3TRG LL_RTC_TAMPER_DisableActiveLevel
2807 * @param RTCx RTC Instance
2808 * @param Tamper This parameter can be a combination of the following values:
2809 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 (*)
2810 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2
2811 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 (*)
2812 *
2813 * (*) value not applicable to all devices.
2814 * @retval None
2815 */
LL_RTC_TAMPER_DisableActiveLevel(RTC_TypeDef * RTCx,uint32_t Tamper)2816 __STATIC_INLINE void LL_RTC_TAMPER_DisableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper)
2817 {
2818 CLEAR_BIT(RTCx->TAMPCR, Tamper);
2819 }
2820
2821 /**
2822 * @}
2823 */
2824
2825 /** @defgroup RTC_LL_EF_Wakeup Wakeup
2826 * @{
2827 */
2828
2829 /**
2830 * @brief Enable Wakeup timer
2831 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2832 * @rmtoll CR WUTE LL_RTC_WAKEUP_Enable
2833 * @param RTCx RTC Instance
2834 * @retval None
2835 */
LL_RTC_WAKEUP_Enable(RTC_TypeDef * RTCx)2836 __STATIC_INLINE void LL_RTC_WAKEUP_Enable(RTC_TypeDef *RTCx)
2837 {
2838 SET_BIT(RTCx->CR, RTC_CR_WUTE);
2839 }
2840
2841 /**
2842 * @brief Disable Wakeup timer
2843 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2844 * @rmtoll CR WUTE LL_RTC_WAKEUP_Disable
2845 * @param RTCx RTC Instance
2846 * @retval None
2847 */
LL_RTC_WAKEUP_Disable(RTC_TypeDef * RTCx)2848 __STATIC_INLINE void LL_RTC_WAKEUP_Disable(RTC_TypeDef *RTCx)
2849 {
2850 CLEAR_BIT(RTCx->CR, RTC_CR_WUTE);
2851 }
2852
2853 /**
2854 * @brief Check if Wakeup timer is enabled or not
2855 * @rmtoll CR WUTE LL_RTC_WAKEUP_IsEnabled
2856 * @param RTCx RTC Instance
2857 * @retval State of bit (1 or 0).
2858 */
LL_RTC_WAKEUP_IsEnabled(RTC_TypeDef * RTCx)2859 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_IsEnabled(RTC_TypeDef *RTCx)
2860 {
2861 return ((READ_BIT(RTCx->CR, RTC_CR_WUTE) == (RTC_CR_WUTE)) ? 1UL : 0UL);
2862 }
2863
2864 /**
2865 * @brief Select Wakeup clock
2866 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2867 * @note Bit can be written only when RTC_CR WUTE bit = 0 and RTC_ISR WUTWF bit = 1
2868 * @rmtoll CR WUCKSEL LL_RTC_WAKEUP_SetClock
2869 * @param RTCx RTC Instance
2870 * @param WakeupClock This parameter can be one of the following values:
2871 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
2872 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
2873 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
2874 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
2875 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
2876 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
2877 * @retval None
2878 */
LL_RTC_WAKEUP_SetClock(RTC_TypeDef * RTCx,uint32_t WakeupClock)2879 __STATIC_INLINE void LL_RTC_WAKEUP_SetClock(RTC_TypeDef *RTCx, uint32_t WakeupClock)
2880 {
2881 MODIFY_REG(RTCx->CR, RTC_CR_WUCKSEL, WakeupClock);
2882 }
2883
2884 /**
2885 * @brief Get Wakeup clock
2886 * @rmtoll CR WUCKSEL LL_RTC_WAKEUP_GetClock
2887 * @param RTCx RTC Instance
2888 * @retval Returned value can be one of the following values:
2889 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
2890 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
2891 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
2892 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
2893 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
2894 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
2895 */
LL_RTC_WAKEUP_GetClock(RTC_TypeDef * RTCx)2896 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetClock(RTC_TypeDef *RTCx)
2897 {
2898 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_WUCKSEL));
2899 }
2900
2901 /**
2902 * @brief Set Wakeup auto-reload value
2903 * @note Bit can be written only when WUTWF is set to 1 in RTC_ISR
2904 * @rmtoll WUTR WUT LL_RTC_WAKEUP_SetAutoReload
2905 * @param RTCx RTC Instance
2906 * @param Value Value between Min_Data=0x00 and Max_Data=0xFFFF
2907 * @retval None
2908 */
LL_RTC_WAKEUP_SetAutoReload(RTC_TypeDef * RTCx,uint32_t Value)2909 __STATIC_INLINE void LL_RTC_WAKEUP_SetAutoReload(RTC_TypeDef *RTCx, uint32_t Value)
2910 {
2911 MODIFY_REG(RTCx->WUTR, RTC_WUTR_WUT, Value);
2912 }
2913
2914 /**
2915 * @brief Get Wakeup auto-reload value
2916 * @rmtoll WUTR WUT LL_RTC_WAKEUP_GetAutoReload
2917 * @param RTCx RTC Instance
2918 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
2919 */
LL_RTC_WAKEUP_GetAutoReload(RTC_TypeDef * RTCx)2920 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetAutoReload(RTC_TypeDef *RTCx)
2921 {
2922 return (uint32_t)(READ_BIT(RTCx->WUTR, RTC_WUTR_WUT));
2923 }
2924
2925 /**
2926 * @}
2927 */
2928
2929 /** @defgroup RTC_LL_EF_Backup_Registers Backup_Registers
2930 * @{
2931 */
2932
2933 /**
2934 * @brief Writes a data in a specified RTC Backup data register.
2935 * @rmtoll BKPxR BKP LL_RTC_BAK_SetRegister
2936 * @param RTCx RTC Instance
2937 * @param BackupRegister This parameter can be one of the following values:
2938 * @arg @ref LL_RTC_BKP_DR0
2939 * @arg @ref LL_RTC_BKP_DR1
2940 * @arg @ref LL_RTC_BKP_DR2
2941 * @arg @ref LL_RTC_BKP_DR3
2942 * @arg @ref LL_RTC_BKP_DR4
2943 * @param Data Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
2944 * @retval None
2945 */
LL_RTC_BAK_SetRegister(RTC_TypeDef * RTCx,uint32_t BackupRegister,uint32_t Data)2946 __STATIC_INLINE void LL_RTC_BAK_SetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister, uint32_t Data)
2947 {
2948 uint32_t temp;
2949
2950 temp = (uint32_t)(&(RTCx->BKP0R));
2951 temp += (BackupRegister * 4U);
2952
2953 /* Write the specified register */
2954 *(__IO uint32_t *)temp = (uint32_t)Data;
2955 }
2956
2957 /**
2958 * @brief Reads data from the specified RTC Backup data Register.
2959 * @rmtoll BKPxR BKP LL_RTC_BAK_GetRegister
2960 * @param RTCx RTC Instance
2961 * @param BackupRegister This parameter can be one of the following values:
2962 * @arg @ref LL_RTC_BKP_DR0
2963 * @arg @ref LL_RTC_BKP_DR1
2964 * @arg @ref LL_RTC_BKP_DR2
2965 * @arg @ref LL_RTC_BKP_DR3
2966 * @arg @ref LL_RTC_BKP_DR4
2967 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
2968 */
LL_RTC_BAK_GetRegister(RTC_TypeDef * RTCx,uint32_t BackupRegister)2969 __STATIC_INLINE uint32_t LL_RTC_BAK_GetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister)
2970 {
2971 uint32_t temp;
2972
2973 temp = (uint32_t)(&(RTCx->BKP0R));
2974 temp += (BackupRegister * 4U);
2975
2976 /* Read the specified register */
2977 return (*(__IO uint32_t *)temp);
2978 }
2979
2980 /**
2981 * @}
2982 */
2983
2984 /** @defgroup RTC_LL_EF_Calibration Calibration
2985 * @{
2986 */
2987
2988 /**
2989 * @brief Set Calibration output frequency (1 Hz or 512 Hz)
2990 * @note Bits are write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2991 * @rmtoll CR COE LL_RTC_CAL_SetOutputFreq\n
2992 * CR COSEL LL_RTC_CAL_SetOutputFreq
2993 * @param RTCx RTC Instance
2994 * @param Frequency This parameter can be one of the following values:
2995 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE
2996 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ
2997 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
2998 *
2999 * @retval None
3000 */
LL_RTC_CAL_SetOutputFreq(RTC_TypeDef * RTCx,uint32_t Frequency)3001 __STATIC_INLINE void LL_RTC_CAL_SetOutputFreq(RTC_TypeDef *RTCx, uint32_t Frequency)
3002 {
3003 MODIFY_REG(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL, Frequency);
3004 }
3005
3006 /**
3007 * @brief Get Calibration output frequency (1 Hz or 512 Hz)
3008 * @rmtoll CR COE LL_RTC_CAL_GetOutputFreq\n
3009 * CR COSEL LL_RTC_CAL_GetOutputFreq
3010 * @param RTCx RTC Instance
3011 * @retval Returned value can be one of the following values:
3012 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE
3013 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ
3014 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
3015 *
3016 */
LL_RTC_CAL_GetOutputFreq(RTC_TypeDef * RTCx)3017 __STATIC_INLINE uint32_t LL_RTC_CAL_GetOutputFreq(RTC_TypeDef *RTCx)
3018 {
3019 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL));
3020 }
3021
3022 /**
3023 * @brief Insert or not One RTCCLK pulse every 2exp11 pulses (frequency increased by 488.5 ppm)
3024 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3025 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR
3026 * @rmtoll CALR CALP LL_RTC_CAL_SetPulse
3027 * @param RTCx RTC Instance
3028 * @param Pulse This parameter can be one of the following values:
3029 * @arg @ref LL_RTC_CALIB_INSERTPULSE_NONE
3030 * @arg @ref LL_RTC_CALIB_INSERTPULSE_SET
3031 * @retval None
3032 */
LL_RTC_CAL_SetPulse(RTC_TypeDef * RTCx,uint32_t Pulse)3033 __STATIC_INLINE void LL_RTC_CAL_SetPulse(RTC_TypeDef *RTCx, uint32_t Pulse)
3034 {
3035 MODIFY_REG(RTCx->CALR, RTC_CALR_CALP, Pulse);
3036 }
3037
3038 /**
3039 * @brief Check if one RTCCLK has been inserted or not every 2exp11 pulses (frequency increased by 488.5 ppm)
3040 * @rmtoll CALR CALP LL_RTC_CAL_IsPulseInserted
3041 * @param RTCx RTC Instance
3042 * @retval State of bit (1 or 0).
3043 */
LL_RTC_CAL_IsPulseInserted(RTC_TypeDef * RTCx)3044 __STATIC_INLINE uint32_t LL_RTC_CAL_IsPulseInserted(RTC_TypeDef *RTCx)
3045 {
3046 return ((READ_BIT(RTCx->CALR, RTC_CALR_CALP) == (RTC_CALR_CALP)) ? 1UL : 0UL);
3047 }
3048
3049 /**
3050 * @brief Set smooth calibration cycle period
3051 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3052 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR
3053 * @rmtoll CALR CALW8 LL_RTC_CAL_SetPeriod\n
3054 * CALR CALW16 LL_RTC_CAL_SetPeriod
3055 * @param RTCx RTC Instance
3056 * @param Period This parameter can be one of the following values:
3057 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC
3058 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC
3059 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC
3060 * @retval None
3061 */
LL_RTC_CAL_SetPeriod(RTC_TypeDef * RTCx,uint32_t Period)3062 __STATIC_INLINE void LL_RTC_CAL_SetPeriod(RTC_TypeDef *RTCx, uint32_t Period)
3063 {
3064 MODIFY_REG(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16, Period);
3065 }
3066
3067 /**
3068 * @brief Get smooth calibration cycle period
3069 * @rmtoll CALR CALW8 LL_RTC_CAL_GetPeriod\n
3070 * CALR CALW16 LL_RTC_CAL_GetPeriod
3071 * @param RTCx RTC Instance
3072 * @retval Returned value can be one of the following values:
3073 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC
3074 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC
3075 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC
3076 */
LL_RTC_CAL_GetPeriod(RTC_TypeDef * RTCx)3077 __STATIC_INLINE uint32_t LL_RTC_CAL_GetPeriod(RTC_TypeDef *RTCx)
3078 {
3079 return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16));
3080 }
3081
3082 /**
3083 * @brief Set smooth Calibration minus
3084 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3085 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR
3086 * @rmtoll CALR CALM LL_RTC_CAL_SetMinus
3087 * @param RTCx RTC Instance
3088 * @param CalibMinus Value between Min_Data=0x00 and Max_Data=0x1FF
3089 * @retval None
3090 */
LL_RTC_CAL_SetMinus(RTC_TypeDef * RTCx,uint32_t CalibMinus)3091 __STATIC_INLINE void LL_RTC_CAL_SetMinus(RTC_TypeDef *RTCx, uint32_t CalibMinus)
3092 {
3093 MODIFY_REG(RTCx->CALR, RTC_CALR_CALM, CalibMinus);
3094 }
3095
3096 /**
3097 * @brief Get smooth Calibration minus
3098 * @rmtoll CALR CALM LL_RTC_CAL_GetMinus
3099 * @param RTCx RTC Instance
3100 * @retval Value between Min_Data=0x00 and Max_Data= 0x1FF
3101 */
LL_RTC_CAL_GetMinus(RTC_TypeDef * RTCx)3102 __STATIC_INLINE uint32_t LL_RTC_CAL_GetMinus(RTC_TypeDef *RTCx)
3103 {
3104 return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALM));
3105 }
3106
3107 /**
3108 * @}
3109 */
3110
3111 /** @defgroup RTC_LL_EF_FLAG_Management FLAG_Management
3112 * @{
3113 */
3114
3115 /**
3116 * @brief Get Recalibration pending Flag
3117 * @rmtoll ISR RECALPF LL_RTC_IsActiveFlag_RECALP
3118 * @param RTCx RTC Instance
3119 * @retval State of bit (1 or 0).
3120 */
LL_RTC_IsActiveFlag_RECALP(RTC_TypeDef * RTCx)3121 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RECALP(RTC_TypeDef *RTCx)
3122 {
3123 return ((READ_BIT(RTCx->ISR, RTC_ISR_RECALPF) == (RTC_ISR_RECALPF)) ? 1UL : 0UL);
3124 }
3125
3126 #if defined(RTC_TAMPER3_SUPPORT)
3127 /**
3128 * @brief Get RTC_TAMP3 detection flag
3129 * @rmtoll ISR TAMP3F LL_RTC_IsActiveFlag_TAMP3
3130 * @param RTCx RTC Instance
3131 * @retval State of bit (1 or 0).
3132 */
LL_RTC_IsActiveFlag_TAMP3(RTC_TypeDef * RTCx)3133 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3(RTC_TypeDef *RTCx)
3134 {
3135 return ((READ_BIT(RTCx->ISR, RTC_ISR_TAMP3F) == (RTC_ISR_TAMP3F)) ? 1UL : 0UL);
3136 }
3137 #endif /* RTC_TAMPER3_SUPPORT */
3138
3139 /**
3140 * @brief Get RTC_TAMP2 detection flag
3141 * @rmtoll ISR TAMP2F LL_RTC_IsActiveFlag_TAMP2
3142 * @param RTCx RTC Instance
3143 * @retval State of bit (1 or 0).
3144 */
LL_RTC_IsActiveFlag_TAMP2(RTC_TypeDef * RTCx)3145 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2(RTC_TypeDef *RTCx)
3146 {
3147 return ((READ_BIT(RTCx->ISR, RTC_ISR_TAMP2F) == (RTC_ISR_TAMP2F)) ? 1UL : 0UL);
3148 }
3149
3150 #if defined(RTC_TAMPER1_SUPPORT)
3151 /**
3152 * @brief Get RTC_TAMP1 detection flag
3153 * @rmtoll ISR TAMP1F LL_RTC_IsActiveFlag_TAMP1
3154 * @param RTCx RTC Instance
3155 * @retval State of bit (1 or 0).
3156 */
LL_RTC_IsActiveFlag_TAMP1(RTC_TypeDef * RTCx)3157 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1(RTC_TypeDef *RTCx)
3158 {
3159 return ((READ_BIT(RTCx->ISR, RTC_ISR_TAMP1F) == (RTC_ISR_TAMP1F)) ? 1UL : 0UL);
3160 }
3161 #endif /* RTC_TAMPER1_SUPPORT */
3162
3163 /**
3164 * @brief Get Time-stamp overflow flag
3165 * @rmtoll ISR TSOVF LL_RTC_IsActiveFlag_TSOV
3166 * @param RTCx RTC Instance
3167 * @retval State of bit (1 or 0).
3168 */
LL_RTC_IsActiveFlag_TSOV(RTC_TypeDef * RTCx)3169 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOV(RTC_TypeDef *RTCx)
3170 {
3171 return ((READ_BIT(RTCx->ISR, RTC_ISR_TSOVF) == (RTC_ISR_TSOVF)) ? 1UL : 0UL);
3172 }
3173
3174 /**
3175 * @brief Get Time-stamp flag
3176 * @rmtoll ISR TSF LL_RTC_IsActiveFlag_TS
3177 * @param RTCx RTC Instance
3178 * @retval State of bit (1 or 0).
3179 */
LL_RTC_IsActiveFlag_TS(RTC_TypeDef * RTCx)3180 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TS(RTC_TypeDef *RTCx)
3181 {
3182 return ((READ_BIT(RTCx->ISR, RTC_ISR_TSF) == (RTC_ISR_TSF)) ? 1UL : 0UL);
3183 }
3184
3185 /**
3186 * @brief Get Wakeup timer flag
3187 * @rmtoll ISR WUTF LL_RTC_IsActiveFlag_WUT
3188 * @param RTCx RTC Instance
3189 * @retval State of bit (1 or 0).
3190 */
LL_RTC_IsActiveFlag_WUT(RTC_TypeDef * RTCx)3191 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUT(RTC_TypeDef *RTCx)
3192 {
3193 return ((READ_BIT(RTCx->ISR, RTC_ISR_WUTF) == (RTC_ISR_WUTF)) ? 1UL : 0UL);
3194 }
3195
3196 /**
3197 * @brief Get Alarm B flag
3198 * @rmtoll ISR ALRBF LL_RTC_IsActiveFlag_ALRB
3199 * @param RTCx RTC Instance
3200 * @retval State of bit (1 or 0).
3201 */
LL_RTC_IsActiveFlag_ALRB(RTC_TypeDef * RTCx)3202 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRB(RTC_TypeDef *RTCx)
3203 {
3204 return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRBF) == (RTC_ISR_ALRBF)) ? 1UL : 0UL);
3205 }
3206
3207 /**
3208 * @brief Get Alarm A flag
3209 * @rmtoll ISR ALRAF LL_RTC_IsActiveFlag_ALRA
3210 * @param RTCx RTC Instance
3211 * @retval State of bit (1 or 0).
3212 */
LL_RTC_IsActiveFlag_ALRA(RTC_TypeDef * RTCx)3213 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRA(RTC_TypeDef *RTCx)
3214 {
3215 return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRAF) == (RTC_ISR_ALRAF)) ? 1UL : 0UL);
3216 }
3217
3218 #if defined(RTC_TAMPER3_SUPPORT)
3219 /**
3220 * @brief Clear RTC_TAMP3 detection flag
3221 * @rmtoll ISR TAMP3F LL_RTC_ClearFlag_TAMP3
3222 * @param RTCx RTC Instance
3223 * @retval None
3224 */
LL_RTC_ClearFlag_TAMP3(RTC_TypeDef * RTCx)3225 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP3(RTC_TypeDef *RTCx)
3226 {
3227 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP3F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3228 }
3229 #endif /* RTC_TAMPER3_SUPPORT */
3230
3231 /**
3232 * @brief Clear RTC_TAMP2 detection flag
3233 * @rmtoll ISR TAMP2F LL_RTC_ClearFlag_TAMP2
3234 * @param RTCx RTC Instance
3235 * @retval None
3236 */
LL_RTC_ClearFlag_TAMP2(RTC_TypeDef * RTCx)3237 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP2(RTC_TypeDef *RTCx)
3238 {
3239 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP2F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3240 }
3241
3242 #if defined(RTC_TAMPER1_SUPPORT)
3243 /**
3244 * @brief Clear RTC_TAMP1 detection flag
3245 * @rmtoll ISR TAMP1F LL_RTC_ClearFlag_TAMP1
3246 * @param RTCx RTC Instance
3247 * @retval None
3248 */
LL_RTC_ClearFlag_TAMP1(RTC_TypeDef * RTCx)3249 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP1(RTC_TypeDef *RTCx)
3250 {
3251 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP1F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3252 }
3253 #endif /* RTC_TAMPER1_SUPPORT */
3254
3255 /**
3256 * @brief Clear Time-stamp overflow flag
3257 * @rmtoll ISR TSOVF LL_RTC_ClearFlag_TSOV
3258 * @param RTCx RTC Instance
3259 * @retval None
3260 */
LL_RTC_ClearFlag_TSOV(RTC_TypeDef * RTCx)3261 __STATIC_INLINE void LL_RTC_ClearFlag_TSOV(RTC_TypeDef *RTCx)
3262 {
3263 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSOVF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3264 }
3265
3266 /**
3267 * @brief Clear Time-stamp flag
3268 * @rmtoll ISR TSF LL_RTC_ClearFlag_TS
3269 * @param RTCx RTC Instance
3270 * @retval None
3271 */
LL_RTC_ClearFlag_TS(RTC_TypeDef * RTCx)3272 __STATIC_INLINE void LL_RTC_ClearFlag_TS(RTC_TypeDef *RTCx)
3273 {
3274 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3275 }
3276
3277 /**
3278 * @brief Clear Wakeup timer flag
3279 * @rmtoll ISR WUTF LL_RTC_ClearFlag_WUT
3280 * @param RTCx RTC Instance
3281 * @retval None
3282 */
LL_RTC_ClearFlag_WUT(RTC_TypeDef * RTCx)3283 __STATIC_INLINE void LL_RTC_ClearFlag_WUT(RTC_TypeDef *RTCx)
3284 {
3285 WRITE_REG(RTCx->ISR, (~((RTC_ISR_WUTF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3286 }
3287
3288 /**
3289 * @brief Clear Alarm B flag
3290 * @rmtoll ISR ALRBF LL_RTC_ClearFlag_ALRB
3291 * @param RTCx RTC Instance
3292 * @retval None
3293 */
LL_RTC_ClearFlag_ALRB(RTC_TypeDef * RTCx)3294 __STATIC_INLINE void LL_RTC_ClearFlag_ALRB(RTC_TypeDef *RTCx)
3295 {
3296 WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRBF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3297 }
3298
3299 /**
3300 * @brief Clear Alarm A flag
3301 * @rmtoll ISR ALRAF LL_RTC_ClearFlag_ALRA
3302 * @param RTCx RTC Instance
3303 * @retval None
3304 */
LL_RTC_ClearFlag_ALRA(RTC_TypeDef * RTCx)3305 __STATIC_INLINE void LL_RTC_ClearFlag_ALRA(RTC_TypeDef *RTCx)
3306 {
3307 WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRAF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3308 }
3309
3310 /**
3311 * @brief Get Initialization flag
3312 * @rmtoll ISR INITF LL_RTC_IsActiveFlag_INIT
3313 * @param RTCx RTC Instance
3314 * @retval State of bit (1 or 0).
3315 */
LL_RTC_IsActiveFlag_INIT(RTC_TypeDef * RTCx)3316 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INIT(RTC_TypeDef *RTCx)
3317 {
3318 return ((READ_BIT(RTCx->ISR, RTC_ISR_INITF) == (RTC_ISR_INITF)) ? 1UL : 0UL);
3319 }
3320
3321 /**
3322 * @brief Get Registers synchronization flag
3323 * @rmtoll ISR RSF LL_RTC_IsActiveFlag_RS
3324 * @param RTCx RTC Instance
3325 * @retval State of bit (1 or 0).
3326 */
LL_RTC_IsActiveFlag_RS(RTC_TypeDef * RTCx)3327 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RS(RTC_TypeDef *RTCx)
3328 {
3329 return ((READ_BIT(RTCx->ISR, RTC_ISR_RSF) == (RTC_ISR_RSF)) ? 1UL : 0UL);
3330 }
3331
3332 /**
3333 * @brief Clear Registers synchronization flag
3334 * @rmtoll ISR RSF LL_RTC_ClearFlag_RS
3335 * @param RTCx RTC Instance
3336 * @retval None
3337 */
LL_RTC_ClearFlag_RS(RTC_TypeDef * RTCx)3338 __STATIC_INLINE void LL_RTC_ClearFlag_RS(RTC_TypeDef *RTCx)
3339 {
3340 WRITE_REG(RTCx->ISR, (~((RTC_ISR_RSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3341 }
3342
3343 /**
3344 * @brief Get Initialization status flag
3345 * @rmtoll ISR INITS LL_RTC_IsActiveFlag_INITS
3346 * @param RTCx RTC Instance
3347 * @retval State of bit (1 or 0).
3348 */
LL_RTC_IsActiveFlag_INITS(RTC_TypeDef * RTCx)3349 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INITS(RTC_TypeDef *RTCx)
3350 {
3351 return ((READ_BIT(RTCx->ISR, RTC_ISR_INITS) == (RTC_ISR_INITS)) ? 1UL : 0UL);
3352 }
3353
3354 /**
3355 * @brief Get Shift operation pending flag
3356 * @rmtoll ISR SHPF LL_RTC_IsActiveFlag_SHP
3357 * @param RTCx RTC Instance
3358 * @retval State of bit (1 or 0).
3359 */
LL_RTC_IsActiveFlag_SHP(RTC_TypeDef * RTCx)3360 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SHP(RTC_TypeDef *RTCx)
3361 {
3362 return ((READ_BIT(RTCx->ISR, RTC_ISR_SHPF) == (RTC_ISR_SHPF)) ? 1UL : 0UL);
3363 }
3364
3365 /**
3366 * @brief Get Wakeup timer write flag
3367 * @rmtoll ISR WUTWF LL_RTC_IsActiveFlag_WUTW
3368 * @param RTCx RTC Instance
3369 * @retval State of bit (1 or 0).
3370 */
LL_RTC_IsActiveFlag_WUTW(RTC_TypeDef * RTCx)3371 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTW(RTC_TypeDef *RTCx)
3372 {
3373 return ((READ_BIT(RTCx->ISR, RTC_ISR_WUTWF) == (RTC_ISR_WUTWF)) ? 1UL : 0UL);
3374 }
3375
3376 /**
3377 * @brief Get Alarm B write flag
3378 * @rmtoll ISR ALRBWF LL_RTC_IsActiveFlag_ALRBW
3379 * @param RTCx RTC Instance
3380 * @retval State of bit (1 or 0).
3381 */
LL_RTC_IsActiveFlag_ALRBW(RTC_TypeDef * RTCx)3382 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBW(RTC_TypeDef *RTCx)
3383 {
3384 return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRBWF) == (RTC_ISR_ALRBWF)) ? 1UL : 0UL);
3385 }
3386
3387 /**
3388 * @brief Get Alarm A write flag
3389 * @rmtoll ISR ALRAWF LL_RTC_IsActiveFlag_ALRAW
3390 * @param RTCx RTC Instance
3391 * @retval State of bit (1 or 0).
3392 */
LL_RTC_IsActiveFlag_ALRAW(RTC_TypeDef * RTCx)3393 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAW(RTC_TypeDef *RTCx)
3394 {
3395 return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRAWF) == (RTC_ISR_ALRAWF)) ? 1UL : 0UL);
3396 }
3397
3398 /**
3399 * @}
3400 */
3401
3402 /** @defgroup RTC_LL_EF_IT_Management IT_Management
3403 * @{
3404 */
3405
3406 /**
3407 * @brief Enable Time-stamp interrupt
3408 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3409 * @rmtoll CR TSIE LL_RTC_EnableIT_TS
3410 * @param RTCx RTC Instance
3411 * @retval None
3412 */
LL_RTC_EnableIT_TS(RTC_TypeDef * RTCx)3413 __STATIC_INLINE void LL_RTC_EnableIT_TS(RTC_TypeDef *RTCx)
3414 {
3415 SET_BIT(RTCx->CR, RTC_CR_TSIE);
3416 }
3417
3418 /**
3419 * @brief Disable Time-stamp interrupt
3420 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3421 * @rmtoll CR TSIE LL_RTC_DisableIT_TS
3422 * @param RTCx RTC Instance
3423 * @retval None
3424 */
LL_RTC_DisableIT_TS(RTC_TypeDef * RTCx)3425 __STATIC_INLINE void LL_RTC_DisableIT_TS(RTC_TypeDef *RTCx)
3426 {
3427 CLEAR_BIT(RTCx->CR, RTC_CR_TSIE);
3428 }
3429
3430 /**
3431 * @brief Enable Wakeup timer interrupt
3432 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3433 * @rmtoll CR WUTIE LL_RTC_EnableIT_WUT
3434 * @param RTCx RTC Instance
3435 * @retval None
3436 */
LL_RTC_EnableIT_WUT(RTC_TypeDef * RTCx)3437 __STATIC_INLINE void LL_RTC_EnableIT_WUT(RTC_TypeDef *RTCx)
3438 {
3439 SET_BIT(RTCx->CR, RTC_CR_WUTIE);
3440 }
3441
3442 /**
3443 * @brief Disable Wakeup timer interrupt
3444 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3445 * @rmtoll CR WUTIE LL_RTC_DisableIT_WUT
3446 * @param RTCx RTC Instance
3447 * @retval None
3448 */
LL_RTC_DisableIT_WUT(RTC_TypeDef * RTCx)3449 __STATIC_INLINE void LL_RTC_DisableIT_WUT(RTC_TypeDef *RTCx)
3450 {
3451 CLEAR_BIT(RTCx->CR, RTC_CR_WUTIE);
3452 }
3453
3454 /**
3455 * @brief Enable Alarm B interrupt
3456 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3457 * @rmtoll CR ALRBIE LL_RTC_EnableIT_ALRB
3458 * @param RTCx RTC Instance
3459 * @retval None
3460 */
LL_RTC_EnableIT_ALRB(RTC_TypeDef * RTCx)3461 __STATIC_INLINE void LL_RTC_EnableIT_ALRB(RTC_TypeDef *RTCx)
3462 {
3463 SET_BIT(RTCx->CR, RTC_CR_ALRBIE);
3464 }
3465
3466 /**
3467 * @brief Disable Alarm B interrupt
3468 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3469 * @rmtoll CR ALRBIE LL_RTC_DisableIT_ALRB
3470 * @param RTCx RTC Instance
3471 * @retval None
3472 */
LL_RTC_DisableIT_ALRB(RTC_TypeDef * RTCx)3473 __STATIC_INLINE void LL_RTC_DisableIT_ALRB(RTC_TypeDef *RTCx)
3474 {
3475 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBIE);
3476 }
3477
3478 /**
3479 * @brief Enable Alarm A interrupt
3480 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3481 * @rmtoll CR ALRAIE LL_RTC_EnableIT_ALRA
3482 * @param RTCx RTC Instance
3483 * @retval None
3484 */
LL_RTC_EnableIT_ALRA(RTC_TypeDef * RTCx)3485 __STATIC_INLINE void LL_RTC_EnableIT_ALRA(RTC_TypeDef *RTCx)
3486 {
3487 SET_BIT(RTCx->CR, RTC_CR_ALRAIE);
3488 }
3489
3490 /**
3491 * @brief Disable Alarm A interrupt
3492 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3493 * @rmtoll CR ALRAIE LL_RTC_DisableIT_ALRA
3494 * @param RTCx RTC Instance
3495 * @retval None
3496 */
LL_RTC_DisableIT_ALRA(RTC_TypeDef * RTCx)3497 __STATIC_INLINE void LL_RTC_DisableIT_ALRA(RTC_TypeDef *RTCx)
3498 {
3499 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAIE);
3500 }
3501
3502 #if defined(RTC_TAMPER3_SUPPORT)
3503 /**
3504 * @brief Enable Tamper 3 interrupt
3505 * @rmtoll TAMPCR TAMP3IE LL_RTC_EnableIT_TAMP3
3506 * @param RTCx RTC Instance
3507 * @retval None
3508 */
LL_RTC_EnableIT_TAMP3(RTC_TypeDef * RTCx)3509 __STATIC_INLINE void LL_RTC_EnableIT_TAMP3(RTC_TypeDef *RTCx)
3510 {
3511 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP3IE);
3512 }
3513
3514 /**
3515 * @brief Disable Tamper 3 interrupt
3516 * @rmtoll TAMPCR TAMP3IE LL_RTC_DisableIT_TAMP3
3517 * @param RTCx RTC Instance
3518 * @retval None
3519 */
LL_RTC_DisableIT_TAMP3(RTC_TypeDef * RTCx)3520 __STATIC_INLINE void LL_RTC_DisableIT_TAMP3(RTC_TypeDef *RTCx)
3521 {
3522 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP3IE);
3523 }
3524 #endif /* RTC_TAMPER3_SUPPORT */
3525
3526 /**
3527 * @brief Enable Tamper 2 interrupt
3528 * @rmtoll TAMPCR TAMP2IE LL_RTC_EnableIT_TAMP2
3529 * @param RTCx RTC Instance
3530 * @retval None
3531 */
LL_RTC_EnableIT_TAMP2(RTC_TypeDef * RTCx)3532 __STATIC_INLINE void LL_RTC_EnableIT_TAMP2(RTC_TypeDef *RTCx)
3533 {
3534 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP2IE);
3535 }
3536
3537 /**
3538 * @brief Disable Tamper 2 interrupt
3539 * @rmtoll TAMPCR TAMP2IE LL_RTC_DisableIT_TAMP2
3540 * @param RTCx RTC Instance
3541 * @retval None
3542 */
LL_RTC_DisableIT_TAMP2(RTC_TypeDef * RTCx)3543 __STATIC_INLINE void LL_RTC_DisableIT_TAMP2(RTC_TypeDef *RTCx)
3544 {
3545 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP2IE);
3546 }
3547
3548 #if defined(RTC_TAMPER1_SUPPORT)
3549 /**
3550 * @brief Enable Tamper 1 interrupt
3551 * @rmtoll TAMPCR TAMP1IE LL_RTC_EnableIT_TAMP1
3552 * @param RTCx RTC Instance
3553 * @retval None
3554 */
LL_RTC_EnableIT_TAMP1(RTC_TypeDef * RTCx)3555 __STATIC_INLINE void LL_RTC_EnableIT_TAMP1(RTC_TypeDef *RTCx)
3556 {
3557 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP1IE);
3558 }
3559
3560 /**
3561 * @brief Disable Tamper 1 interrupt
3562 * @rmtoll TAMPCR TAMP1IE LL_RTC_DisableIT_TAMP1
3563 * @param RTCx RTC Instance
3564 * @retval None
3565 */
LL_RTC_DisableIT_TAMP1(RTC_TypeDef * RTCx)3566 __STATIC_INLINE void LL_RTC_DisableIT_TAMP1(RTC_TypeDef *RTCx)
3567 {
3568 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP1IE);
3569 }
3570 #endif /* RTC_TAMPER1_SUPPORT */
3571
3572 /**
3573 * @brief Enable all Tamper Interrupt
3574 * @rmtoll TAMPCR TAMPIE LL_RTC_EnableIT_TAMP
3575 * @param RTCx RTC Instance
3576 * @retval None
3577 */
LL_RTC_EnableIT_TAMP(RTC_TypeDef * RTCx)3578 __STATIC_INLINE void LL_RTC_EnableIT_TAMP(RTC_TypeDef *RTCx)
3579 {
3580 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPIE);
3581 }
3582
3583 /**
3584 * @brief Disable all Tamper Interrupt
3585 * @rmtoll TAMPCR TAMPIE LL_RTC_DisableIT_TAMP
3586 * @param RTCx RTC Instance
3587 * @retval None
3588 */
LL_RTC_DisableIT_TAMP(RTC_TypeDef * RTCx)3589 __STATIC_INLINE void LL_RTC_DisableIT_TAMP(RTC_TypeDef *RTCx)
3590 {
3591 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPIE);
3592 }
3593
3594 /**
3595 * @brief Check if Time-stamp interrupt is enabled or not
3596 * @rmtoll CR TSIE LL_RTC_IsEnabledIT_TS
3597 * @param RTCx RTC Instance
3598 * @retval State of bit (1 or 0).
3599 */
LL_RTC_IsEnabledIT_TS(RTC_TypeDef * RTCx)3600 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TS(RTC_TypeDef *RTCx)
3601 {
3602 return ((READ_BIT(RTCx->CR, RTC_CR_TSIE) == (RTC_CR_TSIE)) ? 1UL : 0UL);
3603 }
3604
3605 /**
3606 * @brief Check if Wakeup timer interrupt is enabled or not
3607 * @rmtoll CR WUTIE LL_RTC_IsEnabledIT_WUT
3608 * @param RTCx RTC Instance
3609 * @retval State of bit (1 or 0).
3610 */
LL_RTC_IsEnabledIT_WUT(RTC_TypeDef * RTCx)3611 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_WUT(RTC_TypeDef *RTCx)
3612 {
3613 return ((READ_BIT(RTCx->CR, RTC_CR_WUTIE) == (RTC_CR_WUTIE)) ? 1UL : 0UL);
3614 }
3615
3616 /**
3617 * @brief Check if Alarm B interrupt is enabled or not
3618 * @rmtoll CR ALRBIE LL_RTC_IsEnabledIT_ALRB
3619 * @param RTCx RTC Instance
3620 * @retval State of bit (1 or 0).
3621 */
LL_RTC_IsEnabledIT_ALRB(RTC_TypeDef * RTCx)3622 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRB(RTC_TypeDef *RTCx)
3623 {
3624 return ((READ_BIT(RTCx->CR, RTC_CR_ALRBIE) == (RTC_CR_ALRBIE)) ? 1UL : 0UL);
3625 }
3626
3627 /**
3628 * @brief Check if Alarm A interrupt is enabled or not
3629 * @rmtoll CR ALRAIE LL_RTC_IsEnabledIT_ALRA
3630 * @param RTCx RTC Instance
3631 * @retval State of bit (1 or 0).
3632 */
LL_RTC_IsEnabledIT_ALRA(RTC_TypeDef * RTCx)3633 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRA(RTC_TypeDef *RTCx)
3634 {
3635 return ((READ_BIT(RTCx->CR, RTC_CR_ALRAIE) == (RTC_CR_ALRAIE)) ? 1UL : 0UL);
3636 }
3637
3638 #if defined(RTC_TAMPER3_SUPPORT)
3639 /**
3640 * @brief Check if Tamper 3 interrupt is enabled or not
3641 * @rmtoll TAMPCR TAMP3IE LL_RTC_IsEnabledIT_TAMP3
3642 * @param RTCx RTC Instance
3643 * @retval State of bit (1 or 0).
3644 */
LL_RTC_IsEnabledIT_TAMP3(RTC_TypeDef * RTCx)3645 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP3(RTC_TypeDef *RTCx)
3646 {
3647 return ((READ_BIT(RTCx->TAMPCR,
3648 RTC_TAMPCR_TAMP3IE) == (RTC_TAMPCR_TAMP3IE)) ? 1UL : 0UL);
3649 }
3650 #endif /* RTC_TAMPER3_SUPPORT */
3651
3652 /**
3653 * @brief Check if Tamper 2 interrupt is enabled or not
3654 * @rmtoll TAMPCR TAMP2IE LL_RTC_IsEnabledIT_TAMP2
3655 * @param RTCx RTC Instance
3656 * @retval State of bit (1 or 0).
3657 */
LL_RTC_IsEnabledIT_TAMP2(RTC_TypeDef * RTCx)3658 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP2(RTC_TypeDef *RTCx)
3659 {
3660 return ((READ_BIT(RTCx->TAMPCR,
3661 RTC_TAMPCR_TAMP2IE) == (RTC_TAMPCR_TAMP2IE)) ? 1UL : 0UL);
3662
3663 }
3664
3665 #if defined(RTC_TAMPER1_SUPPORT)
3666 /**
3667 * @brief Check if Tamper 1 interrupt is enabled or not
3668 * @rmtoll TAMPCR TAMP1IE LL_RTC_IsEnabledIT_TAMP1
3669 * @param RTCx RTC Instance
3670 * @retval State of bit (1 or 0).
3671 */
LL_RTC_IsEnabledIT_TAMP1(RTC_TypeDef * RTCx)3672 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP1(RTC_TypeDef *RTCx)
3673 {
3674 return ((READ_BIT(RTCx->TAMPCR,
3675 RTC_TAMPCR_TAMP1IE) == (RTC_TAMPCR_TAMP1IE)) ? 1UL : 0UL);
3676 }
3677 #endif /* RTC_TAMPER1_SUPPORT */
3678
3679 /**
3680 * @brief Check if all the TAMPER interrupts are enabled or not
3681 * @rmtoll TAMPCR TAMPIE LL_RTC_IsEnabledIT_TAMP
3682 * @param RTCx RTC Instance
3683 * @retval State of bit (1 or 0).
3684 */
LL_RTC_IsEnabledIT_TAMP(RTC_TypeDef * RTCx)3685 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP(RTC_TypeDef *RTCx)
3686 {
3687 return ((READ_BIT(RTCx->TAMPCR,
3688 RTC_TAMPCR_TAMPIE) == (RTC_TAMPCR_TAMPIE)) ? 1UL : 0UL);
3689 }
3690
3691 /**
3692 * @}
3693 */
3694
3695 #if defined(USE_FULL_LL_DRIVER)
3696 /** @defgroup RTC_LL_EF_Init Initialization and de-initialization functions
3697 * @{
3698 */
3699
3700 ErrorStatus LL_RTC_DeInit(RTC_TypeDef *RTCx);
3701 ErrorStatus LL_RTC_Init(RTC_TypeDef *RTCx, LL_RTC_InitTypeDef *RTC_InitStruct);
3702 void LL_RTC_StructInit(LL_RTC_InitTypeDef *RTC_InitStruct);
3703 ErrorStatus LL_RTC_TIME_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_TimeTypeDef *RTC_TimeStruct);
3704 void LL_RTC_TIME_StructInit(LL_RTC_TimeTypeDef *RTC_TimeStruct);
3705 ErrorStatus LL_RTC_DATE_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_DateTypeDef *RTC_DateStruct);
3706 void LL_RTC_DATE_StructInit(LL_RTC_DateTypeDef *RTC_DateStruct);
3707 ErrorStatus LL_RTC_ALMA_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
3708 ErrorStatus LL_RTC_ALMB_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
3709 void LL_RTC_ALMA_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
3710 void LL_RTC_ALMB_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
3711 ErrorStatus LL_RTC_EnterInitMode(RTC_TypeDef *RTCx);
3712 ErrorStatus LL_RTC_ExitInitMode(RTC_TypeDef *RTCx);
3713 ErrorStatus LL_RTC_WaitForSynchro(RTC_TypeDef *RTCx);
3714
3715 /**
3716 * @}
3717 */
3718 #endif /* USE_FULL_LL_DRIVER */
3719
3720 /**
3721 * @}
3722 */
3723
3724 /**
3725 * @}
3726 */
3727
3728 #endif /* defined(RTC) */
3729
3730 /**
3731 * @}
3732 */
3733
3734 #ifdef __cplusplus
3735 }
3736 #endif
3737
3738 #endif /* STM32L0xx_LL_RTC_H */
3739