Create release.yml
[betaflight.git] / lib / main / STM32F4 / Drivers / STM32F4xx_HAL_Driver / Inc / stm32f4xx_ll_rtc.h
blob8c7cc2b30e776e57d9b8a7a53b2873890c4db8d6
1 /**
2 ******************************************************************************
3 * @file stm32f4xx_ll_rtc.h
4 * @author MCD Application Team
5 * @version V1.7.1
6 * @date 14-April-2017
7 * @brief Header file of RTC LL module.
8 ******************************************************************************
9 * @attention
11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
13 * Redistribution and use in source and binary forms, with or without modification,
14 * are permitted provided that the following conditions are met:
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 ******************************************************************************
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F4xx_LL_RTC_H
40 #define __STM32F4xx_LL_RTC_H
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f4xx.h"
49 /** @addtogroup STM32F4xx_LL_Driver
50 * @{
53 #if defined(RTC)
55 /** @defgroup RTC_LL RTC
56 * @{
59 /* Private types -------------------------------------------------------------*/
60 /* Private variables ---------------------------------------------------------*/
61 /* Private constants ---------------------------------------------------------*/
62 /** @defgroup RTC_LL_Private_Constants RTC Private Constants
63 * @{
65 /* Masks Definition */
66 #define RTC_INIT_MASK 0xFFFFFFFFU
67 #define RTC_RSF_MASK 0xFFFFFF5FU
69 /* Write protection defines */
70 #define RTC_WRITE_PROTECTION_DISABLE ((uint8_t)0xFFU)
71 #define RTC_WRITE_PROTECTION_ENABLE_1 ((uint8_t)0xCAU)
72 #define RTC_WRITE_PROTECTION_ENABLE_2 ((uint8_t)0x53U)
74 /* Defines used to combine date & time */
75 #define RTC_OFFSET_WEEKDAY 24U
76 #define RTC_OFFSET_DAY 16U
77 #define RTC_OFFSET_MONTH 8U
78 #define RTC_OFFSET_HOUR 16U
79 #define RTC_OFFSET_MINUTE 8U
81 /**
82 * @}
85 /* Private macros ------------------------------------------------------------*/
86 #if defined(USE_FULL_LL_DRIVER)
87 /** @defgroup RTC_LL_Private_Macros RTC Private Macros
88 * @{
90 /**
91 * @}
93 #endif /*USE_FULL_LL_DRIVER*/
95 /* Exported types ------------------------------------------------------------*/
96 #if defined(USE_FULL_LL_DRIVER)
97 /** @defgroup RTC_LL_ES_INIT RTC Exported Init structure
98 * @{
102 * @brief RTC Init structures definition
104 typedef struct
106 uint32_t HourFormat; /*!< Specifies the RTC Hours Format.
107 This parameter can be a value of @ref RTC_LL_EC_HOURFORMAT
109 This feature can be modified afterwards using unitary function
110 @ref LL_RTC_SetHourFormat(). */
112 uint32_t AsynchPrescaler; /*!< Specifies the RTC Asynchronous Predivider value.
113 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F
115 This feature can be modified afterwards using unitary function
116 @ref LL_RTC_SetAsynchPrescaler(). */
118 uint32_t SynchPrescaler; /*!< Specifies the RTC Synchronous Predivider value.
119 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF
121 This feature can be modified afterwards using unitary function
122 @ref LL_RTC_SetSynchPrescaler(). */
123 } LL_RTC_InitTypeDef;
126 * @brief RTC Time structure definition
128 typedef struct
130 uint32_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
131 This parameter can be a value of @ref RTC_LL_EC_TIME_FORMAT
133 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetFormat(). */
135 uint8_t Hours; /*!< Specifies the RTC Time Hours.
136 This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the @ref LL_RTC_TIME_FORMAT_PM is selected.
137 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.
139 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetHour(). */
141 uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
142 This parameter must be a number between Min_Data = 0 and Max_Data = 59
144 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetMinute(). */
146 uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
147 This parameter must be a number between Min_Data = 0 and Max_Data = 59
149 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetSecond(). */
150 } LL_RTC_TimeTypeDef;
153 * @brief RTC Date structure definition
155 typedef struct
157 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay.
158 This parameter can be a value of @ref RTC_LL_EC_WEEKDAY
160 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetWeekDay(). */
162 uint8_t Month; /*!< Specifies the RTC Date Month.
163 This parameter can be a value of @ref RTC_LL_EC_MONTH
165 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetMonth(). */
167 uint8_t Day; /*!< Specifies the RTC Date Day.
168 This parameter must be a number between Min_Data = 1 and Max_Data = 31
170 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetDay(). */
172 uint8_t Year; /*!< Specifies the RTC Date Year.
173 This parameter must be a number between Min_Data = 0 and Max_Data = 99
175 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetYear(). */
176 } LL_RTC_DateTypeDef;
179 * @brief RTC Alarm structure definition
181 typedef struct
183 LL_RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members. */
185 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks.
186 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.
188 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetMask() for ALARM A
189 or @ref LL_RTC_ALMB_SetMask() for ALARM B
192 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on day or WeekDay.
193 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
195 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_EnableWeekday() or @ref LL_RTC_ALMA_DisableWeekday()
196 for ALARM A or @ref LL_RTC_ALMB_EnableWeekday() or @ref LL_RTC_ALMB_DisableWeekday() for ALARM B
199 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Day/WeekDay.
200 If AlarmDateWeekDaySel set to day, this parameter must be a number between Min_Data = 1 and Max_Data = 31.
202 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetDay()
203 for ALARM A or @ref LL_RTC_ALMB_SetDay() for ALARM B.
205 If AlarmDateWeekDaySel set to Weekday, this parameter can be a value of @ref RTC_LL_EC_WEEKDAY.
207 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetWeekDay()
208 for ALARM A or @ref LL_RTC_ALMB_SetWeekDay() for ALARM B.
210 } LL_RTC_AlarmTypeDef;
213 * @}
215 #endif /* USE_FULL_LL_DRIVER */
217 /* Exported constants --------------------------------------------------------*/
218 /** @defgroup RTC_LL_Exported_Constants RTC Exported Constants
219 * @{
222 #if defined(USE_FULL_LL_DRIVER)
223 /** @defgroup RTC_LL_EC_FORMAT FORMAT
224 * @{
226 #define LL_RTC_FORMAT_BIN 0x000000000U /*!< Binary data format */
227 #define LL_RTC_FORMAT_BCD 0x000000001U /*!< BCD data format */
229 * @}
232 /** @defgroup RTC_LL_EC_ALMA_WEEKDAY_SELECTION RTC Alarm A Date WeekDay
233 * @{
235 #define LL_RTC_ALMA_DATEWEEKDAYSEL_DATE 0x00000000U /*!< Alarm A Date is selected */
236 #define LL_RTC_ALMA_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMAR_WDSEL /*!< Alarm A WeekDay is selected */
238 * @}
241 /** @defgroup RTC_LL_EC_ALMB_WEEKDAY_SELECTION RTC Alarm B Date WeekDay
242 * @{
244 #define LL_RTC_ALMB_DATEWEEKDAYSEL_DATE 0x00000000U /*!< Alarm B Date is selected */
245 #define LL_RTC_ALMB_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMBR_WDSEL /*!< Alarm B WeekDay is selected */
247 * @}
250 #endif /* USE_FULL_LL_DRIVER */
252 /** @defgroup RTC_LL_EC_GET_FLAG Get Flags Defines
253 * @brief Flags defines which can be used with LL_RTC_ReadReg function
254 * @{
256 #define LL_RTC_ISR_RECALPF RTC_ISR_RECALPF
257 #define LL_RTC_ISR_TAMP3F RTC_ISR_TAMP3F
258 #define LL_RTC_ISR_TAMP2F RTC_ISR_TAMP2F
259 #define LL_RTC_ISR_TAMP1F RTC_ISR_TAMP1F
260 #define LL_RTC_ISR_TSOVF RTC_ISR_TSOVF
261 #define LL_RTC_ISR_TSF RTC_ISR_TSF
262 #define LL_RTC_ISR_WUTF RTC_ISR_WUTF
263 #define LL_RTC_ISR_ALRBF RTC_ISR_ALRBF
264 #define LL_RTC_ISR_ALRAF RTC_ISR_ALRAF
265 #define LL_RTC_ISR_INITF RTC_ISR_INITF
266 #define LL_RTC_ISR_RSF RTC_ISR_RSF
267 #define LL_RTC_ISR_INITS RTC_ISR_INITS
268 #define LL_RTC_ISR_SHPF RTC_ISR_SHPF
269 #define LL_RTC_ISR_WUTWF RTC_ISR_WUTWF
270 #define LL_RTC_ISR_ALRBWF RTC_ISR_ALRBWF
271 #define LL_RTC_ISR_ALRAWF RTC_ISR_ALRAWF
273 * @}
276 /** @defgroup RTC_LL_EC_IT IT Defines
277 * @brief IT defines which can be used with LL_RTC_ReadReg and LL_RTC_WriteReg functions
278 * @{
280 #define LL_RTC_CR_TSIE RTC_CR_TSIE
281 #define LL_RTC_CR_WUTIE RTC_CR_WUTIE
282 #define LL_RTC_CR_ALRBIE RTC_CR_ALRBIE
283 #define LL_RTC_CR_ALRAIE RTC_CR_ALRAIE
284 #define LL_RTC_TAFCR_TAMPIE RTC_TAFCR_TAMPIE
286 * @}
289 /** @defgroup RTC_LL_EC_WEEKDAY WEEK DAY
290 * @{
292 #define LL_RTC_WEEKDAY_MONDAY ((uint8_t)0x01U) /*!< Monday */
293 #define LL_RTC_WEEKDAY_TUESDAY ((uint8_t)0x02U) /*!< Tuesday */
294 #define LL_RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03U) /*!< Wednesday */
295 #define LL_RTC_WEEKDAY_THURSDAY ((uint8_t)0x04U) /*!< Thrusday */
296 #define LL_RTC_WEEKDAY_FRIDAY ((uint8_t)0x05U) /*!< Friday */
297 #define LL_RTC_WEEKDAY_SATURDAY ((uint8_t)0x06U) /*!< Saturday */
298 #define LL_RTC_WEEKDAY_SUNDAY ((uint8_t)0x07U) /*!< Sunday */
300 * @}
303 /** @defgroup RTC_LL_EC_MONTH MONTH
304 * @{
306 #define LL_RTC_MONTH_JANUARY ((uint8_t)0x01U) /*!< January */
307 #define LL_RTC_MONTH_FEBRUARY ((uint8_t)0x02U) /*!< February */
308 #define LL_RTC_MONTH_MARCH ((uint8_t)0x03U) /*!< March */
309 #define LL_RTC_MONTH_APRIL ((uint8_t)0x04U) /*!< April */
310 #define LL_RTC_MONTH_MAY ((uint8_t)0x05U) /*!< May */
311 #define LL_RTC_MONTH_JUNE ((uint8_t)0x06U) /*!< June */
312 #define LL_RTC_MONTH_JULY ((uint8_t)0x07U) /*!< July */
313 #define LL_RTC_MONTH_AUGUST ((uint8_t)0x08U) /*!< August */
314 #define LL_RTC_MONTH_SEPTEMBER ((uint8_t)0x09U) /*!< September */
315 #define LL_RTC_MONTH_OCTOBER ((uint8_t)0x10U) /*!< October */
316 #define LL_RTC_MONTH_NOVEMBER ((uint8_t)0x11U) /*!< November */
317 #define LL_RTC_MONTH_DECEMBER ((uint8_t)0x12U) /*!< December */
319 * @}
322 /** @defgroup RTC_LL_EC_HOURFORMAT HOUR FORMAT
323 * @{
325 #define LL_RTC_HOURFORMAT_24HOUR 0x00000000U /*!< 24 hour/day format */
326 #define LL_RTC_HOURFORMAT_AMPM RTC_CR_FMT /*!< AM/PM hour format */
328 * @}
331 /** @defgroup RTC_LL_EC_ALARMOUT ALARM OUTPUT
332 * @{
334 #define LL_RTC_ALARMOUT_DISABLE 0x00000000U /*!< Output disabled */
335 #define LL_RTC_ALARMOUT_ALMA RTC_CR_OSEL_0 /*!< Alarm A output enabled */
336 #define LL_RTC_ALARMOUT_ALMB RTC_CR_OSEL_1 /*!< Alarm B output enabled */
337 #define LL_RTC_ALARMOUT_WAKEUP RTC_CR_OSEL /*!< Wakeup output enabled */
339 * @}
342 /** @defgroup RTC_LL_EC_ALARM_OUTPUTTYPE ALARM OUTPUT TYPE
343 * @{
345 #define LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN 0x00000000U /*!< RTC_ALARM, when mapped on PC13, is open-drain output */
346 #define LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL RTC_TAFCR_ALARMOUTTYPE /*!< RTC_ALARM, when mapped on PC13, is push-pull output */
348 * @}
351 /** @defgroup RTC_LL_EC_PIN PIN
352 * @{
354 #define LL_RTC_PIN_PC13 RTC_TAFCR_PC13MODE /*!< PC13 is forced to push-pull output if all RTC alternate functions are disabled */
355 #define LL_RTC_PIN_PC14 RTC_TAFCR_PC14MODE /*!< PC14 is forced to push-pull output if LSE is disabled */
356 #define LL_RTC_PIN_PC15 RTC_TAFCR_PC15MODE /*!< PC15 is forced to push-pull output if LSE is disabled */
358 * @}
361 /** @defgroup RTC_LL_EC_OUTPUTPOLARITY_PIN OUTPUT POLARITY PIN
362 * @{
364 #define LL_RTC_OUTPUTPOLARITY_PIN_HIGH 0x00000000U /*!< Pin is high when ALRAF/ALRBF/WUTF is asserted (depending on OSEL)*/
365 #define LL_RTC_OUTPUTPOLARITY_PIN_LOW RTC_CR_POL /*!< Pin is low when ALRAF/ALRBF/WUTF is asserted (depending on OSEL) */
367 * @}
370 /** @defgroup RTC_LL_EC_TIME_FORMAT TIME FORMAT
371 * @{
373 #define LL_RTC_TIME_FORMAT_AM_OR_24 0x00000000U /*!< AM or 24-hour format */
374 #define LL_RTC_TIME_FORMAT_PM RTC_TR_PM /*!< PM */
376 * @}
379 /** @defgroup RTC_LL_EC_SHIFT_SECOND SHIFT SECOND
380 * @{
382 #define LL_RTC_SHIFT_SECOND_DELAY 0x00000000U /* Delay (seconds) = SUBFS / (PREDIV_S + 1) */
383 #define LL_RTC_SHIFT_SECOND_ADVANCE RTC_SHIFTR_ADD1S /* Advance (seconds) = (1 - (SUBFS / (PREDIV_S + 1))) */
385 * @}
388 /** @defgroup RTC_LL_EC_ALMA_MASK ALARMA MASK
389 * @{
391 #define LL_RTC_ALMA_MASK_NONE 0x00000000U /*!< No masks applied on Alarm A*/
392 #define LL_RTC_ALMA_MASK_DATEWEEKDAY RTC_ALRMAR_MSK4 /*!< Date/day do not care in Alarm A comparison */
393 #define LL_RTC_ALMA_MASK_HOURS RTC_ALRMAR_MSK3 /*!< Hours do not care in Alarm A comparison */
394 #define LL_RTC_ALMA_MASK_MINUTES RTC_ALRMAR_MSK2 /*!< Minutes do not care in Alarm A comparison */
395 #define LL_RTC_ALMA_MASK_SECONDS RTC_ALRMAR_MSK1 /*!< Seconds do not care in Alarm A comparison */
396 #define LL_RTC_ALMA_MASK_ALL (RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1) /*!< Masks all */
398 * @}
401 /** @defgroup RTC_LL_EC_ALMA_TIME_FORMAT ALARMA TIME FORMAT
402 * @{
404 #define LL_RTC_ALMA_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */
405 #define LL_RTC_ALMA_TIME_FORMAT_PM RTC_ALRMAR_PM /*!< PM */
407 * @}
410 /** @defgroup RTC_LL_EC_ALMB_MASK ALARMB MASK
411 * @{
413 #define LL_RTC_ALMB_MASK_NONE 0x00000000U /*!< No masks applied on Alarm B*/
414 #define LL_RTC_ALMB_MASK_DATEWEEKDAY RTC_ALRMBR_MSK4 /*!< Date/day do not care in Alarm B comparison */
415 #define LL_RTC_ALMB_MASK_HOURS RTC_ALRMBR_MSK3 /*!< Hours do not care in Alarm B comparison */
416 #define LL_RTC_ALMB_MASK_MINUTES RTC_ALRMBR_MSK2 /*!< Minutes do not care in Alarm B comparison */
417 #define LL_RTC_ALMB_MASK_SECONDS RTC_ALRMBR_MSK1 /*!< Seconds do not care in Alarm B comparison */
418 #define LL_RTC_ALMB_MASK_ALL (RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1) /*!< Masks all */
420 * @}
423 /** @defgroup RTC_LL_EC_ALMB_TIME_FORMAT ALARMB TIME FORMAT
424 * @{
426 #define LL_RTC_ALMB_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */
427 #define LL_RTC_ALMB_TIME_FORMAT_PM RTC_ALRMBR_PM /*!< PM */
429 * @}
432 /** @defgroup RTC_LL_EC_TIMESTAMP_EDGE TIMESTAMP EDGE
433 * @{
435 #define LL_RTC_TIMESTAMP_EDGE_RISING 0x00000000U /*!< RTC_TS input rising edge generates a time-stamp event */
436 #define LL_RTC_TIMESTAMP_EDGE_FALLING RTC_CR_TSEDGE /*!< RTC_TS input falling edge generates a time-stamp even */
438 * @}
441 /** @defgroup RTC_LL_EC_TS_TIME_FORMAT TIMESTAMP TIME FORMAT
442 * @{
444 #define LL_RTC_TS_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */
445 #define LL_RTC_TS_TIME_FORMAT_PM RTC_TSTR_PM /*!< PM */
447 * @}
450 /** @defgroup RTC_LL_EC_TAMPER TAMPER
451 * @{
453 #define LL_RTC_TAMPER_1 RTC_TAFCR_TAMP1E /*!< RTC_TAMP1 input detection */
454 #if defined(RTC_TAMPER2_SUPPORT)
455 #define LL_RTC_TAMPER_2 RTC_TAFCR_TAMP2E /*!< RTC_TAMP2 input detection */
456 #endif /* RTC_TAMPER2_SUPPORT */
458 * @}
461 /** @defgroup RTC_LL_EC_TAMPER_MASK TAMPER MASK
462 * @{
464 #define LL_RTC_TAMPER_MASK_TAMPER1 RTC_TAFCR_TAMP1MF /*!< Tamper 1 event generates a trigger event. TAMP1F is masked and internally cleared by hardware.The backup registers are not erased */
465 #if defined(RTC_TAMPER2_SUPPORT)
466 #define LL_RTC_TAMPER_MASK_TAMPER2 RTC_TAFCR_TAMP2MF /*!< Tamper 2 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */
467 #endif /* RTC_TAMPER2_SUPPORT */
469 * @}
472 /** @defgroup RTC_LL_EC_TAMPER_NOERASE TAMPER NO ERASE
473 * @{
475 #define LL_RTC_TAMPER_NOERASE_TAMPER1 RTC_TAFCR_TAMP1NOERASE /*!< Tamper 1 event does not erase the backup registers. */
476 #if defined(RTC_TAMPER2_SUPPORT)
477 #define LL_RTC_TAMPER_NOERASE_TAMPER2 RTC_TAFCR_TAMP2NOERASE /*!< Tamper 2 event does not erase the backup registers. */
478 #endif /* RTC_TAMPER2_SUPPORT */
480 * @}
483 #if defined(RTC_TAFCR_TAMPPRCH)
484 /** @defgroup RTC_LL_EC_TAMPER_DURATION TAMPER DURATION
485 * @{
487 #define LL_RTC_TAMPER_DURATION_1RTCCLK 0x00000000U /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle */
488 #define LL_RTC_TAMPER_DURATION_2RTCCLK RTC_TAFCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */
489 #define LL_RTC_TAMPER_DURATION_4RTCCLK RTC_TAFCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */
490 #define LL_RTC_TAMPER_DURATION_8RTCCLK RTC_TAFCR_TAMPPRCH /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */
492 * @}
494 #endif /* RTC_TAFCR_TAMPPRCH */
496 #if defined(RTC_TAFCR_TAMPFLT)
497 /** @defgroup RTC_LL_EC_TAMPER_FILTER TAMPER FILTER
498 * @{
500 #define LL_RTC_TAMPER_FILTER_DISABLE 0x00000000U /*!< Tamper filter is disabled */
501 #define LL_RTC_TAMPER_FILTER_2SAMPLE RTC_TAFCR_TAMPFLT_0 /*!< Tamper is activated after 2 consecutive samples at the active level */
502 #define LL_RTC_TAMPER_FILTER_4SAMPLE RTC_TAFCR_TAMPFLT_1 /*!< Tamper is activated after 4 consecutive samples at the active level */
503 #define LL_RTC_TAMPER_FILTER_8SAMPLE RTC_TAFCR_TAMPFLT /*!< Tamper is activated after 8 consecutive samples at the active level. */
505 * @}
507 #endif /* RTC_TAFCR_TAMPFLT */
509 #if defined(RTC_TAFCR_TAMPFREQ)
510 /** @defgroup RTC_LL_EC_TAMPER_SAMPLFREQDIV TAMPER SAMPLING FREQUENCY DIVIDER
511 * @{
513 #define LL_RTC_TAMPER_SAMPLFREQDIV_32768 0x00000000U /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 32768 */
514 #define LL_RTC_TAMPER_SAMPLFREQDIV_16384 RTC_TAFCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 16384 */
515 #define LL_RTC_TAMPER_SAMPLFREQDIV_8192 RTC_TAFCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 8192 */
516 #define LL_RTC_TAMPER_SAMPLFREQDIV_4096 (RTC_TAFCR_TAMPFREQ_1 | RTC_TAFCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 4096 */
517 #define LL_RTC_TAMPER_SAMPLFREQDIV_2048 RTC_TAFCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 2048 */
518 #define LL_RTC_TAMPER_SAMPLFREQDIV_1024 (RTC_TAFCR_TAMPFREQ_2 | RTC_TAFCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 1024 */
519 #define LL_RTC_TAMPER_SAMPLFREQDIV_512 (RTC_TAFCR_TAMPFREQ_2 | RTC_TAFCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 512 */
520 #define LL_RTC_TAMPER_SAMPLFREQDIV_256 RTC_TAFCR_TAMPFREQ /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 256 */
522 * @}
524 #endif /* RTC_TAFCR_TAMPFREQ */
526 /** @defgroup RTC_LL_EC_TAMPER_ACTIVELEVEL TAMPER ACTIVE LEVEL
527 * @{
529 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 RTC_TAFCR_TAMP1TRG /*!< RTC_TAMP1 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/
530 #if defined(RTC_TAMPER2_SUPPORT)
531 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 RTC_TAFCR_TAMP2TRG /*!< RTC_TAMP2 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/
532 #endif /* RTC_TAMPER2_SUPPORT */
534 * @}
537 /** @defgroup RTC_LL_EC_WAKEUPCLOCK_DIV WAKEUP CLOCK DIV
538 * @{
540 #define LL_RTC_WAKEUPCLOCK_DIV_16 0x00000000U /*!< RTC/16 clock is selected */
541 #define LL_RTC_WAKEUPCLOCK_DIV_8 (RTC_CR_WUCKSEL_0) /*!< RTC/8 clock is selected */
542 #define LL_RTC_WAKEUPCLOCK_DIV_4 (RTC_CR_WUCKSEL_1) /*!< RTC/4 clock is selected */
543 #define LL_RTC_WAKEUPCLOCK_DIV_2 (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_0) /*!< RTC/2 clock is selected */
544 #define LL_RTC_WAKEUPCLOCK_CKSPRE (RTC_CR_WUCKSEL_2) /*!< ck_spre (usually 1 Hz) clock is selected */
545 #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*/
547 * @}
550 /** @defgroup RTC_LL_EC_BKP BACKUP
551 * @{
553 #define LL_RTC_BKP_DR0 0x00000000U
554 #define LL_RTC_BKP_DR1 0x00000001U
555 #define LL_RTC_BKP_DR2 0x00000002U
556 #define LL_RTC_BKP_DR3 0x00000003U
557 #define LL_RTC_BKP_DR4 0x00000004U
558 #if RTC_BKP_NUMBER > 5
559 #define LL_RTC_BKP_DR5 0x00000005U
560 #define LL_RTC_BKP_DR6 0x00000006U
561 #define LL_RTC_BKP_DR7 0x00000007U
562 #define LL_RTC_BKP_DR8 0x00000008U
563 #define LL_RTC_BKP_DR9 0x00000009U
564 #define LL_RTC_BKP_DR10 0x0000000AU
565 #define LL_RTC_BKP_DR11 0x0000000BU
566 #define LL_RTC_BKP_DR12 0x0000000CU
567 #define LL_RTC_BKP_DR13 0x0000000DU
568 #define LL_RTC_BKP_DR14 0x0000000EU
569 #define LL_RTC_BKP_DR15 0x0000000FU
570 #endif /* RTC_BKP_NUMBER > 5 */
572 #if RTC_BKP_NUMBER > 16
573 #define LL_RTC_BKP_DR16 0x00000010U
574 #define LL_RTC_BKP_DR17 0x00000011U
575 #define LL_RTC_BKP_DR18 0x00000012U
576 #define LL_RTC_BKP_DR19 0x00000013U
577 #endif /* RTC_BKP_NUMBER > 16 */
579 * @}
582 /** @defgroup RTC_LL_EC_CALIB_OUTPUT Calibration output
583 * @{
585 #define LL_RTC_CALIB_OUTPUT_NONE 0x00000000U /*!< Calibration output disabled */
586 #define LL_RTC_CALIB_OUTPUT_1HZ (RTC_CR_COE | RTC_CR_COSEL) /*!< Calibration output is 1 Hz */
587 #define LL_RTC_CALIB_OUTPUT_512HZ (RTC_CR_COE) /*!< Calibration output is 512 Hz */
589 * @}
592 /** @defgroup RTC_LL_EC_CALIB_SIGN Coarse digital calibration sign
593 * @{
595 #define LL_RTC_CALIB_SIGN_POSITIVE 0x00000000U /*!< Positive calibration: calendar update frequency is increased */
596 #define LL_RTC_CALIB_SIGN_NEGATIVE RTC_CALIBR_DCS /*!< Negative calibration: calendar update frequency is decreased */
598 * @}
601 /** @defgroup RTC_LL_EC_CALIB_INSERTPULSE Calibration pulse insertion
602 * @{
604 #define LL_RTC_CALIB_INSERTPULSE_NONE 0x00000000U /*!< No RTCCLK pulses are added */
605 #define LL_RTC_CALIB_INSERTPULSE_SET RTC_CALR_CALP /*!< One RTCCLK pulse is effectively inserted every 2exp11 pulses (frequency increased by 488.5 ppm) */
607 * @}
610 /** @defgroup RTC_LL_EC_CALIB_PERIOD Calibration period
611 * @{
613 #define LL_RTC_CALIB_PERIOD_32SEC 0x00000000U /*!< Use a 32-second calibration cycle period */
614 #define LL_RTC_CALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< Use a 16-second calibration cycle period */
615 #define LL_RTC_CALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< Use a 8-second calibration cycle period */
617 * @}
620 /** @defgroup RTC_LL_EC_TSINSEL TIMESTAMP mapping
621 * @{
623 #define LL_RTC_TimeStampPin_Default 0x00000000U /*!< Use RTC_AF1 as TIMESTAMP */
624 #if defined(RTC_AF2_SUPPORT)
625 #define LL_RTC_TimeStampPin_Pos1 RTC_TAFCR_TSINSEL /*!< Use RTC_AF2 as TIMESTAMP */
626 #endif
628 * @}
631 /** @defgroup RTC_LL_EC_TAMP1INSEL TAMPER1 mapping
632 * @{
634 #define LL_RTC_TamperPin_Default 0x00000000U /*!< Use RTC_AF1 as TAMPER1 */
635 #if defined(RTC_AF2_SUPPORT)
636 #define LL_RTC_TamperPin_Pos1 RTC_TAFCR_TAMP1INSEL /*!< Use RTC_AF2 as TAMPER1 */
637 #endif
639 * @}
643 * @}
646 /* Exported macro ------------------------------------------------------------*/
647 /** @defgroup RTC_LL_Exported_Macros RTC Exported Macros
648 * @{
651 /** @defgroup RTC_LL_EM_WRITE_READ Common Write and read registers Macros
652 * @{
656 * @brief Write a value in RTC register
657 * @param __INSTANCE__ RTC Instance
658 * @param __REG__ Register to be written
659 * @param __VALUE__ Value to be written in the register
660 * @retval None
662 #define LL_RTC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
665 * @brief Read a value in RTC register
666 * @param __INSTANCE__ RTC Instance
667 * @param __REG__ Register to be read
668 * @retval Register value
670 #define LL_RTC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
672 * @}
675 /** @defgroup RTC_LL_EM_Convert Convert helper Macros
676 * @{
680 * @brief Helper macro to convert a value from 2 digit decimal format to BCD format
681 * @param __VALUE__ Byte to be converted
682 * @retval Converted byte
684 #define __LL_RTC_CONVERT_BIN2BCD(__VALUE__) (uint8_t)((((__VALUE__) / 10U) << 4U) | ((__VALUE__) % 10U))
687 * @brief Helper macro to convert a value from BCD format to 2 digit decimal format
688 * @param __VALUE__ BCD value to be converted
689 * @retval Converted byte
691 #define __LL_RTC_CONVERT_BCD2BIN(__VALUE__) (uint8_t)(((uint8_t)((__VALUE__) & (uint8_t)0xF0U) >> (uint8_t)0x4U) * 10U + ((__VALUE__) & (uint8_t)0x0FU))
694 * @}
697 /** @defgroup RTC_LL_EM_Date Date helper Macros
698 * @{
702 * @brief Helper macro to retrieve weekday.
703 * @param __RTC_DATE__ Date returned by @ref LL_RTC_DATE_Get function.
704 * @retval Returned value can be one of the following values:
705 * @arg @ref LL_RTC_WEEKDAY_MONDAY
706 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
707 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
708 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
709 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
710 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
711 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
713 #define __LL_RTC_GET_WEEKDAY(__RTC_DATE__) (((__RTC_DATE__) >> RTC_OFFSET_WEEKDAY) & 0x000000FFU)
716 * @brief Helper macro to retrieve Year in BCD format
717 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
718 * @retval Year in BCD format (0x00 . . . 0x99)
720 #define __LL_RTC_GET_YEAR(__RTC_DATE__) ((__RTC_DATE__) & 0x000000FFU)
723 * @brief Helper macro to retrieve Month in BCD format
724 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
725 * @retval Returned value can be one of the following values:
726 * @arg @ref LL_RTC_MONTH_JANUARY
727 * @arg @ref LL_RTC_MONTH_FEBRUARY
728 * @arg @ref LL_RTC_MONTH_MARCH
729 * @arg @ref LL_RTC_MONTH_APRIL
730 * @arg @ref LL_RTC_MONTH_MAY
731 * @arg @ref LL_RTC_MONTH_JUNE
732 * @arg @ref LL_RTC_MONTH_JULY
733 * @arg @ref LL_RTC_MONTH_AUGUST
734 * @arg @ref LL_RTC_MONTH_SEPTEMBER
735 * @arg @ref LL_RTC_MONTH_OCTOBER
736 * @arg @ref LL_RTC_MONTH_NOVEMBER
737 * @arg @ref LL_RTC_MONTH_DECEMBER
739 #define __LL_RTC_GET_MONTH(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_MONTH) & 0x000000FFU)
742 * @brief Helper macro to retrieve Day in BCD format
743 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
744 * @retval Day in BCD format (0x01 . . . 0x31)
746 #define __LL_RTC_GET_DAY(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_DAY) & 0x000000FFU)
749 * @}
752 /** @defgroup RTC_LL_EM_Time Time helper Macros
753 * @{
757 * @brief Helper macro to retrieve hour in BCD format
758 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
759 * @retval Hours in BCD format (0x01. . .0x12 or between Min_Data=0x00 and Max_Data=0x23)
761 #define __LL_RTC_GET_HOUR(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_HOUR) & 0x000000FFU)
764 * @brief Helper macro to retrieve minute in BCD format
765 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
766 * @retval Minutes in BCD format (0x00. . .0x59)
768 #define __LL_RTC_GET_MINUTE(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_MINUTE) & 0x000000FFU)
771 * @brief Helper macro to retrieve second in BCD format
772 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
773 * @retval Seconds in format (0x00. . .0x59)
775 #define __LL_RTC_GET_SECOND(__RTC_TIME__) ((__RTC_TIME__) & 0x000000FFU)
778 * @}
782 * @}
785 /* Exported functions --------------------------------------------------------*/
786 /** @defgroup RTC_LL_Exported_Functions RTC Exported Functions
787 * @{
790 /** @defgroup RTC_LL_EF_Configuration Configuration
791 * @{
795 * @brief Set Hours format (24 hour/day or AM/PM hour format)
796 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
797 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
798 * @rmtoll CR FMT LL_RTC_SetHourFormat
799 * @param RTCx RTC Instance
800 * @param HourFormat This parameter can be one of the following values:
801 * @arg @ref LL_RTC_HOURFORMAT_24HOUR
802 * @arg @ref LL_RTC_HOURFORMAT_AMPM
803 * @retval None
805 __STATIC_INLINE void LL_RTC_SetHourFormat(RTC_TypeDef *RTCx, uint32_t HourFormat)
807 MODIFY_REG(RTCx->CR, RTC_CR_FMT, HourFormat);
811 * @brief Get Hours format (24 hour/day or AM/PM hour format)
812 * @rmtoll CR FMT LL_RTC_GetHourFormat
813 * @param RTCx RTC Instance
814 * @retval Returned value can be one of the following values:
815 * @arg @ref LL_RTC_HOURFORMAT_24HOUR
816 * @arg @ref LL_RTC_HOURFORMAT_AMPM
818 __STATIC_INLINE uint32_t LL_RTC_GetHourFormat(RTC_TypeDef *RTCx)
820 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_FMT));
824 * @brief Select the flag to be routed to RTC_ALARM output
825 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
826 * @rmtoll CR OSEL LL_RTC_SetAlarmOutEvent
827 * @param RTCx RTC Instance
828 * @param AlarmOutput This parameter can be one of the following values:
829 * @arg @ref LL_RTC_ALARMOUT_DISABLE
830 * @arg @ref LL_RTC_ALARMOUT_ALMA
831 * @arg @ref LL_RTC_ALARMOUT_ALMB
832 * @arg @ref LL_RTC_ALARMOUT_WAKEUP
833 * @retval None
835 __STATIC_INLINE void LL_RTC_SetAlarmOutEvent(RTC_TypeDef *RTCx, uint32_t AlarmOutput)
837 MODIFY_REG(RTCx->CR, RTC_CR_OSEL, AlarmOutput);
841 * @brief Get the flag to be routed to RTC_ALARM output
842 * @rmtoll CR OSEL LL_RTC_GetAlarmOutEvent
843 * @param RTCx RTC Instance
844 * @retval Returned value can be one of the following values:
845 * @arg @ref LL_RTC_ALARMOUT_DISABLE
846 * @arg @ref LL_RTC_ALARMOUT_ALMA
847 * @arg @ref LL_RTC_ALARMOUT_ALMB
848 * @arg @ref LL_RTC_ALARMOUT_WAKEUP
850 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutEvent(RTC_TypeDef *RTCx)
852 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_OSEL));
856 * @brief Set RTC_ALARM output type (ALARM in push-pull or open-drain output)
857 * @note Used only when RTC_ALARM is mapped on PC13
858 * @note If all RTC alternate functions are disabled and PC13MODE = 1, PC13VALUE configures the
859 * PC13 output data
860 * @rmtoll TAFCR ALARMOUTTYPE LL_RTC_SetAlarmOutputType
861 * @param RTCx RTC Instance
862 * @param Output This parameter can be one of the following values:
863 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
864 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
865 * @retval None
867 __STATIC_INLINE void LL_RTC_SetAlarmOutputType(RTC_TypeDef *RTCx, uint32_t Output)
869 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_ALARMOUTTYPE, Output);
873 * @brief Get RTC_ALARM output type (ALARM in push-pull or open-drain output)
874 * @note used only when RTC_ALARM is mapped on PC13
875 * @note If all RTC alternate functions are disabled and PC13MODE = 1, PC13VALUE configures the
876 * PC13 output data
877 * @rmtoll TAFCR ALARMOUTTYPE LL_RTC_GetAlarmOutputType
878 * @param RTCx RTC Instance
879 * @retval Returned value can be one of the following values:
880 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
881 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
883 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutputType(RTC_TypeDef *RTCx)
885 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_ALARMOUTTYPE));
889 * @brief Enable push-pull output on PC13, PC14 and/or PC15
890 * @note PC13 forced to push-pull output if all RTC alternate functions are disabled
891 * @note PC14 and PC15 forced to push-pull output if LSE is disabled
892 * @rmtoll TAFCR PC13MODE LL_RTC_EnablePushPullMode\n
893 * @rmtoll TAFCR PC14MODE LL_RTC_EnablePushPullMode\n
894 * @rmtoll TAFCR PC15MODE LL_RTC_EnablePushPullMode
895 * @param RTCx RTC Instance
896 * @param PinMask This parameter can be a combination of the following values:
897 * @arg @ref LL_RTC_PIN_PC13
898 * @arg @ref LL_RTC_PIN_PC14
899 * @arg @ref LL_RTC_PIN_PC15
900 * @retval None
902 __STATIC_INLINE void LL_RTC_EnablePushPullMode(RTC_TypeDef *RTCx, uint32_t PinMask)
904 SET_BIT(RTCx->TAFCR, PinMask);
908 * @brief Disable push-pull output on PC13, PC14 and/or PC15
909 * @note PC13, PC14 and/or PC15 are controlled by the GPIO configuration registers.
910 * Consequently PC13, PC14 and/or PC15 are floating in Standby mode.
911 * @rmtoll TAFCR PC13MODE LL_RTC_DisablePushPullMode\n
912 * TAFCR PC14MODE LL_RTC_DisablePushPullMode\n
913 * TAFCR PC15MODE LL_RTC_DisablePushPullMode
914 * @param RTCx RTC Instance
915 * @param PinMask This parameter can be a combination of the following values:
916 * @arg @ref LL_RTC_PIN_PC13
917 * @arg @ref LL_RTC_PIN_PC14
918 * @arg @ref LL_RTC_PIN_PC15
919 * @retval None
921 __STATIC_INLINE void LL_RTC_DisablePushPullMode(RTC_TypeDef* RTCx, uint32_t PinMask)
923 CLEAR_BIT(RTCx->TAFCR, PinMask);
927 * @brief Set PC14 and/or PC15 to high level.
928 * @note Output data configuration is possible if the LSE is disabled and PushPull output is enabled (through @ref LL_RTC_EnablePushPullMode)
929 * @rmtoll TAFCR PC14VALUE LL_RTC_SetOutputPin\n
930 * TAFCR PC15VALUE LL_RTC_SetOutputPin
931 * @param RTCx RTC Instance
932 * @param PinMask This parameter can be a combination of the following values:
933 * @arg @ref LL_RTC_PIN_PC14
934 * @arg @ref LL_RTC_PIN_PC15
935 * @retval None
937 __STATIC_INLINE void LL_RTC_SetOutputPin(RTC_TypeDef* RTCx, uint32_t PinMask)
939 SET_BIT(RTCx->TAFCR, (PinMask >> 1));
943 * @brief Set PC14 and/or PC15 to low level.
944 * @note Output data configuration is possible if the LSE is disabled and PushPull output is enabled (through @ref LL_RTC_EnablePushPullMode)
945 * @rmtoll TAFCR PC14VALUE LL_RTC_ResetOutputPin\n
946 * TAFCR PC15VALUE LL_RTC_ResetOutputPin
947 * @param RTCx RTC Instance
948 * @param PinMask This parameter can be a combination of the following values:
949 * @arg @ref LL_RTC_PIN_PC14
950 * @arg @ref LL_RTC_PIN_PC15
951 * @retval None
953 __STATIC_INLINE void LL_RTC_ResetOutputPin(RTC_TypeDef* RTCx, uint32_t PinMask)
955 CLEAR_BIT(RTCx->TAFCR, (PinMask >> 1));
959 * @brief Enable initialization mode
960 * @note Initialization mode is used to program time and date register (RTC_TR and RTC_DR)
961 * and prescaler register (RTC_PRER).
962 * Counters are stopped and start counting from the new value when INIT is reset.
963 * @rmtoll ISR INIT LL_RTC_EnableInitMode
964 * @param RTCx RTC Instance
965 * @retval None
967 __STATIC_INLINE void LL_RTC_EnableInitMode(RTC_TypeDef *RTCx)
969 /* Set the Initialization mode */
970 WRITE_REG(RTCx->ISR, RTC_INIT_MASK);
974 * @brief Disable initialization mode (Free running mode)
975 * @rmtoll ISR INIT LL_RTC_DisableInitMode
976 * @param RTCx RTC Instance
977 * @retval None
979 __STATIC_INLINE void LL_RTC_DisableInitMode(RTC_TypeDef *RTCx)
981 /* Exit Initialization mode */
982 WRITE_REG(RTCx->ISR, (uint32_t)~RTC_ISR_INIT);
986 * @brief Set Output polarity (pin is low when ALRAF/ALRBF/WUTF is asserted)
987 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
988 * @rmtoll CR POL LL_RTC_SetOutputPolarity
989 * @param RTCx RTC Instance
990 * @param Polarity This parameter can be one of the following values:
991 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
992 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
993 * @retval None
995 __STATIC_INLINE void LL_RTC_SetOutputPolarity(RTC_TypeDef *RTCx, uint32_t Polarity)
997 MODIFY_REG(RTCx->CR, RTC_CR_POL, Polarity);
1001 * @brief Get Output polarity
1002 * @rmtoll CR POL LL_RTC_GetOutputPolarity
1003 * @param RTCx RTC Instance
1004 * @retval Returned value can be one of the following values:
1005 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
1006 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
1008 __STATIC_INLINE uint32_t LL_RTC_GetOutputPolarity(RTC_TypeDef *RTCx)
1010 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_POL));
1014 * @brief Enable Bypass the shadow registers
1015 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1016 * @rmtoll CR BYPSHAD LL_RTC_EnableShadowRegBypass
1017 * @param RTCx RTC Instance
1018 * @retval None
1020 __STATIC_INLINE void LL_RTC_EnableShadowRegBypass(RTC_TypeDef *RTCx)
1022 SET_BIT(RTCx->CR, RTC_CR_BYPSHAD);
1026 * @brief Disable Bypass the shadow registers
1027 * @rmtoll CR BYPSHAD LL_RTC_DisableShadowRegBypass
1028 * @param RTCx RTC Instance
1029 * @retval None
1031 __STATIC_INLINE void LL_RTC_DisableShadowRegBypass(RTC_TypeDef *RTCx)
1033 CLEAR_BIT(RTCx->CR, RTC_CR_BYPSHAD);
1037 * @brief Check if Shadow registers bypass is enabled or not.
1038 * @rmtoll CR BYPSHAD LL_RTC_IsShadowRegBypassEnabled
1039 * @param RTCx RTC Instance
1040 * @retval State of bit (1 or 0).
1042 __STATIC_INLINE uint32_t LL_RTC_IsShadowRegBypassEnabled(RTC_TypeDef *RTCx)
1044 return (READ_BIT(RTCx->CR, RTC_CR_BYPSHAD) == (RTC_CR_BYPSHAD));
1048 * @brief Enable RTC_REFIN reference clock detection (50 or 60 Hz)
1049 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1050 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1051 * @rmtoll CR REFCKON LL_RTC_EnableRefClock
1052 * @param RTCx RTC Instance
1053 * @retval None
1055 __STATIC_INLINE void LL_RTC_EnableRefClock(RTC_TypeDef *RTCx)
1057 SET_BIT(RTCx->CR, RTC_CR_REFCKON);
1061 * @brief Disable RTC_REFIN reference clock detection (50 or 60 Hz)
1062 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1063 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1064 * @rmtoll CR REFCKON LL_RTC_DisableRefClock
1065 * @param RTCx RTC Instance
1066 * @retval None
1068 __STATIC_INLINE void LL_RTC_DisableRefClock(RTC_TypeDef *RTCx)
1070 CLEAR_BIT(RTCx->CR, RTC_CR_REFCKON);
1074 * @brief Set Asynchronous prescaler factor
1075 * @rmtoll PRER PREDIV_A LL_RTC_SetAsynchPrescaler
1076 * @param RTCx RTC Instance
1077 * @param AsynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7F
1078 * @retval None
1080 __STATIC_INLINE void LL_RTC_SetAsynchPrescaler(RTC_TypeDef *RTCx, uint32_t AsynchPrescaler)
1082 MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_A, AsynchPrescaler << RTC_PRER_PREDIV_A_Pos);
1086 * @brief Set Synchronous prescaler factor
1087 * @rmtoll PRER PREDIV_S LL_RTC_SetSynchPrescaler
1088 * @param RTCx RTC Instance
1089 * @param SynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7FFF
1090 * @retval None
1092 __STATIC_INLINE void LL_RTC_SetSynchPrescaler(RTC_TypeDef *RTCx, uint32_t SynchPrescaler)
1094 MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_S, SynchPrescaler);
1098 * @brief Get Asynchronous prescaler factor
1099 * @rmtoll PRER PREDIV_A LL_RTC_GetAsynchPrescaler
1100 * @param RTCx RTC Instance
1101 * @retval Value between Min_Data = 0 and Max_Data = 0x7F
1103 __STATIC_INLINE uint32_t LL_RTC_GetAsynchPrescaler(RTC_TypeDef *RTCx)
1105 return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_A) >> RTC_PRER_PREDIV_A_Pos);
1109 * @brief Get Synchronous prescaler factor
1110 * @rmtoll PRER PREDIV_S LL_RTC_GetSynchPrescaler
1111 * @param RTCx RTC Instance
1112 * @retval Value between Min_Data = 0 and Max_Data = 0x7FFF
1114 __STATIC_INLINE uint32_t LL_RTC_GetSynchPrescaler(RTC_TypeDef *RTCx)
1116 return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_S));
1120 * @brief Enable the write protection for RTC registers.
1121 * @rmtoll WPR KEY LL_RTC_EnableWriteProtection
1122 * @param RTCx RTC Instance
1123 * @retval None
1125 __STATIC_INLINE void LL_RTC_EnableWriteProtection(RTC_TypeDef *RTCx)
1127 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_DISABLE);
1131 * @brief Disable the write protection for RTC registers.
1132 * @rmtoll WPR KEY LL_RTC_DisableWriteProtection
1133 * @param RTCx RTC Instance
1134 * @retval None
1136 __STATIC_INLINE void LL_RTC_DisableWriteProtection(RTC_TypeDef *RTCx)
1138 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_1);
1139 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_2);
1143 * @}
1146 /** @defgroup RTC_LL_EF_Time Time
1147 * @{
1151 * @brief Set time format (AM/24-hour or PM notation)
1152 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1153 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1154 * @rmtoll TR PM LL_RTC_TIME_SetFormat
1155 * @param RTCx RTC Instance
1156 * @param TimeFormat This parameter can be one of the following values:
1157 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1158 * @arg @ref LL_RTC_TIME_FORMAT_PM
1159 * @retval None
1161 __STATIC_INLINE void LL_RTC_TIME_SetFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
1163 MODIFY_REG(RTCx->TR, RTC_TR_PM, TimeFormat);
1167 * @brief Get time format (AM or PM notation)
1168 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1169 * before reading this bit
1170 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1171 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1172 * @rmtoll TR PM LL_RTC_TIME_GetFormat
1173 * @param RTCx RTC Instance
1174 * @retval Returned value can be one of the following values:
1175 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1176 * @arg @ref LL_RTC_TIME_FORMAT_PM
1178 __STATIC_INLINE uint32_t LL_RTC_TIME_GetFormat(RTC_TypeDef *RTCx)
1180 return (uint32_t)(READ_BIT(RTCx->TR, RTC_TR_PM));
1184 * @brief Set Hours in BCD format
1185 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1186 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1187 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert hour from binary to BCD format
1188 * @rmtoll TR HT LL_RTC_TIME_SetHour\n
1189 * TR HU LL_RTC_TIME_SetHour
1190 * @param RTCx RTC Instance
1191 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1192 * @retval None
1194 __STATIC_INLINE void LL_RTC_TIME_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
1196 MODIFY_REG(RTCx->TR, (RTC_TR_HT | RTC_TR_HU),
1197 (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos)));
1201 * @brief Get Hours in BCD format
1202 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1203 * before reading this bit
1204 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1205 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1206 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert hour from BCD to
1207 * Binary format
1208 * @rmtoll TR HT LL_RTC_TIME_GetHour\n
1209 * TR HU LL_RTC_TIME_GetHour
1210 * @param RTCx RTC Instance
1211 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1213 __STATIC_INLINE uint32_t LL_RTC_TIME_GetHour(RTC_TypeDef *RTCx)
1215 register uint32_t temp = 0U;
1217 temp = READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU));
1218 return (uint32_t)((((temp & RTC_TR_HT) >> RTC_TR_HT_Pos) << 4U) | ((temp & RTC_TR_HU) >> RTC_TR_HU_Pos));
1222 * @brief Set Minutes in BCD format
1223 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1224 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1225 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
1226 * @rmtoll TR MNT LL_RTC_TIME_SetMinute\n
1227 * TR MNU LL_RTC_TIME_SetMinute
1228 * @param RTCx RTC Instance
1229 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
1230 * @retval None
1232 __STATIC_INLINE void LL_RTC_TIME_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
1234 MODIFY_REG(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU),
1235 (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)));
1239 * @brief Get Minutes in BCD format
1240 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1241 * before reading this bit
1242 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1243 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1244 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert minute from BCD
1245 * to Binary format
1246 * @rmtoll TR MNT LL_RTC_TIME_GetMinute\n
1247 * TR MNU LL_RTC_TIME_GetMinute
1248 * @param RTCx RTC Instance
1249 * @retval Value between Min_Data=0x00 and Max_Data=0x59
1251 __STATIC_INLINE uint32_t LL_RTC_TIME_GetMinute(RTC_TypeDef *RTCx)
1253 register uint32_t temp = 0U;
1255 temp = READ_BIT(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU));
1256 return (uint32_t)((((temp & RTC_TR_MNT) >> RTC_TR_MNT_Pos) << 4U) | ((temp & RTC_TR_MNU) >> RTC_TR_MNU_Pos));
1260 * @brief Set Seconds in BCD format
1261 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1262 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1263 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
1264 * @rmtoll TR ST LL_RTC_TIME_SetSecond\n
1265 * TR SU LL_RTC_TIME_SetSecond
1266 * @param RTCx RTC Instance
1267 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
1268 * @retval None
1270 __STATIC_INLINE void LL_RTC_TIME_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
1272 MODIFY_REG(RTCx->TR, (RTC_TR_ST | RTC_TR_SU),
1273 (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos)));
1277 * @brief Get Seconds in BCD format
1278 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1279 * before reading this bit
1280 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1281 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1282 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD
1283 * to Binary format
1284 * @rmtoll TR ST LL_RTC_TIME_GetSecond\n
1285 * TR SU LL_RTC_TIME_GetSecond
1286 * @param RTCx RTC Instance
1287 * @retval Value between Min_Data=0x00 and Max_Data=0x59
1289 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSecond(RTC_TypeDef *RTCx)
1291 register uint32_t temp = 0U;
1293 temp = READ_BIT(RTCx->TR, (RTC_TR_ST | RTC_TR_SU));
1294 return (uint32_t)((((temp & RTC_TR_ST) >> RTC_TR_ST_Pos) << 4U) | ((temp & RTC_TR_SU) >> RTC_TR_SU_Pos));
1298 * @brief Set time (hour, minute and second) in BCD format
1299 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1300 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1301 * @note TimeFormat and Hours should follow the same format
1302 * @rmtoll TR PM LL_RTC_TIME_Config\n
1303 * TR HT LL_RTC_TIME_Config\n
1304 * TR HU LL_RTC_TIME_Config\n
1305 * TR MNT LL_RTC_TIME_Config\n
1306 * TR MNU LL_RTC_TIME_Config\n
1307 * TR ST LL_RTC_TIME_Config\n
1308 * TR SU LL_RTC_TIME_Config
1309 * @param RTCx RTC Instance
1310 * @param Format12_24 This parameter can be one of the following values:
1311 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1312 * @arg @ref LL_RTC_TIME_FORMAT_PM
1313 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1314 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
1315 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
1316 * @retval None
1318 __STATIC_INLINE void LL_RTC_TIME_Config(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
1320 register uint32_t temp = 0U;
1322 temp = Format12_24 | \
1323 (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos)) | \
1324 (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)) | \
1325 (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos));
1326 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);
1330 * @brief Get time (hour, minute and second) in BCD format
1331 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1332 * before reading this bit
1333 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1334 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1335 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
1336 * are available to get independently each parameter.
1337 * @rmtoll TR HT LL_RTC_TIME_Get\n
1338 * TR HU LL_RTC_TIME_Get\n
1339 * TR MNT LL_RTC_TIME_Get\n
1340 * TR MNU LL_RTC_TIME_Get\n
1341 * TR ST LL_RTC_TIME_Get\n
1342 * TR SU LL_RTC_TIME_Get
1343 * @param RTCx RTC Instance
1344 * @retval Combination of hours, minutes and seconds (Format: 0x00HHMMSS).
1346 __STATIC_INLINE uint32_t LL_RTC_TIME_Get(RTC_TypeDef *RTCx)
1348 register uint32_t temp = 0U;
1350 temp = READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU));
1351 return (uint32_t)((((((temp & RTC_TR_HT) >> RTC_TR_HT_Pos) << 4U) | ((temp & RTC_TR_HU) >> RTC_TR_HU_Pos)) << RTC_OFFSET_HOUR) | \
1352 (((((temp & RTC_TR_MNT) >> RTC_TR_MNT_Pos) << 4U) | ((temp & RTC_TR_MNU) >> RTC_TR_MNU_Pos)) << RTC_OFFSET_MINUTE) | \
1353 ((((temp & RTC_TR_ST) >> RTC_TR_ST_Pos) << 4U) | ((temp & RTC_TR_SU) >> RTC_TR_SU_Pos)));
1357 * @brief Memorize whether the daylight saving time change has been performed
1358 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1359 * @rmtoll CR BKP LL_RTC_TIME_EnableDayLightStore
1360 * @param RTCx RTC Instance
1361 * @retval None
1363 __STATIC_INLINE void LL_RTC_TIME_EnableDayLightStore(RTC_TypeDef *RTCx)
1365 SET_BIT(RTCx->CR, RTC_CR_BKP);
1369 * @brief Disable memorization whether the daylight saving time change has been performed.
1370 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1371 * @rmtoll CR BKP LL_RTC_TIME_DisableDayLightStore
1372 * @param RTCx RTC Instance
1373 * @retval None
1375 __STATIC_INLINE void LL_RTC_TIME_DisableDayLightStore(RTC_TypeDef *RTCx)
1377 CLEAR_BIT(RTCx->CR, RTC_CR_BKP);
1381 * @brief Check if RTC Day Light Saving stored operation has been enabled or not
1382 * @rmtoll CR BKP LL_RTC_TIME_IsDayLightStoreEnabled
1383 * @param RTCx RTC Instance
1384 * @retval State of bit (1 or 0).
1386 __STATIC_INLINE uint32_t LL_RTC_TIME_IsDayLightStoreEnabled(RTC_TypeDef *RTCx)
1388 return (READ_BIT(RTCx->CR, RTC_CR_BKP) == (RTC_CR_BKP));
1392 * @brief Subtract 1 hour (winter time change)
1393 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1394 * @rmtoll CR SUB1H LL_RTC_TIME_DecHour
1395 * @param RTCx RTC Instance
1396 * @retval None
1398 __STATIC_INLINE void LL_RTC_TIME_DecHour(RTC_TypeDef *RTCx)
1400 SET_BIT(RTCx->CR, RTC_CR_SUB1H);
1404 * @brief Add 1 hour (summer time change)
1405 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1406 * @rmtoll CR ADD1H LL_RTC_TIME_IncHour
1407 * @param RTCx RTC Instance
1408 * @retval None
1410 __STATIC_INLINE void LL_RTC_TIME_IncHour(RTC_TypeDef *RTCx)
1412 SET_BIT(RTCx->CR, RTC_CR_ADD1H);
1416 * @brief Get Sub second value in the synchronous prescaler counter.
1417 * @note You can use both SubSeconds value and SecondFraction (PREDIV_S through
1418 * LL_RTC_GetSynchPrescaler function) terms returned to convert Calendar
1419 * SubSeconds value in second fraction ratio with time unit following
1420 * generic formula:
1421 * ==> Seconds fraction ratio * time_unit= [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit
1422 * This conversion can be performed only if no shift operation is pending
1423 * (ie. SHFP=0) when PREDIV_S >= SS.
1424 * @rmtoll SSR SS LL_RTC_TIME_GetSubSecond
1425 * @param RTCx RTC Instance
1426 * @retval Sub second value (number between 0 and 65535)
1428 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSubSecond(RTC_TypeDef *RTCx)
1430 return (uint32_t)(READ_BIT(RTCx->SSR, RTC_SSR_SS));
1434 * @brief Synchronize to a remote clock with a high degree of precision.
1435 * @note This operation effectively subtracts from (delays) or advance the clock of a fraction of a second.
1436 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1437 * @note When REFCKON is set, firmware must not write to Shift control register.
1438 * @rmtoll SHIFTR ADD1S LL_RTC_TIME_Synchronize\n
1439 * SHIFTR SUBFS LL_RTC_TIME_Synchronize
1440 * @param RTCx RTC Instance
1441 * @param ShiftSecond This parameter can be one of the following values:
1442 * @arg @ref LL_RTC_SHIFT_SECOND_DELAY
1443 * @arg @ref LL_RTC_SHIFT_SECOND_ADVANCE
1444 * @param Fraction Number of Seconds Fractions (any value from 0 to 0x7FFF)
1445 * @retval None
1447 __STATIC_INLINE void LL_RTC_TIME_Synchronize(RTC_TypeDef *RTCx, uint32_t ShiftSecond, uint32_t Fraction)
1449 WRITE_REG(RTCx->SHIFTR, ShiftSecond | Fraction);
1453 * @}
1456 /** @defgroup RTC_LL_EF_Date Date
1457 * @{
1461 * @brief Set Year in BCD format
1462 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Year from binary to BCD format
1463 * @rmtoll DR YT LL_RTC_DATE_SetYear\n
1464 * DR YU LL_RTC_DATE_SetYear
1465 * @param RTCx RTC Instance
1466 * @param Year Value between Min_Data=0x00 and Max_Data=0x99
1467 * @retval None
1469 __STATIC_INLINE void LL_RTC_DATE_SetYear(RTC_TypeDef *RTCx, uint32_t Year)
1471 MODIFY_REG(RTCx->DR, (RTC_DR_YT | RTC_DR_YU),
1472 (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos)));
1476 * @brief Get Year in BCD format
1477 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1478 * before reading this bit
1479 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Year from BCD to Binary format
1480 * @rmtoll DR YT LL_RTC_DATE_GetYear\n
1481 * DR YU LL_RTC_DATE_GetYear
1482 * @param RTCx RTC Instance
1483 * @retval Value between Min_Data=0x00 and Max_Data=0x99
1485 __STATIC_INLINE uint32_t LL_RTC_DATE_GetYear(RTC_TypeDef *RTCx)
1487 register uint32_t temp = 0U;
1489 temp = READ_BIT(RTCx->DR, (RTC_DR_YT | RTC_DR_YU));
1490 return (uint32_t)((((temp & RTC_DR_YT) >> RTC_DR_YT_Pos) << 4U) | ((temp & RTC_DR_YU) >> RTC_DR_YU_Pos));
1494 * @brief Set Week day
1495 * @rmtoll DR WDU LL_RTC_DATE_SetWeekDay
1496 * @param RTCx RTC Instance
1497 * @param WeekDay This parameter can be one of the following values:
1498 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1499 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1500 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1501 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1502 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1503 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1504 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1505 * @retval None
1507 __STATIC_INLINE void LL_RTC_DATE_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
1509 MODIFY_REG(RTCx->DR, RTC_DR_WDU, WeekDay << RTC_DR_WDU_Pos);
1513 * @brief Get Week day
1514 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1515 * before reading this bit
1516 * @rmtoll DR WDU LL_RTC_DATE_GetWeekDay
1517 * @param RTCx RTC Instance
1518 * @retval Returned value can be one of the following values:
1519 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1520 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1521 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1522 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1523 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1524 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1525 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1527 __STATIC_INLINE uint32_t LL_RTC_DATE_GetWeekDay(RTC_TypeDef *RTCx)
1529 return (uint32_t)(READ_BIT(RTCx->DR, RTC_DR_WDU) >> RTC_DR_WDU_Pos);
1533 * @brief Set Month in BCD format
1534 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Month from binary to BCD format
1535 * @rmtoll DR MT LL_RTC_DATE_SetMonth\n
1536 * DR MU LL_RTC_DATE_SetMonth
1537 * @param RTCx RTC Instance
1538 * @param Month This parameter can be one of the following values:
1539 * @arg @ref LL_RTC_MONTH_JANUARY
1540 * @arg @ref LL_RTC_MONTH_FEBRUARY
1541 * @arg @ref LL_RTC_MONTH_MARCH
1542 * @arg @ref LL_RTC_MONTH_APRIL
1543 * @arg @ref LL_RTC_MONTH_MAY
1544 * @arg @ref LL_RTC_MONTH_JUNE
1545 * @arg @ref LL_RTC_MONTH_JULY
1546 * @arg @ref LL_RTC_MONTH_AUGUST
1547 * @arg @ref LL_RTC_MONTH_SEPTEMBER
1548 * @arg @ref LL_RTC_MONTH_OCTOBER
1549 * @arg @ref LL_RTC_MONTH_NOVEMBER
1550 * @arg @ref LL_RTC_MONTH_DECEMBER
1551 * @retval None
1553 __STATIC_INLINE void LL_RTC_DATE_SetMonth(RTC_TypeDef *RTCx, uint32_t Month)
1555 MODIFY_REG(RTCx->DR, (RTC_DR_MT | RTC_DR_MU),
1556 (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)));
1560 * @brief Get Month in BCD format
1561 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1562 * before reading this bit
1563 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
1564 * @rmtoll DR MT LL_RTC_DATE_GetMonth\n
1565 * DR MU LL_RTC_DATE_GetMonth
1566 * @param RTCx RTC Instance
1567 * @retval Returned value can be one of the following values:
1568 * @arg @ref LL_RTC_MONTH_JANUARY
1569 * @arg @ref LL_RTC_MONTH_FEBRUARY
1570 * @arg @ref LL_RTC_MONTH_MARCH
1571 * @arg @ref LL_RTC_MONTH_APRIL
1572 * @arg @ref LL_RTC_MONTH_MAY
1573 * @arg @ref LL_RTC_MONTH_JUNE
1574 * @arg @ref LL_RTC_MONTH_JULY
1575 * @arg @ref LL_RTC_MONTH_AUGUST
1576 * @arg @ref LL_RTC_MONTH_SEPTEMBER
1577 * @arg @ref LL_RTC_MONTH_OCTOBER
1578 * @arg @ref LL_RTC_MONTH_NOVEMBER
1579 * @arg @ref LL_RTC_MONTH_DECEMBER
1581 __STATIC_INLINE uint32_t LL_RTC_DATE_GetMonth(RTC_TypeDef *RTCx)
1583 register uint32_t temp = 0U;
1585 temp = READ_BIT(RTCx->DR, (RTC_DR_MT | RTC_DR_MU));
1586 return (uint32_t)((((temp & RTC_DR_MT) >> RTC_DR_MT_Pos) << 4U) | ((temp & RTC_DR_MU) >> RTC_DR_MU_Pos));
1590 * @brief Set Day in BCD format
1591 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
1592 * @rmtoll DR DT LL_RTC_DATE_SetDay\n
1593 * DR DU LL_RTC_DATE_SetDay
1594 * @param RTCx RTC Instance
1595 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
1596 * @retval None
1598 __STATIC_INLINE void LL_RTC_DATE_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
1600 MODIFY_REG(RTCx->DR, (RTC_DR_DT | RTC_DR_DU),
1601 (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos)));
1605 * @brief Get Day in BCD format
1606 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1607 * before reading this bit
1608 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
1609 * @rmtoll DR DT LL_RTC_DATE_GetDay\n
1610 * DR DU LL_RTC_DATE_GetDay
1611 * @param RTCx RTC Instance
1612 * @retval Value between Min_Data=0x01 and Max_Data=0x31
1614 __STATIC_INLINE uint32_t LL_RTC_DATE_GetDay(RTC_TypeDef *RTCx)
1616 register uint32_t temp = 0U;
1618 temp = READ_BIT(RTCx->DR, (RTC_DR_DT | RTC_DR_DU));
1619 return (uint32_t)((((temp & RTC_DR_DT) >> RTC_DR_DT_Pos) << 4U) | ((temp & RTC_DR_DU) >> RTC_DR_DU_Pos));
1623 * @brief Set date (WeekDay, Day, Month and Year) in BCD format
1624 * @rmtoll DR WDU LL_RTC_DATE_Config\n
1625 * DR MT LL_RTC_DATE_Config\n
1626 * DR MU LL_RTC_DATE_Config\n
1627 * DR DT LL_RTC_DATE_Config\n
1628 * DR DU LL_RTC_DATE_Config\n
1629 * DR YT LL_RTC_DATE_Config\n
1630 * DR YU LL_RTC_DATE_Config
1631 * @param RTCx RTC Instance
1632 * @param WeekDay This parameter can be one of the following values:
1633 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1634 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1635 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1636 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1637 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1638 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1639 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1640 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
1641 * @param Month This parameter can be one of the following values:
1642 * @arg @ref LL_RTC_MONTH_JANUARY
1643 * @arg @ref LL_RTC_MONTH_FEBRUARY
1644 * @arg @ref LL_RTC_MONTH_MARCH
1645 * @arg @ref LL_RTC_MONTH_APRIL
1646 * @arg @ref LL_RTC_MONTH_MAY
1647 * @arg @ref LL_RTC_MONTH_JUNE
1648 * @arg @ref LL_RTC_MONTH_JULY
1649 * @arg @ref LL_RTC_MONTH_AUGUST
1650 * @arg @ref LL_RTC_MONTH_SEPTEMBER
1651 * @arg @ref LL_RTC_MONTH_OCTOBER
1652 * @arg @ref LL_RTC_MONTH_NOVEMBER
1653 * @arg @ref LL_RTC_MONTH_DECEMBER
1654 * @param Year Value between Min_Data=0x00 and Max_Data=0x99
1655 * @retval None
1657 __STATIC_INLINE void LL_RTC_DATE_Config(RTC_TypeDef *RTCx, uint32_t WeekDay, uint32_t Day, uint32_t Month, uint32_t Year)
1659 register uint32_t temp = 0U;
1661 temp = (WeekDay << RTC_DR_WDU_Pos) | \
1662 (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos)) | \
1663 (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)) | \
1664 (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos));
1666 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);
1670 * @brief Get date (WeekDay, Day, Month and Year) in BCD format
1671 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1672 * before reading this bit
1673 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_YEAR, __LL_RTC_GET_MONTH,
1674 * and __LL_RTC_GET_DAY are available to get independently each parameter.
1675 * @rmtoll DR WDU LL_RTC_DATE_Get\n
1676 * DR MT LL_RTC_DATE_Get\n
1677 * DR MU LL_RTC_DATE_Get\n
1678 * DR DT LL_RTC_DATE_Get\n
1679 * DR DU LL_RTC_DATE_Get\n
1680 * DR YT LL_RTC_DATE_Get\n
1681 * DR YU LL_RTC_DATE_Get
1682 * @param RTCx RTC Instance
1683 * @retval Combination of WeekDay, Day, Month and Year (Format: 0xWWDDMMYY).
1685 __STATIC_INLINE uint32_t LL_RTC_DATE_Get(RTC_TypeDef *RTCx)
1687 register uint32_t temp = 0U;
1689 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));
1690 return (uint32_t)((((temp & RTC_DR_WDU) >> RTC_DR_WDU_Pos) << RTC_OFFSET_WEEKDAY) | \
1691 (((((temp & RTC_DR_DT) >> RTC_DR_DT_Pos) << 4U) | ((temp & RTC_DR_DU) >> RTC_DR_DU_Pos)) << RTC_OFFSET_DAY) | \
1692 (((((temp & RTC_DR_MT) >> RTC_DR_MT_Pos) << 4U) | ((temp & RTC_DR_MU) >> RTC_DR_MU_Pos)) << RTC_OFFSET_MONTH) | \
1693 ((((temp & RTC_DR_YT) >> RTC_DR_YT_Pos) << 4U) | ((temp & RTC_DR_YU) >> RTC_DR_YU_Pos)));
1697 * @}
1700 /** @defgroup RTC_LL_EF_ALARMA ALARMA
1701 * @{
1705 * @brief Enable Alarm A
1706 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1707 * @rmtoll CR ALRAE LL_RTC_ALMA_Enable
1708 * @param RTCx RTC Instance
1709 * @retval None
1711 __STATIC_INLINE void LL_RTC_ALMA_Enable(RTC_TypeDef *RTCx)
1713 SET_BIT(RTCx->CR, RTC_CR_ALRAE);
1717 * @brief Disable Alarm A
1718 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1719 * @rmtoll CR ALRAE LL_RTC_ALMA_Disable
1720 * @param RTCx RTC Instance
1721 * @retval None
1723 __STATIC_INLINE void LL_RTC_ALMA_Disable(RTC_TypeDef *RTCx)
1725 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAE);
1729 * @brief Specify the Alarm A masks.
1730 * @rmtoll ALRMAR MSK4 LL_RTC_ALMA_SetMask\n
1731 * ALRMAR MSK3 LL_RTC_ALMA_SetMask\n
1732 * ALRMAR MSK2 LL_RTC_ALMA_SetMask\n
1733 * ALRMAR MSK1 LL_RTC_ALMA_SetMask
1734 * @param RTCx RTC Instance
1735 * @param Mask This parameter can be a combination of the following values:
1736 * @arg @ref LL_RTC_ALMA_MASK_NONE
1737 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
1738 * @arg @ref LL_RTC_ALMA_MASK_HOURS
1739 * @arg @ref LL_RTC_ALMA_MASK_MINUTES
1740 * @arg @ref LL_RTC_ALMA_MASK_SECONDS
1741 * @arg @ref LL_RTC_ALMA_MASK_ALL
1742 * @retval None
1744 __STATIC_INLINE void LL_RTC_ALMA_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
1746 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1, Mask);
1750 * @brief Get the Alarm A masks.
1751 * @rmtoll ALRMAR MSK4 LL_RTC_ALMA_GetMask\n
1752 * ALRMAR MSK3 LL_RTC_ALMA_GetMask\n
1753 * ALRMAR MSK2 LL_RTC_ALMA_GetMask\n
1754 * ALRMAR MSK1 LL_RTC_ALMA_GetMask
1755 * @param RTCx RTC Instance
1756 * @retval Returned value can be can be a combination of the following values:
1757 * @arg @ref LL_RTC_ALMA_MASK_NONE
1758 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
1759 * @arg @ref LL_RTC_ALMA_MASK_HOURS
1760 * @arg @ref LL_RTC_ALMA_MASK_MINUTES
1761 * @arg @ref LL_RTC_ALMA_MASK_SECONDS
1762 * @arg @ref LL_RTC_ALMA_MASK_ALL
1764 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMask(RTC_TypeDef *RTCx)
1766 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1));
1770 * @brief Enable AlarmA Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
1771 * @rmtoll ALRMAR WDSEL LL_RTC_ALMA_EnableWeekday
1772 * @param RTCx RTC Instance
1773 * @retval None
1775 __STATIC_INLINE void LL_RTC_ALMA_EnableWeekday(RTC_TypeDef *RTCx)
1777 SET_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
1781 * @brief Disable AlarmA Week day selection (DU[3:0] represents the date )
1782 * @rmtoll ALRMAR WDSEL LL_RTC_ALMA_DisableWeekday
1783 * @param RTCx RTC Instance
1784 * @retval None
1786 __STATIC_INLINE void LL_RTC_ALMA_DisableWeekday(RTC_TypeDef *RTCx)
1788 CLEAR_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
1792 * @brief Set ALARM A Day in BCD format
1793 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
1794 * @rmtoll ALRMAR DT LL_RTC_ALMA_SetDay\n
1795 * ALRMAR DU LL_RTC_ALMA_SetDay
1796 * @param RTCx RTC Instance
1797 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
1798 * @retval None
1800 __STATIC_INLINE void LL_RTC_ALMA_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
1802 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU),
1803 (((Day & 0xF0U) << (RTC_ALRMAR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMAR_DU_Pos)));
1807 * @brief Get ALARM A Day in BCD format
1808 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
1809 * @rmtoll ALRMAR DT LL_RTC_ALMA_GetDay\n
1810 * ALRMAR DU LL_RTC_ALMA_GetDay
1811 * @param RTCx RTC Instance
1812 * @retval Value between Min_Data=0x01 and Max_Data=0x31
1814 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetDay(RTC_TypeDef *RTCx)
1816 register uint32_t temp = 0U;
1818 temp = READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU));
1819 return (uint32_t)((((temp & RTC_ALRMAR_DT) >> RTC_ALRMAR_DT_Pos) << 4U) | ((temp & RTC_ALRMAR_DU) >> RTC_ALRMAR_DU_Pos));
1823 * @brief Set ALARM A Weekday
1824 * @rmtoll ALRMAR DU LL_RTC_ALMA_SetWeekDay
1825 * @param RTCx RTC Instance
1826 * @param WeekDay This parameter can be one of the following values:
1827 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1828 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1829 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1830 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1831 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1832 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1833 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1834 * @retval None
1836 __STATIC_INLINE void LL_RTC_ALMA_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
1838 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_DU, WeekDay << RTC_ALRMAR_DU_Pos);
1842 * @brief Get ALARM A Weekday
1843 * @rmtoll ALRMAR DU LL_RTC_ALMA_GetWeekDay
1844 * @param RTCx RTC Instance
1845 * @retval Returned value can be one of the following values:
1846 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1847 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1848 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1849 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1850 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1851 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1852 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1854 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetWeekDay(RTC_TypeDef *RTCx)
1856 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_DU) >> RTC_ALRMAR_DU_Pos);
1860 * @brief Set Alarm A time format (AM/24-hour or PM notation)
1861 * @rmtoll ALRMAR PM LL_RTC_ALMA_SetTimeFormat
1862 * @param RTCx RTC Instance
1863 * @param TimeFormat This parameter can be one of the following values:
1864 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1865 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1866 * @retval None
1868 __STATIC_INLINE void LL_RTC_ALMA_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
1870 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM, TimeFormat);
1874 * @brief Get Alarm A time format (AM or PM notation)
1875 * @rmtoll ALRMAR PM LL_RTC_ALMA_GetTimeFormat
1876 * @param RTCx RTC Instance
1877 * @retval Returned value can be one of the following values:
1878 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1879 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1881 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTimeFormat(RTC_TypeDef *RTCx)
1883 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_PM));
1887 * @brief Set ALARM A Hours in BCD format
1888 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
1889 * @rmtoll ALRMAR HT LL_RTC_ALMA_SetHour\n
1890 * ALRMAR HU LL_RTC_ALMA_SetHour
1891 * @param RTCx RTC Instance
1892 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1893 * @retval None
1895 __STATIC_INLINE void LL_RTC_ALMA_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
1897 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU),
1898 (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos)));
1902 * @brief Get ALARM A Hours in BCD format
1903 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
1904 * @rmtoll ALRMAR HT LL_RTC_ALMA_GetHour\n
1905 * ALRMAR HU LL_RTC_ALMA_GetHour
1906 * @param RTCx RTC Instance
1907 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1909 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetHour(RTC_TypeDef *RTCx)
1911 register uint32_t temp = 0U;
1913 temp = READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU));
1914 return (uint32_t)((((temp & RTC_ALRMAR_HT) >> RTC_ALRMAR_HT_Pos) << 4U) | ((temp & RTC_ALRMAR_HU) >> RTC_ALRMAR_HU_Pos));
1918 * @brief Set ALARM A Minutes in BCD format
1919 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
1920 * @rmtoll ALRMAR MNT LL_RTC_ALMA_SetMinute\n
1921 * ALRMAR MNU LL_RTC_ALMA_SetMinute
1922 * @param RTCx RTC Instance
1923 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
1924 * @retval None
1926 __STATIC_INLINE void LL_RTC_ALMA_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
1928 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU),
1929 (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)));
1933 * @brief Get ALARM A Minutes in BCD format
1934 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
1935 * @rmtoll ALRMAR MNT LL_RTC_ALMA_GetMinute\n
1936 * ALRMAR MNU LL_RTC_ALMA_GetMinute
1937 * @param RTCx RTC Instance
1938 * @retval Value between Min_Data=0x00 and Max_Data=0x59
1940 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMinute(RTC_TypeDef *RTCx)
1942 register uint32_t temp = 0U;
1944 temp = READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU));
1945 return (uint32_t)((((temp & RTC_ALRMAR_MNT) >> RTC_ALRMAR_MNT_Pos) << 4U) | ((temp & RTC_ALRMAR_MNU) >> RTC_ALRMAR_MNU_Pos));
1949 * @brief Set ALARM A Seconds in BCD format
1950 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
1951 * @rmtoll ALRMAR ST LL_RTC_ALMA_SetSecond\n
1952 * ALRMAR SU LL_RTC_ALMA_SetSecond
1953 * @param RTCx RTC Instance
1954 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
1955 * @retval None
1957 __STATIC_INLINE void LL_RTC_ALMA_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
1959 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU),
1960 (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos)));
1964 * @brief Get ALARM A Seconds in BCD format
1965 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
1966 * @rmtoll ALRMAR ST LL_RTC_ALMA_GetSecond\n
1967 * ALRMAR SU LL_RTC_ALMA_GetSecond
1968 * @param RTCx RTC Instance
1969 * @retval Value between Min_Data=0x00 and Max_Data=0x59
1971 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSecond(RTC_TypeDef *RTCx)
1973 register uint32_t temp = 0U;
1975 temp = READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU));
1976 return (uint32_t)((((temp & RTC_ALRMAR_ST) >> RTC_ALRMAR_ST_Pos) << 4U) | ((temp & RTC_ALRMAR_SU) >> RTC_ALRMAR_SU_Pos));
1980 * @brief Set Alarm A Time (hour, minute and second) in BCD format
1981 * @rmtoll ALRMAR PM LL_RTC_ALMA_ConfigTime\n
1982 * ALRMAR HT LL_RTC_ALMA_ConfigTime\n
1983 * ALRMAR HU LL_RTC_ALMA_ConfigTime\n
1984 * ALRMAR MNT LL_RTC_ALMA_ConfigTime\n
1985 * ALRMAR MNU LL_RTC_ALMA_ConfigTime\n
1986 * ALRMAR ST LL_RTC_ALMA_ConfigTime\n
1987 * ALRMAR SU LL_RTC_ALMA_ConfigTime
1988 * @param RTCx RTC Instance
1989 * @param Format12_24 This parameter can be one of the following values:
1990 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1991 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1992 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1993 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
1994 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
1995 * @retval None
1997 __STATIC_INLINE void LL_RTC_ALMA_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
1999 register uint32_t temp = 0U;
2001 temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos)) | \
2002 (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)) | \
2003 (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos));
2005 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);
2009 * @brief Get Alarm B Time (hour, minute and second) in BCD format
2010 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2011 * are available to get independently each parameter.
2012 * @rmtoll ALRMAR HT LL_RTC_ALMA_GetTime\n
2013 * ALRMAR HU LL_RTC_ALMA_GetTime\n
2014 * ALRMAR MNT LL_RTC_ALMA_GetTime\n
2015 * ALRMAR MNU LL_RTC_ALMA_GetTime\n
2016 * ALRMAR ST LL_RTC_ALMA_GetTime\n
2017 * ALRMAR SU LL_RTC_ALMA_GetTime
2018 * @param RTCx RTC Instance
2019 * @retval Combination of hours, minutes and seconds.
2021 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTime(RTC_TypeDef *RTCx)
2023 return (uint32_t)((LL_RTC_ALMA_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMA_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMA_GetSecond(RTCx));
2027 * @brief Set Alarm A Mask the most-significant bits starting at this bit
2028 * @note This register can be written only when ALRAE is reset in RTC_CR register,
2029 * or in initialization mode.
2030 * @rmtoll ALRMASSR MASKSS LL_RTC_ALMA_SetSubSecondMask
2031 * @param RTCx RTC Instance
2032 * @param Mask Value between Min_Data=0x00 and Max_Data=0xF
2033 * @retval None
2035 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
2037 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS, Mask << RTC_ALRMASSR_MASKSS_Pos);
2041 * @brief Get Alarm A Mask the most-significant bits starting at this bit
2042 * @rmtoll ALRMASSR MASKSS LL_RTC_ALMA_GetSubSecondMask
2043 * @param RTCx RTC Instance
2044 * @retval Value between Min_Data=0x00 and Max_Data=0xF
2046 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecondMask(RTC_TypeDef *RTCx)
2048 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS) >> RTC_ALRMASSR_MASKSS_Pos);
2052 * @brief Set Alarm A Sub seconds value
2053 * @rmtoll ALRMASSR SS LL_RTC_ALMA_SetSubSecond
2054 * @param RTCx RTC Instance
2055 * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
2056 * @retval None
2058 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
2060 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_SS, Subsecond);
2064 * @brief Get Alarm A Sub seconds value
2065 * @rmtoll ALRMASSR SS LL_RTC_ALMA_GetSubSecond
2066 * @param RTCx RTC Instance
2067 * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
2069 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecond(RTC_TypeDef *RTCx)
2071 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_SS));
2075 * @}
2078 /** @defgroup RTC_LL_EF_ALARMB ALARMB
2079 * @{
2083 * @brief Enable Alarm B
2084 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2085 * @rmtoll CR ALRBE LL_RTC_ALMB_Enable
2086 * @param RTCx RTC Instance
2087 * @retval None
2089 __STATIC_INLINE void LL_RTC_ALMB_Enable(RTC_TypeDef *RTCx)
2091 SET_BIT(RTCx->CR, RTC_CR_ALRBE);
2095 * @brief Disable Alarm B
2096 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2097 * @rmtoll CR ALRBE LL_RTC_ALMB_Disable
2098 * @param RTCx RTC Instance
2099 * @retval None
2101 __STATIC_INLINE void LL_RTC_ALMB_Disable(RTC_TypeDef *RTCx)
2103 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBE);
2107 * @brief Specify the Alarm B masks.
2108 * @rmtoll ALRMBR MSK4 LL_RTC_ALMB_SetMask\n
2109 * ALRMBR MSK3 LL_RTC_ALMB_SetMask\n
2110 * ALRMBR MSK2 LL_RTC_ALMB_SetMask\n
2111 * ALRMBR MSK1 LL_RTC_ALMB_SetMask
2112 * @param RTCx RTC Instance
2113 * @param Mask This parameter can be a combination of the following values:
2114 * @arg @ref LL_RTC_ALMB_MASK_NONE
2115 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
2116 * @arg @ref LL_RTC_ALMB_MASK_HOURS
2117 * @arg @ref LL_RTC_ALMB_MASK_MINUTES
2118 * @arg @ref LL_RTC_ALMB_MASK_SECONDS
2119 * @arg @ref LL_RTC_ALMB_MASK_ALL
2120 * @retval None
2122 __STATIC_INLINE void LL_RTC_ALMB_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
2124 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1, Mask);
2128 * @brief Get the Alarm B masks.
2129 * @rmtoll ALRMBR MSK4 LL_RTC_ALMB_GetMask\n
2130 * ALRMBR MSK3 LL_RTC_ALMB_GetMask\n
2131 * ALRMBR MSK2 LL_RTC_ALMB_GetMask\n
2132 * ALRMBR MSK1 LL_RTC_ALMB_GetMask
2133 * @param RTCx RTC Instance
2134 * @retval Returned value can be can be a combination of the following values:
2135 * @arg @ref LL_RTC_ALMB_MASK_NONE
2136 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
2137 * @arg @ref LL_RTC_ALMB_MASK_HOURS
2138 * @arg @ref LL_RTC_ALMB_MASK_MINUTES
2139 * @arg @ref LL_RTC_ALMB_MASK_SECONDS
2140 * @arg @ref LL_RTC_ALMB_MASK_ALL
2142 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMask(RTC_TypeDef *RTCx)
2144 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1));
2148 * @brief Enable AlarmB Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
2149 * @rmtoll ALRMBR WDSEL LL_RTC_ALMB_EnableWeekday
2150 * @param RTCx RTC Instance
2151 * @retval None
2153 __STATIC_INLINE void LL_RTC_ALMB_EnableWeekday(RTC_TypeDef *RTCx)
2155 SET_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
2159 * @brief Disable AlarmB Week day selection (DU[3:0] represents the date )
2160 * @rmtoll ALRMBR WDSEL LL_RTC_ALMB_DisableWeekday
2161 * @param RTCx RTC Instance
2162 * @retval None
2164 __STATIC_INLINE void LL_RTC_ALMB_DisableWeekday(RTC_TypeDef *RTCx)
2166 CLEAR_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
2170 * @brief Set ALARM B Day in BCD format
2171 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
2172 * @rmtoll ALRMBR DT LL_RTC_ALMB_SetDay\n
2173 * ALRMBR DU LL_RTC_ALMB_SetDay
2174 * @param RTCx RTC Instance
2175 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
2176 * @retval None
2178 __STATIC_INLINE void LL_RTC_ALMB_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
2180 MODIFY_REG(RTC->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU),
2181 (((Day & 0xF0U) << (RTC_ALRMBR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMBR_DU_Pos)));
2185 * @brief Get ALARM B Day in BCD format
2186 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2187 * @rmtoll ALRMBR DT LL_RTC_ALMB_GetDay\n
2188 * ALRMBR DU LL_RTC_ALMB_GetDay
2189 * @param RTCx RTC Instance
2190 * @retval Value between Min_Data=0x01 and Max_Data=0x31
2192 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetDay(RTC_TypeDef *RTCx)
2194 register uint32_t temp = 0U;
2196 temp = READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU));
2197 return (uint32_t)((((temp & RTC_ALRMBR_DT) >> RTC_ALRMBR_DT_Pos) << 4U) | ((temp & RTC_ALRMBR_DU) >> RTC_ALRMBR_DU_Pos));
2201 * @brief Set ALARM B Weekday
2202 * @rmtoll ALRMBR DU LL_RTC_ALMB_SetWeekDay
2203 * @param RTCx RTC Instance
2204 * @param WeekDay This parameter can be one of the following values:
2205 * @arg @ref LL_RTC_WEEKDAY_MONDAY
2206 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
2207 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2208 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
2209 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
2210 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
2211 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
2212 * @retval None
2214 __STATIC_INLINE void LL_RTC_ALMB_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
2216 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_DU, WeekDay << RTC_ALRMBR_DU_Pos);
2220 * @brief Get ALARM B Weekday
2221 * @rmtoll ALRMBR DU LL_RTC_ALMB_GetWeekDay
2222 * @param RTCx RTC Instance
2223 * @retval Returned value can be one of the following values:
2224 * @arg @ref LL_RTC_WEEKDAY_MONDAY
2225 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
2226 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2227 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
2228 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
2229 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
2230 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
2232 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetWeekDay(RTC_TypeDef *RTCx)
2234 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_DU) >> RTC_ALRMBR_DU_Pos);
2238 * @brief Set ALARM B time format (AM/24-hour or PM notation)
2239 * @rmtoll ALRMBR PM LL_RTC_ALMB_SetTimeFormat
2240 * @param RTCx RTC Instance
2241 * @param TimeFormat This parameter can be one of the following values:
2242 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2243 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2244 * @retval None
2246 __STATIC_INLINE void LL_RTC_ALMB_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
2248 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM, TimeFormat);
2252 * @brief Get ALARM B time format (AM or PM notation)
2253 * @rmtoll ALRMBR PM LL_RTC_ALMB_GetTimeFormat
2254 * @param RTCx RTC Instance
2255 * @retval Returned value can be one of the following values:
2256 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2257 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2259 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTimeFormat(RTC_TypeDef *RTCx)
2261 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_PM));
2265 * @brief Set ALARM B Hours in BCD format
2266 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
2267 * @rmtoll ALRMBR HT LL_RTC_ALMB_SetHour\n
2268 * ALRMBR HU LL_RTC_ALMB_SetHour
2269 * @param RTCx RTC Instance
2270 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2271 * @retval None
2273 __STATIC_INLINE void LL_RTC_ALMB_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
2275 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU),
2276 (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos)));
2280 * @brief Get ALARM B Hours in BCD format
2281 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2282 * @rmtoll ALRMBR HT LL_RTC_ALMB_GetHour\n
2283 * ALRMBR HU LL_RTC_ALMB_GetHour
2284 * @param RTCx RTC Instance
2285 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2287 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetHour(RTC_TypeDef *RTCx)
2289 register uint32_t temp = 0U;
2291 temp = READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU));
2292 return (uint32_t)((((temp & RTC_ALRMBR_HT) >> RTC_ALRMBR_HT_Pos) << 4U) | ((temp & RTC_ALRMBR_HU) >> RTC_ALRMBR_HU_Pos));
2296 * @brief Set ALARM B Minutes in BCD format
2297 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
2298 * @rmtoll ALRMBR MNT LL_RTC_ALMB_SetMinute\n
2299 * ALRMBR MNU LL_RTC_ALMB_SetMinute
2300 * @param RTCx RTC Instance
2301 * @param Minutes between Min_Data=0x00 and Max_Data=0x59
2302 * @retval None
2304 __STATIC_INLINE void LL_RTC_ALMB_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
2306 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU),
2307 (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)));
2311 * @brief Get ALARM B Minutes in BCD format
2312 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2313 * @rmtoll ALRMBR MNT LL_RTC_ALMB_GetMinute\n
2314 * ALRMBR MNU LL_RTC_ALMB_GetMinute
2315 * @param RTCx RTC Instance
2316 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2318 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMinute(RTC_TypeDef *RTCx)
2320 register uint32_t temp = 0U;
2322 temp = READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU));
2323 return (uint32_t)((((temp & RTC_ALRMBR_MNT) >> RTC_ALRMBR_MNT_Pos) << 4U) | ((temp & RTC_ALRMBR_MNU) >> RTC_ALRMBR_MNU_Pos));
2327 * @brief Set ALARM B Seconds in BCD format
2328 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
2329 * @rmtoll ALRMBR ST LL_RTC_ALMB_SetSecond\n
2330 * ALRMBR SU LL_RTC_ALMB_SetSecond
2331 * @param RTCx RTC Instance
2332 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
2333 * @retval None
2335 __STATIC_INLINE void LL_RTC_ALMB_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
2337 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU),
2338 (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos)));
2342 * @brief Get ALARM B Seconds in BCD format
2343 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2344 * @rmtoll ALRMBR ST LL_RTC_ALMB_GetSecond\n
2345 * ALRMBR SU LL_RTC_ALMB_GetSecond
2346 * @param RTCx RTC Instance
2347 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2349 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSecond(RTC_TypeDef *RTCx)
2351 register uint32_t temp = 0U;
2353 temp = READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU));
2354 return (uint32_t)((((temp & RTC_ALRMBR_ST) >> RTC_ALRMBR_ST_Pos) << 4U) | ((temp & RTC_ALRMBR_SU) >> RTC_ALRMBR_SU_Pos));
2358 * @brief Set Alarm B Time (hour, minute and second) in BCD format
2359 * @rmtoll ALRMBR PM LL_RTC_ALMB_ConfigTime\n
2360 * ALRMBR HT LL_RTC_ALMB_ConfigTime\n
2361 * ALRMBR HU LL_RTC_ALMB_ConfigTime\n
2362 * ALRMBR MNT LL_RTC_ALMB_ConfigTime\n
2363 * ALRMBR MNU LL_RTC_ALMB_ConfigTime\n
2364 * ALRMBR ST LL_RTC_ALMB_ConfigTime\n
2365 * ALRMBR SU LL_RTC_ALMB_ConfigTime
2366 * @param RTCx RTC Instance
2367 * @param Format12_24 This parameter can be one of the following values:
2368 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2369 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2370 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2371 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
2372 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
2373 * @retval None
2375 __STATIC_INLINE void LL_RTC_ALMB_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
2377 register uint32_t temp = 0U;
2379 temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos)) | \
2380 (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)) | \
2381 (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos));
2383 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);
2387 * @brief Get Alarm B Time (hour, minute and second) in BCD format
2388 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2389 * are available to get independently each parameter.
2390 * @rmtoll ALRMBR HT LL_RTC_ALMB_GetTime\n
2391 * ALRMBR HU LL_RTC_ALMB_GetTime\n
2392 * ALRMBR MNT LL_RTC_ALMB_GetTime\n
2393 * ALRMBR MNU LL_RTC_ALMB_GetTime\n
2394 * ALRMBR ST LL_RTC_ALMB_GetTime\n
2395 * ALRMBR SU LL_RTC_ALMB_GetTime
2396 * @param RTCx RTC Instance
2397 * @retval Combination of hours, minutes and seconds.
2399 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTime(RTC_TypeDef *RTCx)
2401 return (uint32_t)((LL_RTC_ALMB_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMB_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMB_GetSecond(RTCx));
2405 * @brief Set Alarm B Mask the most-significant bits starting at this bit
2406 * @note This register can be written only when ALRBE is reset in RTC_CR register,
2407 * or in initialization mode.
2408 * @rmtoll ALRMBSSR MASKSS LL_RTC_ALMB_SetSubSecondMask
2409 * @param RTCx RTC Instance
2410 * @param Mask Value between Min_Data=0x00 and Max_Data=0xF
2411 * @retval None
2413 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
2415 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS, Mask << RTC_ALRMBSSR_MASKSS_Pos);
2419 * @brief Get Alarm B Mask the most-significant bits starting at this bit
2420 * @rmtoll ALRMBSSR MASKSS LL_RTC_ALMB_GetSubSecondMask
2421 * @param RTCx RTC Instance
2422 * @retval Value between Min_Data=0x00 and Max_Data=0xF
2424 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecondMask(RTC_TypeDef *RTCx)
2426 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS) >> RTC_ALRMBSSR_MASKSS_Pos);
2430 * @brief Set Alarm B Sub seconds value
2431 * @rmtoll ALRMBSSR SS LL_RTC_ALMB_SetSubSecond
2432 * @param RTCx RTC Instance
2433 * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
2434 * @retval None
2436 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
2438 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS, Subsecond);
2442 * @brief Get Alarm B Sub seconds value
2443 * @rmtoll ALRMBSSR SS LL_RTC_ALMB_GetSubSecond
2444 * @param RTCx RTC Instance
2445 * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
2447 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecond(RTC_TypeDef *RTCx)
2449 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS));
2453 * @}
2456 /** @defgroup RTC_LL_EF_Timestamp Timestamp
2457 * @{
2461 * @brief Enable Timestamp
2462 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2463 * @rmtoll CR TSE LL_RTC_TS_Enable
2464 * @param RTCx RTC Instance
2465 * @retval None
2467 __STATIC_INLINE void LL_RTC_TS_Enable(RTC_TypeDef *RTCx)
2469 SET_BIT(RTCx->CR, RTC_CR_TSE);
2473 * @brief Disable Timestamp
2474 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2475 * @rmtoll CR TSE LL_RTC_TS_Disable
2476 * @param RTCx RTC Instance
2477 * @retval None
2479 __STATIC_INLINE void LL_RTC_TS_Disable(RTC_TypeDef *RTCx)
2481 CLEAR_BIT(RTCx->CR, RTC_CR_TSE);
2485 * @brief Set Time-stamp event active edge
2486 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2487 * @note TSE must be reset when TSEDGE is changed to avoid unwanted TSF setting
2488 * @rmtoll CR TSEDGE LL_RTC_TS_SetActiveEdge
2489 * @param RTCx RTC Instance
2490 * @param Edge This parameter can be one of the following values:
2491 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
2492 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
2493 * @retval None
2495 __STATIC_INLINE void LL_RTC_TS_SetActiveEdge(RTC_TypeDef *RTCx, uint32_t Edge)
2497 MODIFY_REG(RTCx->CR, RTC_CR_TSEDGE, Edge);
2501 * @brief Get Time-stamp event active edge
2502 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2503 * @rmtoll CR TSEDGE LL_RTC_TS_GetActiveEdge
2504 * @param RTCx RTC Instance
2505 * @retval Returned value can be one of the following values:
2506 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
2507 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
2509 __STATIC_INLINE uint32_t LL_RTC_TS_GetActiveEdge(RTC_TypeDef *RTCx)
2511 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TSEDGE));
2515 * @brief Get Timestamp AM/PM notation (AM or 24-hour format)
2516 * @rmtoll TSTR PM LL_RTC_TS_GetTimeFormat
2517 * @param RTCx RTC Instance
2518 * @retval Returned value can be one of the following values:
2519 * @arg @ref LL_RTC_TS_TIME_FORMAT_AM
2520 * @arg @ref LL_RTC_TS_TIME_FORMAT_PM
2522 __STATIC_INLINE uint32_t LL_RTC_TS_GetTimeFormat(RTC_TypeDef *RTCx)
2524 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_PM));
2528 * @brief Get Timestamp Hours in BCD format
2529 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2530 * @rmtoll TSTR HT LL_RTC_TS_GetHour\n
2531 * TSTR HU LL_RTC_TS_GetHour
2532 * @param RTCx RTC Instance
2533 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2535 __STATIC_INLINE uint32_t LL_RTC_TS_GetHour(RTC_TypeDef *RTCx)
2537 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_HT | RTC_TSTR_HU) >> RTC_TSTR_HU_Pos);
2541 * @brief Get Timestamp Minutes in BCD format
2542 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2543 * @rmtoll TSTR MNT LL_RTC_TS_GetMinute\n
2544 * TSTR MNU LL_RTC_TS_GetMinute
2545 * @param RTCx RTC Instance
2546 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2548 __STATIC_INLINE uint32_t LL_RTC_TS_GetMinute(RTC_TypeDef *RTCx)
2550 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_MNT | RTC_TSTR_MNU) >> RTC_TSTR_MNU_Pos);
2554 * @brief Get Timestamp Seconds in BCD format
2555 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2556 * @rmtoll TSTR ST LL_RTC_TS_GetSecond\n
2557 * TSTR SU LL_RTC_TS_GetSecond
2558 * @param RTCx RTC Instance
2559 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2561 __STATIC_INLINE uint32_t LL_RTC_TS_GetSecond(RTC_TypeDef *RTCx)
2563 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_ST | RTC_TSTR_SU));
2567 * @brief Get Timestamp time (hour, minute and second) in BCD format
2568 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2569 * are available to get independently each parameter.
2570 * @rmtoll TSTR HT LL_RTC_TS_GetTime\n
2571 * TSTR HU LL_RTC_TS_GetTime\n
2572 * TSTR MNT LL_RTC_TS_GetTime\n
2573 * TSTR MNU LL_RTC_TS_GetTime\n
2574 * TSTR ST LL_RTC_TS_GetTime\n
2575 * TSTR SU LL_RTC_TS_GetTime
2576 * @param RTCx RTC Instance
2577 * @retval Combination of hours, minutes and seconds.
2579 __STATIC_INLINE uint32_t LL_RTC_TS_GetTime(RTC_TypeDef *RTCx)
2581 return (uint32_t)(READ_BIT(RTCx->TSTR,
2582 RTC_TSTR_HT | RTC_TSTR_HU | RTC_TSTR_MNT | RTC_TSTR_MNU | RTC_TSTR_ST | RTC_TSTR_SU));
2586 * @brief Get Timestamp Week day
2587 * @rmtoll TSDR WDU LL_RTC_TS_GetWeekDay
2588 * @param RTCx RTC Instance
2589 * @retval Returned value can be one of the following values:
2590 * @arg @ref LL_RTC_WEEKDAY_MONDAY
2591 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
2592 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2593 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
2594 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
2595 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
2596 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
2598 __STATIC_INLINE uint32_t LL_RTC_TS_GetWeekDay(RTC_TypeDef *RTCx)
2600 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU) >> RTC_TSDR_WDU_Pos);
2604 * @brief Get Timestamp Month in BCD format
2605 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
2606 * @rmtoll TSDR MT LL_RTC_TS_GetMonth\n
2607 * TSDR MU LL_RTC_TS_GetMonth
2608 * @param RTCx RTC Instance
2609 * @retval Returned value can be one of the following values:
2610 * @arg @ref LL_RTC_MONTH_JANUARY
2611 * @arg @ref LL_RTC_MONTH_FEBRUARY
2612 * @arg @ref LL_RTC_MONTH_MARCH
2613 * @arg @ref LL_RTC_MONTH_APRIL
2614 * @arg @ref LL_RTC_MONTH_MAY
2615 * @arg @ref LL_RTC_MONTH_JUNE
2616 * @arg @ref LL_RTC_MONTH_JULY
2617 * @arg @ref LL_RTC_MONTH_AUGUST
2618 * @arg @ref LL_RTC_MONTH_SEPTEMBER
2619 * @arg @ref LL_RTC_MONTH_OCTOBER
2620 * @arg @ref LL_RTC_MONTH_NOVEMBER
2621 * @arg @ref LL_RTC_MONTH_DECEMBER
2623 __STATIC_INLINE uint32_t LL_RTC_TS_GetMonth(RTC_TypeDef *RTCx)
2625 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_MT | RTC_TSDR_MU) >> RTC_TSDR_MU_Pos);
2629 * @brief Get Timestamp Day in BCD format
2630 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2631 * @rmtoll TSDR DT LL_RTC_TS_GetDay\n
2632 * TSDR DU LL_RTC_TS_GetDay
2633 * @param RTCx RTC Instance
2634 * @retval Value between Min_Data=0x01 and Max_Data=0x31
2636 __STATIC_INLINE uint32_t LL_RTC_TS_GetDay(RTC_TypeDef *RTCx)
2638 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_DT | RTC_TSDR_DU));
2642 * @brief Get Timestamp date (WeekDay, Day and Month) in BCD format
2643 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_MONTH,
2644 * and __LL_RTC_GET_DAY are available to get independently each parameter.
2645 * @rmtoll TSDR WDU LL_RTC_TS_GetDate\n
2646 * TSDR MT LL_RTC_TS_GetDate\n
2647 * TSDR MU LL_RTC_TS_GetDate\n
2648 * TSDR DT LL_RTC_TS_GetDate\n
2649 * TSDR DU LL_RTC_TS_GetDate
2650 * @param RTCx RTC Instance
2651 * @retval Combination of Weekday, Day and Month
2653 __STATIC_INLINE uint32_t LL_RTC_TS_GetDate(RTC_TypeDef *RTCx)
2655 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU | RTC_TSDR_MT | RTC_TSDR_MU | RTC_TSDR_DT | RTC_TSDR_DU));
2659 * @brief Get time-stamp sub second value
2660 * @rmtoll TSSSR SS LL_RTC_TS_GetSubSecond
2661 * @param RTCx RTC Instance
2662 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
2664 __STATIC_INLINE uint32_t LL_RTC_TS_GetSubSecond(RTC_TypeDef *RTCx)
2666 return (uint32_t)(READ_BIT(RTCx->TSSSR, RTC_TSSSR_SS));
2669 #if defined(RTC_TAFCR_TAMPTS)
2671 * @brief Activate timestamp on tamper detection event
2672 * @rmtoll TAFCR TAMPTS LL_RTC_TS_EnableOnTamper
2673 * @param RTCx RTC Instance
2674 * @retval None
2676 __STATIC_INLINE void LL_RTC_TS_EnableOnTamper(RTC_TypeDef *RTCx)
2678 SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPTS);
2682 * @brief Disable timestamp on tamper detection event
2683 * @rmtoll TAFCR TAMPTS LL_RTC_TS_DisableOnTamper
2684 * @param RTCx RTC Instance
2685 * @retval None
2687 __STATIC_INLINE void LL_RTC_TS_DisableOnTamper(RTC_TypeDef *RTCx)
2689 CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPTS);
2691 #endif /* RTC_TAFCR_TAMPTS */
2694 * @brief Set timestamp Pin
2695 * @rmtoll TAFCR TSINSEL LL_RTC_TS_SetPin
2696 * @param RTCx RTC Instance
2697 * @param TSPin: specifies the RTC TimeStamp Pin.
2698 * This parameter can be one of the following values:
2699 * @arg LL_RTC_TimeStampPin_Default: RTC_AF1 is used as RTC TimeStamp.
2700 * @arg LL_RTC_TimeStampPin_Pos1: RTC_AF2 is selected as RTC TimeStamp. (*)
2702 * (*) value not defined in all devices.
2703 * @retval None
2705 __STATIC_INLINE void LL_RTC_TS_SetPin(RTC_TypeDef *RTCx, uint32_t TSPin)
2707 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TSINSEL , TSPin);
2711 * @brief Get timestamp Pin
2712 * @rmtoll TAFCR TSINSEL LL_RTC_TS_GetPin
2713 * @param RTCx RTC Instance
2714 * @retval Returned value can be one of the following values:
2715 * @arg LL_RTC_TimeStampPin_Default: RTC_AF1 is used as RTC TimeStamp Pin.
2716 * @arg LL_RTC_TimeStampPin_Pos1: RTC_AF2 is selected as RTC TimeStamp Pin. (*)
2718 * (*) value not defined in all devices.
2719 * @retval None
2722 __STATIC_INLINE uint32_t LL_RTC_TS_GetPin(RTC_TypeDef *RTCx)
2724 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TSINSEL));
2728 * @}
2731 /** @defgroup RTC_LL_EF_Tamper Tamper
2732 * @{
2736 * @brief Enable RTC_TAMPx input detection
2737 * @rmtoll TAFCR TAMP1E LL_RTC_TAMPER_Enable\n
2738 * TAFCR TAMP2E LL_RTC_TAMPER_Enable\n
2739 * @param RTCx RTC Instance
2740 * @param Tamper This parameter can be a combination of the following values:
2741 * @arg @ref LL_RTC_TAMPER_1
2742 * @arg @ref LL_RTC_TAMPER_2 (*)
2744 * (*) value not defined in all devices.
2745 * @retval None
2747 __STATIC_INLINE void LL_RTC_TAMPER_Enable(RTC_TypeDef *RTCx, uint32_t Tamper)
2749 SET_BIT(RTCx->TAFCR, Tamper);
2753 * @brief Clear RTC_TAMPx input detection
2754 * @rmtoll TAFCR TAMP1E LL_RTC_TAMPER_Disable\n
2755 * TAFCR TAMP2E LL_RTC_TAMPER_Disable\n
2756 * @param RTCx RTC Instance
2757 * @param Tamper This parameter can be a combination of the following values:
2758 * @arg @ref LL_RTC_TAMPER_1
2759 * @arg @ref LL_RTC_TAMPER_2 (*)
2761 * (*) value not defined in all devices.
2762 * @retval None
2764 __STATIC_INLINE void LL_RTC_TAMPER_Disable(RTC_TypeDef *RTCx, uint32_t Tamper)
2766 CLEAR_BIT(RTCx->TAFCR, Tamper);
2769 #if defined(RTC_TAFCR_TAMPPUDIS)
2771 * @brief Disable RTC_TAMPx pull-up disable (Disable precharge of RTC_TAMPx pins)
2772 * @rmtoll TAFCR TAMPPUDIS LL_RTC_TAMPER_DisablePullUp
2773 * @param RTCx RTC Instance
2774 * @retval None
2776 __STATIC_INLINE void LL_RTC_TAMPER_DisablePullUp(RTC_TypeDef *RTCx)
2778 SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPUDIS);
2782 * @brief Enable RTC_TAMPx pull-up disable ( Precharge RTC_TAMPx pins before sampling)
2783 * @rmtoll TAFCR TAMPPUDIS LL_RTC_TAMPER_EnablePullUp
2784 * @param RTCx RTC Instance
2785 * @retval None
2787 __STATIC_INLINE void LL_RTC_TAMPER_EnablePullUp(RTC_TypeDef *RTCx)
2789 CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPUDIS);
2791 #endif /* RTC_TAFCR_TAMPPUDIS */
2793 #if defined(RTC_TAFCR_TAMPPRCH)
2795 * @brief Set RTC_TAMPx precharge duration
2796 * @rmtoll TAFCR TAMPPRCH LL_RTC_TAMPER_SetPrecharge
2797 * @param RTCx RTC Instance
2798 * @param Duration This parameter can be one of the following values:
2799 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
2800 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
2801 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
2802 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
2803 * @retval None
2805 __STATIC_INLINE void LL_RTC_TAMPER_SetPrecharge(RTC_TypeDef *RTCx, uint32_t Duration)
2807 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPPRCH, Duration);
2811 * @brief Get RTC_TAMPx precharge duration
2812 * @rmtoll TAFCR TAMPPRCH LL_RTC_TAMPER_GetPrecharge
2813 * @param RTCx RTC Instance
2814 * @retval Returned value can be one of the following values:
2815 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
2816 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
2817 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
2818 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
2820 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPrecharge(RTC_TypeDef *RTCx)
2822 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPRCH));
2824 #endif /* RTC_TAFCR_TAMPPRCH */
2826 #if defined(RTC_TAFCR_TAMPFLT)
2828 * @brief Set RTC_TAMPx filter count
2829 * @rmtoll TAFCR TAMPFLT LL_RTC_TAMPER_SetFilterCount
2830 * @param RTCx RTC Instance
2831 * @param FilterCount This parameter can be one of the following values:
2832 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
2833 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
2834 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
2835 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
2836 * @retval None
2838 __STATIC_INLINE void LL_RTC_TAMPER_SetFilterCount(RTC_TypeDef *RTCx, uint32_t FilterCount)
2840 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPFLT, FilterCount);
2844 * @brief Get RTC_TAMPx filter count
2845 * @rmtoll TAFCR TAMPFLT LL_RTC_TAMPER_GetFilterCount
2846 * @param RTCx RTC Instance
2847 * @retval Returned value can be one of the following values:
2848 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
2849 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
2850 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
2851 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
2853 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetFilterCount(RTC_TypeDef *RTCx)
2855 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPFLT));
2857 #endif /* RTC_TAFCR_TAMPFLT */
2859 #if defined(RTC_TAFCR_TAMPFREQ)
2861 * @brief Set Tamper sampling frequency
2862 * @rmtoll TAFCR TAMPFREQ LL_RTC_TAMPER_SetSamplingFreq
2863 * @param RTCx RTC Instance
2864 * @param SamplingFreq This parameter can be one of the following values:
2865 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
2866 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
2867 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
2868 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
2869 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
2870 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
2871 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
2872 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
2873 * @retval None
2875 __STATIC_INLINE void LL_RTC_TAMPER_SetSamplingFreq(RTC_TypeDef *RTCx, uint32_t SamplingFreq)
2877 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPFREQ, SamplingFreq);
2881 * @brief Get Tamper sampling frequency
2882 * @rmtoll TAFCR TAMPFREQ LL_RTC_TAMPER_GetSamplingFreq
2883 * @param RTCx RTC Instance
2884 * @retval Returned value can be one of the following values:
2885 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
2886 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
2887 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
2888 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
2889 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
2890 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
2891 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
2892 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
2894 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetSamplingFreq(RTC_TypeDef *RTCx)
2896 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPFREQ));
2898 #endif /* RTC_TAFCR_TAMPFREQ */
2901 * @brief Enable Active level for Tamper input
2902 * @rmtoll TAFCR TAMP1TRG LL_RTC_TAMPER_EnableActiveLevel\n
2903 * TAFCR TAMP2TRG LL_RTC_TAMPER_EnableActiveLevel\n
2904 * @param RTCx RTC Instance
2905 * @param Tamper This parameter can be a combination of the following values:
2906 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
2907 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 (*)
2909 * (*) value not defined in all devices.
2910 * @retval None
2912 __STATIC_INLINE void LL_RTC_TAMPER_EnableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper)
2914 SET_BIT(RTCx->TAFCR, Tamper);
2918 * @brief Disable Active level for Tamper input
2919 * @rmtoll TAFCR TAMP1TRG LL_RTC_TAMPER_DisableActiveLevel\n
2920 * TAFCR TAMP2TRG LL_RTC_TAMPER_DisableActiveLevel\n
2921 * @param RTCx RTC Instance
2922 * @param Tamper This parameter can be a combination of the following values:
2923 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
2924 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 (*)
2926 * (*) value not defined in all devices.
2927 * @retval None
2929 __STATIC_INLINE void LL_RTC_TAMPER_DisableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper)
2931 CLEAR_BIT(RTCx->TAFCR, Tamper);
2935 * @brief Set Tamper Pin
2936 * @rmtoll TAFCR TAMP1INSEL LL_RTC_TAMPER_SetPin
2937 * @param RTCx RTC Instance
2938 * @param TamperPin: specifies the RTC Tamper Pin.
2939 * This parameter can be one of the following values:
2940 * @arg LL_RTC_TamperPin_Default: RTC_AF1 is used as RTC Tamper.
2941 * @arg LL_RTC_TamperPin_Pos1: RTC_AF2 is selected as RTC Tamper. (*)
2943 * (*) value not defined in all devices.
2944 * @retval None
2946 __STATIC_INLINE void LL_RTC_TAMPER_SetPin(RTC_TypeDef *RTCx, uint32_t TamperPin)
2948 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMP1INSEL , TamperPin);
2952 * @brief Get Tamper Pin
2953 * @rmtoll TAFCR TAMP1INSEL LL_RTC_TAMPER_GetPin
2954 * @param RTCx RTC Instance
2955 * @retval Returned value can be one of the following values:
2956 * @arg LL_RTC_TamperPin_Default: RTC_AF1 is used as RTC Tamper Pin.
2957 * @arg LL_RTC_TamperPin_Pos1: RTC_AF2 is selected as RTC Tamper Pin. (*)
2959 * (*) value not defined in all devices.
2960 * @retval None
2963 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPin(RTC_TypeDef *RTCx)
2965 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMP1INSEL));
2969 * @}
2972 /** @defgroup RTC_LL_EF_Wakeup Wakeup
2973 * @{
2977 * @brief Enable Wakeup timer
2978 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2979 * @rmtoll CR WUTE LL_RTC_WAKEUP_Enable
2980 * @param RTCx RTC Instance
2981 * @retval None
2983 __STATIC_INLINE void LL_RTC_WAKEUP_Enable(RTC_TypeDef *RTCx)
2985 SET_BIT(RTCx->CR, RTC_CR_WUTE);
2989 * @brief Disable Wakeup timer
2990 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2991 * @rmtoll CR WUTE LL_RTC_WAKEUP_Disable
2992 * @param RTCx RTC Instance
2993 * @retval None
2995 __STATIC_INLINE void LL_RTC_WAKEUP_Disable(RTC_TypeDef *RTCx)
2997 CLEAR_BIT(RTCx->CR, RTC_CR_WUTE);
3001 * @brief Check if Wakeup timer is enabled or not
3002 * @rmtoll CR WUTE LL_RTC_WAKEUP_IsEnabled
3003 * @param RTCx RTC Instance
3004 * @retval State of bit (1 or 0).
3006 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_IsEnabled(RTC_TypeDef *RTCx)
3008 return (READ_BIT(RTCx->CR, RTC_CR_WUTE) == (RTC_CR_WUTE));
3012 * @brief Select Wakeup clock
3013 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3014 * @note Bit can be written only when RTC_CR WUTE bit = 0 and RTC_ISR WUTWF bit = 1
3015 * @rmtoll CR WUCKSEL LL_RTC_WAKEUP_SetClock
3016 * @param RTCx RTC Instance
3017 * @param WakeupClock This parameter can be one of the following values:
3018 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
3019 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
3020 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
3021 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
3022 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
3023 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
3024 * @retval None
3026 __STATIC_INLINE void LL_RTC_WAKEUP_SetClock(RTC_TypeDef *RTCx, uint32_t WakeupClock)
3028 MODIFY_REG(RTCx->CR, RTC_CR_WUCKSEL, WakeupClock);
3032 * @brief Get Wakeup clock
3033 * @rmtoll CR WUCKSEL LL_RTC_WAKEUP_GetClock
3034 * @param RTCx RTC Instance
3035 * @retval Returned value can be one of the following values:
3036 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
3037 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
3038 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
3039 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
3040 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
3041 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
3043 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetClock(RTC_TypeDef *RTCx)
3045 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_WUCKSEL));
3049 * @brief Set Wakeup auto-reload value
3050 * @note Bit can be written only when WUTWF is set to 1 in RTC_ISR
3051 * @rmtoll WUTR WUT LL_RTC_WAKEUP_SetAutoReload
3052 * @param RTCx RTC Instance
3053 * @param Value Value between Min_Data=0x00 and Max_Data=0xFFFF
3054 * @retval None
3056 __STATIC_INLINE void LL_RTC_WAKEUP_SetAutoReload(RTC_TypeDef *RTCx, uint32_t Value)
3058 MODIFY_REG(RTCx->WUTR, RTC_WUTR_WUT, Value);
3062 * @brief Get Wakeup auto-reload value
3063 * @rmtoll WUTR WUT LL_RTC_WAKEUP_GetAutoReload
3064 * @param RTCx RTC Instance
3065 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
3067 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetAutoReload(RTC_TypeDef *RTCx)
3069 return (uint32_t)(READ_BIT(RTCx->WUTR, RTC_WUTR_WUT));
3073 * @}
3076 /** @defgroup RTC_LL_EF_Backup_Registers Backup_Registers
3077 * @{
3081 * @brief Writes a data in a specified RTC Backup data register.
3082 * @rmtoll BKPxR BKP LL_RTC_BAK_SetRegister
3083 * @param RTCx RTC Instance
3084 * @param BackupRegister This parameter can be one of the following values:
3085 * @arg @ref LL_RTC_BKP_DR0
3086 * @arg @ref LL_RTC_BKP_DR1
3087 * @arg @ref LL_RTC_BKP_DR2
3088 * @arg @ref LL_RTC_BKP_DR3
3089 * @arg @ref LL_RTC_BKP_DR4
3090 * @arg @ref LL_RTC_BKP_DR5
3091 * @arg @ref LL_RTC_BKP_DR6
3092 * @arg @ref LL_RTC_BKP_DR7
3093 * @arg @ref LL_RTC_BKP_DR8
3094 * @arg @ref LL_RTC_BKP_DR9
3095 * @arg @ref LL_RTC_BKP_DR10
3096 * @arg @ref LL_RTC_BKP_DR11
3097 * @arg @ref LL_RTC_BKP_DR12
3098 * @arg @ref LL_RTC_BKP_DR13
3099 * @arg @ref LL_RTC_BKP_DR14
3100 * @arg @ref LL_RTC_BKP_DR15
3101 * @arg @ref LL_RTC_BKP_DR16
3102 * @arg @ref LL_RTC_BKP_DR17
3103 * @arg @ref LL_RTC_BKP_DR18
3104 * @arg @ref LL_RTC_BKP_DR19
3105 * @param Data Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
3106 * @retval None
3108 __STATIC_INLINE void LL_RTC_BAK_SetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister, uint32_t Data)
3110 register uint32_t tmp = 0U;
3112 tmp = (uint32_t)(&(RTCx->BKP0R));
3113 tmp += (BackupRegister * 4U);
3115 /* Write the specified register */
3116 *(__IO uint32_t *)tmp = (uint32_t)Data;
3120 * @brief Reads data from the specified RTC Backup data Register.
3121 * @rmtoll BKPxR BKP LL_RTC_BAK_GetRegister
3122 * @param RTCx RTC Instance
3123 * @param BackupRegister This parameter can be one of the following values:
3124 * @arg @ref LL_RTC_BKP_DR0
3125 * @arg @ref LL_RTC_BKP_DR1
3126 * @arg @ref LL_RTC_BKP_DR2
3127 * @arg @ref LL_RTC_BKP_DR3
3128 * @arg @ref LL_RTC_BKP_DR4
3129 * @arg @ref LL_RTC_BKP_DR5
3130 * @arg @ref LL_RTC_BKP_DR6
3131 * @arg @ref LL_RTC_BKP_DR7
3132 * @arg @ref LL_RTC_BKP_DR8
3133 * @arg @ref LL_RTC_BKP_DR9
3134 * @arg @ref LL_RTC_BKP_DR10
3135 * @arg @ref LL_RTC_BKP_DR11
3136 * @arg @ref LL_RTC_BKP_DR12
3137 * @arg @ref LL_RTC_BKP_DR13
3138 * @arg @ref LL_RTC_BKP_DR14
3139 * @arg @ref LL_RTC_BKP_DR15
3140 * @arg @ref LL_RTC_BKP_DR16
3141 * @arg @ref LL_RTC_BKP_DR17
3142 * @arg @ref LL_RTC_BKP_DR18
3143 * @arg @ref LL_RTC_BKP_DR19
3144 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
3146 __STATIC_INLINE uint32_t LL_RTC_BAK_GetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister)
3148 register uint32_t tmp = 0U;
3150 tmp = (uint32_t)(&(RTCx->BKP0R));
3151 tmp += (BackupRegister * 4U);
3153 /* Read the specified register */
3154 return (*(__IO uint32_t *)tmp);
3158 * @}
3161 /** @defgroup RTC_LL_EF_Calibration Calibration
3162 * @{
3166 * @brief Set Calibration output frequency (1 Hz or 512 Hz)
3167 * @note Bits are write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3168 * @rmtoll CR COE LL_RTC_CAL_SetOutputFreq\n
3169 * CR COSEL LL_RTC_CAL_SetOutputFreq
3170 * @param RTCx RTC Instance
3171 * @param Frequency This parameter can be one of the following values:
3172 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE
3173 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ
3174 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
3175 * @retval None
3177 __STATIC_INLINE void LL_RTC_CAL_SetOutputFreq(RTC_TypeDef *RTCx, uint32_t Frequency)
3179 MODIFY_REG(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL, Frequency);
3183 * @brief Get Calibration output frequency (1 Hz or 512 Hz)
3184 * @rmtoll CR COE LL_RTC_CAL_GetOutputFreq\n
3185 * CR COSEL LL_RTC_CAL_GetOutputFreq
3186 * @param RTCx RTC Instance
3187 * @retval Returned value can be one of the following values:
3188 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE
3189 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ
3190 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
3192 __STATIC_INLINE uint32_t LL_RTC_CAL_GetOutputFreq(RTC_TypeDef *RTCx)
3194 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL));
3198 * @brief Enable Coarse digital calibration
3199 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3200 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
3201 * @rmtoll CR DCE LL_RTC_CAL_EnableCoarseDigital
3202 * @param RTCx RTC Instance
3203 * @retval None
3205 __STATIC_INLINE void LL_RTC_CAL_EnableCoarseDigital(RTC_TypeDef *RTCx)
3207 SET_BIT(RTCx->CR, RTC_CR_DCE);
3211 * @brief Disable Coarse digital calibration
3212 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3213 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
3214 * @rmtoll CR DCE LL_RTC_CAL_DisableCoarseDigital
3215 * @param RTCx RTC Instance
3216 * @retval None
3218 __STATIC_INLINE void LL_RTC_CAL_DisableCoarseDigital(RTC_TypeDef *RTCx)
3220 CLEAR_BIT(RTCx->CR, RTC_CR_DCE);
3224 * @brief Set the coarse digital calibration
3225 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3226 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
3227 * @rmtoll CALIBR DCS LL_RTC_CAL_ConfigCoarseDigital\n
3228 * CALIBR DC LL_RTC_CAL_ConfigCoarseDigital
3229 * @param RTCx RTC Instance
3230 * @param Sign This parameter can be one of the following values:
3231 * @arg @ref LL_RTC_CALIB_SIGN_POSITIVE
3232 * @arg @ref LL_RTC_CALIB_SIGN_NEGATIVE
3233 * @param Value value of coarse calibration expressed in ppm (coded on 5 bits)
3234 * @note This Calibration value should be between 0 and 63 when using negative sign with a 2-ppm step.
3235 * @note This Calibration value should be between 0 and 126 when using positive sign with a 4-ppm step.
3236 * @retval None
3238 __STATIC_INLINE void LL_RTC_CAL_ConfigCoarseDigital(RTC_TypeDef* RTCx, uint32_t Sign, uint32_t Value)
3240 MODIFY_REG(RTCx->CALIBR, RTC_CALIBR_DCS | RTC_CALIBR_DC, Sign | Value);
3244 * @brief Get the coarse digital calibration value
3245 * @rmtoll CALIBR DC LL_RTC_CAL_GetCoarseDigitalValue
3246 * @param RTCx RTC Instance
3247 * @retval value of coarse calibration expressed in ppm (coded on 5 bits)
3249 __STATIC_INLINE uint32_t LL_RTC_CAL_GetCoarseDigitalValue(RTC_TypeDef *RTCx)
3251 return (uint32_t)(READ_BIT(RTCx->CALIBR, RTC_CALIBR_DC));
3255 * @brief Get the coarse digital calibration sign
3256 * @rmtoll CALIBR DCS LL_RTC_CAL_GetCoarseDigitalSign
3257 * @param RTCx RTC Instance
3258 * @retval Returned value can be one of the following values:
3259 * @arg @ref LL_RTC_CALIB_SIGN_POSITIVE
3260 * @arg @ref LL_RTC_CALIB_SIGN_NEGATIVE
3262 __STATIC_INLINE uint32_t LL_RTC_CAL_GetCoarseDigitalSign(RTC_TypeDef* RTCx)
3264 return (uint32_t)(READ_BIT(RTCx->CALIBR, RTC_CALIBR_DCS));
3268 * @brief Insert or not One RTCCLK pulse every 2exp11 pulses (frequency increased by 488.5 ppm)
3269 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3270 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR
3271 * @rmtoll CALR CALP LL_RTC_CAL_SetPulse
3272 * @param RTCx RTC Instance
3273 * @param Pulse This parameter can be one of the following values:
3274 * @arg @ref LL_RTC_CALIB_INSERTPULSE_NONE
3275 * @arg @ref LL_RTC_CALIB_INSERTPULSE_SET
3276 * @retval None
3278 __STATIC_INLINE void LL_RTC_CAL_SetPulse(RTC_TypeDef *RTCx, uint32_t Pulse)
3280 MODIFY_REG(RTCx->CALR, RTC_CALR_CALP, Pulse);
3284 * @brief Check if one RTCCLK has been inserted or not every 2exp11 pulses (frequency increased by 488.5 ppm)
3285 * @rmtoll CALR CALP LL_RTC_CAL_IsPulseInserted
3286 * @param RTCx RTC Instance
3287 * @retval State of bit (1 or 0).
3289 __STATIC_INLINE uint32_t LL_RTC_CAL_IsPulseInserted(RTC_TypeDef *RTCx)
3291 return (READ_BIT(RTCx->CALR, RTC_CALR_CALP) == (RTC_CALR_CALP));
3295 * @brief Set the calibration cycle period
3296 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3297 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR
3298 * @rmtoll CALR CALW8 LL_RTC_CAL_SetPeriod\n
3299 * CALR CALW16 LL_RTC_CAL_SetPeriod
3300 * @param RTCx RTC Instance
3301 * @param Period This parameter can be one of the following values:
3302 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC
3303 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC
3304 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC
3305 * @retval None
3307 __STATIC_INLINE void LL_RTC_CAL_SetPeriod(RTC_TypeDef *RTCx, uint32_t Period)
3309 MODIFY_REG(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16, Period);
3313 * @brief Get the calibration cycle period
3314 * @rmtoll CALR CALW8 LL_RTC_CAL_GetPeriod\n
3315 * CALR CALW16 LL_RTC_CAL_GetPeriod
3316 * @param RTCx RTC Instance
3317 * @retval Returned value can be one of the following values:
3318 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC
3319 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC
3320 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC
3322 __STATIC_INLINE uint32_t LL_RTC_CAL_GetPeriod(RTC_TypeDef *RTCx)
3324 return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16));
3328 * @brief Set Calibration minus
3329 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3330 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR
3331 * @rmtoll CALR CALM LL_RTC_CAL_SetMinus
3332 * @param RTCx RTC Instance
3333 * @param CalibMinus Value between Min_Data=0x00 and Max_Data=0x1FF
3334 * @retval None
3336 __STATIC_INLINE void LL_RTC_CAL_SetMinus(RTC_TypeDef *RTCx, uint32_t CalibMinus)
3338 MODIFY_REG(RTCx->CALR, RTC_CALR_CALM, CalibMinus);
3342 * @brief Get Calibration minus
3343 * @rmtoll CALR CALM LL_RTC_CAL_GetMinus
3344 * @param RTCx RTC Instance
3345 * @retval Value between Min_Data=0x00 and Max_Data= 0x1FF
3347 __STATIC_INLINE uint32_t LL_RTC_CAL_GetMinus(RTC_TypeDef *RTCx)
3349 return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALM));
3353 * @}
3356 /** @defgroup RTC_LL_EF_FLAG_Management FLAG_Management
3357 * @{
3361 * @brief Get Recalibration pending Flag
3362 * @rmtoll ISR RECALPF LL_RTC_IsActiveFlag_RECALP
3363 * @param RTCx RTC Instance
3364 * @retval State of bit (1 or 0).
3366 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RECALP(RTC_TypeDef *RTCx)
3368 return (READ_BIT(RTCx->ISR, RTC_ISR_RECALPF) == (RTC_ISR_RECALPF));
3372 #if defined(RTC_TAMPER2_SUPPORT)
3374 * @brief Get RTC_TAMP2 detection flag
3375 * @rmtoll ISR TAMP2F LL_RTC_IsActiveFlag_TAMP2
3376 * @param RTCx RTC Instance
3377 * @retval State of bit (1 or 0).
3379 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2(RTC_TypeDef *RTCx)
3381 return (READ_BIT(RTCx->ISR, RTC_ISR_TAMP2F) == (RTC_ISR_TAMP2F));
3383 #endif /* RTC_TAMPER2_SUPPORT */
3386 * @brief Get RTC_TAMP1 detection flag
3387 * @rmtoll ISR TAMP1F LL_RTC_IsActiveFlag_TAMP1
3388 * @param RTCx RTC Instance
3389 * @retval State of bit (1 or 0).
3391 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1(RTC_TypeDef *RTCx)
3393 return (READ_BIT(RTCx->ISR, RTC_ISR_TAMP1F) == (RTC_ISR_TAMP1F));
3397 * @brief Get Time-stamp overflow flag
3398 * @rmtoll ISR TSOVF LL_RTC_IsActiveFlag_TSOV
3399 * @param RTCx RTC Instance
3400 * @retval State of bit (1 or 0).
3402 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOV(RTC_TypeDef *RTCx)
3404 return (READ_BIT(RTCx->ISR, RTC_ISR_TSOVF) == (RTC_ISR_TSOVF));
3408 * @brief Get Time-stamp flag
3409 * @rmtoll ISR TSF LL_RTC_IsActiveFlag_TS
3410 * @param RTCx RTC Instance
3411 * @retval State of bit (1 or 0).
3413 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TS(RTC_TypeDef *RTCx)
3415 return (READ_BIT(RTCx->ISR, RTC_ISR_TSF) == (RTC_ISR_TSF));
3419 * @brief Get Wakeup timer flag
3420 * @rmtoll ISR WUTF LL_RTC_IsActiveFlag_WUT
3421 * @param RTCx RTC Instance
3422 * @retval State of bit (1 or 0).
3424 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUT(RTC_TypeDef *RTCx)
3426 return (READ_BIT(RTCx->ISR, RTC_ISR_WUTF) == (RTC_ISR_WUTF));
3430 * @brief Get Alarm B flag
3431 * @rmtoll ISR ALRBF LL_RTC_IsActiveFlag_ALRB
3432 * @param RTCx RTC Instance
3433 * @retval State of bit (1 or 0).
3435 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRB(RTC_TypeDef *RTCx)
3437 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRBF) == (RTC_ISR_ALRBF));
3441 * @brief Get Alarm A flag
3442 * @rmtoll ISR ALRAF LL_RTC_IsActiveFlag_ALRA
3443 * @param RTCx RTC Instance
3444 * @retval State of bit (1 or 0).
3446 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRA(RTC_TypeDef *RTCx)
3448 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRAF) == (RTC_ISR_ALRAF));
3452 #if defined(RTC_TAMPER2_SUPPORT)
3454 * @brief Clear RTC_TAMP2 detection flag
3455 * @rmtoll ISR TAMP2F LL_RTC_ClearFlag_TAMP2
3456 * @param RTCx RTC Instance
3457 * @retval None
3459 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP2(RTC_TypeDef *RTCx)
3461 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP2F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3463 #endif /* RTC_TAMPER2_SUPPORT */
3466 * @brief Clear RTC_TAMP1 detection flag
3467 * @rmtoll ISR TAMP1F LL_RTC_ClearFlag_TAMP1
3468 * @param RTCx RTC Instance
3469 * @retval None
3471 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP1(RTC_TypeDef *RTCx)
3473 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP1F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3477 * @brief Clear Time-stamp overflow flag
3478 * @rmtoll ISR TSOVF LL_RTC_ClearFlag_TSOV
3479 * @param RTCx RTC Instance
3480 * @retval None
3482 __STATIC_INLINE void LL_RTC_ClearFlag_TSOV(RTC_TypeDef *RTCx)
3484 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSOVF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3488 * @brief Clear Time-stamp flag
3489 * @rmtoll ISR TSF LL_RTC_ClearFlag_TS
3490 * @param RTCx RTC Instance
3491 * @retval None
3493 __STATIC_INLINE void LL_RTC_ClearFlag_TS(RTC_TypeDef *RTCx)
3495 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3499 * @brief Clear Wakeup timer flag
3500 * @rmtoll ISR WUTF LL_RTC_ClearFlag_WUT
3501 * @param RTCx RTC Instance
3502 * @retval None
3504 __STATIC_INLINE void LL_RTC_ClearFlag_WUT(RTC_TypeDef *RTCx)
3506 WRITE_REG(RTCx->ISR, (~((RTC_ISR_WUTF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3510 * @brief Clear Alarm B flag
3511 * @rmtoll ISR ALRBF LL_RTC_ClearFlag_ALRB
3512 * @param RTCx RTC Instance
3513 * @retval None
3515 __STATIC_INLINE void LL_RTC_ClearFlag_ALRB(RTC_TypeDef *RTCx)
3517 WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRBF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3521 * @brief Clear Alarm A flag
3522 * @rmtoll ISR ALRAF LL_RTC_ClearFlag_ALRA
3523 * @param RTCx RTC Instance
3524 * @retval None
3526 __STATIC_INLINE void LL_RTC_ClearFlag_ALRA(RTC_TypeDef *RTCx)
3528 WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRAF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3532 * @brief Get Initialization flag
3533 * @rmtoll ISR INITF LL_RTC_IsActiveFlag_INIT
3534 * @param RTCx RTC Instance
3535 * @retval State of bit (1 or 0).
3537 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INIT(RTC_TypeDef *RTCx)
3539 return (READ_BIT(RTCx->ISR, RTC_ISR_INITF) == (RTC_ISR_INITF));
3543 * @brief Get Registers synchronization flag
3544 * @rmtoll ISR RSF LL_RTC_IsActiveFlag_RS
3545 * @param RTCx RTC Instance
3546 * @retval State of bit (1 or 0).
3548 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RS(RTC_TypeDef *RTCx)
3550 return (READ_BIT(RTCx->ISR, RTC_ISR_RSF) == (RTC_ISR_RSF));
3554 * @brief Clear Registers synchronization flag
3555 * @rmtoll ISR RSF LL_RTC_ClearFlag_RS
3556 * @param RTCx RTC Instance
3557 * @retval None
3559 __STATIC_INLINE void LL_RTC_ClearFlag_RS(RTC_TypeDef *RTCx)
3561 WRITE_REG(RTCx->ISR, (~((RTC_ISR_RSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3565 * @brief Get Initialization status flag
3566 * @rmtoll ISR INITS LL_RTC_IsActiveFlag_INITS
3567 * @param RTCx RTC Instance
3568 * @retval State of bit (1 or 0).
3570 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INITS(RTC_TypeDef *RTCx)
3572 return (READ_BIT(RTCx->ISR, RTC_ISR_INITS) == (RTC_ISR_INITS));
3576 * @brief Get Shift operation pending flag
3577 * @rmtoll ISR SHPF LL_RTC_IsActiveFlag_SHP
3578 * @param RTCx RTC Instance
3579 * @retval State of bit (1 or 0).
3581 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SHP(RTC_TypeDef *RTCx)
3583 return (READ_BIT(RTCx->ISR, RTC_ISR_SHPF) == (RTC_ISR_SHPF));
3587 * @brief Get Wakeup timer write flag
3588 * @rmtoll ISR WUTWF LL_RTC_IsActiveFlag_WUTW
3589 * @param RTCx RTC Instance
3590 * @retval State of bit (1 or 0).
3592 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTW(RTC_TypeDef *RTCx)
3594 return (READ_BIT(RTCx->ISR, RTC_ISR_WUTWF) == (RTC_ISR_WUTWF));
3598 * @brief Get Alarm B write flag
3599 * @rmtoll ISR ALRBWF LL_RTC_IsActiveFlag_ALRBW
3600 * @param RTCx RTC Instance
3601 * @retval State of bit (1 or 0).
3603 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBW(RTC_TypeDef *RTCx)
3605 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRBWF) == (RTC_ISR_ALRBWF));
3609 * @brief Get Alarm A write flag
3610 * @rmtoll ISR ALRAWF LL_RTC_IsActiveFlag_ALRAW
3611 * @param RTCx RTC Instance
3612 * @retval State of bit (1 or 0).
3614 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAW(RTC_TypeDef *RTCx)
3616 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRAWF) == (RTC_ISR_ALRAWF));
3620 * @}
3623 /** @defgroup RTC_LL_EF_IT_Management IT_Management
3624 * @{
3628 * @brief Enable Time-stamp interrupt
3629 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3630 * @rmtoll CR TSIE LL_RTC_EnableIT_TS
3631 * @param RTCx RTC Instance
3632 * @retval None
3634 __STATIC_INLINE void LL_RTC_EnableIT_TS(RTC_TypeDef *RTCx)
3636 SET_BIT(RTCx->CR, RTC_CR_TSIE);
3640 * @brief Disable Time-stamp interrupt
3641 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3642 * @rmtoll CR TSIE LL_RTC_DisableIT_TS
3643 * @param RTCx RTC Instance
3644 * @retval None
3646 __STATIC_INLINE void LL_RTC_DisableIT_TS(RTC_TypeDef *RTCx)
3648 CLEAR_BIT(RTCx->CR, RTC_CR_TSIE);
3652 * @brief Enable Wakeup timer interrupt
3653 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3654 * @rmtoll CR WUTIE LL_RTC_EnableIT_WUT
3655 * @param RTCx RTC Instance
3656 * @retval None
3658 __STATIC_INLINE void LL_RTC_EnableIT_WUT(RTC_TypeDef *RTCx)
3660 SET_BIT(RTCx->CR, RTC_CR_WUTIE);
3664 * @brief Disable Wakeup timer interrupt
3665 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3666 * @rmtoll CR WUTIE LL_RTC_DisableIT_WUT
3667 * @param RTCx RTC Instance
3668 * @retval None
3670 __STATIC_INLINE void LL_RTC_DisableIT_WUT(RTC_TypeDef *RTCx)
3672 CLEAR_BIT(RTCx->CR, RTC_CR_WUTIE);
3676 * @brief Enable Alarm B interrupt
3677 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3678 * @rmtoll CR ALRBIE LL_RTC_EnableIT_ALRB
3679 * @param RTCx RTC Instance
3680 * @retval None
3682 __STATIC_INLINE void LL_RTC_EnableIT_ALRB(RTC_TypeDef *RTCx)
3684 SET_BIT(RTCx->CR, RTC_CR_ALRBIE);
3688 * @brief Disable Alarm B interrupt
3689 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3690 * @rmtoll CR ALRBIE LL_RTC_DisableIT_ALRB
3691 * @param RTCx RTC Instance
3692 * @retval None
3694 __STATIC_INLINE void LL_RTC_DisableIT_ALRB(RTC_TypeDef *RTCx)
3696 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBIE);
3700 * @brief Enable Alarm A interrupt
3701 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3702 * @rmtoll CR ALRAIE LL_RTC_EnableIT_ALRA
3703 * @param RTCx RTC Instance
3704 * @retval None
3706 __STATIC_INLINE void LL_RTC_EnableIT_ALRA(RTC_TypeDef *RTCx)
3708 SET_BIT(RTCx->CR, RTC_CR_ALRAIE);
3712 * @brief Disable Alarm A interrupt
3713 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3714 * @rmtoll CR ALRAIE LL_RTC_DisableIT_ALRA
3715 * @param RTCx RTC Instance
3716 * @retval None
3718 __STATIC_INLINE void LL_RTC_DisableIT_ALRA(RTC_TypeDef *RTCx)
3720 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAIE);
3724 * @brief Enable all Tamper Interrupt
3725 * @rmtoll TAFCR TAMPIE LL_RTC_EnableIT_TAMP
3726 * @param RTCx RTC Instance
3727 * @retval None
3729 __STATIC_INLINE void LL_RTC_EnableIT_TAMP(RTC_TypeDef *RTCx)
3731 SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPIE);
3735 * @brief Disable all Tamper Interrupt
3736 * @rmtoll TAFCR TAMPIE LL_RTC_DisableIT_TAMP
3737 * @param RTCx RTC Instance
3738 * @retval None
3740 __STATIC_INLINE void LL_RTC_DisableIT_TAMP(RTC_TypeDef *RTCx)
3742 CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPIE);
3746 * @brief Check if Time-stamp interrupt is enabled or not
3747 * @rmtoll CR TSIE LL_RTC_IsEnabledIT_TS
3748 * @param RTCx RTC Instance
3749 * @retval State of bit (1 or 0).
3751 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TS(RTC_TypeDef *RTCx)
3753 return (READ_BIT(RTCx->CR, RTC_CR_TSIE) == (RTC_CR_TSIE));
3757 * @brief Check if Wakeup timer interrupt is enabled or not
3758 * @rmtoll CR WUTIE LL_RTC_IsEnabledIT_WUT
3759 * @param RTCx RTC Instance
3760 * @retval State of bit (1 or 0).
3762 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_WUT(RTC_TypeDef *RTCx)
3764 return (READ_BIT(RTCx->CR, RTC_CR_WUTIE) == (RTC_CR_WUTIE));
3768 * @brief Check if Alarm B interrupt is enabled or not
3769 * @rmtoll CR ALRBIE LL_RTC_IsEnabledIT_ALRB
3770 * @param RTCx RTC Instance
3771 * @retval State of bit (1 or 0).
3773 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRB(RTC_TypeDef *RTCx)
3775 return (READ_BIT(RTCx->CR, RTC_CR_ALRBIE) == (RTC_CR_ALRBIE));
3779 * @brief Check if Alarm A interrupt is enabled or not
3780 * @rmtoll CR ALRAIE LL_RTC_IsEnabledIT_ALRA
3781 * @param RTCx RTC Instance
3782 * @retval State of bit (1 or 0).
3784 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRA(RTC_TypeDef *RTCx)
3786 return (READ_BIT(RTCx->CR, RTC_CR_ALRAIE) == (RTC_CR_ALRAIE));
3790 * @brief Check if all the TAMPER interrupts are enabled or not
3791 * @rmtoll TAFCR TAMPIE LL_RTC_IsEnabledIT_TAMP
3792 * @param RTCx RTC Instance
3793 * @retval State of bit (1 or 0).
3795 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP(RTC_TypeDef *RTCx)
3797 return (READ_BIT(RTCx->TAFCR,
3798 RTC_TAFCR_TAMPIE) == (RTC_TAFCR_TAMPIE));
3802 * @}
3805 #if defined(USE_FULL_LL_DRIVER)
3806 /** @defgroup RTC_LL_EF_Init Initialization and de-initialization functions
3807 * @{
3810 ErrorStatus LL_RTC_DeInit(RTC_TypeDef *RTCx);
3811 ErrorStatus LL_RTC_Init(RTC_TypeDef *RTCx, LL_RTC_InitTypeDef *RTC_InitStruct);
3812 void LL_RTC_StructInit(LL_RTC_InitTypeDef *RTC_InitStruct);
3813 ErrorStatus LL_RTC_TIME_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_TimeTypeDef *RTC_TimeStruct);
3814 void LL_RTC_TIME_StructInit(LL_RTC_TimeTypeDef *RTC_TimeStruct);
3815 ErrorStatus LL_RTC_DATE_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_DateTypeDef *RTC_DateStruct);
3816 void LL_RTC_DATE_StructInit(LL_RTC_DateTypeDef *RTC_DateStruct);
3817 ErrorStatus LL_RTC_ALMA_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
3818 ErrorStatus LL_RTC_ALMB_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
3819 void LL_RTC_ALMA_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
3820 void LL_RTC_ALMB_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
3821 ErrorStatus LL_RTC_EnterInitMode(RTC_TypeDef *RTCx);
3822 ErrorStatus LL_RTC_ExitInitMode(RTC_TypeDef *RTCx);
3823 ErrorStatus LL_RTC_WaitForSynchro(RTC_TypeDef *RTCx);
3826 * @}
3828 #endif /* USE_FULL_LL_DRIVER */
3831 * @}
3835 * @}
3838 #endif /* defined(RTC) */
3841 * @}
3844 #ifdef __cplusplus
3846 #endif
3848 #endif /* __STM32F4xx_LL_RTC_H */
3850 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/