2 ******************************************************************************
3 * @file stm32f7xx_ll_rtc.h
4 * @author MCD Application Team
7 * @brief Header file of RTC LL module.
8 ******************************************************************************
11 * <h2><center>© 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 __STM32F7xx_LL_RTC_H
40 #define __STM32F7xx_LL_RTC_H
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f7xx.h"
49 /** @addtogroup STM32F7xx_LL_Driver
55 /** @defgroup RTC_LL RTC
59 /* Private types -------------------------------------------------------------*/
60 /* Private variables ---------------------------------------------------------*/
61 /* Private constants ---------------------------------------------------------*/
62 /** @defgroup RTC_LL_Private_Constants RTC Private Constants
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
85 /* Private macros ------------------------------------------------------------*/
86 #if defined(USE_FULL_LL_DRIVER)
87 /** @defgroup RTC_LL_Private_Macros RTC Private Macros
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
102 * @brief RTC Init structures definition
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
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
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
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
;
215 #endif /* USE_FULL_LL_DRIVER */
217 /* Exported constants --------------------------------------------------------*/
218 /** @defgroup RTC_LL_Exported_Constants RTC Exported Constants
222 #if defined(USE_FULL_LL_DRIVER)
223 /** @defgroup RTC_LL_EC_FORMAT FORMAT
226 #define LL_RTC_FORMAT_BIN 0x000000000U /*!< Binary data format */
227 #define LL_RTC_FORMAT_BCD 0x000000001U /*!< BCD data format */
232 /** @defgroup RTC_LL_EC_ALMA_WEEKDAY_SELECTION RTC Alarm A Date WeekDay
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 */
241 /** @defgroup RTC_LL_EC_ALMB_WEEKDAY_SELECTION RTC Alarm B Date WeekDay
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 */
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
256 #define LL_RTC_ISR_ITSF RTC_ISR_ITSF
257 #define LL_RTC_ISR_RECALPF RTC_ISR_RECALPF
258 #define LL_RTC_ISR_TAMP3F RTC_ISR_TAMP3F
259 #define LL_RTC_ISR_TAMP2F RTC_ISR_TAMP2F
260 #define LL_RTC_ISR_TAMP1F RTC_ISR_TAMP1F
261 #define LL_RTC_ISR_TSOVF RTC_ISR_TSOVF
262 #define LL_RTC_ISR_TSF RTC_ISR_TSF
263 #define LL_RTC_ISR_WUTF RTC_ISR_WUTF
264 #define LL_RTC_ISR_ALRBF RTC_ISR_ALRBF
265 #define LL_RTC_ISR_ALRAF RTC_ISR_ALRAF
266 #define LL_RTC_ISR_INITF RTC_ISR_INITF
267 #define LL_RTC_ISR_RSF RTC_ISR_RSF
268 #define LL_RTC_ISR_INITS RTC_ISR_INITS
269 #define LL_RTC_ISR_SHPF RTC_ISR_SHPF
270 #define LL_RTC_ISR_WUTWF RTC_ISR_WUTWF
271 #define LL_RTC_ISR_ALRBWF RTC_ISR_ALRBWF
272 #define LL_RTC_ISR_ALRAWF RTC_ISR_ALRAWF
277 /** @defgroup RTC_LL_EC_IT IT Defines
278 * @brief IT defines which can be used with LL_RTC_ReadReg and LL_RTC_WriteReg functions
281 #define LL_RTC_CR_TSIE RTC_CR_TSIE
282 #define LL_RTC_CR_WUTIE RTC_CR_WUTIE
283 #define LL_RTC_CR_ALRBIE RTC_CR_ALRBIE
284 #define LL_RTC_CR_ALRAIE RTC_CR_ALRAIE
285 #define LL_RTC_TAMPCR_TAMP3IE RTC_TAMPCR_TAMP3IE
286 #define LL_RTC_TAMPCR_TAMP2IE RTC_TAMPCR_TAMP2IE
287 #define LL_RTC_TAMPCR_TAMP1IE RTC_TAMPCR_TAMP1IE
288 #define LL_RTC_TAMPCR_TAMPIE RTC_TAMPCR_TAMPIE
293 /** @defgroup RTC_LL_EC_WEEKDAY WEEK DAY
296 #define LL_RTC_WEEKDAY_MONDAY ((uint8_t)0x01U) /*!< Monday */
297 #define LL_RTC_WEEKDAY_TUESDAY ((uint8_t)0x02U) /*!< Tuesday */
298 #define LL_RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03U) /*!< Wednesday */
299 #define LL_RTC_WEEKDAY_THURSDAY ((uint8_t)0x04U) /*!< Thrusday */
300 #define LL_RTC_WEEKDAY_FRIDAY ((uint8_t)0x05U) /*!< Friday */
301 #define LL_RTC_WEEKDAY_SATURDAY ((uint8_t)0x06U) /*!< Saturday */
302 #define LL_RTC_WEEKDAY_SUNDAY ((uint8_t)0x07U) /*!< Sunday */
307 /** @defgroup RTC_LL_EC_MONTH MONTH
310 #define LL_RTC_MONTH_JANUARY ((uint8_t)0x01U) /*!< January */
311 #define LL_RTC_MONTH_FEBRUARY ((uint8_t)0x02U) /*!< February */
312 #define LL_RTC_MONTH_MARCH ((uint8_t)0x03U) /*!< March */
313 #define LL_RTC_MONTH_APRIL ((uint8_t)0x04U) /*!< April */
314 #define LL_RTC_MONTH_MAY ((uint8_t)0x05U) /*!< May */
315 #define LL_RTC_MONTH_JUNE ((uint8_t)0x06U) /*!< June */
316 #define LL_RTC_MONTH_JULY ((uint8_t)0x07U) /*!< July */
317 #define LL_RTC_MONTH_AUGUST ((uint8_t)0x08U) /*!< August */
318 #define LL_RTC_MONTH_SEPTEMBER ((uint8_t)0x09U) /*!< September */
319 #define LL_RTC_MONTH_OCTOBER ((uint8_t)0x10U) /*!< October */
320 #define LL_RTC_MONTH_NOVEMBER ((uint8_t)0x11U) /*!< November */
321 #define LL_RTC_MONTH_DECEMBER ((uint8_t)0x12U) /*!< December */
326 /** @defgroup RTC_LL_EC_HOURFORMAT HOUR FORMAT
329 #define LL_RTC_HOURFORMAT_24HOUR 0x00000000U /*!< 24 hour/day format */
330 #define LL_RTC_HOURFORMAT_AMPM RTC_CR_FMT /*!< AM/PM hour format */
335 /** @defgroup RTC_LL_EC_ALARMOUT ALARM OUTPUT
338 #define LL_RTC_ALARMOUT_DISABLE 0x00000000U /*!< Output disabled */
339 #define LL_RTC_ALARMOUT_ALMA RTC_CR_OSEL_0 /*!< Alarm A output enabled */
340 #define LL_RTC_ALARMOUT_ALMB RTC_CR_OSEL_1 /*!< Alarm B output enabled */
341 #define LL_RTC_ALARMOUT_WAKEUP RTC_CR_OSEL /*!< Wakeup output enabled */
346 /** @defgroup RTC_LL_EC_ALARM_OUTPUTTYPE ALARM OUTPUT TYPE
349 #define LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN 0x00000000U /*!< RTC_ALARM, when mapped on PC13, is open-drain output */
350 #define LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL RTC_OR_ALARMOUTTYPE /*!< RTC_ALARM, when mapped on PC13, is push-pull output */
355 /** @defgroup RTC_LL_EC_OUTPUTPOLARITY_PIN OUTPUT POLARITY PIN
358 #define LL_RTC_OUTPUTPOLARITY_PIN_HIGH 0x00000000U /*!< Pin is high when ALRAF/ALRBF/WUTF is asserted (depending on OSEL)*/
359 #define LL_RTC_OUTPUTPOLARITY_PIN_LOW RTC_CR_POL /*!< Pin is low when ALRAF/ALRBF/WUTF is asserted (depending on OSEL) */
364 /** @defgroup RTC_LL_EC_TIME_FORMAT TIME FORMAT
367 #define LL_RTC_TIME_FORMAT_AM_OR_24 0x00000000U /*!< AM or 24-hour format */
368 #define LL_RTC_TIME_FORMAT_PM RTC_TR_PM /*!< PM */
373 /** @defgroup RTC_LL_EC_SHIFT_SECOND SHIFT SECOND
376 #define LL_RTC_SHIFT_SECOND_DELAY 0x00000000U /* Delay (seconds) = SUBFS / (PREDIV_S + 1) */
377 #define LL_RTC_SHIFT_SECOND_ADVANCE RTC_SHIFTR_ADD1S /* Advance (seconds) = (1 - (SUBFS / (PREDIV_S + 1))) */
382 /** @defgroup RTC_LL_EC_ALMA_MASK ALARMA MASK
385 #define LL_RTC_ALMA_MASK_NONE 0x00000000U /*!< No masks applied on Alarm A*/
386 #define LL_RTC_ALMA_MASK_DATEWEEKDAY RTC_ALRMAR_MSK4 /*!< Date/day do not care in Alarm A comparison */
387 #define LL_RTC_ALMA_MASK_HOURS RTC_ALRMAR_MSK3 /*!< Hours do not care in Alarm A comparison */
388 #define LL_RTC_ALMA_MASK_MINUTES RTC_ALRMAR_MSK2 /*!< Minutes do not care in Alarm A comparison */
389 #define LL_RTC_ALMA_MASK_SECONDS RTC_ALRMAR_MSK1 /*!< Seconds do not care in Alarm A comparison */
390 #define LL_RTC_ALMA_MASK_ALL (RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1) /*!< Masks all */
395 /** @defgroup RTC_LL_EC_ALMA_TIME_FORMAT ALARMA TIME FORMAT
398 #define LL_RTC_ALMA_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */
399 #define LL_RTC_ALMA_TIME_FORMAT_PM RTC_ALRMAR_PM /*!< PM */
404 /** @defgroup RTC_LL_EC_ALMB_MASK ALARMB MASK
407 #define LL_RTC_ALMB_MASK_NONE 0x00000000U /*!< No masks applied on Alarm B*/
408 #define LL_RTC_ALMB_MASK_DATEWEEKDAY RTC_ALRMBR_MSK4 /*!< Date/day do not care in Alarm B comparison */
409 #define LL_RTC_ALMB_MASK_HOURS RTC_ALRMBR_MSK3 /*!< Hours do not care in Alarm B comparison */
410 #define LL_RTC_ALMB_MASK_MINUTES RTC_ALRMBR_MSK2 /*!< Minutes do not care in Alarm B comparison */
411 #define LL_RTC_ALMB_MASK_SECONDS RTC_ALRMBR_MSK1 /*!< Seconds do not care in Alarm B comparison */
412 #define LL_RTC_ALMB_MASK_ALL (RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1) /*!< Masks all */
417 /** @defgroup RTC_LL_EC_ALMB_TIME_FORMAT ALARMB TIME FORMAT
420 #define LL_RTC_ALMB_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */
421 #define LL_RTC_ALMB_TIME_FORMAT_PM RTC_ALRMBR_PM /*!< PM */
426 /** @defgroup RTC_LL_EC_TIMESTAMP_EDGE TIMESTAMP EDGE
429 #define LL_RTC_TIMESTAMP_EDGE_RISING 0x00000000U /*!< RTC_TS input rising edge generates a time-stamp event */
430 #define LL_RTC_TIMESTAMP_EDGE_FALLING RTC_CR_TSEDGE /*!< RTC_TS input falling edge generates a time-stamp even */
435 /** @defgroup RTC_LL_EC_TS_TIME_FORMAT TIMESTAMP TIME FORMAT
438 #define LL_RTC_TS_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */
439 #define LL_RTC_TS_TIME_FORMAT_PM RTC_TSTR_PM /*!< PM */
444 /** @defgroup RTC_LL_EC_TAMPER TAMPER
447 #define LL_RTC_TAMPER_1 RTC_TAMPCR_TAMP1E /*!< RTC_TAMP1 input detection */
448 #define LL_RTC_TAMPER_2 RTC_TAMPCR_TAMP2E /*!< RTC_TAMP2 input detection */
449 #define LL_RTC_TAMPER_3 RTC_TAMPCR_TAMP3E /*!< RTC_TAMP3 input detection */
454 /** @defgroup RTC_LL_EC_TAMPER_MASK TAMPER MASK
457 #define LL_RTC_TAMPER_MASK_TAMPER1 RTC_TAMPCR_TAMP1MF /*!< Tamper 1 event generates a trigger event. TAMP1F is masked and internally cleared by hardware.The backup registers are not erased */
458 #define LL_RTC_TAMPER_MASK_TAMPER2 RTC_TAMPCR_TAMP2MF /*!< Tamper 2 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */
459 #define LL_RTC_TAMPER_MASK_TAMPER3 RTC_TAMPCR_TAMP3MF /*!< Tamper 3 event generates a trigger event. TAMP3F is masked and internally cleared by hardware. The backup registers are not erased */
464 /** @defgroup RTC_LL_EC_TAMPER_NOERASE TAMPER NO ERASE
467 #define LL_RTC_TAMPER_NOERASE_TAMPER1 RTC_TAMPCR_TAMP1NOERASE /*!< Tamper 1 event does not erase the backup registers. */
468 #define LL_RTC_TAMPER_NOERASE_TAMPER2 RTC_TAMPCR_TAMP2NOERASE /*!< Tamper 2 event does not erase the backup registers. */
469 #define LL_RTC_TAMPER_NOERASE_TAMPER3 RTC_TAMPCR_TAMP3NOERASE /*!< Tamper 3 event does not erase the backup registers. */
474 #if defined(RTC_TAMPCR_TAMPPRCH)
475 /** @defgroup RTC_LL_EC_TAMPER_DURATION TAMPER DURATION
478 #define LL_RTC_TAMPER_DURATION_1RTCCLK 0x00000000U /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle */
479 #define LL_RTC_TAMPER_DURATION_2RTCCLK RTC_TAMPCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */
480 #define LL_RTC_TAMPER_DURATION_4RTCCLK RTC_TAMPCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */
481 #define LL_RTC_TAMPER_DURATION_8RTCCLK RTC_TAMPCR_TAMPPRCH /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */
485 #endif /* RTC_TAMPCR_TAMPPRCH */
487 #if defined(RTC_TAMPCR_TAMPFLT)
488 /** @defgroup RTC_LL_EC_TAMPER_FILTER TAMPER FILTER
491 #define LL_RTC_TAMPER_FILTER_DISABLE 0x00000000U /*!< Tamper filter is disabled */
492 #define LL_RTC_TAMPER_FILTER_2SAMPLE RTC_TAMPCR_TAMPFLT_0 /*!< Tamper is activated after 2 consecutive samples at the active level */
493 #define LL_RTC_TAMPER_FILTER_4SAMPLE RTC_TAMPCR_TAMPFLT_1 /*!< Tamper is activated after 4 consecutive samples at the active level */
494 #define LL_RTC_TAMPER_FILTER_8SAMPLE RTC_TAMPCR_TAMPFLT /*!< Tamper is activated after 8 consecutive samples at the active level. */
498 #endif /* RTC_TAMPCR_TAMPFLT */
500 #if defined(RTC_TAMPCR_TAMPFREQ)
501 /** @defgroup RTC_LL_EC_TAMPER_SAMPLFREQDIV TAMPER SAMPLING FREQUENCY DIVIDER
504 #define LL_RTC_TAMPER_SAMPLFREQDIV_32768 0x00000000U /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 32768 */
505 #define LL_RTC_TAMPER_SAMPLFREQDIV_16384 RTC_TAMPCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 16384 */
506 #define LL_RTC_TAMPER_SAMPLFREQDIV_8192 RTC_TAMPCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 8192 */
507 #define LL_RTC_TAMPER_SAMPLFREQDIV_4096 (RTC_TAMPCR_TAMPFREQ_1 | RTC_TAMPCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 4096 */
508 #define LL_RTC_TAMPER_SAMPLFREQDIV_2048 RTC_TAMPCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 2048 */
509 #define LL_RTC_TAMPER_SAMPLFREQDIV_1024 (RTC_TAMPCR_TAMPFREQ_2 | RTC_TAMPCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 1024 */
510 #define LL_RTC_TAMPER_SAMPLFREQDIV_512 (RTC_TAMPCR_TAMPFREQ_2 | RTC_TAMPCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 512 */
511 #define LL_RTC_TAMPER_SAMPLFREQDIV_256 RTC_TAMPCR_TAMPFREQ /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 256 */
515 #endif /* RTC_TAMPCR_TAMPFREQ */
517 /** @defgroup RTC_LL_EC_TAMPER_ACTIVELEVEL TAMPER ACTIVE LEVEL
520 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 RTC_TAMPCR_TAMP1TRG /*!< RTC_TAMP1 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/
521 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 RTC_TAMPCR_TAMP2TRG /*!< RTC_TAMP2 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/
522 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 RTC_TAMPCR_TAMP3TRG /*!< RTC_TAMP3 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/
527 /** @defgroup RTC_LL_EC_WAKEUPCLOCK_DIV WAKEUP CLOCK DIV
530 #define LL_RTC_WAKEUPCLOCK_DIV_16 0x00000000U /*!< RTC/16 clock is selected */
531 #define LL_RTC_WAKEUPCLOCK_DIV_8 (RTC_CR_WUCKSEL_0) /*!< RTC/8 clock is selected */
532 #define LL_RTC_WAKEUPCLOCK_DIV_4 (RTC_CR_WUCKSEL_1) /*!< RTC/4 clock is selected */
533 #define LL_RTC_WAKEUPCLOCK_DIV_2 (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_0) /*!< RTC/2 clock is selected */
534 #define LL_RTC_WAKEUPCLOCK_CKSPRE (RTC_CR_WUCKSEL_2) /*!< ck_spre (usually 1 Hz) clock is selected */
535 #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*/
540 /** @defgroup RTC_LL_EC_BKP BACKUP
543 #define LL_RTC_BKP_DR0 0x00000000U
544 #define LL_RTC_BKP_DR1 0x00000001U
545 #define LL_RTC_BKP_DR2 0x00000002U
546 #define LL_RTC_BKP_DR3 0x00000003U
547 #define LL_RTC_BKP_DR4 0x00000004U
548 #if RTC_BKP_NUMBER > 5
549 #define LL_RTC_BKP_DR5 0x00000005U
550 #define LL_RTC_BKP_DR6 0x00000006U
551 #define LL_RTC_BKP_DR7 0x00000007U
552 #define LL_RTC_BKP_DR8 0x00000008U
553 #define LL_RTC_BKP_DR9 0x00000009U
554 #define LL_RTC_BKP_DR10 0x0000000AU
555 #define LL_RTC_BKP_DR11 0x0000000BU
556 #define LL_RTC_BKP_DR12 0x0000000CU
557 #define LL_RTC_BKP_DR13 0x0000000DU
558 #define LL_RTC_BKP_DR14 0x0000000EU
559 #define LL_RTC_BKP_DR15 0x0000000FU
560 #endif /* RTC_BKP_NUMBER > 5 */
562 #if RTC_BKP_NUMBER > 16
563 #define LL_RTC_BKP_DR16 0x00000010U
564 #define LL_RTC_BKP_DR17 0x00000011U
565 #define LL_RTC_BKP_DR18 0x00000012U
566 #define LL_RTC_BKP_DR19 0x00000013U
567 #endif /* RTC_BKP_NUMBER > 16 */
569 #if RTC_BKP_NUMBER > 20
570 #define LL_RTC_BKP_DR20 0x00000014U
571 #define LL_RTC_BKP_DR21 0x00000015U
572 #define LL_RTC_BKP_DR22 0x00000016U
573 #define LL_RTC_BKP_DR23 0x00000017U
574 #define LL_RTC_BKP_DR24 0x00000018U
575 #define LL_RTC_BKP_DR25 0x00000019U
576 #define LL_RTC_BKP_DR26 0x0000001AU
577 #define LL_RTC_BKP_DR27 0x0000001BU
578 #define LL_RTC_BKP_DR28 0x0000001CU
579 #define LL_RTC_BKP_DR29 0x0000001DU
580 #define LL_RTC_BKP_DR30 0x0000001EU
581 #define LL_RTC_BKP_DR31 0x0000001FU
582 #endif /* RTC_BKP_NUMBER > 20 */
587 /** @defgroup RTC_LL_EC_CALIB_OUTPUT Calibration output
590 #define LL_RTC_CALIB_OUTPUT_NONE 0x00000000U /*!< Calibration output disabled */
591 #define LL_RTC_CALIB_OUTPUT_1HZ (RTC_CR_COE | RTC_CR_COSEL) /*!< Calibration output is 1 Hz */
592 #define LL_RTC_CALIB_OUTPUT_512HZ (RTC_CR_COE) /*!< Calibration output is 512 Hz */
597 /** @defgroup RTC_LL_EC_CALIB_INSERTPULSE Calibration pulse insertion
600 #define LL_RTC_CALIB_INSERTPULSE_NONE 0x00000000U /*!< No RTCCLK pulses are added */
601 #define LL_RTC_CALIB_INSERTPULSE_SET RTC_CALR_CALP /*!< One RTCCLK pulse is effectively inserted every 2exp11 pulses (frequency increased by 488.5 ppm) */
606 /** @defgroup RTC_LL_EC_CALIB_PERIOD Calibration period
609 #define LL_RTC_CALIB_PERIOD_32SEC 0x00000000U /*!< Use a 32-second calibration cycle period */
610 #define LL_RTC_CALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< Use a 16-second calibration cycle period */
611 #define LL_RTC_CALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< Use a 8-second calibration cycle period */
620 /* Exported macro ------------------------------------------------------------*/
621 /** @defgroup RTC_LL_Exported_Macros RTC Exported Macros
625 /** @defgroup RTC_LL_EM_WRITE_READ Common Write and read registers Macros
630 * @brief Write a value in RTC register
631 * @param __INSTANCE__ RTC Instance
632 * @param __REG__ Register to be written
633 * @param __VALUE__ Value to be written in the register
636 #define LL_RTC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
639 * @brief Read a value in RTC register
640 * @param __INSTANCE__ RTC Instance
641 * @param __REG__ Register to be read
642 * @retval Register value
644 #define LL_RTC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
649 /** @defgroup RTC_LL_EM_Convert Convert helper Macros
654 * @brief Helper macro to convert a value from 2 digit decimal format to BCD format
655 * @param __VALUE__ Byte to be converted
656 * @retval Converted byte
658 #define __LL_RTC_CONVERT_BIN2BCD(__VALUE__) (uint8_t)((((__VALUE__) / 10U) << 4U) | ((__VALUE__) % 10U))
661 * @brief Helper macro to convert a value from BCD format to 2 digit decimal format
662 * @param __VALUE__ BCD value to be converted
663 * @retval Converted byte
665 #define __LL_RTC_CONVERT_BCD2BIN(__VALUE__) (uint8_t)(((uint8_t)((__VALUE__) & (uint8_t)0xF0U) >> (uint8_t)0x4U) * 10U + ((__VALUE__) & (uint8_t)0x0FU))
671 /** @defgroup RTC_LL_EM_Date Date helper Macros
676 * @brief Helper macro to retrieve weekday.
677 * @param __RTC_DATE__ Date returned by @ref LL_RTC_DATE_Get function.
678 * @retval Returned value can be one of the following values:
679 * @arg @ref LL_RTC_WEEKDAY_MONDAY
680 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
681 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
682 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
683 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
684 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
685 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
687 #define __LL_RTC_GET_WEEKDAY(__RTC_DATE__) (((__RTC_DATE__) >> RTC_OFFSET_WEEKDAY) & 0x000000FFU)
690 * @brief Helper macro to retrieve Year in BCD format
691 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
692 * @retval Year in BCD format (0x00 . . . 0x99)
694 #define __LL_RTC_GET_YEAR(__RTC_DATE__) ((__RTC_DATE__) & 0x000000FFU)
697 * @brief Helper macro to retrieve Month in BCD format
698 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
699 * @retval Returned value can be one of the following values:
700 * @arg @ref LL_RTC_MONTH_JANUARY
701 * @arg @ref LL_RTC_MONTH_FEBRUARY
702 * @arg @ref LL_RTC_MONTH_MARCH
703 * @arg @ref LL_RTC_MONTH_APRIL
704 * @arg @ref LL_RTC_MONTH_MAY
705 * @arg @ref LL_RTC_MONTH_JUNE
706 * @arg @ref LL_RTC_MONTH_JULY
707 * @arg @ref LL_RTC_MONTH_AUGUST
708 * @arg @ref LL_RTC_MONTH_SEPTEMBER
709 * @arg @ref LL_RTC_MONTH_OCTOBER
710 * @arg @ref LL_RTC_MONTH_NOVEMBER
711 * @arg @ref LL_RTC_MONTH_DECEMBER
713 #define __LL_RTC_GET_MONTH(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_MONTH) & 0x000000FFU)
716 * @brief Helper macro to retrieve Day in BCD format
717 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
718 * @retval Day in BCD format (0x01 . . . 0x31)
720 #define __LL_RTC_GET_DAY(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_DAY) & 0x000000FFU)
726 /** @defgroup RTC_LL_EM_Time Time helper Macros
731 * @brief Helper macro to retrieve hour in BCD format
732 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
733 * @retval Hours in BCD format (0x01. . .0x12 or between Min_Data=0x00 and Max_Data=0x23)
735 #define __LL_RTC_GET_HOUR(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_HOUR) & 0x000000FFU)
738 * @brief Helper macro to retrieve minute in BCD format
739 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
740 * @retval Minutes in BCD format (0x00. . .0x59)
742 #define __LL_RTC_GET_MINUTE(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_MINUTE) & 0x000000FFU)
745 * @brief Helper macro to retrieve second in BCD format
746 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
747 * @retval Seconds in format (0x00. . .0x59)
749 #define __LL_RTC_GET_SECOND(__RTC_TIME__) ((__RTC_TIME__) & 0x000000FFU)
759 /* Exported functions --------------------------------------------------------*/
760 /** @defgroup RTC_LL_Exported_Functions RTC Exported Functions
764 /** @defgroup RTC_LL_EF_Configuration Configuration
769 * @brief Set Hours format (24 hour/day or AM/PM hour format)
770 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
771 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
772 * @rmtoll CR FMT LL_RTC_SetHourFormat
773 * @param RTCx RTC Instance
774 * @param HourFormat This parameter can be one of the following values:
775 * @arg @ref LL_RTC_HOURFORMAT_24HOUR
776 * @arg @ref LL_RTC_HOURFORMAT_AMPM
779 __STATIC_INLINE
void LL_RTC_SetHourFormat(RTC_TypeDef
*RTCx
, uint32_t HourFormat
)
781 MODIFY_REG(RTCx
->CR
, RTC_CR_FMT
, HourFormat
);
785 * @brief Get Hours format (24 hour/day or AM/PM hour format)
786 * @rmtoll CR FMT LL_RTC_GetHourFormat
787 * @param RTCx RTC Instance
788 * @retval Returned value can be one of the following values:
789 * @arg @ref LL_RTC_HOURFORMAT_24HOUR
790 * @arg @ref LL_RTC_HOURFORMAT_AMPM
792 __STATIC_INLINE
uint32_t LL_RTC_GetHourFormat(RTC_TypeDef
*RTCx
)
794 return (uint32_t)(READ_BIT(RTCx
->CR
, RTC_CR_FMT
));
798 * @brief Select the flag to be routed to RTC_ALARM output
799 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
800 * @rmtoll CR OSEL LL_RTC_SetAlarmOutEvent
801 * @param RTCx RTC Instance
802 * @param AlarmOutput This parameter can be one of the following values:
803 * @arg @ref LL_RTC_ALARMOUT_DISABLE
804 * @arg @ref LL_RTC_ALARMOUT_ALMA
805 * @arg @ref LL_RTC_ALARMOUT_ALMB
806 * @arg @ref LL_RTC_ALARMOUT_WAKEUP
809 __STATIC_INLINE
void LL_RTC_SetAlarmOutEvent(RTC_TypeDef
*RTCx
, uint32_t AlarmOutput
)
811 MODIFY_REG(RTCx
->CR
, RTC_CR_OSEL
, AlarmOutput
);
815 * @brief Get the flag to be routed to RTC_ALARM output
816 * @rmtoll CR OSEL LL_RTC_GetAlarmOutEvent
817 * @param RTCx RTC Instance
818 * @retval Returned value can be one of the following values:
819 * @arg @ref LL_RTC_ALARMOUT_DISABLE
820 * @arg @ref LL_RTC_ALARMOUT_ALMA
821 * @arg @ref LL_RTC_ALARMOUT_ALMB
822 * @arg @ref LL_RTC_ALARMOUT_WAKEUP
824 __STATIC_INLINE
uint32_t LL_RTC_GetAlarmOutEvent(RTC_TypeDef
*RTCx
)
826 return (uint32_t)(READ_BIT(RTCx
->CR
, RTC_CR_OSEL
));
830 * @brief Set RTC_ALARM output type (ALARM in push-pull or open-drain output)
831 * @note Used only when RTC_ALARM is mapped on PC13
832 * @rmtoll OR ALARMOUTTYPE LL_RTC_SetAlarmOutputType
833 * @param RTCx RTC Instance
834 * @param Output This parameter can be one of the following values:
835 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
836 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
839 __STATIC_INLINE
void LL_RTC_SetAlarmOutputType(RTC_TypeDef
*RTCx
, uint32_t Output
)
841 MODIFY_REG(RTCx
->OR
, RTC_OR_ALARMOUTTYPE
, Output
);
845 * @brief Get RTC_ALARM output type (ALARM in push-pull or open-drain output)
846 * @note used only when RTC_ALARM is mapped on PC13
847 * @rmtoll OR ALARMOUTTYPE LL_RTC_GetAlarmOutputType
848 * @param RTCx RTC Instance
849 * @retval Returned value can be one of the following values:
850 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
851 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
853 __STATIC_INLINE
uint32_t LL_RTC_GetAlarmOutputType(RTC_TypeDef
*RTCx
)
855 return (uint32_t)(READ_BIT(RTCx
->OR
, RTC_OR_ALARMOUTTYPE
));
859 * @brief Enable initialization mode
860 * @note Initialization mode is used to program time and date register (RTC_TR and RTC_DR)
861 * and prescaler register (RTC_PRER).
862 * Counters are stopped and start counting from the new value when INIT is reset.
863 * @rmtoll ISR INIT LL_RTC_EnableInitMode
864 * @param RTCx RTC Instance
867 __STATIC_INLINE
void LL_RTC_EnableInitMode(RTC_TypeDef
*RTCx
)
869 /* Set the Initialization mode */
870 WRITE_REG(RTCx
->ISR
, RTC_INIT_MASK
);
874 * @brief Disable initialization mode (Free running mode)
875 * @rmtoll ISR INIT LL_RTC_DisableInitMode
876 * @param RTCx RTC Instance
879 __STATIC_INLINE
void LL_RTC_DisableInitMode(RTC_TypeDef
*RTCx
)
881 /* Exit Initialization mode */
882 WRITE_REG(RTCx
->ISR
, (uint32_t)~RTC_ISR_INIT
);
886 * @brief Set Output polarity (pin is low when ALRAF/ALRBF/WUTF is asserted)
887 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
888 * @rmtoll CR POL LL_RTC_SetOutputPolarity
889 * @param RTCx RTC Instance
890 * @param Polarity This parameter can be one of the following values:
891 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
892 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
895 __STATIC_INLINE
void LL_RTC_SetOutputPolarity(RTC_TypeDef
*RTCx
, uint32_t Polarity
)
897 MODIFY_REG(RTCx
->CR
, RTC_CR_POL
, Polarity
);
901 * @brief Get Output polarity
902 * @rmtoll CR POL LL_RTC_GetOutputPolarity
903 * @param RTCx RTC Instance
904 * @retval Returned value can be one of the following values:
905 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
906 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
908 __STATIC_INLINE
uint32_t LL_RTC_GetOutputPolarity(RTC_TypeDef
*RTCx
)
910 return (uint32_t)(READ_BIT(RTCx
->CR
, RTC_CR_POL
));
914 * @brief Enable Bypass the shadow registers
915 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
916 * @rmtoll CR BYPSHAD LL_RTC_EnableShadowRegBypass
917 * @param RTCx RTC Instance
920 __STATIC_INLINE
void LL_RTC_EnableShadowRegBypass(RTC_TypeDef
*RTCx
)
922 SET_BIT(RTCx
->CR
, RTC_CR_BYPSHAD
);
926 * @brief Disable Bypass the shadow registers
927 * @rmtoll CR BYPSHAD LL_RTC_DisableShadowRegBypass
928 * @param RTCx RTC Instance
931 __STATIC_INLINE
void LL_RTC_DisableShadowRegBypass(RTC_TypeDef
*RTCx
)
933 CLEAR_BIT(RTCx
->CR
, RTC_CR_BYPSHAD
);
937 * @brief Check if Shadow registers bypass is enabled or not.
938 * @rmtoll CR BYPSHAD LL_RTC_IsShadowRegBypassEnabled
939 * @param RTCx RTC Instance
940 * @retval State of bit (1 or 0).
942 __STATIC_INLINE
uint32_t LL_RTC_IsShadowRegBypassEnabled(RTC_TypeDef
*RTCx
)
944 return (READ_BIT(RTCx
->CR
, RTC_CR_BYPSHAD
) == (RTC_CR_BYPSHAD
));
948 * @brief Enable RTC_REFIN reference clock detection (50 or 60 Hz)
949 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
950 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
951 * @rmtoll CR REFCKON LL_RTC_EnableRefClock
952 * @param RTCx RTC Instance
955 __STATIC_INLINE
void LL_RTC_EnableRefClock(RTC_TypeDef
*RTCx
)
957 SET_BIT(RTCx
->CR
, RTC_CR_REFCKON
);
961 * @brief Disable RTC_REFIN reference clock detection (50 or 60 Hz)
962 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
963 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
964 * @rmtoll CR REFCKON LL_RTC_DisableRefClock
965 * @param RTCx RTC Instance
968 __STATIC_INLINE
void LL_RTC_DisableRefClock(RTC_TypeDef
*RTCx
)
970 CLEAR_BIT(RTCx
->CR
, RTC_CR_REFCKON
);
974 * @brief Set Asynchronous prescaler factor
975 * @rmtoll PRER PREDIV_A LL_RTC_SetAsynchPrescaler
976 * @param RTCx RTC Instance
977 * @param AsynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7F
980 __STATIC_INLINE
void LL_RTC_SetAsynchPrescaler(RTC_TypeDef
*RTCx
, uint32_t AsynchPrescaler
)
982 MODIFY_REG(RTCx
->PRER
, RTC_PRER_PREDIV_A
, AsynchPrescaler
<< RTC_PRER_PREDIV_A_Pos
);
986 * @brief Set Synchronous prescaler factor
987 * @rmtoll PRER PREDIV_S LL_RTC_SetSynchPrescaler
988 * @param RTCx RTC Instance
989 * @param SynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7FFF
992 __STATIC_INLINE
void LL_RTC_SetSynchPrescaler(RTC_TypeDef
*RTCx
, uint32_t SynchPrescaler
)
994 MODIFY_REG(RTCx
->PRER
, RTC_PRER_PREDIV_S
, SynchPrescaler
);
998 * @brief Get Asynchronous prescaler factor
999 * @rmtoll PRER PREDIV_A LL_RTC_GetAsynchPrescaler
1000 * @param RTCx RTC Instance
1001 * @retval Value between Min_Data = 0 and Max_Data = 0x7F
1003 __STATIC_INLINE
uint32_t LL_RTC_GetAsynchPrescaler(RTC_TypeDef
*RTCx
)
1005 return (uint32_t)(READ_BIT(RTCx
->PRER
, RTC_PRER_PREDIV_A
) >> RTC_PRER_PREDIV_A_Pos
);
1009 * @brief Get Synchronous prescaler factor
1010 * @rmtoll PRER PREDIV_S LL_RTC_GetSynchPrescaler
1011 * @param RTCx RTC Instance
1012 * @retval Value between Min_Data = 0 and Max_Data = 0x7FFF
1014 __STATIC_INLINE
uint32_t LL_RTC_GetSynchPrescaler(RTC_TypeDef
*RTCx
)
1016 return (uint32_t)(READ_BIT(RTCx
->PRER
, RTC_PRER_PREDIV_S
));
1020 * @brief Enable the write protection for RTC registers.
1021 * @rmtoll WPR KEY LL_RTC_EnableWriteProtection
1022 * @param RTCx RTC Instance
1025 __STATIC_INLINE
void LL_RTC_EnableWriteProtection(RTC_TypeDef
*RTCx
)
1027 WRITE_REG(RTCx
->WPR
, RTC_WRITE_PROTECTION_DISABLE
);
1031 * @brief Disable the write protection for RTC registers.
1032 * @rmtoll WPR KEY LL_RTC_DisableWriteProtection
1033 * @param RTCx RTC Instance
1036 __STATIC_INLINE
void LL_RTC_DisableWriteProtection(RTC_TypeDef
*RTCx
)
1038 WRITE_REG(RTCx
->WPR
, RTC_WRITE_PROTECTION_ENABLE_1
);
1039 WRITE_REG(RTCx
->WPR
, RTC_WRITE_PROTECTION_ENABLE_2
);
1046 /** @defgroup RTC_LL_EF_Time Time
1051 * @brief Set time format (AM/24-hour or PM notation)
1052 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1053 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1054 * @rmtoll TR PM LL_RTC_TIME_SetFormat
1055 * @param RTCx RTC Instance
1056 * @param TimeFormat This parameter can be one of the following values:
1057 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1058 * @arg @ref LL_RTC_TIME_FORMAT_PM
1061 __STATIC_INLINE
void LL_RTC_TIME_SetFormat(RTC_TypeDef
*RTCx
, uint32_t TimeFormat
)
1063 MODIFY_REG(RTCx
->TR
, RTC_TR_PM
, TimeFormat
);
1067 * @brief Get time format (AM or PM notation)
1068 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1069 * before reading this bit
1070 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1071 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1072 * @rmtoll TR PM LL_RTC_TIME_GetFormat
1073 * @param RTCx RTC Instance
1074 * @retval Returned value can be one of the following values:
1075 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1076 * @arg @ref LL_RTC_TIME_FORMAT_PM
1078 __STATIC_INLINE
uint32_t LL_RTC_TIME_GetFormat(RTC_TypeDef
*RTCx
)
1080 return (uint32_t)(READ_BIT(RTCx
->TR
, RTC_TR_PM
));
1084 * @brief Set Hours in BCD format
1085 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1086 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1087 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert hour from binary to BCD format
1088 * @rmtoll TR HT LL_RTC_TIME_SetHour\n
1089 * TR HU LL_RTC_TIME_SetHour
1090 * @param RTCx RTC Instance
1091 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1094 __STATIC_INLINE
void LL_RTC_TIME_SetHour(RTC_TypeDef
*RTCx
, uint32_t Hours
)
1096 MODIFY_REG(RTCx
->TR
, (RTC_TR_HT
| RTC_TR_HU
),
1097 (((Hours
& 0xF0U
) << (RTC_TR_HT_Pos
- 4U)) | ((Hours
& 0x0FU
) << RTC_TR_HU_Pos
)));
1101 * @brief Get Hours in BCD format
1102 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1103 * before reading this bit
1104 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1105 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1106 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert hour from BCD to
1108 * @rmtoll TR HT LL_RTC_TIME_GetHour\n
1109 * TR HU LL_RTC_TIME_GetHour
1110 * @param RTCx RTC Instance
1111 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1113 __STATIC_INLINE
uint32_t LL_RTC_TIME_GetHour(RTC_TypeDef
*RTCx
)
1115 register uint32_t temp
= 0U;
1117 temp
= READ_BIT(RTCx
->TR
, (RTC_TR_HT
| RTC_TR_HU
));
1118 return (uint32_t)((((temp
& RTC_TR_HT
) >> RTC_TR_HT_Pos
) << 4U) | ((temp
& RTC_TR_HU
) >> RTC_TR_HU_Pos
));
1122 * @brief Set Minutes in BCD format
1123 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1124 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1125 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
1126 * @rmtoll TR MNT LL_RTC_TIME_SetMinute\n
1127 * TR MNU LL_RTC_TIME_SetMinute
1128 * @param RTCx RTC Instance
1129 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
1132 __STATIC_INLINE
void LL_RTC_TIME_SetMinute(RTC_TypeDef
*RTCx
, uint32_t Minutes
)
1134 MODIFY_REG(RTCx
->TR
, (RTC_TR_MNT
| RTC_TR_MNU
),
1135 (((Minutes
& 0xF0U
) << (RTC_TR_MNT_Pos
- 4U)) | ((Minutes
& 0x0FU
) << RTC_TR_MNU_Pos
)));
1139 * @brief Get Minutes in BCD format
1140 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1141 * before reading this bit
1142 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1143 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1144 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert minute from BCD
1146 * @rmtoll TR MNT LL_RTC_TIME_GetMinute\n
1147 * TR MNU LL_RTC_TIME_GetMinute
1148 * @param RTCx RTC Instance
1149 * @retval Value between Min_Data=0x00 and Max_Data=0x59
1151 __STATIC_INLINE
uint32_t LL_RTC_TIME_GetMinute(RTC_TypeDef
*RTCx
)
1153 register uint32_t temp
= 0U;
1155 temp
= READ_BIT(RTCx
->TR
, (RTC_TR_MNT
| RTC_TR_MNU
));
1156 return (uint32_t)((((temp
& RTC_TR_MNT
) >> RTC_TR_MNT_Pos
) << 4U) | ((temp
& RTC_TR_MNU
) >> RTC_TR_MNU_Pos
));
1160 * @brief Set Seconds in BCD format
1161 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1162 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1163 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
1164 * @rmtoll TR ST LL_RTC_TIME_SetSecond\n
1165 * TR SU LL_RTC_TIME_SetSecond
1166 * @param RTCx RTC Instance
1167 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
1170 __STATIC_INLINE
void LL_RTC_TIME_SetSecond(RTC_TypeDef
*RTCx
, uint32_t Seconds
)
1172 MODIFY_REG(RTCx
->TR
, (RTC_TR_ST
| RTC_TR_SU
),
1173 (((Seconds
& 0xF0U
) << (RTC_TR_ST_Pos
- 4U)) | ((Seconds
& 0x0FU
) << RTC_TR_SU_Pos
)));
1177 * @brief Get Seconds in BCD format
1178 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1179 * before reading this bit
1180 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1181 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1182 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD
1184 * @rmtoll TR ST LL_RTC_TIME_GetSecond\n
1185 * TR SU LL_RTC_TIME_GetSecond
1186 * @param RTCx RTC Instance
1187 * @retval Value between Min_Data=0x00 and Max_Data=0x59
1189 __STATIC_INLINE
uint32_t LL_RTC_TIME_GetSecond(RTC_TypeDef
*RTCx
)
1191 register uint32_t temp
= 0U;
1193 temp
= READ_BIT(RTCx
->TR
, (RTC_TR_ST
| RTC_TR_SU
));
1194 return (uint32_t)((((temp
& RTC_TR_ST
) >> RTC_TR_ST_Pos
) << 4U) | ((temp
& RTC_TR_SU
) >> RTC_TR_SU_Pos
));
1198 * @brief Set time (hour, minute and second) in BCD format
1199 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1200 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1201 * @note TimeFormat and Hours should follow the same format
1202 * @rmtoll TR PM LL_RTC_TIME_Config\n
1203 * TR HT LL_RTC_TIME_Config\n
1204 * TR HU LL_RTC_TIME_Config\n
1205 * TR MNT LL_RTC_TIME_Config\n
1206 * TR MNU LL_RTC_TIME_Config\n
1207 * TR ST LL_RTC_TIME_Config\n
1208 * TR SU LL_RTC_TIME_Config
1209 * @param RTCx RTC Instance
1210 * @param Format12_24 This parameter can be one of the following values:
1211 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1212 * @arg @ref LL_RTC_TIME_FORMAT_PM
1213 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1214 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
1215 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
1218 __STATIC_INLINE
void LL_RTC_TIME_Config(RTC_TypeDef
*RTCx
, uint32_t Format12_24
, uint32_t Hours
, uint32_t Minutes
, uint32_t Seconds
)
1220 register uint32_t temp
= 0U;
1222 temp
= Format12_24
| \
1223 (((Hours
& 0xF0U
) << (RTC_TR_HT_Pos
- 4U)) | ((Hours
& 0x0FU
) << RTC_TR_HU_Pos
)) | \
1224 (((Minutes
& 0xF0U
) << (RTC_TR_MNT_Pos
- 4U)) | ((Minutes
& 0x0FU
) << RTC_TR_MNU_Pos
)) | \
1225 (((Seconds
& 0xF0U
) << (RTC_TR_ST_Pos
- 4U)) | ((Seconds
& 0x0FU
) << RTC_TR_SU_Pos
));
1226 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
);
1230 * @brief Get time (hour, minute and second) in BCD format
1231 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1232 * before reading this bit
1233 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1234 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1235 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
1236 * are available to get independently each parameter.
1237 * @rmtoll TR HT LL_RTC_TIME_Get\n
1238 * TR HU LL_RTC_TIME_Get\n
1239 * TR MNT LL_RTC_TIME_Get\n
1240 * TR MNU LL_RTC_TIME_Get\n
1241 * TR ST LL_RTC_TIME_Get\n
1242 * TR SU LL_RTC_TIME_Get
1243 * @param RTCx RTC Instance
1244 * @retval Combination of hours, minutes and seconds (Format: 0x00HHMMSS).
1246 __STATIC_INLINE
uint32_t LL_RTC_TIME_Get(RTC_TypeDef
*RTCx
)
1248 register uint32_t temp
= 0U;
1250 temp
= READ_BIT(RTCx
->TR
, (RTC_TR_HT
| RTC_TR_HU
| RTC_TR_MNT
| RTC_TR_MNU
| RTC_TR_ST
| RTC_TR_SU
));
1251 return (uint32_t)((((((temp
& RTC_TR_HT
) >> RTC_TR_HT_Pos
) << 4U) | ((temp
& RTC_TR_HU
) >> RTC_TR_HU_Pos
)) << RTC_OFFSET_HOUR
) | \
1252 (((((temp
& RTC_TR_MNT
) >> RTC_TR_MNT_Pos
) << 4U) | ((temp
& RTC_TR_MNU
) >> RTC_TR_MNU_Pos
)) << RTC_OFFSET_MINUTE
) | \
1253 ((((temp
& RTC_TR_ST
) >> RTC_TR_ST_Pos
) << 4U) | ((temp
& RTC_TR_SU
) >> RTC_TR_SU_Pos
)));
1257 * @brief Memorize whether the daylight saving time change has been performed
1258 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1259 * @rmtoll CR BKP LL_RTC_TIME_EnableDayLightStore
1260 * @param RTCx RTC Instance
1263 __STATIC_INLINE
void LL_RTC_TIME_EnableDayLightStore(RTC_TypeDef
*RTCx
)
1265 SET_BIT(RTCx
->CR
, RTC_CR_BKP
);
1269 * @brief Disable memorization whether the daylight saving time change has been performed.
1270 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1271 * @rmtoll CR BKP LL_RTC_TIME_DisableDayLightStore
1272 * @param RTCx RTC Instance
1275 __STATIC_INLINE
void LL_RTC_TIME_DisableDayLightStore(RTC_TypeDef
*RTCx
)
1277 CLEAR_BIT(RTCx
->CR
, RTC_CR_BKP
);
1281 * @brief Check if RTC Day Light Saving stored operation has been enabled or not
1282 * @rmtoll CR BKP LL_RTC_TIME_IsDayLightStoreEnabled
1283 * @param RTCx RTC Instance
1284 * @retval State of bit (1 or 0).
1286 __STATIC_INLINE
uint32_t LL_RTC_TIME_IsDayLightStoreEnabled(RTC_TypeDef
*RTCx
)
1288 return (READ_BIT(RTCx
->CR
, RTC_CR_BKP
) == (RTC_CR_BKP
));
1292 * @brief Subtract 1 hour (winter time change)
1293 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1294 * @rmtoll CR SUB1H LL_RTC_TIME_DecHour
1295 * @param RTCx RTC Instance
1298 __STATIC_INLINE
void LL_RTC_TIME_DecHour(RTC_TypeDef
*RTCx
)
1300 SET_BIT(RTCx
->CR
, RTC_CR_SUB1H
);
1304 * @brief Add 1 hour (summer time change)
1305 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1306 * @rmtoll CR ADD1H LL_RTC_TIME_IncHour
1307 * @param RTCx RTC Instance
1310 __STATIC_INLINE
void LL_RTC_TIME_IncHour(RTC_TypeDef
*RTCx
)
1312 SET_BIT(RTCx
->CR
, RTC_CR_ADD1H
);
1316 * @brief Get Sub second value in the synchronous prescaler counter.
1317 * @note You can use both SubSeconds value and SecondFraction (PREDIV_S through
1318 * LL_RTC_GetSynchPrescaler function) terms returned to convert Calendar
1319 * SubSeconds value in second fraction ratio with time unit following
1321 * ==> Seconds fraction ratio * time_unit= [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit
1322 * This conversion can be performed only if no shift operation is pending
1323 * (ie. SHFP=0) when PREDIV_S >= SS.
1324 * @rmtoll SSR SS LL_RTC_TIME_GetSubSecond
1325 * @param RTCx RTC Instance
1326 * @retval Sub second value (number between 0 and 65535)
1328 __STATIC_INLINE
uint32_t LL_RTC_TIME_GetSubSecond(RTC_TypeDef
*RTCx
)
1330 return (uint32_t)(READ_BIT(RTCx
->SSR
, RTC_SSR_SS
));
1334 * @brief Synchronize to a remote clock with a high degree of precision.
1335 * @note This operation effectively subtracts from (delays) or advance the clock of a fraction of a second.
1336 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1337 * @note When REFCKON is set, firmware must not write to Shift control register.
1338 * @rmtoll SHIFTR ADD1S LL_RTC_TIME_Synchronize\n
1339 * SHIFTR SUBFS LL_RTC_TIME_Synchronize
1340 * @param RTCx RTC Instance
1341 * @param ShiftSecond This parameter can be one of the following values:
1342 * @arg @ref LL_RTC_SHIFT_SECOND_DELAY
1343 * @arg @ref LL_RTC_SHIFT_SECOND_ADVANCE
1344 * @param Fraction Number of Seconds Fractions (any value from 0 to 0x7FFF)
1347 __STATIC_INLINE
void LL_RTC_TIME_Synchronize(RTC_TypeDef
*RTCx
, uint32_t ShiftSecond
, uint32_t Fraction
)
1349 WRITE_REG(RTCx
->SHIFTR
, ShiftSecond
| Fraction
);
1356 /** @defgroup RTC_LL_EF_Date Date
1361 * @brief Set Year in BCD format
1362 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Year from binary to BCD format
1363 * @rmtoll DR YT LL_RTC_DATE_SetYear\n
1364 * DR YU LL_RTC_DATE_SetYear
1365 * @param RTCx RTC Instance
1366 * @param Year Value between Min_Data=0x00 and Max_Data=0x99
1369 __STATIC_INLINE
void LL_RTC_DATE_SetYear(RTC_TypeDef
*RTCx
, uint32_t Year
)
1371 MODIFY_REG(RTCx
->DR
, (RTC_DR_YT
| RTC_DR_YU
),
1372 (((Year
& 0xF0U
) << (RTC_DR_YT_Pos
- 4U)) | ((Year
& 0x0FU
) << RTC_DR_YU_Pos
)));
1376 * @brief Get Year in BCD format
1377 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1378 * before reading this bit
1379 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Year from BCD to Binary format
1380 * @rmtoll DR YT LL_RTC_DATE_GetYear\n
1381 * DR YU LL_RTC_DATE_GetYear
1382 * @param RTCx RTC Instance
1383 * @retval Value between Min_Data=0x00 and Max_Data=0x99
1385 __STATIC_INLINE
uint32_t LL_RTC_DATE_GetYear(RTC_TypeDef
*RTCx
)
1387 register uint32_t temp
= 0U;
1389 temp
= READ_BIT(RTCx
->DR
, (RTC_DR_YT
| RTC_DR_YU
));
1390 return (uint32_t)((((temp
& RTC_DR_YT
) >> RTC_DR_YT_Pos
) << 4U) | ((temp
& RTC_DR_YU
) >> RTC_DR_YU_Pos
));
1394 * @brief Set Week day
1395 * @rmtoll DR WDU LL_RTC_DATE_SetWeekDay
1396 * @param RTCx RTC Instance
1397 * @param WeekDay This parameter can be one of the following values:
1398 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1399 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1400 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1401 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1402 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1403 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1404 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1407 __STATIC_INLINE
void LL_RTC_DATE_SetWeekDay(RTC_TypeDef
*RTCx
, uint32_t WeekDay
)
1409 MODIFY_REG(RTCx
->DR
, RTC_DR_WDU
, WeekDay
<< RTC_DR_WDU_Pos
);
1413 * @brief Get Week day
1414 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1415 * before reading this bit
1416 * @rmtoll DR WDU LL_RTC_DATE_GetWeekDay
1417 * @param RTCx RTC Instance
1418 * @retval Returned value can be one of the following values:
1419 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1420 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1421 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1422 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1423 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1424 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1425 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1427 __STATIC_INLINE
uint32_t LL_RTC_DATE_GetWeekDay(RTC_TypeDef
*RTCx
)
1429 return (uint32_t)(READ_BIT(RTCx
->DR
, RTC_DR_WDU
) >> RTC_DR_WDU_Pos
);
1433 * @brief Set Month in BCD format
1434 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Month from binary to BCD format
1435 * @rmtoll DR MT LL_RTC_DATE_SetMonth\n
1436 * DR MU LL_RTC_DATE_SetMonth
1437 * @param RTCx RTC Instance
1438 * @param Month This parameter can be one of the following values:
1439 * @arg @ref LL_RTC_MONTH_JANUARY
1440 * @arg @ref LL_RTC_MONTH_FEBRUARY
1441 * @arg @ref LL_RTC_MONTH_MARCH
1442 * @arg @ref LL_RTC_MONTH_APRIL
1443 * @arg @ref LL_RTC_MONTH_MAY
1444 * @arg @ref LL_RTC_MONTH_JUNE
1445 * @arg @ref LL_RTC_MONTH_JULY
1446 * @arg @ref LL_RTC_MONTH_AUGUST
1447 * @arg @ref LL_RTC_MONTH_SEPTEMBER
1448 * @arg @ref LL_RTC_MONTH_OCTOBER
1449 * @arg @ref LL_RTC_MONTH_NOVEMBER
1450 * @arg @ref LL_RTC_MONTH_DECEMBER
1453 __STATIC_INLINE
void LL_RTC_DATE_SetMonth(RTC_TypeDef
*RTCx
, uint32_t Month
)
1455 MODIFY_REG(RTCx
->DR
, (RTC_DR_MT
| RTC_DR_MU
),
1456 (((Month
& 0xF0U
) << (RTC_DR_MT_Pos
- 4U)) | ((Month
& 0x0FU
) << RTC_DR_MU_Pos
)));
1460 * @brief Get Month in BCD format
1461 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1462 * before reading this bit
1463 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
1464 * @rmtoll DR MT LL_RTC_DATE_GetMonth\n
1465 * DR MU LL_RTC_DATE_GetMonth
1466 * @param RTCx RTC Instance
1467 * @retval Returned value can be one of the following values:
1468 * @arg @ref LL_RTC_MONTH_JANUARY
1469 * @arg @ref LL_RTC_MONTH_FEBRUARY
1470 * @arg @ref LL_RTC_MONTH_MARCH
1471 * @arg @ref LL_RTC_MONTH_APRIL
1472 * @arg @ref LL_RTC_MONTH_MAY
1473 * @arg @ref LL_RTC_MONTH_JUNE
1474 * @arg @ref LL_RTC_MONTH_JULY
1475 * @arg @ref LL_RTC_MONTH_AUGUST
1476 * @arg @ref LL_RTC_MONTH_SEPTEMBER
1477 * @arg @ref LL_RTC_MONTH_OCTOBER
1478 * @arg @ref LL_RTC_MONTH_NOVEMBER
1479 * @arg @ref LL_RTC_MONTH_DECEMBER
1481 __STATIC_INLINE
uint32_t LL_RTC_DATE_GetMonth(RTC_TypeDef
*RTCx
)
1483 register uint32_t temp
= 0U;
1485 temp
= READ_BIT(RTCx
->DR
, (RTC_DR_MT
| RTC_DR_MU
));
1486 return (uint32_t)((((temp
& RTC_DR_MT
) >> RTC_DR_MT_Pos
) << 4U) | ((temp
& RTC_DR_MU
) >> RTC_DR_MU_Pos
));
1490 * @brief Set Day in BCD format
1491 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
1492 * @rmtoll DR DT LL_RTC_DATE_SetDay\n
1493 * DR DU LL_RTC_DATE_SetDay
1494 * @param RTCx RTC Instance
1495 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
1498 __STATIC_INLINE
void LL_RTC_DATE_SetDay(RTC_TypeDef
*RTCx
, uint32_t Day
)
1500 MODIFY_REG(RTCx
->DR
, (RTC_DR_DT
| RTC_DR_DU
),
1501 (((Day
& 0xF0U
) << (RTC_DR_DT_Pos
- 4U)) | ((Day
& 0x0FU
) << RTC_DR_DU_Pos
)));
1505 * @brief Get Day in BCD format
1506 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1507 * before reading this bit
1508 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
1509 * @rmtoll DR DT LL_RTC_DATE_GetDay\n
1510 * DR DU LL_RTC_DATE_GetDay
1511 * @param RTCx RTC Instance
1512 * @retval Value between Min_Data=0x01 and Max_Data=0x31
1514 __STATIC_INLINE
uint32_t LL_RTC_DATE_GetDay(RTC_TypeDef
*RTCx
)
1516 register uint32_t temp
= 0U;
1518 temp
= READ_BIT(RTCx
->DR
, (RTC_DR_DT
| RTC_DR_DU
));
1519 return (uint32_t)((((temp
& RTC_DR_DT
) >> RTC_DR_DT_Pos
) << 4U) | ((temp
& RTC_DR_DU
) >> RTC_DR_DU_Pos
));
1523 * @brief Set date (WeekDay, Day, Month and Year) in BCD format
1524 * @rmtoll DR WDU LL_RTC_DATE_Config\n
1525 * DR MT LL_RTC_DATE_Config\n
1526 * DR MU LL_RTC_DATE_Config\n
1527 * DR DT LL_RTC_DATE_Config\n
1528 * DR DU LL_RTC_DATE_Config\n
1529 * DR YT LL_RTC_DATE_Config\n
1530 * DR YU LL_RTC_DATE_Config
1531 * @param RTCx RTC Instance
1532 * @param WeekDay This parameter can be one of the following values:
1533 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1534 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1535 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1536 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1537 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1538 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1539 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1540 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
1541 * @param Month This parameter can be one of the following values:
1542 * @arg @ref LL_RTC_MONTH_JANUARY
1543 * @arg @ref LL_RTC_MONTH_FEBRUARY
1544 * @arg @ref LL_RTC_MONTH_MARCH
1545 * @arg @ref LL_RTC_MONTH_APRIL
1546 * @arg @ref LL_RTC_MONTH_MAY
1547 * @arg @ref LL_RTC_MONTH_JUNE
1548 * @arg @ref LL_RTC_MONTH_JULY
1549 * @arg @ref LL_RTC_MONTH_AUGUST
1550 * @arg @ref LL_RTC_MONTH_SEPTEMBER
1551 * @arg @ref LL_RTC_MONTH_OCTOBER
1552 * @arg @ref LL_RTC_MONTH_NOVEMBER
1553 * @arg @ref LL_RTC_MONTH_DECEMBER
1554 * @param Year Value between Min_Data=0x00 and Max_Data=0x99
1557 __STATIC_INLINE
void LL_RTC_DATE_Config(RTC_TypeDef
*RTCx
, uint32_t WeekDay
, uint32_t Day
, uint32_t Month
, uint32_t Year
)
1559 register uint32_t temp
= 0U;
1561 temp
= (WeekDay
<< RTC_DR_WDU_Pos
) | \
1562 (((Year
& 0xF0U
) << (RTC_DR_YT_Pos
- 4U)) | ((Year
& 0x0FU
) << RTC_DR_YU_Pos
)) | \
1563 (((Month
& 0xF0U
) << (RTC_DR_MT_Pos
- 4U)) | ((Month
& 0x0FU
) << RTC_DR_MU_Pos
)) | \
1564 (((Day
& 0xF0U
) << (RTC_DR_DT_Pos
- 4U)) | ((Day
& 0x0FU
) << RTC_DR_DU_Pos
));
1566 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
);
1570 * @brief Get date (WeekDay, Day, Month and Year) in BCD format
1571 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1572 * before reading this bit
1573 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_YEAR, __LL_RTC_GET_MONTH,
1574 * and __LL_RTC_GET_DAY are available to get independently each parameter.
1575 * @rmtoll DR WDU LL_RTC_DATE_Get\n
1576 * DR MT LL_RTC_DATE_Get\n
1577 * DR MU LL_RTC_DATE_Get\n
1578 * DR DT LL_RTC_DATE_Get\n
1579 * DR DU LL_RTC_DATE_Get\n
1580 * DR YT LL_RTC_DATE_Get\n
1581 * DR YU LL_RTC_DATE_Get
1582 * @param RTCx RTC Instance
1583 * @retval Combination of WeekDay, Day, Month and Year (Format: 0xWWDDMMYY).
1585 __STATIC_INLINE
uint32_t LL_RTC_DATE_Get(RTC_TypeDef
*RTCx
)
1587 register uint32_t temp
= 0U;
1589 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
));
1590 return (uint32_t)((((temp
& RTC_DR_WDU
) >> RTC_DR_WDU_Pos
) << RTC_OFFSET_WEEKDAY
) | \
1591 (((((temp
& RTC_DR_DT
) >> RTC_DR_DT_Pos
) << 4U) | ((temp
& RTC_DR_DU
) >> RTC_DR_DU_Pos
)) << RTC_OFFSET_DAY
) | \
1592 (((((temp
& RTC_DR_MT
) >> RTC_DR_MT_Pos
) << 4U) | ((temp
& RTC_DR_MU
) >> RTC_DR_MU_Pos
)) << RTC_OFFSET_MONTH
) | \
1593 ((((temp
& RTC_DR_YT
) >> RTC_DR_YT_Pos
) << 4U) | ((temp
& RTC_DR_YU
) >> RTC_DR_YU_Pos
)));
1600 /** @defgroup RTC_LL_EF_ALARMA ALARMA
1605 * @brief Enable Alarm A
1606 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1607 * @rmtoll CR ALRAE LL_RTC_ALMA_Enable
1608 * @param RTCx RTC Instance
1611 __STATIC_INLINE
void LL_RTC_ALMA_Enable(RTC_TypeDef
*RTCx
)
1613 SET_BIT(RTCx
->CR
, RTC_CR_ALRAE
);
1617 * @brief Disable Alarm A
1618 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1619 * @rmtoll CR ALRAE LL_RTC_ALMA_Disable
1620 * @param RTCx RTC Instance
1623 __STATIC_INLINE
void LL_RTC_ALMA_Disable(RTC_TypeDef
*RTCx
)
1625 CLEAR_BIT(RTCx
->CR
, RTC_CR_ALRAE
);
1629 * @brief Specify the Alarm A masks.
1630 * @rmtoll ALRMAR MSK4 LL_RTC_ALMA_SetMask\n
1631 * ALRMAR MSK3 LL_RTC_ALMA_SetMask\n
1632 * ALRMAR MSK2 LL_RTC_ALMA_SetMask\n
1633 * ALRMAR MSK1 LL_RTC_ALMA_SetMask
1634 * @param RTCx RTC Instance
1635 * @param Mask This parameter can be a combination of the following values:
1636 * @arg @ref LL_RTC_ALMA_MASK_NONE
1637 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
1638 * @arg @ref LL_RTC_ALMA_MASK_HOURS
1639 * @arg @ref LL_RTC_ALMA_MASK_MINUTES
1640 * @arg @ref LL_RTC_ALMA_MASK_SECONDS
1641 * @arg @ref LL_RTC_ALMA_MASK_ALL
1644 __STATIC_INLINE
void LL_RTC_ALMA_SetMask(RTC_TypeDef
*RTCx
, uint32_t Mask
)
1646 MODIFY_REG(RTCx
->ALRMAR
, RTC_ALRMAR_MSK4
| RTC_ALRMAR_MSK3
| RTC_ALRMAR_MSK2
| RTC_ALRMAR_MSK1
, Mask
);
1650 * @brief Get the Alarm A masks.
1651 * @rmtoll ALRMAR MSK4 LL_RTC_ALMA_GetMask\n
1652 * ALRMAR MSK3 LL_RTC_ALMA_GetMask\n
1653 * ALRMAR MSK2 LL_RTC_ALMA_GetMask\n
1654 * ALRMAR MSK1 LL_RTC_ALMA_GetMask
1655 * @param RTCx RTC Instance
1656 * @retval Returned value can be can be a combination of the following values:
1657 * @arg @ref LL_RTC_ALMA_MASK_NONE
1658 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
1659 * @arg @ref LL_RTC_ALMA_MASK_HOURS
1660 * @arg @ref LL_RTC_ALMA_MASK_MINUTES
1661 * @arg @ref LL_RTC_ALMA_MASK_SECONDS
1662 * @arg @ref LL_RTC_ALMA_MASK_ALL
1664 __STATIC_INLINE
uint32_t LL_RTC_ALMA_GetMask(RTC_TypeDef
*RTCx
)
1666 return (uint32_t)(READ_BIT(RTCx
->ALRMAR
, RTC_ALRMAR_MSK4
| RTC_ALRMAR_MSK3
| RTC_ALRMAR_MSK2
| RTC_ALRMAR_MSK1
));
1670 * @brief Enable AlarmA Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
1671 * @rmtoll ALRMAR WDSEL LL_RTC_ALMA_EnableWeekday
1672 * @param RTCx RTC Instance
1675 __STATIC_INLINE
void LL_RTC_ALMA_EnableWeekday(RTC_TypeDef
*RTCx
)
1677 SET_BIT(RTCx
->ALRMAR
, RTC_ALRMAR_WDSEL
);
1681 * @brief Disable AlarmA Week day selection (DU[3:0] represents the date )
1682 * @rmtoll ALRMAR WDSEL LL_RTC_ALMA_DisableWeekday
1683 * @param RTCx RTC Instance
1686 __STATIC_INLINE
void LL_RTC_ALMA_DisableWeekday(RTC_TypeDef
*RTCx
)
1688 CLEAR_BIT(RTCx
->ALRMAR
, RTC_ALRMAR_WDSEL
);
1692 * @brief Set ALARM A Day in BCD format
1693 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
1694 * @rmtoll ALRMAR DT LL_RTC_ALMA_SetDay\n
1695 * ALRMAR DU LL_RTC_ALMA_SetDay
1696 * @param RTCx RTC Instance
1697 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
1700 __STATIC_INLINE
void LL_RTC_ALMA_SetDay(RTC_TypeDef
*RTCx
, uint32_t Day
)
1702 MODIFY_REG(RTCx
->ALRMAR
, (RTC_ALRMAR_DT
| RTC_ALRMAR_DU
),
1703 (((Day
& 0xF0U
) << (RTC_ALRMAR_DT_Pos
- 4U)) | ((Day
& 0x0FU
) << RTC_ALRMAR_DU_Pos
)));
1707 * @brief Get ALARM A Day in BCD format
1708 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
1709 * @rmtoll ALRMAR DT LL_RTC_ALMA_GetDay\n
1710 * ALRMAR DU LL_RTC_ALMA_GetDay
1711 * @param RTCx RTC Instance
1712 * @retval Value between Min_Data=0x01 and Max_Data=0x31
1714 __STATIC_INLINE
uint32_t LL_RTC_ALMA_GetDay(RTC_TypeDef
*RTCx
)
1716 register uint32_t temp
= 0U;
1718 temp
= READ_BIT(RTCx
->ALRMAR
, (RTC_ALRMAR_DT
| RTC_ALRMAR_DU
));
1719 return (uint32_t)((((temp
& RTC_ALRMAR_DT
) >> RTC_ALRMAR_DT_Pos
) << 4U) | ((temp
& RTC_ALRMAR_DU
) >> RTC_ALRMAR_DU_Pos
));
1723 * @brief Set ALARM A Weekday
1724 * @rmtoll ALRMAR DU LL_RTC_ALMA_SetWeekDay
1725 * @param RTCx RTC Instance
1726 * @param WeekDay This parameter can be one of the following values:
1727 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1728 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1729 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1730 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1731 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1732 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1733 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1736 __STATIC_INLINE
void LL_RTC_ALMA_SetWeekDay(RTC_TypeDef
*RTCx
, uint32_t WeekDay
)
1738 MODIFY_REG(RTCx
->ALRMAR
, RTC_ALRMAR_DU
, WeekDay
<< RTC_ALRMAR_DU_Pos
);
1742 * @brief Get ALARM A Weekday
1743 * @rmtoll ALRMAR DU LL_RTC_ALMA_GetWeekDay
1744 * @param RTCx RTC Instance
1745 * @retval Returned value can be one of the following values:
1746 * @arg @ref LL_RTC_WEEKDAY_MONDAY
1747 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
1748 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1749 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
1750 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
1751 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
1752 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
1754 __STATIC_INLINE
uint32_t LL_RTC_ALMA_GetWeekDay(RTC_TypeDef
*RTCx
)
1756 return (uint32_t)(READ_BIT(RTCx
->ALRMAR
, RTC_ALRMAR_DU
) >> RTC_ALRMAR_DU_Pos
);
1760 * @brief Set Alarm A time format (AM/24-hour or PM notation)
1761 * @rmtoll ALRMAR PM LL_RTC_ALMA_SetTimeFormat
1762 * @param RTCx RTC Instance
1763 * @param TimeFormat This parameter can be one of the following values:
1764 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1765 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1768 __STATIC_INLINE
void LL_RTC_ALMA_SetTimeFormat(RTC_TypeDef
*RTCx
, uint32_t TimeFormat
)
1770 MODIFY_REG(RTCx
->ALRMAR
, RTC_ALRMAR_PM
, TimeFormat
);
1774 * @brief Get Alarm A time format (AM or PM notation)
1775 * @rmtoll ALRMAR PM LL_RTC_ALMA_GetTimeFormat
1776 * @param RTCx RTC Instance
1777 * @retval Returned value can be one of the following values:
1778 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1779 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1781 __STATIC_INLINE
uint32_t LL_RTC_ALMA_GetTimeFormat(RTC_TypeDef
*RTCx
)
1783 return (uint32_t)(READ_BIT(RTCx
->ALRMAR
, RTC_ALRMAR_PM
));
1787 * @brief Set ALARM A Hours in BCD format
1788 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
1789 * @rmtoll ALRMAR HT LL_RTC_ALMA_SetHour\n
1790 * ALRMAR HU LL_RTC_ALMA_SetHour
1791 * @param RTCx RTC Instance
1792 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1795 __STATIC_INLINE
void LL_RTC_ALMA_SetHour(RTC_TypeDef
*RTCx
, uint32_t Hours
)
1797 MODIFY_REG(RTCx
->ALRMAR
, (RTC_ALRMAR_HT
| RTC_ALRMAR_HU
),
1798 (((Hours
& 0xF0U
) << (RTC_ALRMAR_HT_Pos
- 4U)) | ((Hours
& 0x0FU
) << RTC_ALRMAR_HU_Pos
)));
1802 * @brief Get ALARM A Hours in BCD format
1803 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
1804 * @rmtoll ALRMAR HT LL_RTC_ALMA_GetHour\n
1805 * ALRMAR HU LL_RTC_ALMA_GetHour
1806 * @param RTCx RTC Instance
1807 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1809 __STATIC_INLINE
uint32_t LL_RTC_ALMA_GetHour(RTC_TypeDef
*RTCx
)
1811 register uint32_t temp
= 0U;
1813 temp
= READ_BIT(RTCx
->ALRMAR
, (RTC_ALRMAR_HT
| RTC_ALRMAR_HU
));
1814 return (uint32_t)((((temp
& RTC_ALRMAR_HT
) >> RTC_ALRMAR_HT_Pos
) << 4U) | ((temp
& RTC_ALRMAR_HU
) >> RTC_ALRMAR_HU_Pos
));
1818 * @brief Set ALARM A Minutes in BCD format
1819 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
1820 * @rmtoll ALRMAR MNT LL_RTC_ALMA_SetMinute\n
1821 * ALRMAR MNU LL_RTC_ALMA_SetMinute
1822 * @param RTCx RTC Instance
1823 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
1826 __STATIC_INLINE
void LL_RTC_ALMA_SetMinute(RTC_TypeDef
*RTCx
, uint32_t Minutes
)
1828 MODIFY_REG(RTCx
->ALRMAR
, (RTC_ALRMAR_MNT
| RTC_ALRMAR_MNU
),
1829 (((Minutes
& 0xF0U
) << (RTC_ALRMAR_MNT_Pos
- 4U)) | ((Minutes
& 0x0FU
) << RTC_ALRMAR_MNU_Pos
)));
1833 * @brief Get ALARM A Minutes in BCD format
1834 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
1835 * @rmtoll ALRMAR MNT LL_RTC_ALMA_GetMinute\n
1836 * ALRMAR MNU LL_RTC_ALMA_GetMinute
1837 * @param RTCx RTC Instance
1838 * @retval Value between Min_Data=0x00 and Max_Data=0x59
1840 __STATIC_INLINE
uint32_t LL_RTC_ALMA_GetMinute(RTC_TypeDef
*RTCx
)
1842 register uint32_t temp
= 0U;
1844 temp
= READ_BIT(RTCx
->ALRMAR
, (RTC_ALRMAR_MNT
| RTC_ALRMAR_MNU
));
1845 return (uint32_t)((((temp
& RTC_ALRMAR_MNT
) >> RTC_ALRMAR_MNT_Pos
) << 4U) | ((temp
& RTC_ALRMAR_MNU
) >> RTC_ALRMAR_MNU_Pos
));
1849 * @brief Set ALARM A Seconds in BCD format
1850 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
1851 * @rmtoll ALRMAR ST LL_RTC_ALMA_SetSecond\n
1852 * ALRMAR SU LL_RTC_ALMA_SetSecond
1853 * @param RTCx RTC Instance
1854 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
1857 __STATIC_INLINE
void LL_RTC_ALMA_SetSecond(RTC_TypeDef
*RTCx
, uint32_t Seconds
)
1859 MODIFY_REG(RTCx
->ALRMAR
, (RTC_ALRMAR_ST
| RTC_ALRMAR_SU
),
1860 (((Seconds
& 0xF0U
) << (RTC_ALRMAR_ST_Pos
- 4U)) | ((Seconds
& 0x0FU
) << RTC_ALRMAR_SU_Pos
)));
1864 * @brief Get ALARM A Seconds in BCD format
1865 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
1866 * @rmtoll ALRMAR ST LL_RTC_ALMA_GetSecond\n
1867 * ALRMAR SU LL_RTC_ALMA_GetSecond
1868 * @param RTCx RTC Instance
1869 * @retval Value between Min_Data=0x00 and Max_Data=0x59
1871 __STATIC_INLINE
uint32_t LL_RTC_ALMA_GetSecond(RTC_TypeDef
*RTCx
)
1873 register uint32_t temp
= 0U;
1875 temp
= READ_BIT(RTCx
->ALRMAR
, (RTC_ALRMAR_ST
| RTC_ALRMAR_SU
));
1876 return (uint32_t)((((temp
& RTC_ALRMAR_ST
) >> RTC_ALRMAR_ST_Pos
) << 4U) | ((temp
& RTC_ALRMAR_SU
) >> RTC_ALRMAR_SU_Pos
));
1880 * @brief Set Alarm A Time (hour, minute and second) in BCD format
1881 * @rmtoll ALRMAR PM LL_RTC_ALMA_ConfigTime\n
1882 * ALRMAR HT LL_RTC_ALMA_ConfigTime\n
1883 * ALRMAR HU LL_RTC_ALMA_ConfigTime\n
1884 * ALRMAR MNT LL_RTC_ALMA_ConfigTime\n
1885 * ALRMAR MNU LL_RTC_ALMA_ConfigTime\n
1886 * ALRMAR ST LL_RTC_ALMA_ConfigTime\n
1887 * ALRMAR SU LL_RTC_ALMA_ConfigTime
1888 * @param RTCx RTC Instance
1889 * @param Format12_24 This parameter can be one of the following values:
1890 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1891 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1892 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1893 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
1894 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
1897 __STATIC_INLINE
void LL_RTC_ALMA_ConfigTime(RTC_TypeDef
*RTCx
, uint32_t Format12_24
, uint32_t Hours
, uint32_t Minutes
, uint32_t Seconds
)
1899 register uint32_t temp
= 0U;
1901 temp
= Format12_24
| (((Hours
& 0xF0U
) << (RTC_ALRMAR_HT_Pos
- 4U)) | ((Hours
& 0x0FU
) << RTC_ALRMAR_HU_Pos
)) | \
1902 (((Minutes
& 0xF0U
) << (RTC_ALRMAR_MNT_Pos
- 4U)) | ((Minutes
& 0x0FU
) << RTC_ALRMAR_MNU_Pos
)) | \
1903 (((Seconds
& 0xF0U
) << (RTC_ALRMAR_ST_Pos
- 4U)) | ((Seconds
& 0x0FU
) << RTC_ALRMAR_SU_Pos
));
1905 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
);
1909 * @brief Get Alarm B Time (hour, minute and second) in BCD format
1910 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
1911 * are available to get independently each parameter.
1912 * @rmtoll ALRMAR HT LL_RTC_ALMA_GetTime\n
1913 * ALRMAR HU LL_RTC_ALMA_GetTime\n
1914 * ALRMAR MNT LL_RTC_ALMA_GetTime\n
1915 * ALRMAR MNU LL_RTC_ALMA_GetTime\n
1916 * ALRMAR ST LL_RTC_ALMA_GetTime\n
1917 * ALRMAR SU LL_RTC_ALMA_GetTime
1918 * @param RTCx RTC Instance
1919 * @retval Combination of hours, minutes and seconds.
1921 __STATIC_INLINE
uint32_t LL_RTC_ALMA_GetTime(RTC_TypeDef
*RTCx
)
1923 return (uint32_t)((LL_RTC_ALMA_GetHour(RTCx
) << RTC_OFFSET_HOUR
) | (LL_RTC_ALMA_GetMinute(RTCx
) << RTC_OFFSET_MINUTE
) | LL_RTC_ALMA_GetSecond(RTCx
));
1927 * @brief Set Alarm A Mask the most-significant bits starting at this bit
1928 * @note This register can be written only when ALRAE is reset in RTC_CR register,
1929 * or in initialization mode.
1930 * @rmtoll ALRMASSR MASKSS LL_RTC_ALMA_SetSubSecondMask
1931 * @param RTCx RTC Instance
1932 * @param Mask Value between Min_Data=0x00 and Max_Data=0xF
1935 __STATIC_INLINE
void LL_RTC_ALMA_SetSubSecondMask(RTC_TypeDef
*RTCx
, uint32_t Mask
)
1937 MODIFY_REG(RTCx
->ALRMASSR
, RTC_ALRMASSR_MASKSS
, Mask
<< RTC_ALRMASSR_MASKSS_Pos
);
1941 * @brief Get Alarm A Mask the most-significant bits starting at this bit
1942 * @rmtoll ALRMASSR MASKSS LL_RTC_ALMA_GetSubSecondMask
1943 * @param RTCx RTC Instance
1944 * @retval Value between Min_Data=0x00 and Max_Data=0xF
1946 __STATIC_INLINE
uint32_t LL_RTC_ALMA_GetSubSecondMask(RTC_TypeDef
*RTCx
)
1948 return (uint32_t)(READ_BIT(RTCx
->ALRMASSR
, RTC_ALRMASSR_MASKSS
) >> RTC_ALRMASSR_MASKSS_Pos
);
1952 * @brief Set Alarm A Sub seconds value
1953 * @rmtoll ALRMASSR SS LL_RTC_ALMA_SetSubSecond
1954 * @param RTCx RTC Instance
1955 * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
1958 __STATIC_INLINE
void LL_RTC_ALMA_SetSubSecond(RTC_TypeDef
*RTCx
, uint32_t Subsecond
)
1960 MODIFY_REG(RTCx
->ALRMASSR
, RTC_ALRMASSR_SS
, Subsecond
);
1964 * @brief Get Alarm A Sub seconds value
1965 * @rmtoll ALRMASSR SS LL_RTC_ALMA_GetSubSecond
1966 * @param RTCx RTC Instance
1967 * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
1969 __STATIC_INLINE
uint32_t LL_RTC_ALMA_GetSubSecond(RTC_TypeDef
*RTCx
)
1971 return (uint32_t)(READ_BIT(RTCx
->ALRMASSR
, RTC_ALRMASSR_SS
));
1978 /** @defgroup RTC_LL_EF_ALARMB ALARMB
1983 * @brief Enable Alarm B
1984 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1985 * @rmtoll CR ALRBE LL_RTC_ALMB_Enable
1986 * @param RTCx RTC Instance
1989 __STATIC_INLINE
void LL_RTC_ALMB_Enable(RTC_TypeDef
*RTCx
)
1991 SET_BIT(RTCx
->CR
, RTC_CR_ALRBE
);
1995 * @brief Disable Alarm B
1996 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1997 * @rmtoll CR ALRBE LL_RTC_ALMB_Disable
1998 * @param RTCx RTC Instance
2001 __STATIC_INLINE
void LL_RTC_ALMB_Disable(RTC_TypeDef
*RTCx
)
2003 CLEAR_BIT(RTCx
->CR
, RTC_CR_ALRBE
);
2007 * @brief Specify the Alarm B masks.
2008 * @rmtoll ALRMBR MSK4 LL_RTC_ALMB_SetMask\n
2009 * ALRMBR MSK3 LL_RTC_ALMB_SetMask\n
2010 * ALRMBR MSK2 LL_RTC_ALMB_SetMask\n
2011 * ALRMBR MSK1 LL_RTC_ALMB_SetMask
2012 * @param RTCx RTC Instance
2013 * @param Mask This parameter can be a combination of the following values:
2014 * @arg @ref LL_RTC_ALMB_MASK_NONE
2015 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
2016 * @arg @ref LL_RTC_ALMB_MASK_HOURS
2017 * @arg @ref LL_RTC_ALMB_MASK_MINUTES
2018 * @arg @ref LL_RTC_ALMB_MASK_SECONDS
2019 * @arg @ref LL_RTC_ALMB_MASK_ALL
2022 __STATIC_INLINE
void LL_RTC_ALMB_SetMask(RTC_TypeDef
*RTCx
, uint32_t Mask
)
2024 MODIFY_REG(RTCx
->ALRMBR
, RTC_ALRMBR_MSK4
| RTC_ALRMBR_MSK3
| RTC_ALRMBR_MSK2
| RTC_ALRMBR_MSK1
, Mask
);
2028 * @brief Get the Alarm B masks.
2029 * @rmtoll ALRMBR MSK4 LL_RTC_ALMB_GetMask\n
2030 * ALRMBR MSK3 LL_RTC_ALMB_GetMask\n
2031 * ALRMBR MSK2 LL_RTC_ALMB_GetMask\n
2032 * ALRMBR MSK1 LL_RTC_ALMB_GetMask
2033 * @param RTCx RTC Instance
2034 * @retval Returned value can be can be a combination of the following values:
2035 * @arg @ref LL_RTC_ALMB_MASK_NONE
2036 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
2037 * @arg @ref LL_RTC_ALMB_MASK_HOURS
2038 * @arg @ref LL_RTC_ALMB_MASK_MINUTES
2039 * @arg @ref LL_RTC_ALMB_MASK_SECONDS
2040 * @arg @ref LL_RTC_ALMB_MASK_ALL
2042 __STATIC_INLINE
uint32_t LL_RTC_ALMB_GetMask(RTC_TypeDef
*RTCx
)
2044 return (uint32_t)(READ_BIT(RTCx
->ALRMBR
, RTC_ALRMBR_MSK4
| RTC_ALRMBR_MSK3
| RTC_ALRMBR_MSK2
| RTC_ALRMBR_MSK1
));
2048 * @brief Enable AlarmB Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
2049 * @rmtoll ALRMBR WDSEL LL_RTC_ALMB_EnableWeekday
2050 * @param RTCx RTC Instance
2053 __STATIC_INLINE
void LL_RTC_ALMB_EnableWeekday(RTC_TypeDef
*RTCx
)
2055 SET_BIT(RTCx
->ALRMBR
, RTC_ALRMBR_WDSEL
);
2059 * @brief Disable AlarmB Week day selection (DU[3:0] represents the date )
2060 * @rmtoll ALRMBR WDSEL LL_RTC_ALMB_DisableWeekday
2061 * @param RTCx RTC Instance
2064 __STATIC_INLINE
void LL_RTC_ALMB_DisableWeekday(RTC_TypeDef
*RTCx
)
2066 CLEAR_BIT(RTCx
->ALRMBR
, RTC_ALRMBR_WDSEL
);
2070 * @brief Set ALARM B Day in BCD format
2071 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
2072 * @rmtoll ALRMBR DT LL_RTC_ALMB_SetDay\n
2073 * ALRMBR DU LL_RTC_ALMB_SetDay
2074 * @param RTCx RTC Instance
2075 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
2078 __STATIC_INLINE
void LL_RTC_ALMB_SetDay(RTC_TypeDef
*RTCx
, uint32_t Day
)
2080 MODIFY_REG(RTC
->ALRMBR
, (RTC_ALRMBR_DT
| RTC_ALRMBR_DU
),
2081 (((Day
& 0xF0U
) << (RTC_ALRMBR_DT_Pos
- 4U)) | ((Day
& 0x0FU
) << RTC_ALRMBR_DU_Pos
)));
2085 * @brief Get ALARM B Day in BCD format
2086 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2087 * @rmtoll ALRMBR DT LL_RTC_ALMB_GetDay\n
2088 * ALRMBR DU LL_RTC_ALMB_GetDay
2089 * @param RTCx RTC Instance
2090 * @retval Value between Min_Data=0x01 and Max_Data=0x31
2092 __STATIC_INLINE
uint32_t LL_RTC_ALMB_GetDay(RTC_TypeDef
*RTCx
)
2094 register uint32_t temp
= 0U;
2096 temp
= READ_BIT(RTCx
->ALRMBR
, (RTC_ALRMBR_DT
| RTC_ALRMBR_DU
));
2097 return (uint32_t)((((temp
& RTC_ALRMBR_DT
) >> RTC_ALRMBR_DT_Pos
) << 4U) | ((temp
& RTC_ALRMBR_DU
) >> RTC_ALRMBR_DU_Pos
));
2101 * @brief Set ALARM B Weekday
2102 * @rmtoll ALRMBR DU LL_RTC_ALMB_SetWeekDay
2103 * @param RTCx RTC Instance
2104 * @param WeekDay This parameter can be one of the following values:
2105 * @arg @ref LL_RTC_WEEKDAY_MONDAY
2106 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
2107 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2108 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
2109 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
2110 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
2111 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
2114 __STATIC_INLINE
void LL_RTC_ALMB_SetWeekDay(RTC_TypeDef
*RTCx
, uint32_t WeekDay
)
2116 MODIFY_REG(RTCx
->ALRMBR
, RTC_ALRMBR_DU
, WeekDay
<< RTC_ALRMBR_DU_Pos
);
2120 * @brief Get ALARM B Weekday
2121 * @rmtoll ALRMBR DU LL_RTC_ALMB_GetWeekDay
2122 * @param RTCx RTC Instance
2123 * @retval Returned value can be one of the following values:
2124 * @arg @ref LL_RTC_WEEKDAY_MONDAY
2125 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
2126 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2127 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
2128 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
2129 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
2130 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
2132 __STATIC_INLINE
uint32_t LL_RTC_ALMB_GetWeekDay(RTC_TypeDef
*RTCx
)
2134 return (uint32_t)(READ_BIT(RTCx
->ALRMBR
, RTC_ALRMBR_DU
) >> RTC_ALRMBR_DU_Pos
);
2138 * @brief Set ALARM B time format (AM/24-hour or PM notation)
2139 * @rmtoll ALRMBR PM LL_RTC_ALMB_SetTimeFormat
2140 * @param RTCx RTC Instance
2141 * @param TimeFormat This parameter can be one of the following values:
2142 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2143 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2146 __STATIC_INLINE
void LL_RTC_ALMB_SetTimeFormat(RTC_TypeDef
*RTCx
, uint32_t TimeFormat
)
2148 MODIFY_REG(RTCx
->ALRMBR
, RTC_ALRMBR_PM
, TimeFormat
);
2152 * @brief Get ALARM B time format (AM or PM notation)
2153 * @rmtoll ALRMBR PM LL_RTC_ALMB_GetTimeFormat
2154 * @param RTCx RTC Instance
2155 * @retval Returned value can be one of the following values:
2156 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2157 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2159 __STATIC_INLINE
uint32_t LL_RTC_ALMB_GetTimeFormat(RTC_TypeDef
*RTCx
)
2161 return (uint32_t)(READ_BIT(RTCx
->ALRMBR
, RTC_ALRMBR_PM
));
2165 * @brief Set ALARM B Hours in BCD format
2166 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
2167 * @rmtoll ALRMBR HT LL_RTC_ALMB_SetHour\n
2168 * ALRMBR HU LL_RTC_ALMB_SetHour
2169 * @param RTCx RTC Instance
2170 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2173 __STATIC_INLINE
void LL_RTC_ALMB_SetHour(RTC_TypeDef
*RTCx
, uint32_t Hours
)
2175 MODIFY_REG(RTCx
->ALRMBR
, (RTC_ALRMBR_HT
| RTC_ALRMBR_HU
),
2176 (((Hours
& 0xF0U
) << (RTC_ALRMBR_HT_Pos
- 4U)) | ((Hours
& 0x0FU
) << RTC_ALRMBR_HU_Pos
)));
2180 * @brief Get ALARM B Hours in BCD format
2181 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2182 * @rmtoll ALRMBR HT LL_RTC_ALMB_GetHour\n
2183 * ALRMBR HU LL_RTC_ALMB_GetHour
2184 * @param RTCx RTC Instance
2185 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2187 __STATIC_INLINE
uint32_t LL_RTC_ALMB_GetHour(RTC_TypeDef
*RTCx
)
2189 register uint32_t temp
= 0U;
2191 temp
= READ_BIT(RTCx
->ALRMBR
, (RTC_ALRMBR_HT
| RTC_ALRMBR_HU
));
2192 return (uint32_t)((((temp
& RTC_ALRMBR_HT
) >> RTC_ALRMBR_HT_Pos
) << 4U) | ((temp
& RTC_ALRMBR_HU
) >> RTC_ALRMBR_HU_Pos
));
2196 * @brief Set ALARM B Minutes in BCD format
2197 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
2198 * @rmtoll ALRMBR MNT LL_RTC_ALMB_SetMinute\n
2199 * ALRMBR MNU LL_RTC_ALMB_SetMinute
2200 * @param RTCx RTC Instance
2201 * @param Minutes between Min_Data=0x00 and Max_Data=0x59
2204 __STATIC_INLINE
void LL_RTC_ALMB_SetMinute(RTC_TypeDef
*RTCx
, uint32_t Minutes
)
2206 MODIFY_REG(RTCx
->ALRMBR
, (RTC_ALRMBR_MNT
| RTC_ALRMBR_MNU
),
2207 (((Minutes
& 0xF0U
) << (RTC_ALRMBR_MNT_Pos
- 4U)) | ((Minutes
& 0x0FU
) << RTC_ALRMBR_MNU_Pos
)));
2211 * @brief Get ALARM B Minutes in BCD format
2212 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2213 * @rmtoll ALRMBR MNT LL_RTC_ALMB_GetMinute\n
2214 * ALRMBR MNU LL_RTC_ALMB_GetMinute
2215 * @param RTCx RTC Instance
2216 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2218 __STATIC_INLINE
uint32_t LL_RTC_ALMB_GetMinute(RTC_TypeDef
*RTCx
)
2220 register uint32_t temp
= 0U;
2222 temp
= READ_BIT(RTCx
->ALRMBR
, (RTC_ALRMBR_MNT
| RTC_ALRMBR_MNU
));
2223 return (uint32_t)((((temp
& RTC_ALRMBR_MNT
) >> RTC_ALRMBR_MNT_Pos
) << 4U) | ((temp
& RTC_ALRMBR_MNU
) >> RTC_ALRMBR_MNU_Pos
));
2227 * @brief Set ALARM B Seconds in BCD format
2228 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
2229 * @rmtoll ALRMBR ST LL_RTC_ALMB_SetSecond\n
2230 * ALRMBR SU LL_RTC_ALMB_SetSecond
2231 * @param RTCx RTC Instance
2232 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
2235 __STATIC_INLINE
void LL_RTC_ALMB_SetSecond(RTC_TypeDef
*RTCx
, uint32_t Seconds
)
2237 MODIFY_REG(RTCx
->ALRMBR
, (RTC_ALRMBR_ST
| RTC_ALRMBR_SU
),
2238 (((Seconds
& 0xF0U
) << (RTC_ALRMBR_ST_Pos
- 4U)) | ((Seconds
& 0x0FU
) << RTC_ALRMBR_SU_Pos
)));
2242 * @brief Get ALARM B Seconds in BCD format
2243 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2244 * @rmtoll ALRMBR ST LL_RTC_ALMB_GetSecond\n
2245 * ALRMBR SU LL_RTC_ALMB_GetSecond
2246 * @param RTCx RTC Instance
2247 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2249 __STATIC_INLINE
uint32_t LL_RTC_ALMB_GetSecond(RTC_TypeDef
*RTCx
)
2251 register uint32_t temp
= 0U;
2253 temp
= READ_BIT(RTCx
->ALRMBR
, (RTC_ALRMBR_ST
| RTC_ALRMBR_SU
));
2254 return (uint32_t)((((temp
& RTC_ALRMBR_ST
) >> RTC_ALRMBR_ST_Pos
) << 4U) | ((temp
& RTC_ALRMBR_SU
) >> RTC_ALRMBR_SU_Pos
));
2258 * @brief Set Alarm B Time (hour, minute and second) in BCD format
2259 * @rmtoll ALRMBR PM LL_RTC_ALMB_ConfigTime\n
2260 * ALRMBR HT LL_RTC_ALMB_ConfigTime\n
2261 * ALRMBR HU LL_RTC_ALMB_ConfigTime\n
2262 * ALRMBR MNT LL_RTC_ALMB_ConfigTime\n
2263 * ALRMBR MNU LL_RTC_ALMB_ConfigTime\n
2264 * ALRMBR ST LL_RTC_ALMB_ConfigTime\n
2265 * ALRMBR SU LL_RTC_ALMB_ConfigTime
2266 * @param RTCx RTC Instance
2267 * @param Format12_24 This parameter can be one of the following values:
2268 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2269 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2270 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2271 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
2272 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
2275 __STATIC_INLINE
void LL_RTC_ALMB_ConfigTime(RTC_TypeDef
*RTCx
, uint32_t Format12_24
, uint32_t Hours
, uint32_t Minutes
, uint32_t Seconds
)
2277 register uint32_t temp
= 0U;
2279 temp
= Format12_24
| (((Hours
& 0xF0U
) << (RTC_ALRMBR_HT_Pos
- 4U)) | ((Hours
& 0x0FU
) << RTC_ALRMBR_HU_Pos
)) | \
2280 (((Minutes
& 0xF0U
) << (RTC_ALRMBR_MNT_Pos
- 4U)) | ((Minutes
& 0x0FU
) << RTC_ALRMBR_MNU_Pos
)) | \
2281 (((Seconds
& 0xF0U
) << (RTC_ALRMBR_ST_Pos
- 4U)) | ((Seconds
& 0x0FU
) << RTC_ALRMBR_SU_Pos
));
2283 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
);
2287 * @brief Get Alarm B Time (hour, minute and second) in BCD format
2288 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2289 * are available to get independently each parameter.
2290 * @rmtoll ALRMBR HT LL_RTC_ALMB_GetTime\n
2291 * ALRMBR HU LL_RTC_ALMB_GetTime\n
2292 * ALRMBR MNT LL_RTC_ALMB_GetTime\n
2293 * ALRMBR MNU LL_RTC_ALMB_GetTime\n
2294 * ALRMBR ST LL_RTC_ALMB_GetTime\n
2295 * ALRMBR SU LL_RTC_ALMB_GetTime
2296 * @param RTCx RTC Instance
2297 * @retval Combination of hours, minutes and seconds.
2299 __STATIC_INLINE
uint32_t LL_RTC_ALMB_GetTime(RTC_TypeDef
*RTCx
)
2301 return (uint32_t)((LL_RTC_ALMB_GetHour(RTCx
) << RTC_OFFSET_HOUR
) | (LL_RTC_ALMB_GetMinute(RTCx
) << RTC_OFFSET_MINUTE
) | LL_RTC_ALMB_GetSecond(RTCx
));
2305 * @brief Set Alarm B Mask the most-significant bits starting at this bit
2306 * @note This register can be written only when ALRBE is reset in RTC_CR register,
2307 * or in initialization mode.
2308 * @rmtoll ALRMBSSR MASKSS LL_RTC_ALMB_SetSubSecondMask
2309 * @param RTCx RTC Instance
2310 * @param Mask Value between Min_Data=0x00 and Max_Data=0xF
2313 __STATIC_INLINE
void LL_RTC_ALMB_SetSubSecondMask(RTC_TypeDef
*RTCx
, uint32_t Mask
)
2315 MODIFY_REG(RTCx
->ALRMBSSR
, RTC_ALRMBSSR_MASKSS
, Mask
<< RTC_ALRMBSSR_MASKSS_Pos
);
2319 * @brief Get Alarm B Mask the most-significant bits starting at this bit
2320 * @rmtoll ALRMBSSR MASKSS LL_RTC_ALMB_GetSubSecondMask
2321 * @param RTCx RTC Instance
2322 * @retval Value between Min_Data=0x00 and Max_Data=0xF
2324 __STATIC_INLINE
uint32_t LL_RTC_ALMB_GetSubSecondMask(RTC_TypeDef
*RTCx
)
2326 return (uint32_t)(READ_BIT(RTCx
->ALRMBSSR
, RTC_ALRMBSSR_MASKSS
) >> RTC_ALRMBSSR_MASKSS_Pos
);
2330 * @brief Set Alarm B Sub seconds value
2331 * @rmtoll ALRMBSSR SS LL_RTC_ALMB_SetSubSecond
2332 * @param RTCx RTC Instance
2333 * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
2336 __STATIC_INLINE
void LL_RTC_ALMB_SetSubSecond(RTC_TypeDef
*RTCx
, uint32_t Subsecond
)
2338 MODIFY_REG(RTCx
->ALRMBSSR
, RTC_ALRMBSSR_SS
, Subsecond
);
2342 * @brief Get Alarm B Sub seconds value
2343 * @rmtoll ALRMBSSR SS LL_RTC_ALMB_GetSubSecond
2344 * @param RTCx RTC Instance
2345 * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
2347 __STATIC_INLINE
uint32_t LL_RTC_ALMB_GetSubSecond(RTC_TypeDef
*RTCx
)
2349 return (uint32_t)(READ_BIT(RTCx
->ALRMBSSR
, RTC_ALRMBSSR_SS
));
2356 /** @defgroup RTC_LL_EF_Timestamp Timestamp
2361 * @brief Enable internal event timestamp
2362 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2363 * @rmtoll CR ITSE LL_RTC_TS_EnableInternalEvent
2364 * @param RTCx RTC Instance
2367 __STATIC_INLINE
void LL_RTC_TS_EnableInternalEvent(RTC_TypeDef
*RTCx
)
2369 SET_BIT(RTCx
->CR
, RTC_CR_ITSE
);
2373 * @brief Disable internal event timestamp
2374 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2375 * @rmtoll CR ITSE LL_RTC_TS_DisableInternalEvent
2376 * @param RTCx RTC Instance
2379 __STATIC_INLINE
void LL_RTC_TS_DisableInternalEvent(RTC_TypeDef
*RTCx
)
2381 CLEAR_BIT(RTCx
->CR
, RTC_CR_ITSE
);
2385 * @brief Enable Timestamp
2386 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2387 * @rmtoll CR TSE LL_RTC_TS_Enable
2388 * @param RTCx RTC Instance
2391 __STATIC_INLINE
void LL_RTC_TS_Enable(RTC_TypeDef
*RTCx
)
2393 SET_BIT(RTCx
->CR
, RTC_CR_TSE
);
2397 * @brief Disable Timestamp
2398 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2399 * @rmtoll CR TSE LL_RTC_TS_Disable
2400 * @param RTCx RTC Instance
2403 __STATIC_INLINE
void LL_RTC_TS_Disable(RTC_TypeDef
*RTCx
)
2405 CLEAR_BIT(RTCx
->CR
, RTC_CR_TSE
);
2409 * @brief Set Time-stamp event active edge
2410 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2411 * @note TSE must be reset when TSEDGE is changed to avoid unwanted TSF setting
2412 * @rmtoll CR TSEDGE LL_RTC_TS_SetActiveEdge
2413 * @param RTCx RTC Instance
2414 * @param Edge This parameter can be one of the following values:
2415 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
2416 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
2419 __STATIC_INLINE
void LL_RTC_TS_SetActiveEdge(RTC_TypeDef
*RTCx
, uint32_t Edge
)
2421 MODIFY_REG(RTCx
->CR
, RTC_CR_TSEDGE
, Edge
);
2425 * @brief Get Time-stamp event active edge
2426 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2427 * @rmtoll CR TSEDGE LL_RTC_TS_GetActiveEdge
2428 * @param RTCx RTC Instance
2429 * @retval Returned value can be one of the following values:
2430 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
2431 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
2433 __STATIC_INLINE
uint32_t LL_RTC_TS_GetActiveEdge(RTC_TypeDef
*RTCx
)
2435 return (uint32_t)(READ_BIT(RTCx
->CR
, RTC_CR_TSEDGE
));
2439 * @brief Get Timestamp AM/PM notation (AM or 24-hour format)
2440 * @rmtoll TSTR PM LL_RTC_TS_GetTimeFormat
2441 * @param RTCx RTC Instance
2442 * @retval Returned value can be one of the following values:
2443 * @arg @ref LL_RTC_TS_TIME_FORMAT_AM
2444 * @arg @ref LL_RTC_TS_TIME_FORMAT_PM
2446 __STATIC_INLINE
uint32_t LL_RTC_TS_GetTimeFormat(RTC_TypeDef
*RTCx
)
2448 return (uint32_t)(READ_BIT(RTCx
->TSTR
, RTC_TSTR_PM
));
2452 * @brief Get Timestamp Hours in BCD format
2453 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2454 * @rmtoll TSTR HT LL_RTC_TS_GetHour\n
2455 * TSTR HU LL_RTC_TS_GetHour
2456 * @param RTCx RTC Instance
2457 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2459 __STATIC_INLINE
uint32_t LL_RTC_TS_GetHour(RTC_TypeDef
*RTCx
)
2461 return (uint32_t)(READ_BIT(RTCx
->TSTR
, RTC_TSTR_HT
| RTC_TSTR_HU
) >> RTC_TSTR_HU_Pos
);
2465 * @brief Get Timestamp Minutes in BCD format
2466 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2467 * @rmtoll TSTR MNT LL_RTC_TS_GetMinute\n
2468 * TSTR MNU LL_RTC_TS_GetMinute
2469 * @param RTCx RTC Instance
2470 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2472 __STATIC_INLINE
uint32_t LL_RTC_TS_GetMinute(RTC_TypeDef
*RTCx
)
2474 return (uint32_t)(READ_BIT(RTCx
->TSTR
, RTC_TSTR_MNT
| RTC_TSTR_MNU
) >> RTC_TSTR_MNU_Pos
);
2478 * @brief Get Timestamp Seconds in BCD format
2479 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2480 * @rmtoll TSTR ST LL_RTC_TS_GetSecond\n
2481 * TSTR SU LL_RTC_TS_GetSecond
2482 * @param RTCx RTC Instance
2483 * @retval Value between Min_Data=0x00 and Max_Data=0x59
2485 __STATIC_INLINE
uint32_t LL_RTC_TS_GetSecond(RTC_TypeDef
*RTCx
)
2487 return (uint32_t)(READ_BIT(RTCx
->TSTR
, RTC_TSTR_ST
| RTC_TSTR_SU
));
2491 * @brief Get Timestamp time (hour, minute and second) in BCD format
2492 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2493 * are available to get independently each parameter.
2494 * @rmtoll TSTR HT LL_RTC_TS_GetTime\n
2495 * TSTR HU LL_RTC_TS_GetTime\n
2496 * TSTR MNT LL_RTC_TS_GetTime\n
2497 * TSTR MNU LL_RTC_TS_GetTime\n
2498 * TSTR ST LL_RTC_TS_GetTime\n
2499 * TSTR SU LL_RTC_TS_GetTime
2500 * @param RTCx RTC Instance
2501 * @retval Combination of hours, minutes and seconds.
2503 __STATIC_INLINE
uint32_t LL_RTC_TS_GetTime(RTC_TypeDef
*RTCx
)
2505 return (uint32_t)(READ_BIT(RTCx
->TSTR
,
2506 RTC_TSTR_HT
| RTC_TSTR_HU
| RTC_TSTR_MNT
| RTC_TSTR_MNU
| RTC_TSTR_ST
| RTC_TSTR_SU
));
2510 * @brief Get Timestamp Week day
2511 * @rmtoll TSDR WDU LL_RTC_TS_GetWeekDay
2512 * @param RTCx RTC Instance
2513 * @retval Returned value can be one of the following values:
2514 * @arg @ref LL_RTC_WEEKDAY_MONDAY
2515 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
2516 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2517 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
2518 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
2519 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
2520 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
2522 __STATIC_INLINE
uint32_t LL_RTC_TS_GetWeekDay(RTC_TypeDef
*RTCx
)
2524 return (uint32_t)(READ_BIT(RTCx
->TSDR
, RTC_TSDR_WDU
) >> RTC_TSDR_WDU_Pos
);
2528 * @brief Get Timestamp Month in BCD format
2529 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
2530 * @rmtoll TSDR MT LL_RTC_TS_GetMonth\n
2531 * TSDR MU LL_RTC_TS_GetMonth
2532 * @param RTCx RTC Instance
2533 * @retval Returned value can be one of the following values:
2534 * @arg @ref LL_RTC_MONTH_JANUARY
2535 * @arg @ref LL_RTC_MONTH_FEBRUARY
2536 * @arg @ref LL_RTC_MONTH_MARCH
2537 * @arg @ref LL_RTC_MONTH_APRIL
2538 * @arg @ref LL_RTC_MONTH_MAY
2539 * @arg @ref LL_RTC_MONTH_JUNE
2540 * @arg @ref LL_RTC_MONTH_JULY
2541 * @arg @ref LL_RTC_MONTH_AUGUST
2542 * @arg @ref LL_RTC_MONTH_SEPTEMBER
2543 * @arg @ref LL_RTC_MONTH_OCTOBER
2544 * @arg @ref LL_RTC_MONTH_NOVEMBER
2545 * @arg @ref LL_RTC_MONTH_DECEMBER
2547 __STATIC_INLINE
uint32_t LL_RTC_TS_GetMonth(RTC_TypeDef
*RTCx
)
2549 return (uint32_t)(READ_BIT(RTCx
->TSDR
, RTC_TSDR_MT
| RTC_TSDR_MU
) >> RTC_TSDR_MU_Pos
);
2553 * @brief Get Timestamp Day in BCD format
2554 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2555 * @rmtoll TSDR DT LL_RTC_TS_GetDay\n
2556 * TSDR DU LL_RTC_TS_GetDay
2557 * @param RTCx RTC Instance
2558 * @retval Value between Min_Data=0x01 and Max_Data=0x31
2560 __STATIC_INLINE
uint32_t LL_RTC_TS_GetDay(RTC_TypeDef
*RTCx
)
2562 return (uint32_t)(READ_BIT(RTCx
->TSDR
, RTC_TSDR_DT
| RTC_TSDR_DU
));
2566 * @brief Get Timestamp date (WeekDay, Day and Month) in BCD format
2567 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_MONTH,
2568 * and __LL_RTC_GET_DAY are available to get independently each parameter.
2569 * @rmtoll TSDR WDU LL_RTC_TS_GetDate\n
2570 * TSDR MT LL_RTC_TS_GetDate\n
2571 * TSDR MU LL_RTC_TS_GetDate\n
2572 * TSDR DT LL_RTC_TS_GetDate\n
2573 * TSDR DU LL_RTC_TS_GetDate
2574 * @param RTCx RTC Instance
2575 * @retval Combination of Weekday, Day and Month
2577 __STATIC_INLINE
uint32_t LL_RTC_TS_GetDate(RTC_TypeDef
*RTCx
)
2579 return (uint32_t)(READ_BIT(RTCx
->TSDR
, RTC_TSDR_WDU
| RTC_TSDR_MT
| RTC_TSDR_MU
| RTC_TSDR_DT
| RTC_TSDR_DU
));
2583 * @brief Get time-stamp sub second value
2584 * @rmtoll TSSSR SS LL_RTC_TS_GetSubSecond
2585 * @param RTCx RTC Instance
2586 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
2588 __STATIC_INLINE
uint32_t LL_RTC_TS_GetSubSecond(RTC_TypeDef
*RTCx
)
2590 return (uint32_t)(READ_BIT(RTCx
->TSSSR
, RTC_TSSSR_SS
));
2593 #if defined(RTC_TAMPCR_TAMPTS)
2595 * @brief Activate timestamp on tamper detection event
2596 * @rmtoll TAMPCR TAMPTS LL_RTC_TS_EnableOnTamper
2597 * @param RTCx RTC Instance
2600 __STATIC_INLINE
void LL_RTC_TS_EnableOnTamper(RTC_TypeDef
*RTCx
)
2602 SET_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMPTS
);
2606 * @brief Disable timestamp on tamper detection event
2607 * @rmtoll TAMPCR TAMPTS LL_RTC_TS_DisableOnTamper
2608 * @param RTCx RTC Instance
2611 __STATIC_INLINE
void LL_RTC_TS_DisableOnTamper(RTC_TypeDef
*RTCx
)
2613 CLEAR_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMPTS
);
2615 #endif /* RTC_TAMPCR_TAMPTS */
2621 /** @defgroup RTC_LL_EF_Tamper Tamper
2626 * @brief Enable RTC_TAMPx input detection
2627 * @rmtoll TAMPCR TAMP1E LL_RTC_TAMPER_Enable\n
2628 * TAMPCR TAMP2E LL_RTC_TAMPER_Enable\n
2629 * TAMPCR TAMP3E LL_RTC_TAMPER_Enable
2630 * @param RTCx RTC Instance
2631 * @param Tamper This parameter can be a combination of the following values:
2632 * @arg @ref LL_RTC_TAMPER_1
2633 * @arg @ref LL_RTC_TAMPER_2
2634 * @arg @ref LL_RTC_TAMPER_3
2638 __STATIC_INLINE
void LL_RTC_TAMPER_Enable(RTC_TypeDef
*RTCx
, uint32_t Tamper
)
2640 SET_BIT(RTCx
->TAMPCR
, Tamper
);
2644 * @brief Clear RTC_TAMPx input detection
2645 * @rmtoll TAMPCR TAMP1E LL_RTC_TAMPER_Disable\n
2646 * TAMPCR TAMP2E LL_RTC_TAMPER_Disable\n
2647 * TAMPCR TAMP3E LL_RTC_TAMPER_Disable
2648 * @param RTCx RTC Instance
2649 * @param Tamper This parameter can be a combination of the following values:
2650 * @arg @ref LL_RTC_TAMPER_1
2651 * @arg @ref LL_RTC_TAMPER_2
2652 * @arg @ref LL_RTC_TAMPER_3
2656 __STATIC_INLINE
void LL_RTC_TAMPER_Disable(RTC_TypeDef
*RTCx
, uint32_t Tamper
)
2658 CLEAR_BIT(RTCx
->TAMPCR
, Tamper
);
2662 * @brief Enable Tamper mask flag
2663 * @note Associated Tamper IT must not enabled when tamper mask is set.
2664 * @rmtoll TAMPCR TAMP1MF LL_RTC_TAMPER_EnableMask\n
2665 * TAMPCR TAMP2MF LL_RTC_TAMPER_EnableMask\n
2666 * TAMPCR TAMP3MF LL_RTC_TAMPER_EnableMask
2667 * @param RTCx RTC Instance
2668 * @param Mask This parameter can be a combination of the following values:
2669 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER1
2670 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER2
2671 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER3
2675 __STATIC_INLINE
void LL_RTC_TAMPER_EnableMask(RTC_TypeDef
*RTCx
, uint32_t Mask
)
2677 SET_BIT(RTCx
->TAMPCR
, Mask
);
2681 * @brief Disable Tamper mask flag
2682 * @rmtoll TAMPCR TAMP1MF LL_RTC_TAMPER_DisableMask\n
2683 * TAMPCR TAMP2MF LL_RTC_TAMPER_DisableMask\n
2684 * TAMPCR TAMP3MF LL_RTC_TAMPER_DisableMask
2685 * @param RTCx RTC Instance
2686 * @param Mask This parameter can be a combination of the following values:
2687 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER1
2688 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER2
2689 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER3
2693 __STATIC_INLINE
void LL_RTC_TAMPER_DisableMask(RTC_TypeDef
*RTCx
, uint32_t Mask
)
2695 CLEAR_BIT(RTCx
->TAMPCR
, Mask
);
2699 * @brief Enable backup register erase after Tamper event detection
2700 * @rmtoll TAMPCR TAMP1NOERASE LL_RTC_TAMPER_EnableEraseBKP\n
2701 * TAMPCR TAMP2NOERASE LL_RTC_TAMPER_EnableEraseBKP\n
2702 * TAMPCR TAMP3NOERASE LL_RTC_TAMPER_EnableEraseBKP
2703 * @param RTCx RTC Instance
2704 * @param Tamper This parameter can be a combination of the following values:
2705 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1
2706 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2
2707 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER3
2711 __STATIC_INLINE
void LL_RTC_TAMPER_EnableEraseBKP(RTC_TypeDef
*RTCx
, uint32_t Tamper
)
2713 CLEAR_BIT(RTCx
->TAMPCR
, Tamper
);
2717 * @brief Disable backup register erase after Tamper event detection
2718 * @rmtoll TAMPCR TAMP1NOERASE LL_RTC_TAMPER_DisableEraseBKP\n
2719 * TAMPCR TAMP2NOERASE LL_RTC_TAMPER_DisableEraseBKP\n
2720 * TAMPCR TAMP3NOERASE LL_RTC_TAMPER_DisableEraseBKP
2721 * @param RTCx RTC Instance
2722 * @param Tamper This parameter can be a combination of the following values:
2723 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1
2724 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2
2725 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER3
2729 __STATIC_INLINE
void LL_RTC_TAMPER_DisableEraseBKP(RTC_TypeDef
*RTCx
, uint32_t Tamper
)
2731 SET_BIT(RTCx
->TAMPCR
, Tamper
);
2734 #if defined(RTC_TAMPCR_TAMPPUDIS)
2736 * @brief Disable RTC_TAMPx pull-up disable (Disable precharge of RTC_TAMPx pins)
2737 * @rmtoll TAMPCR TAMPPUDIS LL_RTC_TAMPER_DisablePullUp
2738 * @param RTCx RTC Instance
2741 __STATIC_INLINE
void LL_RTC_TAMPER_DisablePullUp(RTC_TypeDef
*RTCx
)
2743 SET_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMPPUDIS
);
2747 * @brief Enable RTC_TAMPx pull-up disable ( Precharge RTC_TAMPx pins before sampling)
2748 * @rmtoll TAMPCR TAMPPUDIS LL_RTC_TAMPER_EnablePullUp
2749 * @param RTCx RTC Instance
2752 __STATIC_INLINE
void LL_RTC_TAMPER_EnablePullUp(RTC_TypeDef
*RTCx
)
2754 CLEAR_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMPPUDIS
);
2756 #endif /* RTC_TAMPCR_TAMPPUDIS */
2758 #if defined(RTC_TAMPCR_TAMPPRCH)
2760 * @brief Set RTC_TAMPx precharge duration
2761 * @rmtoll TAMPCR TAMPPRCH LL_RTC_TAMPER_SetPrecharge
2762 * @param RTCx RTC Instance
2763 * @param Duration This parameter can be one of the following values:
2764 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
2765 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
2766 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
2767 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
2770 __STATIC_INLINE
void LL_RTC_TAMPER_SetPrecharge(RTC_TypeDef
*RTCx
, uint32_t Duration
)
2772 MODIFY_REG(RTCx
->TAMPCR
, RTC_TAMPCR_TAMPPRCH
, Duration
);
2776 * @brief Get RTC_TAMPx precharge duration
2777 * @rmtoll TAMPCR TAMPPRCH LL_RTC_TAMPER_GetPrecharge
2778 * @param RTCx RTC Instance
2779 * @retval Returned value can be one of the following values:
2780 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
2781 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
2782 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
2783 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
2785 __STATIC_INLINE
uint32_t LL_RTC_TAMPER_GetPrecharge(RTC_TypeDef
*RTCx
)
2787 return (uint32_t)(READ_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMPPRCH
));
2789 #endif /* RTC_TAMPCR_TAMPPRCH */
2791 #if defined(RTC_TAMPCR_TAMPFLT)
2793 * @brief Set RTC_TAMPx filter count
2794 * @rmtoll TAMPCR TAMPFLT LL_RTC_TAMPER_SetFilterCount
2795 * @param RTCx RTC Instance
2796 * @param FilterCount This parameter can be one of the following values:
2797 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
2798 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
2799 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
2800 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
2803 __STATIC_INLINE
void LL_RTC_TAMPER_SetFilterCount(RTC_TypeDef
*RTCx
, uint32_t FilterCount
)
2805 MODIFY_REG(RTCx
->TAMPCR
, RTC_TAMPCR_TAMPFLT
, FilterCount
);
2809 * @brief Get RTC_TAMPx filter count
2810 * @rmtoll TAMPCR TAMPFLT LL_RTC_TAMPER_GetFilterCount
2811 * @param RTCx RTC Instance
2812 * @retval Returned value can be one of the following values:
2813 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
2814 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
2815 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
2816 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
2818 __STATIC_INLINE
uint32_t LL_RTC_TAMPER_GetFilterCount(RTC_TypeDef
*RTCx
)
2820 return (uint32_t)(READ_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMPFLT
));
2822 #endif /* RTC_TAMPCR_TAMPFLT */
2824 #if defined(RTC_TAMPCR_TAMPFREQ)
2826 * @brief Set Tamper sampling frequency
2827 * @rmtoll TAMPCR TAMPFREQ LL_RTC_TAMPER_SetSamplingFreq
2828 * @param RTCx RTC Instance
2829 * @param SamplingFreq This parameter can be one of the following values:
2830 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
2831 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
2832 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
2833 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
2834 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
2835 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
2836 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
2837 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
2840 __STATIC_INLINE
void LL_RTC_TAMPER_SetSamplingFreq(RTC_TypeDef
*RTCx
, uint32_t SamplingFreq
)
2842 MODIFY_REG(RTCx
->TAMPCR
, RTC_TAMPCR_TAMPFREQ
, SamplingFreq
);
2846 * @brief Get Tamper sampling frequency
2847 * @rmtoll TAMPCR TAMPFREQ LL_RTC_TAMPER_GetSamplingFreq
2848 * @param RTCx RTC Instance
2849 * @retval Returned value can be one of the following values:
2850 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
2851 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
2852 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
2853 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
2854 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
2855 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
2856 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
2857 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
2859 __STATIC_INLINE
uint32_t LL_RTC_TAMPER_GetSamplingFreq(RTC_TypeDef
*RTCx
)
2861 return (uint32_t)(READ_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMPFREQ
));
2863 #endif /* RTC_TAMPCR_TAMPFREQ */
2866 * @brief Enable Active level for Tamper input
2867 * @rmtoll TAMPCR TAMP1TRG LL_RTC_TAMPER_EnableActiveLevel\n
2868 * TAMPCR TAMP2TRG LL_RTC_TAMPER_EnableActiveLevel\n
2869 * TAMPCR TAMP3TRG LL_RTC_TAMPER_EnableActiveLevel
2870 * @param RTCx RTC Instance
2871 * @param Tamper This parameter can be a combination of the following values:
2872 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
2873 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2
2874 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3
2878 __STATIC_INLINE
void LL_RTC_TAMPER_EnableActiveLevel(RTC_TypeDef
*RTCx
, uint32_t Tamper
)
2880 SET_BIT(RTCx
->TAMPCR
, Tamper
);
2884 * @brief Disable Active level for Tamper input
2885 * @rmtoll TAMPCR TAMP1TRG LL_RTC_TAMPER_DisableActiveLevel\n
2886 * TAMPCR TAMP2TRG LL_RTC_TAMPER_DisableActiveLevel\n
2887 * TAMPCR TAMP3TRG LL_RTC_TAMPER_DisableActiveLevel
2888 * @param RTCx RTC Instance
2889 * @param Tamper This parameter can be a combination of the following values:
2890 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
2891 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2
2892 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3
2896 __STATIC_INLINE
void LL_RTC_TAMPER_DisableActiveLevel(RTC_TypeDef
*RTCx
, uint32_t Tamper
)
2898 CLEAR_BIT(RTCx
->TAMPCR
, Tamper
);
2905 /** @defgroup RTC_LL_EF_Wakeup Wakeup
2910 * @brief Enable Wakeup timer
2911 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2912 * @rmtoll CR WUTE LL_RTC_WAKEUP_Enable
2913 * @param RTCx RTC Instance
2916 __STATIC_INLINE
void LL_RTC_WAKEUP_Enable(RTC_TypeDef
*RTCx
)
2918 SET_BIT(RTCx
->CR
, RTC_CR_WUTE
);
2922 * @brief Disable Wakeup timer
2923 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2924 * @rmtoll CR WUTE LL_RTC_WAKEUP_Disable
2925 * @param RTCx RTC Instance
2928 __STATIC_INLINE
void LL_RTC_WAKEUP_Disable(RTC_TypeDef
*RTCx
)
2930 CLEAR_BIT(RTCx
->CR
, RTC_CR_WUTE
);
2934 * @brief Check if Wakeup timer is enabled or not
2935 * @rmtoll CR WUTE LL_RTC_WAKEUP_IsEnabled
2936 * @param RTCx RTC Instance
2937 * @retval State of bit (1 or 0).
2939 __STATIC_INLINE
uint32_t LL_RTC_WAKEUP_IsEnabled(RTC_TypeDef
*RTCx
)
2941 return (READ_BIT(RTCx
->CR
, RTC_CR_WUTE
) == (RTC_CR_WUTE
));
2945 * @brief Select Wakeup clock
2946 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2947 * @note Bit can be written only when RTC_CR WUTE bit = 0 and RTC_ISR WUTWF bit = 1
2948 * @rmtoll CR WUCKSEL LL_RTC_WAKEUP_SetClock
2949 * @param RTCx RTC Instance
2950 * @param WakeupClock This parameter can be one of the following values:
2951 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
2952 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
2953 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
2954 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
2955 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
2956 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
2959 __STATIC_INLINE
void LL_RTC_WAKEUP_SetClock(RTC_TypeDef
*RTCx
, uint32_t WakeupClock
)
2961 MODIFY_REG(RTCx
->CR
, RTC_CR_WUCKSEL
, WakeupClock
);
2965 * @brief Get Wakeup clock
2966 * @rmtoll CR WUCKSEL LL_RTC_WAKEUP_GetClock
2967 * @param RTCx RTC Instance
2968 * @retval Returned value can be one of the following values:
2969 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
2970 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
2971 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
2972 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
2973 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
2974 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
2976 __STATIC_INLINE
uint32_t LL_RTC_WAKEUP_GetClock(RTC_TypeDef
*RTCx
)
2978 return (uint32_t)(READ_BIT(RTCx
->CR
, RTC_CR_WUCKSEL
));
2982 * @brief Set Wakeup auto-reload value
2983 * @note Bit can be written only when WUTWF is set to 1 in RTC_ISR
2984 * @rmtoll WUTR WUT LL_RTC_WAKEUP_SetAutoReload
2985 * @param RTCx RTC Instance
2986 * @param Value Value between Min_Data=0x00 and Max_Data=0xFFFF
2989 __STATIC_INLINE
void LL_RTC_WAKEUP_SetAutoReload(RTC_TypeDef
*RTCx
, uint32_t Value
)
2991 MODIFY_REG(RTCx
->WUTR
, RTC_WUTR_WUT
, Value
);
2995 * @brief Get Wakeup auto-reload value
2996 * @rmtoll WUTR WUT LL_RTC_WAKEUP_GetAutoReload
2997 * @param RTCx RTC Instance
2998 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
3000 __STATIC_INLINE
uint32_t LL_RTC_WAKEUP_GetAutoReload(RTC_TypeDef
*RTCx
)
3002 return (uint32_t)(READ_BIT(RTCx
->WUTR
, RTC_WUTR_WUT
));
3009 /** @defgroup RTC_LL_EF_Backup_Registers Backup_Registers
3014 * @brief Writes a data in a specified RTC Backup data register.
3015 * @rmtoll BKPxR BKP LL_RTC_BAK_SetRegister
3016 * @param RTCx RTC Instance
3017 * @param BackupRegister This parameter can be one of the following values:
3018 * @arg @ref LL_RTC_BKP_DR0
3019 * @arg @ref LL_RTC_BKP_DR1
3020 * @arg @ref LL_RTC_BKP_DR2
3021 * @arg @ref LL_RTC_BKP_DR3
3022 * @arg @ref LL_RTC_BKP_DR4
3023 * @arg @ref LL_RTC_BKP_DR5
3024 * @arg @ref LL_RTC_BKP_DR6
3025 * @arg @ref LL_RTC_BKP_DR7
3026 * @arg @ref LL_RTC_BKP_DR8
3027 * @arg @ref LL_RTC_BKP_DR9
3028 * @arg @ref LL_RTC_BKP_DR10
3029 * @arg @ref LL_RTC_BKP_DR11
3030 * @arg @ref LL_RTC_BKP_DR12
3031 * @arg @ref LL_RTC_BKP_DR13
3032 * @arg @ref LL_RTC_BKP_DR14
3033 * @arg @ref LL_RTC_BKP_DR15
3034 * @arg @ref LL_RTC_BKP_DR16
3035 * @arg @ref LL_RTC_BKP_DR17
3036 * @arg @ref LL_RTC_BKP_DR18
3037 * @arg @ref LL_RTC_BKP_DR19
3038 * @arg @ref LL_RTC_BKP_DR20
3039 * @arg @ref LL_RTC_BKP_DR21
3040 * @arg @ref LL_RTC_BKP_DR22
3041 * @arg @ref LL_RTC_BKP_DR23
3042 * @arg @ref LL_RTC_BKP_DR24
3043 * @arg @ref LL_RTC_BKP_DR25
3044 * @arg @ref LL_RTC_BKP_DR26
3045 * @arg @ref LL_RTC_BKP_DR27
3046 * @arg @ref LL_RTC_BKP_DR28
3047 * @arg @ref LL_RTC_BKP_DR29
3048 * @arg @ref LL_RTC_BKP_DR30
3049 * @arg @ref LL_RTC_BKP_DR31
3050 * @param Data Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
3053 __STATIC_INLINE
void LL_RTC_BAK_SetRegister(RTC_TypeDef
*RTCx
, uint32_t BackupRegister
, uint32_t Data
)
3055 register uint32_t tmp
= 0U;
3057 tmp
= (uint32_t)(&(RTCx
->BKP0R
));
3058 tmp
+= (BackupRegister
* 4U);
3060 /* Write the specified register */
3061 *(__IO
uint32_t *)tmp
= (uint32_t)Data
;
3065 * @brief Reads data from the specified RTC Backup data Register.
3066 * @rmtoll BKPxR BKP LL_RTC_BAK_GetRegister
3067 * @param RTCx RTC Instance
3068 * @param BackupRegister This parameter can be one of the following values:
3069 * @arg @ref LL_RTC_BKP_DR0
3070 * @arg @ref LL_RTC_BKP_DR1
3071 * @arg @ref LL_RTC_BKP_DR2
3072 * @arg @ref LL_RTC_BKP_DR3
3073 * @arg @ref LL_RTC_BKP_DR4
3074 * @arg @ref LL_RTC_BKP_DR5
3075 * @arg @ref LL_RTC_BKP_DR6
3076 * @arg @ref LL_RTC_BKP_DR7
3077 * @arg @ref LL_RTC_BKP_DR8
3078 * @arg @ref LL_RTC_BKP_DR9
3079 * @arg @ref LL_RTC_BKP_DR10
3080 * @arg @ref LL_RTC_BKP_DR11
3081 * @arg @ref LL_RTC_BKP_DR12
3082 * @arg @ref LL_RTC_BKP_DR13
3083 * @arg @ref LL_RTC_BKP_DR14
3084 * @arg @ref LL_RTC_BKP_DR15
3085 * @arg @ref LL_RTC_BKP_DR16
3086 * @arg @ref LL_RTC_BKP_DR17
3087 * @arg @ref LL_RTC_BKP_DR18
3088 * @arg @ref LL_RTC_BKP_DR19
3089 * @arg @ref LL_RTC_BKP_DR20
3090 * @arg @ref LL_RTC_BKP_DR21
3091 * @arg @ref LL_RTC_BKP_DR22
3092 * @arg @ref LL_RTC_BKP_DR23
3093 * @arg @ref LL_RTC_BKP_DR24
3094 * @arg @ref LL_RTC_BKP_DR25
3095 * @arg @ref LL_RTC_BKP_DR26
3096 * @arg @ref LL_RTC_BKP_DR27
3097 * @arg @ref LL_RTC_BKP_DR28
3098 * @arg @ref LL_RTC_BKP_DR29
3099 * @arg @ref LL_RTC_BKP_DR30
3100 * @arg @ref LL_RTC_BKP_DR31
3101 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
3103 __STATIC_INLINE
uint32_t LL_RTC_BAK_GetRegister(RTC_TypeDef
*RTCx
, uint32_t BackupRegister
)
3105 register uint32_t tmp
= 0U;
3107 tmp
= (uint32_t)(&(RTCx
->BKP0R
));
3108 tmp
+= (BackupRegister
* 4U);
3110 /* Read the specified register */
3111 return (*(__IO
uint32_t *)tmp
);
3118 /** @defgroup RTC_LL_EF_Calibration Calibration
3123 * @brief Set Calibration output frequency (1 Hz or 512 Hz)
3124 * @note Bits are write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3125 * @rmtoll CR COE LL_RTC_CAL_SetOutputFreq\n
3126 * CR COSEL LL_RTC_CAL_SetOutputFreq
3127 * @param RTCx RTC Instance
3128 * @param Frequency This parameter can be one of the following values:
3129 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE
3130 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ
3131 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
3134 __STATIC_INLINE
void LL_RTC_CAL_SetOutputFreq(RTC_TypeDef
*RTCx
, uint32_t Frequency
)
3136 MODIFY_REG(RTCx
->CR
, RTC_CR_COE
| RTC_CR_COSEL
, Frequency
);
3140 * @brief Get Calibration output frequency (1 Hz or 512 Hz)
3141 * @rmtoll CR COE LL_RTC_CAL_GetOutputFreq\n
3142 * CR COSEL LL_RTC_CAL_GetOutputFreq
3143 * @param RTCx RTC Instance
3144 * @retval Returned value can be one of the following values:
3145 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE
3146 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ
3147 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
3149 __STATIC_INLINE
uint32_t LL_RTC_CAL_GetOutputFreq(RTC_TypeDef
*RTCx
)
3151 return (uint32_t)(READ_BIT(RTCx
->CR
, RTC_CR_COE
| RTC_CR_COSEL
));
3155 * @brief Insert or not One RTCCLK pulse every 2exp11 pulses (frequency increased by 488.5 ppm)
3156 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3157 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR
3158 * @rmtoll CALR CALP LL_RTC_CAL_SetPulse
3159 * @param RTCx RTC Instance
3160 * @param Pulse This parameter can be one of the following values:
3161 * @arg @ref LL_RTC_CALIB_INSERTPULSE_NONE
3162 * @arg @ref LL_RTC_CALIB_INSERTPULSE_SET
3165 __STATIC_INLINE
void LL_RTC_CAL_SetPulse(RTC_TypeDef
*RTCx
, uint32_t Pulse
)
3167 MODIFY_REG(RTCx
->CALR
, RTC_CALR_CALP
, Pulse
);
3171 * @brief Check if one RTCCLK has been inserted or not every 2exp11 pulses (frequency increased by 488.5 ppm)
3172 * @rmtoll CALR CALP LL_RTC_CAL_IsPulseInserted
3173 * @param RTCx RTC Instance
3174 * @retval State of bit (1 or 0).
3176 __STATIC_INLINE
uint32_t LL_RTC_CAL_IsPulseInserted(RTC_TypeDef
*RTCx
)
3178 return (READ_BIT(RTCx
->CALR
, RTC_CALR_CALP
) == (RTC_CALR_CALP
));
3182 * @brief Set the calibration cycle period
3183 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3184 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR
3185 * @rmtoll CALR CALW8 LL_RTC_CAL_SetPeriod\n
3186 * CALR CALW16 LL_RTC_CAL_SetPeriod
3187 * @param RTCx RTC Instance
3188 * @param Period This parameter can be one of the following values:
3189 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC
3190 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC
3191 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC
3194 __STATIC_INLINE
void LL_RTC_CAL_SetPeriod(RTC_TypeDef
*RTCx
, uint32_t Period
)
3196 MODIFY_REG(RTCx
->CALR
, RTC_CALR_CALW8
| RTC_CALR_CALW16
, Period
);
3200 * @brief Get the calibration cycle period
3201 * @rmtoll CALR CALW8 LL_RTC_CAL_GetPeriod\n
3202 * CALR CALW16 LL_RTC_CAL_GetPeriod
3203 * @param RTCx RTC Instance
3204 * @retval Returned value can be one of the following values:
3205 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC
3206 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC
3207 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC
3209 __STATIC_INLINE
uint32_t LL_RTC_CAL_GetPeriod(RTC_TypeDef
*RTCx
)
3211 return (uint32_t)(READ_BIT(RTCx
->CALR
, RTC_CALR_CALW8
| RTC_CALR_CALW16
));
3215 * @brief Set Calibration minus
3216 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3217 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR
3218 * @rmtoll CALR CALM LL_RTC_CAL_SetMinus
3219 * @param RTCx RTC Instance
3220 * @param CalibMinus Value between Min_Data=0x00 and Max_Data=0x1FF
3223 __STATIC_INLINE
void LL_RTC_CAL_SetMinus(RTC_TypeDef
*RTCx
, uint32_t CalibMinus
)
3225 MODIFY_REG(RTCx
->CALR
, RTC_CALR_CALM
, CalibMinus
);
3229 * @brief Get Calibration minus
3230 * @rmtoll CALR CALM LL_RTC_CAL_GetMinus
3231 * @param RTCx RTC Instance
3232 * @retval Value between Min_Data=0x00 and Max_Data= 0x1FF
3234 __STATIC_INLINE
uint32_t LL_RTC_CAL_GetMinus(RTC_TypeDef
*RTCx
)
3236 return (uint32_t)(READ_BIT(RTCx
->CALR
, RTC_CALR_CALM
));
3243 /** @defgroup RTC_LL_EF_FLAG_Management FLAG_Management
3248 * @brief Get Internal Time-stamp flag
3249 * @rmtoll ISR ITSF LL_RTC_IsActiveFlag_ITS
3250 * @param RTCx RTC Instance
3251 * @retval State of bit (1 or 0).
3253 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_ITS(RTC_TypeDef
*RTCx
)
3255 return (READ_BIT(RTCx
->ISR
, RTC_ISR_ITSF
) == (RTC_ISR_ITSF
));
3259 * @brief Get Recalibration pending Flag
3260 * @rmtoll ISR RECALPF LL_RTC_IsActiveFlag_RECALP
3261 * @param RTCx RTC Instance
3262 * @retval State of bit (1 or 0).
3264 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_RECALP(RTC_TypeDef
*RTCx
)
3266 return (READ_BIT(RTCx
->ISR
, RTC_ISR_RECALPF
) == (RTC_ISR_RECALPF
));
3270 * @brief Get RTC_TAMP3 detection flag
3271 * @rmtoll ISR TAMP3F LL_RTC_IsActiveFlag_TAMP3
3272 * @param RTCx RTC Instance
3273 * @retval State of bit (1 or 0).
3275 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_TAMP3(RTC_TypeDef
*RTCx
)
3277 return (READ_BIT(RTCx
->ISR
, RTC_ISR_TAMP3F
) == (RTC_ISR_TAMP3F
));
3281 * @brief Get RTC_TAMP2 detection flag
3282 * @rmtoll ISR TAMP2F LL_RTC_IsActiveFlag_TAMP2
3283 * @param RTCx RTC Instance
3284 * @retval State of bit (1 or 0).
3286 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_TAMP2(RTC_TypeDef
*RTCx
)
3288 return (READ_BIT(RTCx
->ISR
, RTC_ISR_TAMP2F
) == (RTC_ISR_TAMP2F
));
3292 * @brief Get RTC_TAMP1 detection flag
3293 * @rmtoll ISR TAMP1F LL_RTC_IsActiveFlag_TAMP1
3294 * @param RTCx RTC Instance
3295 * @retval State of bit (1 or 0).
3297 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_TAMP1(RTC_TypeDef
*RTCx
)
3299 return (READ_BIT(RTCx
->ISR
, RTC_ISR_TAMP1F
) == (RTC_ISR_TAMP1F
));
3303 * @brief Get Time-stamp overflow flag
3304 * @rmtoll ISR TSOVF LL_RTC_IsActiveFlag_TSOV
3305 * @param RTCx RTC Instance
3306 * @retval State of bit (1 or 0).
3308 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_TSOV(RTC_TypeDef
*RTCx
)
3310 return (READ_BIT(RTCx
->ISR
, RTC_ISR_TSOVF
) == (RTC_ISR_TSOVF
));
3314 * @brief Get Time-stamp flag
3315 * @rmtoll ISR TSF LL_RTC_IsActiveFlag_TS
3316 * @param RTCx RTC Instance
3317 * @retval State of bit (1 or 0).
3319 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_TS(RTC_TypeDef
*RTCx
)
3321 return (READ_BIT(RTCx
->ISR
, RTC_ISR_TSF
) == (RTC_ISR_TSF
));
3325 * @brief Get Wakeup timer flag
3326 * @rmtoll ISR WUTF LL_RTC_IsActiveFlag_WUT
3327 * @param RTCx RTC Instance
3328 * @retval State of bit (1 or 0).
3330 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_WUT(RTC_TypeDef
*RTCx
)
3332 return (READ_BIT(RTCx
->ISR
, RTC_ISR_WUTF
) == (RTC_ISR_WUTF
));
3336 * @brief Get Alarm B flag
3337 * @rmtoll ISR ALRBF LL_RTC_IsActiveFlag_ALRB
3338 * @param RTCx RTC Instance
3339 * @retval State of bit (1 or 0).
3341 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_ALRB(RTC_TypeDef
*RTCx
)
3343 return (READ_BIT(RTCx
->ISR
, RTC_ISR_ALRBF
) == (RTC_ISR_ALRBF
));
3347 * @brief Get Alarm A flag
3348 * @rmtoll ISR ALRAF LL_RTC_IsActiveFlag_ALRA
3349 * @param RTCx RTC Instance
3350 * @retval State of bit (1 or 0).
3352 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_ALRA(RTC_TypeDef
*RTCx
)
3354 return (READ_BIT(RTCx
->ISR
, RTC_ISR_ALRAF
) == (RTC_ISR_ALRAF
));
3358 * @brief Clear Internal Time-stamp flag
3359 * @rmtoll ISR ITSF LL_RTC_ClearFlag_ITS
3360 * @param RTCx RTC Instance
3363 __STATIC_INLINE
void LL_RTC_ClearFlag_ITS(RTC_TypeDef
*RTCx
)
3365 WRITE_REG(RTCx
->ISR
, (~((RTC_ISR_ITSF
| RTC_ISR_INIT
) & 0x0000FFFFU
) | (RTCx
->ISR
& RTC_ISR_INIT
)));
3369 * @brief Clear RTC_TAMP3 detection flag
3370 * @rmtoll ISR TAMP3F LL_RTC_ClearFlag_TAMP3
3371 * @param RTCx RTC Instance
3374 __STATIC_INLINE
void LL_RTC_ClearFlag_TAMP3(RTC_TypeDef
*RTCx
)
3376 WRITE_REG(RTCx
->ISR
, (~((RTC_ISR_TAMP3F
| RTC_ISR_INIT
) & 0x0000FFFFU
) | (RTCx
->ISR
& RTC_ISR_INIT
)));
3380 * @brief Clear RTC_TAMP2 detection flag
3381 * @rmtoll ISR TAMP2F LL_RTC_ClearFlag_TAMP2
3382 * @param RTCx RTC Instance
3385 __STATIC_INLINE
void LL_RTC_ClearFlag_TAMP2(RTC_TypeDef
*RTCx
)
3387 WRITE_REG(RTCx
->ISR
, (~((RTC_ISR_TAMP2F
| RTC_ISR_INIT
) & 0x0000FFFFU
) | (RTCx
->ISR
& RTC_ISR_INIT
)));
3391 * @brief Clear RTC_TAMP1 detection flag
3392 * @rmtoll ISR TAMP1F LL_RTC_ClearFlag_TAMP1
3393 * @param RTCx RTC Instance
3396 __STATIC_INLINE
void LL_RTC_ClearFlag_TAMP1(RTC_TypeDef
*RTCx
)
3398 WRITE_REG(RTCx
->ISR
, (~((RTC_ISR_TAMP1F
| RTC_ISR_INIT
) & 0x0000FFFFU
) | (RTCx
->ISR
& RTC_ISR_INIT
)));
3402 * @brief Clear Time-stamp overflow flag
3403 * @rmtoll ISR TSOVF LL_RTC_ClearFlag_TSOV
3404 * @param RTCx RTC Instance
3407 __STATIC_INLINE
void LL_RTC_ClearFlag_TSOV(RTC_TypeDef
*RTCx
)
3409 WRITE_REG(RTCx
->ISR
, (~((RTC_ISR_TSOVF
| RTC_ISR_INIT
) & 0x0000FFFFU
) | (RTCx
->ISR
& RTC_ISR_INIT
)));
3413 * @brief Clear Time-stamp flag
3414 * @rmtoll ISR TSF LL_RTC_ClearFlag_TS
3415 * @param RTCx RTC Instance
3418 __STATIC_INLINE
void LL_RTC_ClearFlag_TS(RTC_TypeDef
*RTCx
)
3420 WRITE_REG(RTCx
->ISR
, (~((RTC_ISR_TSF
| RTC_ISR_INIT
) & 0x0000FFFFU
) | (RTCx
->ISR
& RTC_ISR_INIT
)));
3424 * @brief Clear Wakeup timer flag
3425 * @rmtoll ISR WUTF LL_RTC_ClearFlag_WUT
3426 * @param RTCx RTC Instance
3429 __STATIC_INLINE
void LL_RTC_ClearFlag_WUT(RTC_TypeDef
*RTCx
)
3431 WRITE_REG(RTCx
->ISR
, (~((RTC_ISR_WUTF
| RTC_ISR_INIT
) & 0x0000FFFFU
) | (RTCx
->ISR
& RTC_ISR_INIT
)));
3435 * @brief Clear Alarm B flag
3436 * @rmtoll ISR ALRBF LL_RTC_ClearFlag_ALRB
3437 * @param RTCx RTC Instance
3440 __STATIC_INLINE
void LL_RTC_ClearFlag_ALRB(RTC_TypeDef
*RTCx
)
3442 WRITE_REG(RTCx
->ISR
, (~((RTC_ISR_ALRBF
| RTC_ISR_INIT
) & 0x0000FFFFU
) | (RTCx
->ISR
& RTC_ISR_INIT
)));
3446 * @brief Clear Alarm A flag
3447 * @rmtoll ISR ALRAF LL_RTC_ClearFlag_ALRA
3448 * @param RTCx RTC Instance
3451 __STATIC_INLINE
void LL_RTC_ClearFlag_ALRA(RTC_TypeDef
*RTCx
)
3453 WRITE_REG(RTCx
->ISR
, (~((RTC_ISR_ALRAF
| RTC_ISR_INIT
) & 0x0000FFFFU
) | (RTCx
->ISR
& RTC_ISR_INIT
)));
3457 * @brief Get Initialization flag
3458 * @rmtoll ISR INITF LL_RTC_IsActiveFlag_INIT
3459 * @param RTCx RTC Instance
3460 * @retval State of bit (1 or 0).
3462 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_INIT(RTC_TypeDef
*RTCx
)
3464 return (READ_BIT(RTCx
->ISR
, RTC_ISR_INITF
) == (RTC_ISR_INITF
));
3468 * @brief Get Registers synchronization flag
3469 * @rmtoll ISR RSF LL_RTC_IsActiveFlag_RS
3470 * @param RTCx RTC Instance
3471 * @retval State of bit (1 or 0).
3473 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_RS(RTC_TypeDef
*RTCx
)
3475 return (READ_BIT(RTCx
->ISR
, RTC_ISR_RSF
) == (RTC_ISR_RSF
));
3479 * @brief Clear Registers synchronization flag
3480 * @rmtoll ISR RSF LL_RTC_ClearFlag_RS
3481 * @param RTCx RTC Instance
3484 __STATIC_INLINE
void LL_RTC_ClearFlag_RS(RTC_TypeDef
*RTCx
)
3486 WRITE_REG(RTCx
->ISR
, (~((RTC_ISR_RSF
| RTC_ISR_INIT
) & 0x0000FFFFU
) | (RTCx
->ISR
& RTC_ISR_INIT
)));
3490 * @brief Get Initialization status flag
3491 * @rmtoll ISR INITS LL_RTC_IsActiveFlag_INITS
3492 * @param RTCx RTC Instance
3493 * @retval State of bit (1 or 0).
3495 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_INITS(RTC_TypeDef
*RTCx
)
3497 return (READ_BIT(RTCx
->ISR
, RTC_ISR_INITS
) == (RTC_ISR_INITS
));
3501 * @brief Get Shift operation pending flag
3502 * @rmtoll ISR SHPF LL_RTC_IsActiveFlag_SHP
3503 * @param RTCx RTC Instance
3504 * @retval State of bit (1 or 0).
3506 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_SHP(RTC_TypeDef
*RTCx
)
3508 return (READ_BIT(RTCx
->ISR
, RTC_ISR_SHPF
) == (RTC_ISR_SHPF
));
3512 * @brief Get Wakeup timer write flag
3513 * @rmtoll ISR WUTWF LL_RTC_IsActiveFlag_WUTW
3514 * @param RTCx RTC Instance
3515 * @retval State of bit (1 or 0).
3517 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_WUTW(RTC_TypeDef
*RTCx
)
3519 return (READ_BIT(RTCx
->ISR
, RTC_ISR_WUTWF
) == (RTC_ISR_WUTWF
));
3523 * @brief Get Alarm B write flag
3524 * @rmtoll ISR ALRBWF LL_RTC_IsActiveFlag_ALRBW
3525 * @param RTCx RTC Instance
3526 * @retval State of bit (1 or 0).
3528 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_ALRBW(RTC_TypeDef
*RTCx
)
3530 return (READ_BIT(RTCx
->ISR
, RTC_ISR_ALRBWF
) == (RTC_ISR_ALRBWF
));
3534 * @brief Get Alarm A write flag
3535 * @rmtoll ISR ALRAWF LL_RTC_IsActiveFlag_ALRAW
3536 * @param RTCx RTC Instance
3537 * @retval State of bit (1 or 0).
3539 __STATIC_INLINE
uint32_t LL_RTC_IsActiveFlag_ALRAW(RTC_TypeDef
*RTCx
)
3541 return (READ_BIT(RTCx
->ISR
, RTC_ISR_ALRAWF
) == (RTC_ISR_ALRAWF
));
3548 /** @defgroup RTC_LL_EF_IT_Management IT_Management
3553 * @brief Enable Time-stamp interrupt
3554 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3555 * @rmtoll CR TSIE LL_RTC_EnableIT_TS
3556 * @param RTCx RTC Instance
3559 __STATIC_INLINE
void LL_RTC_EnableIT_TS(RTC_TypeDef
*RTCx
)
3561 SET_BIT(RTCx
->CR
, RTC_CR_TSIE
);
3565 * @brief Disable Time-stamp interrupt
3566 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3567 * @rmtoll CR TSIE LL_RTC_DisableIT_TS
3568 * @param RTCx RTC Instance
3571 __STATIC_INLINE
void LL_RTC_DisableIT_TS(RTC_TypeDef
*RTCx
)
3573 CLEAR_BIT(RTCx
->CR
, RTC_CR_TSIE
);
3577 * @brief Enable Wakeup timer interrupt
3578 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3579 * @rmtoll CR WUTIE LL_RTC_EnableIT_WUT
3580 * @param RTCx RTC Instance
3583 __STATIC_INLINE
void LL_RTC_EnableIT_WUT(RTC_TypeDef
*RTCx
)
3585 SET_BIT(RTCx
->CR
, RTC_CR_WUTIE
);
3589 * @brief Disable Wakeup timer interrupt
3590 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3591 * @rmtoll CR WUTIE LL_RTC_DisableIT_WUT
3592 * @param RTCx RTC Instance
3595 __STATIC_INLINE
void LL_RTC_DisableIT_WUT(RTC_TypeDef
*RTCx
)
3597 CLEAR_BIT(RTCx
->CR
, RTC_CR_WUTIE
);
3601 * @brief Enable Alarm B interrupt
3602 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3603 * @rmtoll CR ALRBIE LL_RTC_EnableIT_ALRB
3604 * @param RTCx RTC Instance
3607 __STATIC_INLINE
void LL_RTC_EnableIT_ALRB(RTC_TypeDef
*RTCx
)
3609 SET_BIT(RTCx
->CR
, RTC_CR_ALRBIE
);
3613 * @brief Disable Alarm B interrupt
3614 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3615 * @rmtoll CR ALRBIE LL_RTC_DisableIT_ALRB
3616 * @param RTCx RTC Instance
3619 __STATIC_INLINE
void LL_RTC_DisableIT_ALRB(RTC_TypeDef
*RTCx
)
3621 CLEAR_BIT(RTCx
->CR
, RTC_CR_ALRBIE
);
3625 * @brief Enable Alarm A interrupt
3626 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3627 * @rmtoll CR ALRAIE LL_RTC_EnableIT_ALRA
3628 * @param RTCx RTC Instance
3631 __STATIC_INLINE
void LL_RTC_EnableIT_ALRA(RTC_TypeDef
*RTCx
)
3633 SET_BIT(RTCx
->CR
, RTC_CR_ALRAIE
);
3637 * @brief Disable Alarm A interrupt
3638 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3639 * @rmtoll CR ALRAIE LL_RTC_DisableIT_ALRA
3640 * @param RTCx RTC Instance
3643 __STATIC_INLINE
void LL_RTC_DisableIT_ALRA(RTC_TypeDef
*RTCx
)
3645 CLEAR_BIT(RTCx
->CR
, RTC_CR_ALRAIE
);
3649 * @brief Enable Tamper 3 interrupt
3650 * @rmtoll TAMPCR TAMP3IE LL_RTC_EnableIT_TAMP3
3651 * @param RTCx RTC Instance
3654 __STATIC_INLINE
void LL_RTC_EnableIT_TAMP3(RTC_TypeDef
*RTCx
)
3656 SET_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMP3IE
);
3660 * @brief Disable Tamper 3 interrupt
3661 * @rmtoll TAMPCR TAMP3IE LL_RTC_DisableIT_TAMP3
3662 * @param RTCx RTC Instance
3665 __STATIC_INLINE
void LL_RTC_DisableIT_TAMP3(RTC_TypeDef
*RTCx
)
3667 CLEAR_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMP3IE
);
3671 * @brief Enable Tamper 2 interrupt
3672 * @rmtoll TAMPCR TAMP2IE LL_RTC_EnableIT_TAMP2
3673 * @param RTCx RTC Instance
3676 __STATIC_INLINE
void LL_RTC_EnableIT_TAMP2(RTC_TypeDef
*RTCx
)
3678 SET_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMP2IE
);
3682 * @brief Disable Tamper 2 interrupt
3683 * @rmtoll TAMPCR TAMP2IE LL_RTC_DisableIT_TAMP2
3684 * @param RTCx RTC Instance
3687 __STATIC_INLINE
void LL_RTC_DisableIT_TAMP2(RTC_TypeDef
*RTCx
)
3689 CLEAR_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMP2IE
);
3693 * @brief Enable Tamper 1 interrupt
3694 * @rmtoll TAMPCR TAMP1IE LL_RTC_EnableIT_TAMP1
3695 * @param RTCx RTC Instance
3698 __STATIC_INLINE
void LL_RTC_EnableIT_TAMP1(RTC_TypeDef
*RTCx
)
3700 SET_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMP1IE
);
3704 * @brief Disable Tamper 1 interrupt
3705 * @rmtoll TAMPCR TAMP1IE LL_RTC_DisableIT_TAMP1
3706 * @param RTCx RTC Instance
3709 __STATIC_INLINE
void LL_RTC_DisableIT_TAMP1(RTC_TypeDef
*RTCx
)
3711 CLEAR_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMP1IE
);
3715 * @brief Enable all Tamper Interrupt
3716 * @rmtoll TAMPCR TAMPIE LL_RTC_EnableIT_TAMP
3717 * @param RTCx RTC Instance
3720 __STATIC_INLINE
void LL_RTC_EnableIT_TAMP(RTC_TypeDef
*RTCx
)
3722 SET_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMPIE
);
3726 * @brief Disable all Tamper Interrupt
3727 * @rmtoll TAMPCR TAMPIE LL_RTC_DisableIT_TAMP
3728 * @param RTCx RTC Instance
3731 __STATIC_INLINE
void LL_RTC_DisableIT_TAMP(RTC_TypeDef
*RTCx
)
3733 CLEAR_BIT(RTCx
->TAMPCR
, RTC_TAMPCR_TAMPIE
);
3737 * @brief Check if Time-stamp interrupt is enabled or not
3738 * @rmtoll CR TSIE LL_RTC_IsEnabledIT_TS
3739 * @param RTCx RTC Instance
3740 * @retval State of bit (1 or 0).
3742 __STATIC_INLINE
uint32_t LL_RTC_IsEnabledIT_TS(RTC_TypeDef
*RTCx
)
3744 return (READ_BIT(RTCx
->CR
, RTC_CR_TSIE
) == (RTC_CR_TSIE
));
3748 * @brief Check if Wakeup timer interrupt is enabled or not
3749 * @rmtoll CR WUTIE LL_RTC_IsEnabledIT_WUT
3750 * @param RTCx RTC Instance
3751 * @retval State of bit (1 or 0).
3753 __STATIC_INLINE
uint32_t LL_RTC_IsEnabledIT_WUT(RTC_TypeDef
*RTCx
)
3755 return (READ_BIT(RTCx
->CR
, RTC_CR_WUTIE
) == (RTC_CR_WUTIE
));
3759 * @brief Check if Alarm B interrupt is enabled or not
3760 * @rmtoll CR ALRBIE LL_RTC_IsEnabledIT_ALRB
3761 * @param RTCx RTC Instance
3762 * @retval State of bit (1 or 0).
3764 __STATIC_INLINE
uint32_t LL_RTC_IsEnabledIT_ALRB(RTC_TypeDef
*RTCx
)
3766 return (READ_BIT(RTCx
->CR
, RTC_CR_ALRBIE
) == (RTC_CR_ALRBIE
));
3770 * @brief Check if Alarm A interrupt is enabled or not
3771 * @rmtoll CR ALRAIE LL_RTC_IsEnabledIT_ALRA
3772 * @param RTCx RTC Instance
3773 * @retval State of bit (1 or 0).
3775 __STATIC_INLINE
uint32_t LL_RTC_IsEnabledIT_ALRA(RTC_TypeDef
*RTCx
)
3777 return (READ_BIT(RTCx
->CR
, RTC_CR_ALRAIE
) == (RTC_CR_ALRAIE
));
3781 * @brief Check if Tamper 3 interrupt is enabled or not
3782 * @rmtoll TAMPCR TAMP3IE LL_RTC_IsEnabledIT_TAMP3
3783 * @param RTCx RTC Instance
3784 * @retval State of bit (1 or 0).
3786 __STATIC_INLINE
uint32_t LL_RTC_IsEnabledIT_TAMP3(RTC_TypeDef
*RTCx
)
3788 return (READ_BIT(RTCx
->TAMPCR
,
3789 RTC_TAMPCR_TAMP3IE
) == (RTC_TAMPCR_TAMP3IE
));
3793 * @brief Check if Tamper 2 interrupt is enabled or not
3794 * @rmtoll TAMPCR TAMP2IE LL_RTC_IsEnabledIT_TAMP2
3795 * @param RTCx RTC Instance
3796 * @retval State of bit (1 or 0).
3798 __STATIC_INLINE
uint32_t LL_RTC_IsEnabledIT_TAMP2(RTC_TypeDef
*RTCx
)
3800 return (READ_BIT(RTCx
->TAMPCR
,
3801 RTC_TAMPCR_TAMP2IE
) == (RTC_TAMPCR_TAMP2IE
));
3806 * @brief Check if Tamper 1 interrupt is enabled or not
3807 * @rmtoll TAMPCR TAMP1IE LL_RTC_IsEnabledIT_TAMP1
3808 * @param RTCx RTC Instance
3809 * @retval State of bit (1 or 0).
3811 __STATIC_INLINE
uint32_t LL_RTC_IsEnabledIT_TAMP1(RTC_TypeDef
*RTCx
)
3813 return (READ_BIT(RTCx
->TAMPCR
,
3814 RTC_TAMPCR_TAMP1IE
) == (RTC_TAMPCR_TAMP1IE
));
3818 * @brief Check if all the TAMPER interrupts are enabled or not
3819 * @rmtoll TAMPCR TAMPIE LL_RTC_IsEnabledIT_TAMP
3820 * @param RTCx RTC Instance
3821 * @retval State of bit (1 or 0).
3823 __STATIC_INLINE
uint32_t LL_RTC_IsEnabledIT_TAMP(RTC_TypeDef
*RTCx
)
3825 return (READ_BIT(RTCx
->TAMPCR
,
3826 RTC_TAMPCR_TAMPIE
) == (RTC_TAMPCR_TAMPIE
));
3833 #if defined(USE_FULL_LL_DRIVER)
3834 /** @defgroup RTC_LL_EF_Init Initialization and de-initialization functions
3838 ErrorStatus
LL_RTC_DeInit(RTC_TypeDef
*RTCx
);
3839 ErrorStatus
LL_RTC_Init(RTC_TypeDef
*RTCx
, LL_RTC_InitTypeDef
*RTC_InitStruct
);
3840 void LL_RTC_StructInit(LL_RTC_InitTypeDef
*RTC_InitStruct
);
3841 ErrorStatus
LL_RTC_TIME_Init(RTC_TypeDef
*RTCx
, uint32_t RTC_Format
, LL_RTC_TimeTypeDef
*RTC_TimeStruct
);
3842 void LL_RTC_TIME_StructInit(LL_RTC_TimeTypeDef
*RTC_TimeStruct
);
3843 ErrorStatus
LL_RTC_DATE_Init(RTC_TypeDef
*RTCx
, uint32_t RTC_Format
, LL_RTC_DateTypeDef
*RTC_DateStruct
);
3844 void LL_RTC_DATE_StructInit(LL_RTC_DateTypeDef
*RTC_DateStruct
);
3845 ErrorStatus
LL_RTC_ALMA_Init(RTC_TypeDef
*RTCx
, uint32_t RTC_Format
, LL_RTC_AlarmTypeDef
*RTC_AlarmStruct
);
3846 ErrorStatus
LL_RTC_ALMB_Init(RTC_TypeDef
*RTCx
, uint32_t RTC_Format
, LL_RTC_AlarmTypeDef
*RTC_AlarmStruct
);
3847 void LL_RTC_ALMA_StructInit(LL_RTC_AlarmTypeDef
*RTC_AlarmStruct
);
3848 void LL_RTC_ALMB_StructInit(LL_RTC_AlarmTypeDef
*RTC_AlarmStruct
);
3849 ErrorStatus
LL_RTC_EnterInitMode(RTC_TypeDef
*RTCx
);
3850 ErrorStatus
LL_RTC_ExitInitMode(RTC_TypeDef
*RTCx
);
3851 ErrorStatus
LL_RTC_WaitForSynchro(RTC_TypeDef
*RTCx
);
3856 #endif /* USE_FULL_LL_DRIVER */
3866 #endif /* defined(RTC) */
3876 #endif /* __STM32F7xx_LL_RTC_H */
3878 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/