STM32L443xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_ll_rtc.h 00004 * @author MCD Application Team 00005 * @brief Header file of RTC LL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * Copyright (c) 2017 STMicroelectronics. 00010 * All rights reserved. 00011 * 00012 * This software is licensed under terms that can be found in the LICENSE file 00013 * in the root directory of this software component. 00014 * If no LICENSE file comes with this software, it is provided AS-IS. 00015 * 00016 ****************************************************************************** 00017 */ 00018 00019 /* Define to prevent recursive inclusion -------------------------------------*/ 00020 #ifndef STM32L4xx_LL_RTC_H 00021 #define STM32L4xx_LL_RTC_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm32l4xx.h" 00029 00030 /** @addtogroup STM32L4xx_LL_Driver 00031 * @{ 00032 */ 00033 00034 #if defined(RTC) 00035 00036 /** @defgroup RTC_LL RTC 00037 * @{ 00038 */ 00039 00040 /* Private types -------------------------------------------------------------*/ 00041 /* Private variables ---------------------------------------------------------*/ 00042 /* Private constants ---------------------------------------------------------*/ 00043 /** @defgroup RTC_LL_Private_Constants RTC Private Constants 00044 * @{ 00045 */ 00046 /* Masks Definition */ 00047 #define RTC_LL_INIT_MASK 0xFFFFFFFFU 00048 #define RTC_LL_RSF_MASK 0xFFFFFF5FU 00049 00050 /* Write protection defines */ 00051 #define RTC_WRITE_PROTECTION_DISABLE 0xFFU 00052 #define RTC_WRITE_PROTECTION_ENABLE_1 0xCAU 00053 #define RTC_WRITE_PROTECTION_ENABLE_2 0x53U 00054 00055 /* Defines used to combine date & time */ 00056 #define RTC_OFFSET_WEEKDAY 24U 00057 #define RTC_OFFSET_DAY 16U 00058 #define RTC_OFFSET_MONTH 8U 00059 #define RTC_OFFSET_HOUR 16U 00060 #define RTC_OFFSET_MINUTE 8U 00061 00062 /** 00063 * @} 00064 */ 00065 00066 /* Private macros ------------------------------------------------------------*/ 00067 #if defined(USE_FULL_LL_DRIVER) 00068 /** @defgroup RTC_LL_Private_Macros RTC Private Macros 00069 * @{ 00070 */ 00071 /** 00072 * @} 00073 */ 00074 #endif /*USE_FULL_LL_DRIVER*/ 00075 00076 /* Exported types ------------------------------------------------------------*/ 00077 #if defined(USE_FULL_LL_DRIVER) 00078 /** @defgroup RTC_LL_ES_INIT RTC Exported Init structure 00079 * @{ 00080 */ 00081 00082 /** 00083 * @brief RTC Init structures definition 00084 */ 00085 typedef struct 00086 { 00087 uint32_t HourFormat; /*!< Specifies the RTC Hours Format. 00088 This parameter can be a value of @ref RTC_LL_EC_HOURFORMAT 00089 00090 This feature can be modified afterwards using unitary function 00091 @ref LL_RTC_SetHourFormat(). */ 00092 00093 uint32_t AsynchPrescaler; /*!< Specifies the RTC Asynchronous Predivider value. 00094 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F 00095 00096 This feature can be modified afterwards using unitary function 00097 @ref LL_RTC_SetAsynchPrescaler(). */ 00098 00099 uint32_t SynchPrescaler; /*!< Specifies the RTC Synchronous Predivider value. 00100 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF 00101 00102 This feature can be modified afterwards using unitary function 00103 @ref LL_RTC_SetSynchPrescaler(). */ 00104 } LL_RTC_InitTypeDef; 00105 00106 /** 00107 * @brief RTC Time structure definition 00108 */ 00109 typedef struct 00110 { 00111 uint32_t TimeFormat; /*!< Specifies the RTC AM/PM Time. 00112 This parameter can be a value of @ref RTC_LL_EC_TIME_FORMAT 00113 00114 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetFormat(). */ 00115 00116 uint8_t Hours; /*!< Specifies the RTC Time Hours. 00117 This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the @ref LL_RTC_TIME_FORMAT_PM is selected. 00118 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. 00119 00120 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetHour(). */ 00121 00122 uint8_t Minutes; /*!< Specifies the RTC Time Minutes. 00123 This parameter must be a number between Min_Data = 0 and Max_Data = 59 00124 00125 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetMinute(). */ 00126 00127 uint8_t Seconds; /*!< Specifies the RTC Time Seconds. 00128 This parameter must be a number between Min_Data = 0 and Max_Data = 59 00129 00130 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetSecond(). */ 00131 } LL_RTC_TimeTypeDef; 00132 00133 /** 00134 * @brief RTC Date structure definition 00135 */ 00136 typedef struct 00137 { 00138 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay. 00139 This parameter can be a value of @ref RTC_LL_EC_WEEKDAY 00140 00141 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetWeekDay(). */ 00142 00143 uint8_t Month; /*!< Specifies the RTC Date Month. 00144 This parameter can be a value of @ref RTC_LL_EC_MONTH 00145 00146 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetMonth(). */ 00147 00148 uint8_t Day; /*!< Specifies the RTC Date Day. 00149 This parameter must be a number between Min_Data = 1 and Max_Data = 31 00150 00151 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetDay(). */ 00152 00153 uint8_t Year; /*!< Specifies the RTC Date Year. 00154 This parameter must be a number between Min_Data = 0 and Max_Data = 99 00155 00156 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetYear(). */ 00157 } LL_RTC_DateTypeDef; 00158 00159 /** 00160 * @brief RTC Alarm structure definition 00161 */ 00162 typedef struct 00163 { 00164 LL_RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members. */ 00165 00166 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks. 00167 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. 00168 00169 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetMask() for ALARM A 00170 or @ref LL_RTC_ALMB_SetMask() for ALARM B 00171 */ 00172 00173 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on day or WeekDay. 00174 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 00175 00176 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_EnableWeekday() or @ref LL_RTC_ALMA_DisableWeekday() 00177 for ALARM A or @ref LL_RTC_ALMB_EnableWeekday() or @ref LL_RTC_ALMB_DisableWeekday() for ALARM B 00178 */ 00179 00180 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Day/WeekDay. 00181 If AlarmDateWeekDaySel set to day, this parameter must be a number between Min_Data = 1 and Max_Data = 31. 00182 00183 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetDay() 00184 for ALARM A or @ref LL_RTC_ALMB_SetDay() for ALARM B. 00185 00186 If AlarmDateWeekDaySel set to Weekday, this parameter can be a value of @ref RTC_LL_EC_WEEKDAY. 00187 00188 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetWeekDay() 00189 for ALARM A or @ref LL_RTC_ALMB_SetWeekDay() for ALARM B. 00190 */ 00191 } LL_RTC_AlarmTypeDef; 00192 00193 /** 00194 * @} 00195 */ 00196 #endif /* USE_FULL_LL_DRIVER */ 00197 00198 /* Exported constants --------------------------------------------------------*/ 00199 /** @defgroup RTC_LL_Exported_Constants RTC Exported Constants 00200 * @{ 00201 */ 00202 00203 #if defined(USE_FULL_LL_DRIVER) 00204 /** @defgroup RTC_LL_EC_FORMAT FORMAT 00205 * @{ 00206 */ 00207 #define LL_RTC_FORMAT_BIN 0x00000000U /*!< Binary data format */ 00208 #define LL_RTC_FORMAT_BCD 0x00000001U /*!< BCD data format */ 00209 /** 00210 * @} 00211 */ 00212 00213 /** @defgroup RTC_LL_EC_ALMA_WEEKDAY_SELECTION RTC Alarm A Date WeekDay 00214 * @{ 00215 */ 00216 #define LL_RTC_ALMA_DATEWEEKDAYSEL_DATE 0x00000000U /*!< Alarm A Date is selected */ 00217 #define LL_RTC_ALMA_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMAR_WDSEL /*!< Alarm A WeekDay is selected */ 00218 /** 00219 * @} 00220 */ 00221 00222 /** @defgroup RTC_LL_EC_ALMB_WEEKDAY_SELECTION RTC Alarm B Date WeekDay 00223 * @{ 00224 */ 00225 #define LL_RTC_ALMB_DATEWEEKDAYSEL_DATE 0x00000000U /*!< Alarm B Date is selected */ 00226 #define LL_RTC_ALMB_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMBR_WDSEL /*!< Alarm B WeekDay is selected */ 00227 /** 00228 * @} 00229 */ 00230 00231 #endif /* USE_FULL_LL_DRIVER */ 00232 00233 /** @defgroup RTC_LL_EC_GET_FLAG Get Flags Defines 00234 * @brief Flags defines which can be used with LL_RTC_ReadReg function 00235 * @{ 00236 */ 00237 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00238 #define LL_RTC_SCR_ITSF RTC_SCR_CITSF 00239 #define LL_RTC_SCR_TSOVF RTC_SCR_CTSOVF 00240 #define LL_RTC_SCR_TSF RTC_SCR_CTSF 00241 #define LL_RTC_SCR_WUTF RTC_SCR_CWUTF 00242 #define LL_RTC_SCR_ALRBF RTC_SCR_CALRBF 00243 #define LL_RTC_SCR_ALRAF RTC_SCR_CALRAF 00244 00245 #define LL_RTC_ICSR_RECALPF RTC_ICSR_RECALPF 00246 #define LL_RTC_ICSR_INITF RTC_ICSR_INITF 00247 #define LL_RTC_ICSR_RSF RTC_ICSR_RSF 00248 #define LL_RTC_ICSR_INITS RTC_ICSR_INITS 00249 #define LL_RTC_ICSR_SHPF RTC_ICSR_SHPF 00250 #define LL_RTC_ICSR_WUTWF RTC_ICSR_WUTWF 00251 #else /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00252 #define LL_RTC_ISR_ITSF RTC_ISR_ITSF 00253 #define LL_RTC_ISR_RECALPF RTC_ISR_RECALPF 00254 #define LL_RTC_ISR_TAMP3F RTC_ISR_TAMP3F 00255 #define LL_RTC_ISR_TAMP2F RTC_ISR_TAMP2F 00256 #define LL_RTC_ISR_TAMP1F RTC_ISR_TAMP1F 00257 #define LL_RTC_ISR_TSOVF RTC_ISR_TSOVF 00258 #define LL_RTC_ISR_TSF RTC_ISR_TSF 00259 #define LL_RTC_ISR_WUTF RTC_ISR_WUTF 00260 #define LL_RTC_ISR_ALRBF RTC_ISR_ALRBF 00261 #define LL_RTC_ISR_ALRAF RTC_ISR_ALRAF 00262 #define LL_RTC_ISR_INITF RTC_ISR_INITF 00263 #define LL_RTC_ISR_RSF RTC_ISR_RSF 00264 #define LL_RTC_ISR_INITS RTC_ISR_INITS 00265 #define LL_RTC_ISR_SHPF RTC_ISR_SHPF 00266 #define LL_RTC_ISR_WUTWF RTC_ISR_WUTWF 00267 #define LL_RTC_ISR_ALRBWF RTC_ISR_ALRBWF 00268 #define LL_RTC_ISR_ALRAWF RTC_ISR_ALRAWF 00269 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00270 /** 00271 * @} 00272 */ 00273 00274 /** @defgroup RTC_LL_EC_IT IT Defines 00275 * @brief IT defines which can be used with LL_RTC_ReadReg and LL_RTC_WriteReg functions 00276 * @{ 00277 */ 00278 #define LL_RTC_CR_TSIE RTC_CR_TSIE 00279 #define LL_RTC_CR_WUTIE RTC_CR_WUTIE 00280 #define LL_RTC_CR_ALRBIE RTC_CR_ALRBIE 00281 #define LL_RTC_CR_ALRAIE RTC_CR_ALRAIE 00282 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00283 #else /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00284 #define LL_RTC_TAMPCR_TAMP3IE RTC_TAMPCR_TAMP3IE 00285 #define LL_RTC_TAMPCR_TAMP2IE RTC_TAMPCR_TAMP2IE 00286 #define LL_RTC_TAMPCR_TAMP1IE RTC_TAMPCR_TAMP1IE 00287 #define LL_RTC_TAMPCR_TAMPIE RTC_TAMPCR_TAMPIE 00288 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00289 /** 00290 * @} 00291 */ 00292 00293 /** @defgroup RTC_LL_EC_WEEKDAY WEEK DAY 00294 * @{ 00295 */ 00296 #define LL_RTC_WEEKDAY_MONDAY (uint8_t)0x01 /*!< Monday */ 00297 #define LL_RTC_WEEKDAY_TUESDAY (uint8_t)0x02 /*!< Tuesday */ 00298 #define LL_RTC_WEEKDAY_WEDNESDAY (uint8_t)0x03 /*!< Wednesday */ 00299 #define LL_RTC_WEEKDAY_THURSDAY (uint8_t)0x04 /*!< Thrusday */ 00300 #define LL_RTC_WEEKDAY_FRIDAY (uint8_t)0x05 /*!< Friday */ 00301 #define LL_RTC_WEEKDAY_SATURDAY (uint8_t)0x06 /*!< Saturday */ 00302 #define LL_RTC_WEEKDAY_SUNDAY (uint8_t)0x07 /*!< Sunday */ 00303 /** 00304 * @} 00305 */ 00306 00307 /** @defgroup RTC_LL_EC_MONTH MONTH 00308 * @{ 00309 */ 00310 #define LL_RTC_MONTH_JANUARY (uint8_t)0x01 /*!< January */ 00311 #define LL_RTC_MONTH_FEBRUARY (uint8_t)0x02 /*!< February */ 00312 #define LL_RTC_MONTH_MARCH (uint8_t)0x03 /*!< March */ 00313 #define LL_RTC_MONTH_APRIL (uint8_t)0x04 /*!< April */ 00314 #define LL_RTC_MONTH_MAY (uint8_t)0x05 /*!< May */ 00315 #define LL_RTC_MONTH_JUNE (uint8_t)0x06 /*!< June */ 00316 #define LL_RTC_MONTH_JULY (uint8_t)0x07 /*!< July */ 00317 #define LL_RTC_MONTH_AUGUST (uint8_t)0x08 /*!< August */ 00318 #define LL_RTC_MONTH_SEPTEMBER (uint8_t)0x09 /*!< September */ 00319 #define LL_RTC_MONTH_OCTOBER (uint8_t)0x10 /*!< October */ 00320 #define LL_RTC_MONTH_NOVEMBER (uint8_t)0x11 /*!< November */ 00321 #define LL_RTC_MONTH_DECEMBER (uint8_t)0x12 /*!< December */ 00322 /** 00323 * @} 00324 */ 00325 00326 /** @defgroup RTC_LL_EC_HOURFORMAT HOUR FORMAT 00327 * @{ 00328 */ 00329 #define LL_RTC_HOURFORMAT_24HOUR 0x00000000U /*!< 24 hour/day format */ 00330 #define LL_RTC_HOURFORMAT_AMPM RTC_CR_FMT /*!< AM/PM hour format */ 00331 /** 00332 * @} 00333 */ 00334 00335 /** @defgroup RTC_LL_EC_ALARMOUT ALARM OUTPUT 00336 * @{ 00337 */ 00338 #define LL_RTC_ALARMOUT_DISABLE 0x00000000U /*!< Output disabled */ 00339 #define LL_RTC_ALARMOUT_ALMA RTC_CR_OSEL_0 /*!< Alarm A output enabled */ 00340 #define LL_RTC_ALARMOUT_ALMB RTC_CR_OSEL_1 /*!< Alarm B output enabled */ 00341 #define LL_RTC_ALARMOUT_WAKEUP RTC_CR_OSEL /*!< Wakeup output enabled */ 00342 /** 00343 * @} 00344 */ 00345 00346 /** @defgroup RTC_LL_EC_ALARM_OUTPUTTYPE ALARM OUTPUT TYPE 00347 * @{ 00348 */ 00349 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00350 #define LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN RTC_CR_TAMPALRM_TYPE /*!< RTC_ALARM is open-drain output */ 00351 #define LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL 0x00000000U /*!< RTC_ALARM is push-pull output */ 00352 #else /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00353 #define LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN 0x00000000U /*!< RTC_ALARM is open-drain output */ 00354 #define LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL RTC_OR_ALARMOUTTYPE /*!< RTC_ALARM, when mapped on PC13, is push-pull output */ 00355 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00356 /** 00357 * @} 00358 */ 00359 00360 /** @defgroup RTC_LL_EC_OUTPUTPOLARITY_PIN OUTPUT POLARITY PIN 00361 * @{ 00362 */ 00363 #define LL_RTC_OUTPUTPOLARITY_PIN_HIGH 0x00000000U /*!< Pin is high when ALRAF/ALRBF/WUTF is asserted (depending on OSEL)*/ 00364 #define LL_RTC_OUTPUTPOLARITY_PIN_LOW RTC_CR_POL /*!< Pin is low when ALRAF/ALRBF/WUTF is asserted (depending on OSEL) */ 00365 /** 00366 * @} 00367 */ 00368 00369 /** @defgroup RTC_LL_EC_TIME_FORMAT TIME FORMAT 00370 * @{ 00371 */ 00372 #define LL_RTC_TIME_FORMAT_AM_OR_24 0x00000000U /*!< AM or 24-hour format */ 00373 #define LL_RTC_TIME_FORMAT_PM RTC_TR_PM /*!< PM */ 00374 /** 00375 * @} 00376 */ 00377 00378 /** @defgroup RTC_LL_EC_SHIFT_SECOND SHIFT SECOND 00379 * @{ 00380 */ 00381 #define LL_RTC_SHIFT_SECOND_DELAY 0x00000000U /* Delay (seconds) = SUBFS / (PREDIV_S + 1) */ 00382 #define LL_RTC_SHIFT_SECOND_ADVANCE RTC_SHIFTR_ADD1S /* Advance (seconds) = (1 - (SUBFS / (PREDIV_S + 1))) */ 00383 /** 00384 * @} 00385 */ 00386 00387 /** @defgroup RTC_LL_EC_ALMA_MASK ALARMA MASK 00388 * @{ 00389 */ 00390 #define LL_RTC_ALMA_MASK_NONE 0x00000000U /*!< No masks applied on Alarm A*/ 00391 #define LL_RTC_ALMA_MASK_DATEWEEKDAY RTC_ALRMAR_MSK4 /*!< Date/day do not care in Alarm A comparison */ 00392 #define LL_RTC_ALMA_MASK_HOURS RTC_ALRMAR_MSK3 /*!< Hours do not care in Alarm A comparison */ 00393 #define LL_RTC_ALMA_MASK_MINUTES RTC_ALRMAR_MSK2 /*!< Minutes do not care in Alarm A comparison */ 00394 #define LL_RTC_ALMA_MASK_SECONDS RTC_ALRMAR_MSK1 /*!< Seconds do not care in Alarm A comparison */ 00395 #define LL_RTC_ALMA_MASK_ALL (RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1) /*!< Masks all */ 00396 /** 00397 * @} 00398 */ 00399 00400 /** @defgroup RTC_LL_EC_ALMA_TIME_FORMAT ALARMA TIME FORMAT 00401 * @{ 00402 */ 00403 #define LL_RTC_ALMA_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */ 00404 #define LL_RTC_ALMA_TIME_FORMAT_PM RTC_ALRMAR_PM /*!< PM */ 00405 /** 00406 * @} 00407 */ 00408 00409 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00410 /** @defgroup RTC_ALMA_SUBSECONDBIN_AUTOCLR RTCEx_AlarmA_Sub_Seconds_binary_Clear_Definitions RTC Alarm Sub Seconds with binary mode auto clear Definitions 00411 * @{ 00412 */ 00413 #define LL_RTC_ALMA_SUBSECONDBIN_AUTOCLR_NO 0UL /*!< The synchronous binary counter (SS[31:0] in RTC_SSR) is free-running. */ 00414 #define LL_RTC_ALMA_SUBSECONDBIN_AUTOCLR_YES RTC_ALRMASSR_SSCLR /*!< The synchronous binary counter (SS[31:0] in RTC_SSR) is running from 0xFFFF FFFF to 00415 RTC_ALRMABINR -> SS[31:0] value and is automatically reloaded with 0xFFFF FFFF 00416 when reaching RTC_ALRMABINR -> SS[31:0]. */ 00417 /** 00418 * @} 00419 */ 00420 #endif /* #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00421 00422 /** @defgroup RTC_LL_EC_ALMB_MASK ALARMB MASK 00423 * @{ 00424 */ 00425 #define LL_RTC_ALMB_MASK_NONE 0x00000000U /*!< No masks applied on Alarm B*/ 00426 #define LL_RTC_ALMB_MASK_DATEWEEKDAY RTC_ALRMBR_MSK4 /*!< Date/day do not care in Alarm B comparison */ 00427 #define LL_RTC_ALMB_MASK_HOURS RTC_ALRMBR_MSK3 /*!< Hours do not care in Alarm B comparison */ 00428 #define LL_RTC_ALMB_MASK_MINUTES RTC_ALRMBR_MSK2 /*!< Minutes do not care in Alarm B comparison */ 00429 #define LL_RTC_ALMB_MASK_SECONDS RTC_ALRMBR_MSK1 /*!< Seconds do not care in Alarm B comparison */ 00430 #define LL_RTC_ALMB_MASK_ALL (RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1) /*!< Masks all */ 00431 /** 00432 * @} 00433 */ 00434 00435 /** @defgroup RTC_LL_EC_ALMB_TIME_FORMAT ALARMB TIME FORMAT 00436 * @{ 00437 */ 00438 #define LL_RTC_ALMB_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */ 00439 #define LL_RTC_ALMB_TIME_FORMAT_PM RTC_ALRMBR_PM /*!< PM */ 00440 /** 00441 * @} 00442 */ 00443 00444 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00445 /** @defgroup RTC_ALMB_SUBSECONDBIN_AUTOCLR RTCEx_AlarmB_Sub_Seconds_binary_Clear_Definitions RTC Alarm Sub Seconds with binary mode auto clear Definitions 00446 * @{ 00447 */ 00448 #define LL_RTC_ALMB_SUBSECONDBIN_AUTOCLR_NO 0UL /*!< The synchronous binary counter (SS[31:0] in RTC_SSR) is free-running. */ 00449 #define LL_RTC_ALMB_SUBSECONDBIN_AUTOCLR_YES RTC_ALRMBSSR_SSCLR /*!< The synchronous binary counter (SS[31:0] in RTC_SSR) is running from 0xFFFF FFFF to 00450 RTC_ALRMABINR -> SS[31:0] value and is automatically reloaded with 0xFFFF FFFF 00451 when reaching RTC_ALRMABINR -> SS[31:0]. */ 00452 /** 00453 * @} 00454 */ 00455 00456 /** @defgroup RTC_ALMB_FLAG_AUTOCLR RTCEx_Alarm_Flag_Clear_Definitions RTC Alarm Flag auto clear Definitions 00457 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 00458 * @{ 00459 */ 00460 #define LL_RTC_ALMB_FLAG_AUTOCLR_NO 0UL /*!< */ 00461 #define LL_RTC_ALMB_FLAG_AUTOCLR_YES RTC_CR_ALRBMSK /*!< */ 00462 /** 00463 * @} 00464 */ 00465 #endif /* #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00466 00467 /** @defgroup RTC_LL_EC_TIMESTAMP_EDGE TIMESTAMP EDGE 00468 * @{ 00469 */ 00470 #define LL_RTC_TIMESTAMP_EDGE_RISING 0x00000000U /*!< RTC_TS input rising edge generates a time-stamp event */ 00471 #define LL_RTC_TIMESTAMP_EDGE_FALLING RTC_CR_TSEDGE /*!< RTC_TS input falling edge generates a time-stamp even */ 00472 /** 00473 * @} 00474 */ 00475 00476 /** @defgroup RTC_LL_EC_TS_TIME_FORMAT TIMESTAMP TIME FORMAT 00477 * @{ 00478 */ 00479 #define LL_RTC_TS_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */ 00480 #define LL_RTC_TS_TIME_FORMAT_PM RTC_TSTR_PM /*!< PM */ 00481 /** 00482 * @} 00483 */ 00484 00485 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00486 /** @defgroup RTC_LL_EC_TAMPER TAMPER 00487 * @{ 00488 */ 00489 #define LL_RTC_TAMPER_1 TAMP_CR1_TAMP1E /*!< Tamper 1 input detection */ 00490 #define LL_RTC_TAMPER_2 TAMP_CR1_TAMP2E /*!< Tamper 2 input detection */ 00491 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00492 #define LL_RTC_TAMPER_3 TAMP_CR1_TAMP3E /*!< Tamper 3 input detection */ 00493 #endif 00494 /** 00495 * @} 00496 */ 00497 00498 /** @defgroup RTC_LL_EC_TAMPER_MASK TAMPER MASK 00499 * @{ 00500 */ 00501 #define LL_RTC_TAMPER_MASK_TAMPER1 TAMP_CR2_TAMP1MSK /*!< Tamper 1 event generates a trigger event. TAMP1F is masked and internally cleared by hardware.The backup registers are not erased */ 00502 #define LL_RTC_TAMPER_MASK_TAMPER2 TAMP_CR2_TAMP2MSK /*!< Tamper 2 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */ 00503 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00504 #define LL_RTC_TAMPER_MASK_TAMPER3 TAMP_CR2_TAMP3MSK /*!< Tamper 3 event generates a trigger event. TAMP3F is masked and internally cleared by hardware. The backup registers are not erased. */ 00505 #endif 00506 /** 00507 * @} 00508 */ 00509 00510 /** @defgroup RTC_LL_EC_TAMPER_NOERASE TAMPER NO ERASE 00511 * @{ 00512 */ 00513 #define LL_RTC_TAMPER_NOERASE_TAMPER1 TAMP_CR2_TAMP1NOERASE /*!< Tamper 1 event does not erase the backup registers. */ 00514 #define LL_RTC_TAMPER_NOERASE_TAMPER2 TAMP_CR2_TAMP2NOERASE /*!< Tamper 2 event does not erase the backup registers. */ 00515 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00516 #define LL_RTC_TAMPER_NOERASE_TAMPER3 TAMP_CR2_TAMP3NOERASE /*!< Tamper 3 event does not erase the backup registers. */ 00517 #endif 00518 /** 00519 * @} 00520 */ 00521 00522 /** @defgroup RTC_LL_EC_TAMPER_DURATION TAMPER DURATION 00523 * @{ 00524 */ 00525 #define LL_RTC_TAMPER_DURATION_1RTCCLK 0x00000000U /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle */ 00526 #define LL_RTC_TAMPER_DURATION_2RTCCLK TAMP_FLTCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */ 00527 #define LL_RTC_TAMPER_DURATION_4RTCCLK TAMP_FLTCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */ 00528 #define LL_RTC_TAMPER_DURATION_8RTCCLK TAMP_FLTCR_TAMPPRCH /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */ 00529 /** 00530 * @} 00531 */ 00532 00533 /** @defgroup RTC_LL_EC_TAMPER_FILTER TAMPER FILTER 00534 * @{ 00535 */ 00536 #define LL_RTC_TAMPER_FILTER_DISABLE 0x00000000U /*!< Tamper filter is disabled */ 00537 #define LL_RTC_TAMPER_FILTER_2SAMPLE TAMP_FLTCR_TAMPFLT_0 /*!< Tamper is activated after 2 consecutive samples at the active level */ 00538 #define LL_RTC_TAMPER_FILTER_4SAMPLE TAMP_FLTCR_TAMPFLT_1 /*!< Tamper is activated after 4 consecutive samples at the active level */ 00539 #define LL_RTC_TAMPER_FILTER_8SAMPLE TAMP_FLTCR_TAMPFLT /*!< Tamper is activated after 8 consecutive samples at the active level. */ 00540 /** 00541 * @} 00542 */ 00543 00544 /** @defgroup RTC_LL_EC_TAMPER_SAMPLFREQDIV TAMPER SAMPLING FREQUENCY DIVIDER 00545 * @{ 00546 */ 00547 #define LL_RTC_TAMPER_SAMPLFREQDIV_32768 0x00000000U /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 32768 */ 00548 #define LL_RTC_TAMPER_SAMPLFREQDIV_16384 TAMP_FLTCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 16384 */ 00549 #define LL_RTC_TAMPER_SAMPLFREQDIV_8192 TAMP_FLTCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 8192 */ 00550 #define LL_RTC_TAMPER_SAMPLFREQDIV_4096 (TAMP_FLTCR_TAMPFREQ_1 | TAMP_FLTCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 4096 */ 00551 #define LL_RTC_TAMPER_SAMPLFREQDIV_2048 TAMP_FLTCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 2048 */ 00552 #define LL_RTC_TAMPER_SAMPLFREQDIV_1024 (TAMP_FLTCR_TAMPFREQ_2 | TAMP_FLTCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 1024 */ 00553 #define LL_RTC_TAMPER_SAMPLFREQDIV_512 (TAMP_FLTCR_TAMPFREQ_2 | TAMP_FLTCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 512 */ 00554 #define LL_RTC_TAMPER_SAMPLFREQDIV_256 TAMP_FLTCR_TAMPFREQ /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 256 */ 00555 /** 00556 * @} 00557 */ 00558 00559 /** @defgroup RTC_LL_EC_TAMPER_ACTIVELEVEL TAMPER ACTIVE LEVEL 00560 * @{ 00561 */ 00562 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 TAMP_CR2_TAMP1TRG /*!< Tamper 1 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */ 00563 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 TAMP_CR2_TAMP2TRG /*!< Tamper 2 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */ 00564 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00565 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 TAMP_CR2_TAMP3TRG /*!< Tamper 3 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */ 00566 #endif 00567 /** 00568 * @} 00569 */ 00570 00571 #else /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00572 00573 /** @defgroup RTC_LL_EC_TAMPER TAMPER 00574 * @{ 00575 */ 00576 #if defined(RTC_TAMPER1_SUPPORT) 00577 #define LL_RTC_TAMPER_1 RTC_TAMPCR_TAMP1E /*!< RTC_TAMP1 input detection */ 00578 #endif /* RTC_TAMPER1_SUPPORT */ 00579 #if defined(RTC_TAMPER2_SUPPORT) 00580 #define LL_RTC_TAMPER_2 RTC_TAMPCR_TAMP2E /*!< RTC_TAMP2 input detection */ 00581 #endif /* RTC_TAMPER2_SUPPORT */ 00582 #if defined(RTC_TAMPER3_SUPPORT) 00583 #define LL_RTC_TAMPER_3 RTC_TAMPCR_TAMP3E /*!< RTC_TAMP3 input detection */ 00584 #endif /* RTC_TAMPER3_SUPPORT */ 00585 /** 00586 * @} 00587 */ 00588 00589 /** @defgroup RTC_LL_EC_TAMPER_MASK TAMPER MASK 00590 * @{ 00591 */ 00592 #if defined(RTC_TAMPER1_SUPPORT) 00593 #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 */ 00594 #endif /* RTC_TAMPER1_SUPPORT */ 00595 #if defined(RTC_TAMPER2_SUPPORT) 00596 #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. */ 00597 #endif /* RTC_TAMPER2_SUPPORT */ 00598 #if defined(RTC_TAMPER3_SUPPORT) 00599 #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 */ 00600 #endif /* RTC_TAMPER3_SUPPORT */ 00601 /** 00602 * @} 00603 */ 00604 00605 /** @defgroup RTC_LL_EC_TAMPER_NOERASE TAMPER NO ERASE 00606 * @{ 00607 */ 00608 #if defined(RTC_TAMPER1_SUPPORT) 00609 #define LL_RTC_TAMPER_NOERASE_TAMPER1 RTC_TAMPCR_TAMP1NOERASE /*!< Tamper 1 event does not erase the backup registers. */ 00610 #endif /* RTC_TAMPER1_SUPPORT */ 00611 #if defined(RTC_TAMPER2_SUPPORT) 00612 #define LL_RTC_TAMPER_NOERASE_TAMPER2 RTC_TAMPCR_TAMP2NOERASE /*!< Tamper 2 event does not erase the backup registers. */ 00613 #endif /* RTC_TAMPER2_SUPPORT */ 00614 #if defined(RTC_TAMPER3_SUPPORT) 00615 #define LL_RTC_TAMPER_NOERASE_TAMPER3 RTC_TAMPCR_TAMP3NOERASE /*!< Tamper 3 event does not erase the backup registers. */ 00616 #endif /* RTC_TAMPER3_SUPPORT */ 00617 /** 00618 * @} 00619 */ 00620 00621 #if defined(RTC_TAMPCR_TAMPPRCH) 00622 /** @defgroup RTC_LL_EC_TAMPER_DURATION TAMPER DURATION 00623 * @{ 00624 */ 00625 #define LL_RTC_TAMPER_DURATION_1RTCCLK 0x00000000U /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle */ 00626 #define LL_RTC_TAMPER_DURATION_2RTCCLK RTC_TAMPCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */ 00627 #define LL_RTC_TAMPER_DURATION_4RTCCLK RTC_TAMPCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */ 00628 #define LL_RTC_TAMPER_DURATION_8RTCCLK RTC_TAMPCR_TAMPPRCH /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */ 00629 /** 00630 * @} 00631 */ 00632 #endif /* RTC_TAMPCR_TAMPPRCH */ 00633 00634 #if defined(RTC_TAMPCR_TAMPFLT) 00635 /** @defgroup RTC_LL_EC_TAMPER_FILTER TAMPER FILTER 00636 * @{ 00637 */ 00638 #define LL_RTC_TAMPER_FILTER_DISABLE 0x00000000U /*!< Tamper filter is disabled */ 00639 #define LL_RTC_TAMPER_FILTER_2SAMPLE RTC_TAMPCR_TAMPFLT_0 /*!< Tamper is activated after 2 consecutive samples at the active level */ 00640 #define LL_RTC_TAMPER_FILTER_4SAMPLE RTC_TAMPCR_TAMPFLT_1 /*!< Tamper is activated after 4 consecutive samples at the active level */ 00641 #define LL_RTC_TAMPER_FILTER_8SAMPLE RTC_TAMPCR_TAMPFLT /*!< Tamper is activated after 8 consecutive samples at the active level. */ 00642 /** 00643 * @} 00644 */ 00645 #endif /* RTC_TAMPCR_TAMPFLT */ 00646 00647 #if defined(RTC_TAMPCR_TAMPFREQ) 00648 /** @defgroup RTC_LL_EC_TAMPER_SAMPLFREQDIV TAMPER SAMPLING FREQUENCY DIVIDER 00649 * @{ 00650 */ 00651 #define LL_RTC_TAMPER_SAMPLFREQDIV_32768 0x00000000U /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 32768 */ 00652 #define LL_RTC_TAMPER_SAMPLFREQDIV_16384 RTC_TAMPCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 16384 */ 00653 #define LL_RTC_TAMPER_SAMPLFREQDIV_8192 RTC_TAMPCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 8192 */ 00654 #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 */ 00655 #define LL_RTC_TAMPER_SAMPLFREQDIV_2048 RTC_TAMPCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 2048 */ 00656 #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 */ 00657 #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 */ 00658 #define LL_RTC_TAMPER_SAMPLFREQDIV_256 RTC_TAMPCR_TAMPFREQ /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 256 */ 00659 /** 00660 * @} 00661 */ 00662 #endif /* RTC_TAMPCR_TAMPFREQ */ 00663 00664 /** @defgroup RTC_LL_EC_TAMPER_ACTIVELEVEL TAMPER ACTIVE LEVEL 00665 * @{ 00666 */ 00667 #if defined(RTC_TAMPER1_SUPPORT) 00668 #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*/ 00669 #endif /* RTC_TAMPER1_SUPPORT */ 00670 #if defined(RTC_TAMPER2_SUPPORT) 00671 #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*/ 00672 #endif /* RTC_TAMPER2_SUPPORT */ 00673 #if defined(RTC_TAMPER3_SUPPORT) 00674 #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*/ 00675 #endif /* RTC_TAMPER3_SUPPORT */ 00676 /** 00677 * @} 00678 */ 00679 00680 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00681 00682 /** @defgroup RTC_LL_EC_WAKEUPCLOCK_DIV WAKEUP CLOCK DIV 00683 * @{ 00684 */ 00685 #define LL_RTC_WAKEUPCLOCK_DIV_16 0x00000000U /*!< RTC/16 clock is selected */ 00686 #define LL_RTC_WAKEUPCLOCK_DIV_8 RTC_CR_WUCKSEL_0 /*!< RTC/8 clock is selected */ 00687 #define LL_RTC_WAKEUPCLOCK_DIV_4 RTC_CR_WUCKSEL_1 /*!< RTC/4 clock is selected */ 00688 #define LL_RTC_WAKEUPCLOCK_DIV_2 (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_0) /*!< RTC/2 clock is selected */ 00689 #define LL_RTC_WAKEUPCLOCK_CKSPRE RTC_CR_WUCKSEL_2 /*!< ck_spre (usually 1 Hz) clock is selected */ 00690 #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*/ 00691 /** 00692 * @} 00693 */ 00694 00695 #if defined(RTC_BACKUP_SUPPORT) 00696 /** @defgroup RTC_LL_EC_BKP BACKUP 00697 * @{ 00698 */ 00699 #define LL_RTC_BKP_DR0 0x00000000U 00700 #define LL_RTC_BKP_DR1 0x00000001U 00701 #define LL_RTC_BKP_DR2 0x00000002U 00702 #define LL_RTC_BKP_DR3 0x00000003U 00703 #define LL_RTC_BKP_DR4 0x00000004U 00704 #if RTC_BKP_NUMBER > 5 00705 #define LL_RTC_BKP_DR5 0x00000005U 00706 #define LL_RTC_BKP_DR6 0x00000006U 00707 #define LL_RTC_BKP_DR7 0x00000007U 00708 #define LL_RTC_BKP_DR8 0x00000008U 00709 #define LL_RTC_BKP_DR9 0x00000009U 00710 #define LL_RTC_BKP_DR10 0x0000000AU 00711 #define LL_RTC_BKP_DR11 0x0000000BU 00712 #define LL_RTC_BKP_DR12 0x0000000CU 00713 #define LL_RTC_BKP_DR13 0x0000000DU 00714 #define LL_RTC_BKP_DR14 0x0000000EU 00715 #define LL_RTC_BKP_DR15 0x0000000FU 00716 #endif /* RTC_BKP_NUMBER > 5 */ 00717 00718 #if RTC_BKP_NUMBER > 16 00719 #define LL_RTC_BKP_DR16 0x00000010U 00720 #define LL_RTC_BKP_DR17 0x00000011U 00721 #define LL_RTC_BKP_DR18 0x00000012U 00722 #define LL_RTC_BKP_DR19 0x00000013U 00723 #endif /* RTC_BKP_NUMBER > 16 */ 00724 00725 #if RTC_BKP_NUMBER > 20 00726 #define LL_RTC_BKP_DR20 0x00000014U 00727 #define LL_RTC_BKP_DR21 0x00000015U 00728 #define LL_RTC_BKP_DR22 0x00000016U 00729 #define LL_RTC_BKP_DR23 0x00000017U 00730 #define LL_RTC_BKP_DR24 0x00000018U 00731 #define LL_RTC_BKP_DR25 0x00000019U 00732 #define LL_RTC_BKP_DR26 0x0000001AU 00733 #define LL_RTC_BKP_DR27 0x0000001BU 00734 #define LL_RTC_BKP_DR28 0x0000001CU 00735 #define LL_RTC_BKP_DR29 0x0000001DU 00736 #define LL_RTC_BKP_DR30 0x0000001EU 00737 #define LL_RTC_BKP_DR31 0x0000001FU 00738 #endif /* RTC_BKP_NUMBER > 20 */ 00739 /** 00740 * @} 00741 */ 00742 #endif /* RTC_BACKUP_SUPPORT */ 00743 00744 /** @defgroup RTC_LL_EC_CALIB_OUTPUT Calibration output 00745 * @{ 00746 */ 00747 #define LL_RTC_CALIB_OUTPUT_NONE 0x00000000U /*!< Calibration output disabled */ 00748 #define LL_RTC_CALIB_OUTPUT_1HZ (RTC_CR_COE | RTC_CR_COSEL) /*!< Calibration output is 1 Hz */ 00749 #define LL_RTC_CALIB_OUTPUT_512HZ RTC_CR_COE /*!< Calibration output is 512 Hz */ 00750 /** 00751 * @} 00752 */ 00753 00754 /** @defgroup RTC_LL_EC_CALIB_INSERTPULSE Calibration pulse insertion 00755 * @{ 00756 */ 00757 #define LL_RTC_CALIB_INSERTPULSE_NONE 0x00000000U /*!< No RTCCLK pulses are added */ 00758 #define LL_RTC_CALIB_INSERTPULSE_SET RTC_CALR_CALP /*!< One RTCCLK pulse is effectively inserted every 2exp11 pulses (frequency increased by 488.5 ppm) */ 00759 /** 00760 * @} 00761 */ 00762 00763 /** @defgroup RTC_LL_EC_CALIB_PERIOD Calibration period 00764 * @{ 00765 */ 00766 #define LL_RTC_CALIB_PERIOD_32SEC 0x00000000U /*!< Use a 32-second calibration cycle period */ 00767 #define LL_RTC_CALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< Use a 16-second calibration cycle period */ 00768 #define LL_RTC_CALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< Use a 8-second calibration cycle period */ 00769 /** 00770 * @} 00771 */ 00772 00773 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00774 /** @defgroup RTC_LL_EC_CALIB_LOWPOWER Calibration low power 00775 * @{ 00776 */ 00777 #define LL_RTC_CALIB_LOWPOWER_NONE 0x00000000U /*!< High conso mode */ 00778 #define LL_RTC_CALIB_LOWPOWER_SET RTC_CALR_LPCAL /*!< low power mode */ 00779 /** 00780 * @} 00781 */ 00782 00783 /** @defgroup RTC_LL_EC_BINARY_MODE Binary mode (Sub Second Register) 00784 * @{ 00785 */ 00786 #define LL_RTC_BINARY_NONE 0x00000000U /*!< Free running BCD calendar mode (Binary mode disabled). */ 00787 #define LL_RTC_BINARY_ONLY RTC_ICSR_BIN_0 /*!< Free running Binary mode (BCD mode disabled) */ 00788 #define LL_RTC_BINARY_MIX RTC_ICSR_BIN_1 /*!< Free running BCD calendar and Binary mode enable */ 00789 /** 00790 * @} 00791 */ 00792 00793 /** @defgroup RTC_LL_EC_BINARY_MIX_BCDU Calendar second incrementation in Binary mix mode 00794 * @{ 00795 */ 00796 #define LL_RTC_BINARY_MIX_BCDU_0 0x00000000u /*!< 1s calendar increment is generated each time SS[7:0] = 0 */ 00797 #define LL_RTC_BINARY_MIX_BCDU_1 (0x1UL << RTC_ICSR_BCDU_Pos) /*!< 1s calendar increment is generated each time SS[8:0] = 0 */ 00798 #define LL_RTC_BINARY_MIX_BCDU_2 (0x2UL << RTC_ICSR_BCDU_Pos) /*!< 1s calendar increment is generated each time SS[9:0] = 0 */ 00799 #define LL_RTC_BINARY_MIX_BCDU_3 (0x3UL << RTC_ICSR_BCDU_Pos) /*!< 1s calendar increment is generated each time SS[10:0] = 0 */ 00800 #define LL_RTC_BINARY_MIX_BCDU_4 (0x4UL << RTC_ICSR_BCDU_Pos) /*!< 1s calendar increment is generated each time SS[11:0] = 0 */ 00801 #define LL_RTC_BINARY_MIX_BCDU_5 (0x5UL << RTC_ICSR_BCDU_Pos) /*!< 1s calendar increment is generated each time SS[12:0] = 0 */ 00802 #define LL_RTC_BINARY_MIX_BCDU_6 (0x6UL << RTC_ICSR_BCDU_Pos) /*!< 1s calendar increment is generated each time SS[13:0] = 0 */ 00803 #define LL_RTC_BINARY_MIX_BCDU_7 (0x7UL << RTC_ICSR_BCDU_Pos) /*!< 1s calendar increment is generated each time SS[14:0] = 0 */ 00804 /** 00805 * @} 00806 */ 00807 #endif /* #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00808 00809 /** 00810 * @} 00811 */ 00812 00813 /* Exported macro ------------------------------------------------------------*/ 00814 /** @defgroup RTC_LL_Exported_Macros RTC Exported Macros 00815 * @{ 00816 */ 00817 00818 /** @defgroup RTC_LL_EM_WRITE_READ Common Write and read registers Macros 00819 * @{ 00820 */ 00821 00822 /** 00823 * @brief Write a value in RTC register 00824 * @param __INSTANCE__ RTC Instance 00825 * @param __REG__ Register to be written 00826 * @param __VALUE__ Value to be written in the register 00827 * @retval None 00828 */ 00829 #define LL_RTC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) 00830 00831 /** 00832 * @brief Read a value in RTC register 00833 * @param __INSTANCE__ RTC Instance 00834 * @param __REG__ Register to be read 00835 * @retval Register value 00836 */ 00837 #define LL_RTC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) 00838 /** 00839 * @} 00840 */ 00841 00842 /** @defgroup RTC_LL_EM_Convert Convert helper Macros 00843 * @{ 00844 */ 00845 00846 /** 00847 * @brief Helper macro to convert a value from 2 digit decimal format to BCD format 00848 * @param __VALUE__ Byte to be converted 00849 * @retval Converted byte 00850 */ 00851 #define __LL_RTC_CONVERT_BIN2BCD(__VALUE__) (uint8_t)((((__VALUE__) / 10U) << 4U) | ((__VALUE__) % 10U)) 00852 00853 /** 00854 * @brief Helper macro to convert a value from BCD format to 2 digit decimal format 00855 * @param __VALUE__ BCD value to be converted 00856 * @retval Converted byte 00857 */ 00858 #define __LL_RTC_CONVERT_BCD2BIN(__VALUE__) (uint8_t)(((uint8_t)((__VALUE__) & (uint8_t)0xF0U) >> (uint8_t)0x4U) * 10U + ((__VALUE__) & (uint8_t)0x0FU)) 00859 00860 /** 00861 * @} 00862 */ 00863 00864 /** @defgroup RTC_LL_EM_Date Date helper Macros 00865 * @{ 00866 */ 00867 00868 /** 00869 * @brief Helper macro to retrieve weekday. 00870 * @param __RTC_DATE__ Date returned by @ref LL_RTC_DATE_Get function. 00871 * @retval Returned value can be one of the following values: 00872 * @arg @ref LL_RTC_WEEKDAY_MONDAY 00873 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 00874 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 00875 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 00876 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 00877 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 00878 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 00879 */ 00880 #define __LL_RTC_GET_WEEKDAY(__RTC_DATE__) (((__RTC_DATE__) >> RTC_OFFSET_WEEKDAY) & 0x000000FFU) 00881 00882 /** 00883 * @brief Helper macro to retrieve Year in BCD format 00884 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get 00885 * @retval Year in BCD format (0x00 . . . 0x99) 00886 */ 00887 #define __LL_RTC_GET_YEAR(__RTC_DATE__) ((__RTC_DATE__) & 0x000000FFU) 00888 00889 /** 00890 * @brief Helper macro to retrieve Month in BCD format 00891 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get 00892 * @retval Returned value can be one of the following values: 00893 * @arg @ref LL_RTC_MONTH_JANUARY 00894 * @arg @ref LL_RTC_MONTH_FEBRUARY 00895 * @arg @ref LL_RTC_MONTH_MARCH 00896 * @arg @ref LL_RTC_MONTH_APRIL 00897 * @arg @ref LL_RTC_MONTH_MAY 00898 * @arg @ref LL_RTC_MONTH_JUNE 00899 * @arg @ref LL_RTC_MONTH_JULY 00900 * @arg @ref LL_RTC_MONTH_AUGUST 00901 * @arg @ref LL_RTC_MONTH_SEPTEMBER 00902 * @arg @ref LL_RTC_MONTH_OCTOBER 00903 * @arg @ref LL_RTC_MONTH_NOVEMBER 00904 * @arg @ref LL_RTC_MONTH_DECEMBER 00905 */ 00906 #define __LL_RTC_GET_MONTH(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_MONTH) & 0x000000FFU) 00907 00908 /** 00909 * @brief Helper macro to retrieve Day in BCD format 00910 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get 00911 * @retval Day in BCD format (0x01 . . . 0x31) 00912 */ 00913 #define __LL_RTC_GET_DAY(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_DAY) & 0x000000FFU) 00914 00915 /** 00916 * @} 00917 */ 00918 00919 /** @defgroup RTC_LL_EM_Time Time helper Macros 00920 * @{ 00921 */ 00922 00923 /** 00924 * @brief Helper macro to retrieve hour in BCD format 00925 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function 00926 * @retval Hours in BCD format (0x01. . .0x12 or between Min_Data=0x00 and Max_Data=0x23) 00927 */ 00928 #define __LL_RTC_GET_HOUR(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_HOUR) & 0x000000FFU) 00929 00930 /** 00931 * @brief Helper macro to retrieve minute in BCD format 00932 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function 00933 * @retval Minutes in BCD format (0x00. . .0x59) 00934 */ 00935 #define __LL_RTC_GET_MINUTE(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_MINUTE) & 0x000000FFU) 00936 00937 /** 00938 * @brief Helper macro to retrieve second in BCD format 00939 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function 00940 * @retval Seconds in format (0x00. . .0x59) 00941 */ 00942 #define __LL_RTC_GET_SECOND(__RTC_TIME__) ((__RTC_TIME__) & 0x000000FFU) 00943 00944 /** 00945 * @} 00946 */ 00947 00948 /** 00949 * @} 00950 */ 00951 00952 /* Exported functions --------------------------------------------------------*/ 00953 /** @defgroup RTC_LL_Exported_Functions RTC Exported Functions 00954 * @{ 00955 */ 00956 00957 /** @defgroup RTC_LL_EF_Configuration Configuration 00958 * @{ 00959 */ 00960 00961 /** 00962 * @brief Set Hours format (24 hour/day or AM/PM hour format) 00963 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 00964 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 00965 * @rmtoll RTC_CR FMT LL_RTC_SetHourFormat 00966 * @param RTCx RTC Instance 00967 * @param HourFormat This parameter can be one of the following values: 00968 * @arg @ref LL_RTC_HOURFORMAT_24HOUR 00969 * @arg @ref LL_RTC_HOURFORMAT_AMPM 00970 * @retval None 00971 */ 00972 __STATIC_INLINE void LL_RTC_SetHourFormat(RTC_TypeDef *RTCx, uint32_t HourFormat) 00973 { 00974 MODIFY_REG(RTCx->CR, RTC_CR_FMT, HourFormat); 00975 } 00976 00977 /** 00978 * @brief Get Hours format (24 hour/day or AM/PM hour format) 00979 * @rmtoll RTC_CR FMT LL_RTC_GetHourFormat 00980 * @param RTCx RTC Instance 00981 * @retval Returned value can be one of the following values: 00982 * @arg @ref LL_RTC_HOURFORMAT_24HOUR 00983 * @arg @ref LL_RTC_HOURFORMAT_AMPM 00984 */ 00985 __STATIC_INLINE uint32_t LL_RTC_GetHourFormat(RTC_TypeDef *RTCx) 00986 { 00987 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_FMT)); 00988 } 00989 00990 /** 00991 * @brief Select the flag to be routed to RTC_ALARM output 00992 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 00993 * @rmtoll RTC_CR OSEL LL_RTC_SetAlarmOutEvent 00994 * @param RTCx RTC Instance 00995 * @param AlarmOutput This parameter can be one of the following values: 00996 * @arg @ref LL_RTC_ALARMOUT_DISABLE 00997 * @arg @ref LL_RTC_ALARMOUT_ALMA 00998 * @arg @ref LL_RTC_ALARMOUT_ALMB 00999 * @arg @ref LL_RTC_ALARMOUT_WAKEUP 01000 * @retval None 01001 */ 01002 __STATIC_INLINE void LL_RTC_SetAlarmOutEvent(RTC_TypeDef *RTCx, uint32_t AlarmOutput) 01003 { 01004 MODIFY_REG(RTCx->CR, RTC_CR_OSEL, AlarmOutput); 01005 } 01006 01007 /** 01008 * @brief Get the flag to be routed to RTC_ALARM output 01009 * @rmtoll RTC_CR OSEL LL_RTC_GetAlarmOutEvent 01010 * @param RTCx RTC Instance 01011 * @retval Returned value can be one of the following values: 01012 * @arg @ref LL_RTC_ALARMOUT_DISABLE 01013 * @arg @ref LL_RTC_ALARMOUT_ALMA 01014 * @arg @ref LL_RTC_ALARMOUT_ALMB 01015 * @arg @ref LL_RTC_ALARMOUT_WAKEUP 01016 */ 01017 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutEvent(RTC_TypeDef *RTCx) 01018 { 01019 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_OSEL)); 01020 } 01021 01022 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01023 /** 01024 * @brief Set RTC_ALARM output type (ALARM in push-pull or open-drain output) 01025 * @rmtoll RTC_CR TAMPALRM_TYPE LL_RTC_SetAlarmOutputType 01026 * @param RTCx RTC Instance 01027 * @param Output This parameter can be one of the following values: 01028 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN 01029 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL 01030 * @retval None 01031 */ 01032 __STATIC_INLINE void LL_RTC_SetAlarmOutputType(RTC_TypeDef *RTCx, uint32_t Output) 01033 { 01034 MODIFY_REG(RTCx->CR, RTC_CR_TAMPALRM_TYPE, Output); 01035 } 01036 01037 /** 01038 * @brief Get RTC_ALARM output type (ALARM in push-pull or open-drain output) 01039 * @rmtoll RTC_CR TAMPALRM_TYPE LL_RTC_SetAlarmOutputType 01040 * @param RTCx RTC Instance 01041 * @retval Returned value can be one of the following values: 01042 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN 01043 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL 01044 */ 01045 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutputType(RTC_TypeDef *RTCx) 01046 { 01047 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TAMPALRM_TYPE)); 01048 } 01049 01050 /** 01051 * @brief Enable initialization mode 01052 * @note Initialization mode is used to program time and date register (RTC_TR and RTC_DR) 01053 * and prescaler register (RTC_PRER). 01054 * Counters are stopped and start counting from the new value when INIT is reset. 01055 * @rmtoll RTC_ICSR INIT LL_RTC_EnableInitMode 01056 * @param RTCx RTC Instance 01057 * @retval None 01058 */ 01059 __STATIC_INLINE void LL_RTC_EnableInitMode(RTC_TypeDef *RTCx) 01060 { 01061 /* Set the Initialization mode */ 01062 SET_BIT(RTCx->ICSR, RTC_ICSR_INIT); 01063 } 01064 01065 /** 01066 * @brief Disable initialization mode (Free running mode) 01067 * @rmtoll RTC_ICSR INIT LL_RTC_DisableInitMode 01068 * @param RTCx RTC Instance 01069 * @retval None 01070 */ 01071 __STATIC_INLINE void LL_RTC_DisableInitMode(RTC_TypeDef *RTCx) 01072 { 01073 /* Exit Initialization mode */ 01074 CLEAR_BIT(RTCx->ICSR, RTC_ICSR_INIT); 01075 } 01076 01077 #else /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 01078 01079 /** 01080 * @brief Set RTC_ALARM output type (ALARM in push-pull or open-drain output) 01081 * @note Used only when RTC_ALARM is mapped on PC13 01082 * @rmtoll OR ALARMOUTTYPE LL_RTC_SetAlarmOutputType 01083 * @param RTCx RTC Instance 01084 * @param Output This parameter can be one of the following values: 01085 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN 01086 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL 01087 * @retval None 01088 */ 01089 __STATIC_INLINE void LL_RTC_SetAlarmOutputType(RTC_TypeDef *RTCx, uint32_t Output) 01090 { 01091 MODIFY_REG(RTCx->OR, RTC_OR_ALARMOUTTYPE, Output); 01092 } 01093 01094 /** 01095 * @brief Get RTC_ALARM output type (ALARM in push-pull or open-drain output) 01096 * @note used only when RTC_ALARM is mapped on PC13 01097 * @rmtoll OR ALARMOUTTYPE LL_RTC_GetAlarmOutputType 01098 * @param RTCx RTC Instance 01099 * @retval Returned value can be one of the following values: 01100 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN 01101 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL 01102 */ 01103 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutputType(RTC_TypeDef *RTCx) 01104 { 01105 return (uint32_t)(READ_BIT(RTCx->OR, RTC_OR_ALARMOUTTYPE)); 01106 } 01107 01108 /** 01109 * @brief Enable initialization mode 01110 * @note Initialization mode is used to program time and date register (RTC_TR and RTC_DR) 01111 * and prescaler register (RTC_PRER). 01112 * Counters are stopped and start counting from the new value when INIT is reset. 01113 * @rmtoll ISR INIT LL_RTC_EnableInitMode 01114 * @param RTCx RTC Instance 01115 * @retval None 01116 */ 01117 __STATIC_INLINE void LL_RTC_EnableInitMode(RTC_TypeDef *RTCx) 01118 { 01119 /* Set the Initialization mode */ 01120 WRITE_REG(RTCx->ISR, RTC_LL_INIT_MASK); 01121 } 01122 01123 /** 01124 * @brief Disable initialization mode (Free running mode) 01125 * @rmtoll ISR INIT LL_RTC_DisableInitMode 01126 * @param RTCx RTC Instance 01127 * @retval None 01128 */ 01129 __STATIC_INLINE void LL_RTC_DisableInitMode(RTC_TypeDef *RTCx) 01130 { 01131 /* Exit Initialization mode */ 01132 WRITE_REG(RTCx->ISR, (uint32_t)~RTC_ISR_INIT); 01133 } 01134 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 01135 01136 01137 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01138 /** 01139 * @brief Set Binary mode (Sub Second Register) 01140 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01141 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function). 01142 * @rmtoll RTC_ICSR BIN LL_RTC_SetBinaryMode 01143 * @param RTCx RTC Instance 01144 * @param BinaryMode can be one of the following values: 01145 * @arg @ref LL_RTC_BINARY_NONE 01146 * @arg @ref LL_RTC_BINARY_ONLY 01147 * @arg @ref LL_RTC_BINARY_BINARY_MIX 01148 * @retval None 01149 */ 01150 __STATIC_INLINE void LL_RTC_SetBinaryMode(RTC_TypeDef *RTCx, uint32_t BinaryMode) 01151 { 01152 MODIFY_REG(RTCx->ICSR, RTC_ICSR_BIN, BinaryMode); 01153 } 01154 01155 /** 01156 * @brief Get Binary mode (Sub Second Register) 01157 * @rmtoll RTC_ICSR BIN LL_RTC_GetBinaryMode 01158 * @param RTCx RTC Instance 01159 * @retval This parameter can be one of the following values: 01160 * @arg @ref LL_RTC_BINARY_NONE 01161 * @arg @ref LL_RTC_BINARY_ONLY 01162 * @arg @ref LL_RTC_BINARY_BINARY_MIX 01163 * @retval None 01164 */ 01165 __STATIC_INLINE uint32_t LL_RTC_GetBinaryMode(RTC_TypeDef *RTCx) 01166 { 01167 return (uint32_t)(READ_BIT(RTCx->ICSR, RTC_ICSR_BIN)); 01168 } 01169 01170 /** 01171 * @brief Set Binary Mix mode BCDU 01172 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01173 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function). 01174 * @rmtoll RTC_ICSR BCDU LL_RTC_SetBinMixBCDU 01175 * @param RTCx RTC Instance 01176 * @param BinMixBcdU can be one of the following values: 01177 * @arg @ref LL_RTC_BINARY_MIX_BCDU_0 01178 * @arg @ref LL_RTC_BINARY_MIX_BCDU_1 01179 * @arg @ref LL_RTC_BINARY_MIX_BCDU_2 01180 * @arg @ref LL_RTC_BINARY_MIX_BCDU_3 01181 * @arg @ref LL_RTC_BINARY_MIX_BCDU_4 01182 * @arg @ref LL_RTC_BINARY_MIX_BCDU_5 01183 * @arg @ref LL_RTC_BINARY_MIX_BCDU_6 01184 * @arg @ref LL_RTC_BINARY_MIX_BCDU_7 01185 * @retval None 01186 */ 01187 __STATIC_INLINE void LL_RTC_SetBinMixBCDU(RTC_TypeDef *RTCx, uint32_t BinMixBcdU) 01188 { 01189 MODIFY_REG(RTCx->ICSR, RTC_ICSR_BCDU, BinMixBcdU); 01190 } 01191 01192 /** 01193 * @brief Get Binary Mix mode BCDU 01194 * @rmtoll RTC_ICSR BCDU LL_RTC_GetBinMixBCDU 01195 * @param RTCx RTC Instance 01196 * @retval This parameter can be one of the following values: 01197 * @arg @ref LL_RTC_BINARY_MIX_BCDU_0 01198 * @arg @ref LL_RTC_BINARY_MIX_BCDU_1 01199 * @arg @ref LL_RTC_BINARY_MIX_BCDU_2 01200 * @arg @ref LL_RTC_BINARY_MIX_BCDU_3 01201 * @arg @ref LL_RTC_BINARY_MIX_BCDU_4 01202 * @arg @ref LL_RTC_BINARY_MIX_BCDU_5 01203 * @arg @ref LL_RTC_BINARY_MIX_BCDU_6 01204 * @arg @ref LL_RTC_BINARY_MIX_BCDU_7 01205 * @retval None 01206 */ 01207 __STATIC_INLINE uint32_t LL_RTC_GetBinMixBCDU(RTC_TypeDef *RTCx) 01208 { 01209 return (uint32_t)(READ_BIT(RTCx->ICSR, RTC_ICSR_BCDU)); 01210 } 01211 #endif /* #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 01212 01213 01214 /** 01215 * @brief Set Output polarity (pin is low when ALRAF/ALRBF/WUTF is asserted) 01216 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01217 * @rmtoll RTC_CR POL LL_RTC_SetOutputPolarity 01218 * @param RTCx RTC Instance 01219 * @param Polarity This parameter can be one of the following values: 01220 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH 01221 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW 01222 * @retval None 01223 */ 01224 __STATIC_INLINE void LL_RTC_SetOutputPolarity(RTC_TypeDef *RTCx, uint32_t Polarity) 01225 { 01226 MODIFY_REG(RTCx->CR, RTC_CR_POL, Polarity); 01227 } 01228 01229 /** 01230 * @brief Get Output polarity 01231 * @rmtoll RTC_CR POL LL_RTC_GetOutputPolarity 01232 * @param RTCx RTC Instance 01233 * @retval Returned value can be one of the following values: 01234 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH 01235 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW 01236 */ 01237 __STATIC_INLINE uint32_t LL_RTC_GetOutputPolarity(RTC_TypeDef *RTCx) 01238 { 01239 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_POL)); 01240 } 01241 01242 /** 01243 * @brief Enable Bypass the shadow registers 01244 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01245 * @rmtoll RTC_CR BYPSHAD LL_RTC_EnableShadowRegBypass 01246 * @param RTCx RTC Instance 01247 * @retval None 01248 */ 01249 __STATIC_INLINE void LL_RTC_EnableShadowRegBypass(RTC_TypeDef *RTCx) 01250 { 01251 SET_BIT(RTCx->CR, RTC_CR_BYPSHAD); 01252 } 01253 01254 /** 01255 * @brief Disable Bypass the shadow registers 01256 * @rmtoll RTC_CR BYPSHAD LL_RTC_DisableShadowRegBypass 01257 * @param RTCx RTC Instance 01258 * @retval None 01259 */ 01260 __STATIC_INLINE void LL_RTC_DisableShadowRegBypass(RTC_TypeDef *RTCx) 01261 { 01262 CLEAR_BIT(RTCx->CR, RTC_CR_BYPSHAD); 01263 } 01264 01265 /** 01266 * @brief Check if Shadow registers bypass is enabled or not. 01267 * @rmtoll RTC_CR BYPSHAD LL_RTC_IsShadowRegBypassEnabled 01268 * @param RTCx RTC Instance 01269 * @retval State of bit (1 or 0). 01270 */ 01271 __STATIC_INLINE uint32_t LL_RTC_IsShadowRegBypassEnabled(RTC_TypeDef *RTCx) 01272 { 01273 return (READ_BIT(RTCx->CR, RTC_CR_BYPSHAD) == (RTC_CR_BYPSHAD)); 01274 } 01275 01276 /** 01277 * @brief Enable RTC_REFIN reference clock detection (50 or 60 Hz) 01278 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01279 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 01280 * @rmtoll RTC_CR REFCKON LL_RTC_EnableRefClock 01281 * @param RTCx RTC Instance 01282 * @retval None 01283 */ 01284 __STATIC_INLINE void LL_RTC_EnableRefClock(RTC_TypeDef *RTCx) 01285 { 01286 SET_BIT(RTCx->CR, RTC_CR_REFCKON); 01287 } 01288 01289 /** 01290 * @brief Disable RTC_REFIN reference clock detection (50 or 60 Hz) 01291 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01292 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 01293 * @rmtoll RTC_CR REFCKON LL_RTC_DisableRefClock 01294 * @param RTCx RTC Instance 01295 * @retval None 01296 */ 01297 __STATIC_INLINE void LL_RTC_DisableRefClock(RTC_TypeDef *RTCx) 01298 { 01299 CLEAR_BIT(RTCx->CR, RTC_CR_REFCKON); 01300 } 01301 01302 /** 01303 * @brief Set Asynchronous prescaler factor 01304 * @rmtoll RTC_PRER PREDIV_A LL_RTC_SetAsynchPrescaler 01305 * @param RTCx RTC Instance 01306 * @param AsynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7F 01307 * @retval None 01308 */ 01309 __STATIC_INLINE void LL_RTC_SetAsynchPrescaler(RTC_TypeDef *RTCx, uint32_t AsynchPrescaler) 01310 { 01311 MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_A, AsynchPrescaler << RTC_PRER_PREDIV_A_Pos); 01312 } 01313 01314 /** 01315 * @brief Set Synchronous prescaler factor 01316 * @rmtoll RTC_PRER PREDIV_S LL_RTC_SetSynchPrescaler 01317 * @param RTCx RTC Instance 01318 * @param SynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7FFF 01319 * @retval None 01320 */ 01321 __STATIC_INLINE void LL_RTC_SetSynchPrescaler(RTC_TypeDef *RTCx, uint32_t SynchPrescaler) 01322 { 01323 MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_S, SynchPrescaler); 01324 } 01325 01326 /** 01327 * @brief Get Asynchronous prescaler factor 01328 * @rmtoll RTC_PRER PREDIV_A LL_RTC_GetAsynchPrescaler 01329 * @param RTCx RTC Instance 01330 * @retval Value between Min_Data = 0 and Max_Data = 0x7F 01331 */ 01332 __STATIC_INLINE uint32_t LL_RTC_GetAsynchPrescaler(RTC_TypeDef *RTCx) 01333 { 01334 return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_A) >> RTC_PRER_PREDIV_A_Pos); 01335 } 01336 01337 /** 01338 * @brief Get Synchronous prescaler factor 01339 * @rmtoll RTC_PRER PREDIV_S LL_RTC_GetSynchPrescaler 01340 * @param RTCx RTC Instance 01341 * @retval Value between Min_Data = 0 and Max_Data = 0x7FFF 01342 */ 01343 __STATIC_INLINE uint32_t LL_RTC_GetSynchPrescaler(RTC_TypeDef *RTCx) 01344 { 01345 return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_S)); 01346 } 01347 01348 /** 01349 * @brief Enable the write protection for RTC registers. 01350 * @rmtoll RTC_WPR KEY LL_RTC_EnableWriteProtection 01351 * @param RTCx RTC Instance 01352 * @retval None 01353 */ 01354 __STATIC_INLINE void LL_RTC_EnableWriteProtection(RTC_TypeDef *RTCx) 01355 { 01356 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_DISABLE); 01357 } 01358 01359 /** 01360 * @brief Disable the write protection for RTC registers. 01361 * @rmtoll RTC_WPR KEY LL_RTC_DisableWriteProtection 01362 * @param RTCx RTC Instance 01363 * @retval None 01364 */ 01365 __STATIC_INLINE void LL_RTC_DisableWriteProtection(RTC_TypeDef *RTCx) 01366 { 01367 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_1); 01368 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_2); 01369 } 01370 01371 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01372 /** 01373 * @brief Enable tamper output. 01374 * @note When the tamper output is enabled, all external and internal tamper flags 01375 * are ORed and routed to the TAMPALRM output. 01376 * @rmtoll RTC_CR TAMPOE LL_RTC_EnableTamperOutput 01377 * @param RTCx RTC Instance 01378 * @retval None 01379 */ 01380 __STATIC_INLINE void LL_RTC_EnableTamperOutput(RTC_TypeDef *RTCx) 01381 { 01382 SET_BIT(RTCx->CR, RTC_CR_TAMPOE); 01383 } 01384 01385 /** 01386 * @brief Disable tamper output. 01387 * @rmtoll RTC_CR TAMPOE LL_RTC_DisableTamperOutput 01388 * @param RTCx RTC Instance 01389 * @retval None 01390 */ 01391 __STATIC_INLINE void LL_RTC_DisableTamperOutput(RTC_TypeDef *RTCx) 01392 { 01393 CLEAR_BIT(RTCx->CR, RTC_CR_TAMPOE); 01394 } 01395 01396 /** 01397 * @brief Check if tamper output is enabled or not. 01398 * @rmtoll RTC_CR TAMPOE LL_RTC_IsTamperOutputEnabled 01399 * @param RTCx RTC Instance 01400 * @retval State of bit (1 or 0). 01401 */ 01402 __STATIC_INLINE uint32_t LL_RTC_IsTamperOutputEnabled(RTC_TypeDef *RTCx) 01403 { 01404 return (READ_BIT(RTCx->CR, RTC_CR_TAMPOE) == (RTC_CR_TAMPOE)); 01405 } 01406 01407 /** 01408 * @brief Enable internal pull-up in output mode. 01409 * @rmtoll RTC_CR TAMPALRM_PU LL_RTC_EnableAlarmPullUp 01410 * @param RTCx RTC Instance 01411 * @retval None 01412 */ 01413 __STATIC_INLINE void LL_RTC_EnableAlarmPullUp(RTC_TypeDef *RTCx) 01414 { 01415 SET_BIT(RTCx->CR, RTC_CR_TAMPALRM_PU); 01416 } 01417 01418 /** 01419 * @brief Disable internal pull-up in output mode. 01420 * @rmtoll RTC_CR TAMPALRM_PU LL_RTC_EnableAlarmPullUp 01421 * @param RTCx RTC Instance 01422 * @retval None 01423 */ 01424 __STATIC_INLINE void LL_RTC_DisableAlarmPullUp(RTC_TypeDef *RTCx) 01425 { 01426 CLEAR_BIT(RTCx->CR, RTC_CR_TAMPALRM_PU); 01427 } 01428 01429 /** 01430 * @brief Check if internal pull-up in output mode is enabled or not. 01431 * @rmtoll RTC_CR TAMPALRM_PU LL_RTC_IsAlarmPullUpEnabled 01432 * @param RTCx RTC Instance 01433 * @retval State of bit (1 or 0). 01434 */ 01435 __STATIC_INLINE uint32_t LL_RTC_IsAlarmPullUpEnabled(RTC_TypeDef *RTCx) 01436 { 01437 return (READ_BIT(RTCx->CR, RTC_CR_TAMPALRM_PU) == (RTC_CR_TAMPALRM_PU)); 01438 } 01439 01440 /** 01441 * @brief Enable RTC_OUT2 output 01442 * @note RTC_OUT2 mapping depends on both OSEL (@ref LL_RTC_SetAlarmOutEvent) 01443 * and COE (@ref LL_RTC_CAL_SetOutputFreq) settings. 01444 * @note RTC_OUT2 isn't available ins VBAT mode. 01445 * @rmtoll RTC_CR OUT2EN LL_RTC_EnableOutput2 01446 * @param RTCx RTC Instance 01447 * @retval None 01448 */ 01449 __STATIC_INLINE void LL_RTC_EnableOutput2(RTC_TypeDef *RTCx) 01450 { 01451 SET_BIT(RTCx->CR, RTC_CR_OUT2EN); 01452 } 01453 01454 /** 01455 * @brief Disable RTC_OUT2 output 01456 * @rmtoll RTC_CR OUT2EN LL_RTC_DisableOutput2 01457 * @param RTCx RTC Instance 01458 * @retval None 01459 */ 01460 __STATIC_INLINE void LL_RTC_DisableOutput2(RTC_TypeDef *RTCx) 01461 { 01462 CLEAR_BIT(RTCx->CR, RTC_CR_OUT2EN); 01463 } 01464 01465 /** 01466 * @brief Check if RTC_OUT2 output is enabled or not. 01467 * @rmtoll RTC_CR OUT2EN LL_RTC_IsOutput2Enabled 01468 * @param RTCx RTC Instance 01469 * @retval State of bit (1 or 0). 01470 */ 01471 __STATIC_INLINE uint32_t LL_RTC_IsOutput2Enabled(RTC_TypeDef *RTCx) 01472 { 01473 return (READ_BIT(RTCx->CR, RTC_CR_OUT2EN) == (RTC_CR_OUT2EN)); 01474 } 01475 01476 #else /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 01477 01478 /** 01479 * @brief Enable RTC_OUT remap 01480 * @rmtoll OR OUT_RMP LL_RTC_EnableOutRemap 01481 * @param RTCx RTC Instance 01482 * @retval None 01483 */ 01484 __STATIC_INLINE void LL_RTC_EnableOutRemap(RTC_TypeDef *RTCx) 01485 { 01486 SET_BIT(RTCx->OR, RTC_OR_OUT_RMP); 01487 } 01488 01489 /** 01490 * @brief Disable RTC_OUT remap 01491 * @rmtoll OR OUT_RMP LL_RTC_DisableOutRemap 01492 * @param RTCx RTC Instance 01493 * @retval None 01494 */ 01495 __STATIC_INLINE void LL_RTC_DisableOutRemap(RTC_TypeDef *RTCx) 01496 { 01497 CLEAR_BIT(RTCx->OR, RTC_OR_OUT_RMP); 01498 } 01499 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 01500 01501 /** 01502 * @} 01503 */ 01504 01505 /** @defgroup RTC_LL_EF_Time Time 01506 * @{ 01507 */ 01508 01509 /** 01510 * @brief Set time format (AM/24-hour or PM notation) 01511 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01512 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 01513 * @rmtoll RTC_TR PM LL_RTC_TIME_SetFormat 01514 * @param RTCx RTC Instance 01515 * @param TimeFormat This parameter can be one of the following values: 01516 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24 01517 * @arg @ref LL_RTC_TIME_FORMAT_PM 01518 * @retval None 01519 */ 01520 __STATIC_INLINE void LL_RTC_TIME_SetFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat) 01521 { 01522 MODIFY_REG(RTCx->TR, RTC_TR_PM, TimeFormat); 01523 } 01524 01525 /** 01526 * @brief Get time format (AM or PM notation) 01527 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01528 * before reading this bit 01529 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar 01530 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). 01531 * @rmtoll RTC_TR PM LL_RTC_TIME_GetFormat 01532 * @param RTCx RTC Instance 01533 * @retval Returned value can be one of the following values: 01534 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24 01535 * @arg @ref LL_RTC_TIME_FORMAT_PM 01536 */ 01537 __STATIC_INLINE uint32_t LL_RTC_TIME_GetFormat(RTC_TypeDef *RTCx) 01538 { 01539 return (uint32_t)(READ_BIT(RTCx->TR, RTC_TR_PM)); 01540 } 01541 01542 /** 01543 * @brief Set Hours in BCD format 01544 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01545 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 01546 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert hour from binary to BCD format 01547 * @rmtoll RTC_TR HT LL_RTC_TIME_SetHour\n 01548 * RTC_TR HU LL_RTC_TIME_SetHour 01549 * @param RTCx RTC Instance 01550 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 01551 * @retval None 01552 */ 01553 __STATIC_INLINE void LL_RTC_TIME_SetHour(RTC_TypeDef *RTCx, uint32_t Hours) 01554 { 01555 MODIFY_REG(RTCx->TR, (RTC_TR_HT | RTC_TR_HU), 01556 (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos))); 01557 } 01558 01559 /** 01560 * @brief Get Hours in BCD format 01561 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01562 * before reading this bit 01563 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar 01564 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). 01565 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert hour from BCD to 01566 * Binary format 01567 * @rmtoll RTC_TR HT LL_RTC_TIME_GetHour\n 01568 * RTC_TR HU LL_RTC_TIME_GetHour 01569 * @param RTCx RTC Instance 01570 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 01571 */ 01572 __STATIC_INLINE uint32_t LL_RTC_TIME_GetHour(RTC_TypeDef *RTCx) 01573 { 01574 return ((READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU))) >> RTC_TR_HU_Pos); 01575 } 01576 01577 /** 01578 * @brief Set Minutes in BCD format 01579 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01580 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 01581 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format 01582 * @rmtoll RTC_TR MNT LL_RTC_TIME_SetMinute\n 01583 * RTC_TR MNU LL_RTC_TIME_SetMinute 01584 * @param RTCx RTC Instance 01585 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 01586 * @retval None 01587 */ 01588 __STATIC_INLINE void LL_RTC_TIME_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes) 01589 { 01590 MODIFY_REG(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU), 01591 (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos))); 01592 } 01593 01594 /** 01595 * @brief Get Minutes in BCD format 01596 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01597 * before reading this bit 01598 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar 01599 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). 01600 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert minute from BCD 01601 * to Binary format 01602 * @rmtoll RTC_TR MNT LL_RTC_TIME_GetMinute\n 01603 * RTC_TR MNU LL_RTC_TIME_GetMinute 01604 * @param RTCx RTC Instance 01605 * @retval Value between Min_Data=0x00 and Max_Data=0x59 01606 */ 01607 __STATIC_INLINE uint32_t LL_RTC_TIME_GetMinute(RTC_TypeDef *RTCx) 01608 { 01609 return ((READ_BIT(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU))) >> RTC_TR_MNU_Pos); 01610 } 01611 01612 /** 01613 * @brief Set Seconds in BCD format 01614 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01615 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 01616 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format 01617 * @rmtoll RTC_TR ST LL_RTC_TIME_SetSecond\n 01618 * RTC_TR SU LL_RTC_TIME_SetSecond 01619 * @param RTCx RTC Instance 01620 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 01621 * @retval None 01622 */ 01623 __STATIC_INLINE void LL_RTC_TIME_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds) 01624 { 01625 MODIFY_REG(RTCx->TR, (RTC_TR_ST | RTC_TR_SU), 01626 (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos))); 01627 } 01628 01629 /** 01630 * @brief Get Seconds in BCD format 01631 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01632 * before reading this bit 01633 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar 01634 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). 01635 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD 01636 * to Binary format 01637 * @rmtoll RTC_TR ST LL_RTC_TIME_GetSecond\n 01638 * RTC_TR SU LL_RTC_TIME_GetSecond 01639 * @param RTCx RTC Instance 01640 * @retval Value between Min_Data=0x00 and Max_Data=0x59 01641 */ 01642 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSecond(RTC_TypeDef *RTCx) 01643 { 01644 return ((READ_BIT(RTCx->TR, (RTC_TR_ST | RTC_TR_SU))) >> RTC_TR_SU_Pos); 01645 } 01646 01647 /** 01648 * @brief Set time (hour, minute and second) in BCD format 01649 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01650 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 01651 * @note TimeFormat and Hours should follow the same format 01652 * @rmtoll RTC_TR PM LL_RTC_TIME_Config\n 01653 * RTC_TR HT LL_RTC_TIME_Config\n 01654 * RTC_TR HU LL_RTC_TIME_Config\n 01655 * RTC_TR MNT LL_RTC_TIME_Config\n 01656 * RTC_TR MNU LL_RTC_TIME_Config\n 01657 * RTC_TR ST LL_RTC_TIME_Config\n 01658 * RTC_TR SU LL_RTC_TIME_Config 01659 * @param RTCx RTC Instance 01660 * @param Format12_24 This parameter can be one of the following values: 01661 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24 01662 * @arg @ref LL_RTC_TIME_FORMAT_PM 01663 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 01664 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 01665 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 01666 * @retval None 01667 */ 01668 __STATIC_INLINE void LL_RTC_TIME_Config(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds) 01669 { 01670 uint32_t temp = 0U; 01671 01672 temp = Format12_24 | \ 01673 (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos)) | \ 01674 (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)) | \ 01675 (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos)); 01676 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); 01677 } 01678 01679 /** 01680 * @brief Get time (hour, minute and second) in BCD format 01681 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01682 * before reading this bit 01683 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar 01684 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). 01685 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND 01686 * are available to get independently each parameter. 01687 * @rmtoll RTC_TR HT LL_RTC_TIME_Get\n 01688 * RTC_TR HU LL_RTC_TIME_Get\n 01689 * RTC_TR MNT LL_RTC_TIME_Get\n 01690 * RTC_TR MNU LL_RTC_TIME_Get\n 01691 * RTC_TR ST LL_RTC_TIME_Get\n 01692 * RTC_TR SU LL_RTC_TIME_Get 01693 * @param RTCx RTC Instance 01694 * @retval Combination of hours, minutes and seconds (Format: 0x00HHMMSS). 01695 */ 01696 __STATIC_INLINE uint32_t LL_RTC_TIME_Get(RTC_TypeDef *RTCx) 01697 { 01698 uint32_t temp = 0U; 01699 01700 temp = READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU)); 01701 return (uint32_t)((((((temp & RTC_TR_HT) >> RTC_TR_HT_Pos) << 4U) | ((temp & RTC_TR_HU) >> RTC_TR_HU_Pos)) << RTC_OFFSET_HOUR) | \ 01702 (((((temp & RTC_TR_MNT) >> RTC_TR_MNT_Pos) << 4U) | ((temp & RTC_TR_MNU) >> RTC_TR_MNU_Pos)) << RTC_OFFSET_MINUTE) | \ 01703 ((((temp & RTC_TR_ST) >> RTC_TR_ST_Pos) << 4U) | ((temp & RTC_TR_SU) >> RTC_TR_SU_Pos))); 01704 } 01705 01706 /** 01707 * @brief Memorize whether the daylight saving time change has been performed 01708 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01709 * @rmtoll RTC_CR BKP LL_RTC_TIME_EnableDayLightStore 01710 * @param RTCx RTC Instance 01711 * @retval None 01712 */ 01713 __STATIC_INLINE void LL_RTC_TIME_EnableDayLightStore(RTC_TypeDef *RTCx) 01714 { 01715 SET_BIT(RTCx->CR, RTC_CR_BKP); 01716 } 01717 01718 /** 01719 * @brief Disable memorization whether the daylight saving time change has been performed. 01720 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01721 * @rmtoll RTC_CR BKP LL_RTC_TIME_DisableDayLightStore 01722 * @param RTCx RTC Instance 01723 * @retval None 01724 */ 01725 __STATIC_INLINE void LL_RTC_TIME_DisableDayLightStore(RTC_TypeDef *RTCx) 01726 { 01727 CLEAR_BIT(RTCx->CR, RTC_CR_BKP); 01728 } 01729 01730 /** 01731 * @brief Check if RTC Day Light Saving stored operation has been enabled or not 01732 * @rmtoll RTC_CR BKP LL_RTC_TIME_IsDayLightStoreEnabled 01733 * @param RTCx RTC Instance 01734 * @retval State of bit (1 or 0). 01735 */ 01736 __STATIC_INLINE uint32_t LL_RTC_TIME_IsDayLightStoreEnabled(RTC_TypeDef *RTCx) 01737 { 01738 return (READ_BIT(RTCx->CR, RTC_CR_BKP) == (RTC_CR_BKP)); 01739 } 01740 01741 /** 01742 * @brief Subtract 1 hour (winter time change) 01743 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01744 * @rmtoll RTC_CR SUB1H LL_RTC_TIME_DecHour 01745 * @param RTCx RTC Instance 01746 * @retval None 01747 */ 01748 __STATIC_INLINE void LL_RTC_TIME_DecHour(RTC_TypeDef *RTCx) 01749 { 01750 SET_BIT(RTCx->CR, RTC_CR_SUB1H); 01751 } 01752 01753 /** 01754 * @brief Add 1 hour (summer time change) 01755 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01756 * @rmtoll RTC_CR ADD1H LL_RTC_TIME_IncHour 01757 * @param RTCx RTC Instance 01758 * @retval None 01759 */ 01760 __STATIC_INLINE void LL_RTC_TIME_IncHour(RTC_TypeDef *RTCx) 01761 { 01762 SET_BIT(RTCx->CR, RTC_CR_ADD1H); 01763 } 01764 01765 /** 01766 * @brief Get Sub second value in the synchronous prescaler counter. 01767 * @note You can use both SubSeconds value and SecondFraction (PREDIV_S through 01768 * LL_RTC_GetSynchPrescaler function) terms returned to convert Calendar 01769 * SubSeconds value in second fraction ratio with time unit following 01770 * generic formula: 01771 * ==> Seconds fraction ratio * time_unit= [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit 01772 * This conversion can be performed only if no shift operation is pending 01773 * (ie. SHFP=0) when PREDIV_S >= SS. 01774 * @rmtoll RTC_SSR SS LL_RTC_TIME_GetSubSecond 01775 * @param RTCx RTC Instance 01776 * @retval If binary mode is none, Value between Min_Data=0x0 and Max_Data=0x7FFF 01777 * else Value between Min_Data=0x0 and Max_Data=0xFFFFFFFF 01778 */ 01779 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSubSecond(RTC_TypeDef *RTCx) 01780 { 01781 return (uint32_t)(READ_BIT(RTCx->SSR, RTC_SSR_SS)); 01782 } 01783 01784 /** 01785 * @brief Synchronize to a remote clock with a high degree of precision. 01786 * @note This operation effectively subtracts from (delays) or advance the clock of a fraction of a second. 01787 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01788 * @note When REFCKON is set, firmware must not write to Shift control register. 01789 * @rmtoll RTC_SHIFTR ADD1S LL_RTC_TIME_Synchronize\n 01790 * RTC_SHIFTR SUBFS LL_RTC_TIME_Synchronize 01791 * @param RTCx RTC Instance 01792 * @param ShiftSecond This parameter can be one of the following values: 01793 * @arg @ref LL_RTC_SHIFT_SECOND_DELAY 01794 * @arg @ref LL_RTC_SHIFT_SECOND_ADVANCE 01795 * @param Fraction Number of Seconds Fractions (any value from 0 to 0x7FFF) 01796 * @retval None 01797 */ 01798 __STATIC_INLINE void LL_RTC_TIME_Synchronize(RTC_TypeDef *RTCx, uint32_t ShiftSecond, uint32_t Fraction) 01799 { 01800 WRITE_REG(RTCx->SHIFTR, ShiftSecond | Fraction); 01801 } 01802 01803 /** 01804 * @} 01805 */ 01806 01807 /** @defgroup RTC_LL_EF_Date Date 01808 * @{ 01809 */ 01810 01811 /** 01812 * @brief Set Year in BCD format 01813 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Year from binary to BCD format 01814 * @rmtoll RTC_DR YT LL_RTC_DATE_SetYear\n 01815 * RTC_DR YU LL_RTC_DATE_SetYear 01816 * @param RTCx RTC Instance 01817 * @param Year Value between Min_Data=0x00 and Max_Data=0x99 01818 * @retval None 01819 */ 01820 __STATIC_INLINE void LL_RTC_DATE_SetYear(RTC_TypeDef *RTCx, uint32_t Year) 01821 { 01822 MODIFY_REG(RTCx->DR, (RTC_DR_YT | RTC_DR_YU), 01823 (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos))); 01824 } 01825 01826 /** 01827 * @brief Get Year in BCD format 01828 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01829 * before reading this bit 01830 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Year from BCD to Binary format 01831 * @rmtoll RTC_DR YT LL_RTC_DATE_GetYear\n 01832 * RTC_DR YU LL_RTC_DATE_GetYear 01833 * @param RTCx RTC Instance 01834 * @retval Value between Min_Data=0x00 and Max_Data=0x99 01835 */ 01836 __STATIC_INLINE uint32_t LL_RTC_DATE_GetYear(RTC_TypeDef *RTCx) 01837 { 01838 return ((READ_BIT(RTCx->DR, (RTC_DR_YT | RTC_DR_YU))) >> RTC_DR_YU_Pos); 01839 } 01840 01841 /** 01842 * @brief Set Week day 01843 * @rmtoll RTC_DR WDU LL_RTC_DATE_SetWeekDay 01844 * @param RTCx RTC Instance 01845 * @param WeekDay This parameter can be one of the following values: 01846 * @arg @ref LL_RTC_WEEKDAY_MONDAY 01847 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 01848 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 01849 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 01850 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 01851 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 01852 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 01853 * @retval None 01854 */ 01855 __STATIC_INLINE void LL_RTC_DATE_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay) 01856 { 01857 MODIFY_REG(RTCx->DR, RTC_DR_WDU, WeekDay << RTC_DR_WDU_Pos); 01858 } 01859 01860 /** 01861 * @brief Get Week day 01862 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01863 * before reading this bit 01864 * @rmtoll RTC_DR WDU LL_RTC_DATE_GetWeekDay 01865 * @param RTCx RTC Instance 01866 * @retval Returned value can be one of the following values: 01867 * @arg @ref LL_RTC_WEEKDAY_MONDAY 01868 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 01869 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 01870 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 01871 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 01872 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 01873 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 01874 */ 01875 __STATIC_INLINE uint32_t LL_RTC_DATE_GetWeekDay(RTC_TypeDef *RTCx) 01876 { 01877 return (uint32_t)(READ_BIT(RTCx->DR, RTC_DR_WDU) >> RTC_DR_WDU_Pos); 01878 } 01879 01880 /** 01881 * @brief Set Month in BCD format 01882 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Month from binary to BCD format 01883 * @rmtoll RTC_DR MT LL_RTC_DATE_SetMonth\n 01884 * RTC_DR MU LL_RTC_DATE_SetMonth 01885 * @param RTCx RTC Instance 01886 * @param Month This parameter can be one of the following values: 01887 * @arg @ref LL_RTC_MONTH_JANUARY 01888 * @arg @ref LL_RTC_MONTH_FEBRUARY 01889 * @arg @ref LL_RTC_MONTH_MARCH 01890 * @arg @ref LL_RTC_MONTH_APRIL 01891 * @arg @ref LL_RTC_MONTH_MAY 01892 * @arg @ref LL_RTC_MONTH_JUNE 01893 * @arg @ref LL_RTC_MONTH_JULY 01894 * @arg @ref LL_RTC_MONTH_AUGUST 01895 * @arg @ref LL_RTC_MONTH_SEPTEMBER 01896 * @arg @ref LL_RTC_MONTH_OCTOBER 01897 * @arg @ref LL_RTC_MONTH_NOVEMBER 01898 * @arg @ref LL_RTC_MONTH_DECEMBER 01899 * @retval None 01900 */ 01901 __STATIC_INLINE void LL_RTC_DATE_SetMonth(RTC_TypeDef *RTCx, uint32_t Month) 01902 { 01903 MODIFY_REG(RTCx->DR, (RTC_DR_MT | RTC_DR_MU), 01904 (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos))); 01905 } 01906 01907 /** 01908 * @brief Get Month in BCD format 01909 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01910 * before reading this bit 01911 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format 01912 * @rmtoll RTC_DR MT LL_RTC_DATE_GetMonth\n 01913 * RTC_DR MU LL_RTC_DATE_GetMonth 01914 * @param RTCx RTC Instance 01915 * @retval Returned value can be one of the following values: 01916 * @arg @ref LL_RTC_MONTH_JANUARY 01917 * @arg @ref LL_RTC_MONTH_FEBRUARY 01918 * @arg @ref LL_RTC_MONTH_MARCH 01919 * @arg @ref LL_RTC_MONTH_APRIL 01920 * @arg @ref LL_RTC_MONTH_MAY 01921 * @arg @ref LL_RTC_MONTH_JUNE 01922 * @arg @ref LL_RTC_MONTH_JULY 01923 * @arg @ref LL_RTC_MONTH_AUGUST 01924 * @arg @ref LL_RTC_MONTH_SEPTEMBER 01925 * @arg @ref LL_RTC_MONTH_OCTOBER 01926 * @arg @ref LL_RTC_MONTH_NOVEMBER 01927 * @arg @ref LL_RTC_MONTH_DECEMBER 01928 */ 01929 __STATIC_INLINE uint32_t LL_RTC_DATE_GetMonth(RTC_TypeDef *RTCx) 01930 { 01931 return ((READ_BIT(RTCx->DR, (RTC_DR_MT | RTC_DR_MU))) >> RTC_DR_MU_Pos); 01932 } 01933 01934 /** 01935 * @brief Set Day in BCD format 01936 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format 01937 * @rmtoll RTC_DR DT LL_RTC_DATE_SetDay\n 01938 * RTC_DR DU LL_RTC_DATE_SetDay 01939 * @param RTCx RTC Instance 01940 * @param Day Value between Min_Data=0x01 and Max_Data=0x31 01941 * @retval None 01942 */ 01943 __STATIC_INLINE void LL_RTC_DATE_SetDay(RTC_TypeDef *RTCx, uint32_t Day) 01944 { 01945 MODIFY_REG(RTCx->DR, (RTC_DR_DT | RTC_DR_DU), 01946 (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos))); 01947 } 01948 01949 /** 01950 * @brief Get Day in BCD format 01951 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01952 * before reading this bit 01953 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format 01954 * @rmtoll RTC_DR DT LL_RTC_DATE_GetDay\n 01955 * RTC_DR DU LL_RTC_DATE_GetDay 01956 * @param RTCx RTC Instance 01957 * @retval Value between Min_Data=0x01 and Max_Data=0x31 01958 */ 01959 __STATIC_INLINE uint32_t LL_RTC_DATE_GetDay(RTC_TypeDef *RTCx) 01960 { 01961 return ((READ_BIT(RTCx->DR, (RTC_DR_DT | RTC_DR_DU))) >> RTC_DR_DU_Pos); 01962 } 01963 01964 /** 01965 * @brief Set date (WeekDay, Day, Month and Year) in BCD format 01966 * @rmtoll RTC_DR WDU LL_RTC_DATE_Config\n 01967 * RTC_DR MT LL_RTC_DATE_Config\n 01968 * RTC_DR MU LL_RTC_DATE_Config\n 01969 * RTC_DR DT LL_RTC_DATE_Config\n 01970 * RTC_DR DU LL_RTC_DATE_Config\n 01971 * RTC_DR YT LL_RTC_DATE_Config\n 01972 * RTC_DR YU LL_RTC_DATE_Config 01973 * @param RTCx RTC Instance 01974 * @param WeekDay This parameter can be one of the following values: 01975 * @arg @ref LL_RTC_WEEKDAY_MONDAY 01976 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 01977 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 01978 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 01979 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 01980 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 01981 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 01982 * @param Day Value between Min_Data=0x01 and Max_Data=0x31 01983 * @param Month This parameter can be one of the following values: 01984 * @arg @ref LL_RTC_MONTH_JANUARY 01985 * @arg @ref LL_RTC_MONTH_FEBRUARY 01986 * @arg @ref LL_RTC_MONTH_MARCH 01987 * @arg @ref LL_RTC_MONTH_APRIL 01988 * @arg @ref LL_RTC_MONTH_MAY 01989 * @arg @ref LL_RTC_MONTH_JUNE 01990 * @arg @ref LL_RTC_MONTH_JULY 01991 * @arg @ref LL_RTC_MONTH_AUGUST 01992 * @arg @ref LL_RTC_MONTH_SEPTEMBER 01993 * @arg @ref LL_RTC_MONTH_OCTOBER 01994 * @arg @ref LL_RTC_MONTH_NOVEMBER 01995 * @arg @ref LL_RTC_MONTH_DECEMBER 01996 * @param Year Value between Min_Data=0x00 and Max_Data=0x99 01997 * @retval None 01998 */ 01999 __STATIC_INLINE void LL_RTC_DATE_Config(RTC_TypeDef *RTCx, uint32_t WeekDay, uint32_t Day, uint32_t Month, uint32_t Year) 02000 { 02001 uint32_t temp = 0U; 02002 02003 temp = (WeekDay << RTC_DR_WDU_Pos) | \ 02004 (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos)) | \ 02005 (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)) | \ 02006 (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos)); 02007 02008 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); 02009 } 02010 02011 /** 02012 * @brief Get date (WeekDay, Day, Month and Year) in BCD format 02013 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 02014 * before reading this bit 02015 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_YEAR, __LL_RTC_GET_MONTH, 02016 * and __LL_RTC_GET_DAY are available to get independently each parameter. 02017 * @rmtoll RTC_DR WDU LL_RTC_DATE_Get\n 02018 * RTC_DR MT LL_RTC_DATE_Get\n 02019 * RTC_DR MU LL_RTC_DATE_Get\n 02020 * RTC_DR DT LL_RTC_DATE_Get\n 02021 * RTC_DR DU LL_RTC_DATE_Get\n 02022 * RTC_DR YT LL_RTC_DATE_Get\n 02023 * RTC_DR YU LL_RTC_DATE_Get 02024 * @param RTCx RTC Instance 02025 * @retval Combination of WeekDay, Day, Month and Year (Format: 0xWWDDMMYY). 02026 */ 02027 __STATIC_INLINE uint32_t LL_RTC_DATE_Get(RTC_TypeDef *RTCx) 02028 { 02029 uint32_t temp = 0U; 02030 02031 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)); 02032 return (uint32_t)((((temp & RTC_DR_WDU) >> RTC_DR_WDU_Pos) << RTC_OFFSET_WEEKDAY) | \ 02033 (((((temp & RTC_DR_DT) >> RTC_DR_DT_Pos) << 4U) | ((temp & RTC_DR_DU) >> RTC_DR_DU_Pos)) << RTC_OFFSET_DAY) | \ 02034 (((((temp & RTC_DR_MT) >> RTC_DR_MT_Pos) << 4U) | ((temp & RTC_DR_MU) >> RTC_DR_MU_Pos)) << RTC_OFFSET_MONTH) | \ 02035 ((((temp & RTC_DR_YT) >> RTC_DR_YT_Pos) << 4U) | ((temp & RTC_DR_YU) >> RTC_DR_YU_Pos))); 02036 } 02037 02038 /** 02039 * @} 02040 */ 02041 02042 /** @defgroup RTC_LL_EF_ALARMA ALARMA 02043 * @{ 02044 */ 02045 02046 /** 02047 * @brief Enable Alarm A 02048 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02049 * @rmtoll RTC_CR ALRAE LL_RTC_ALMA_Enable 02050 * @param RTCx RTC Instance 02051 * @retval None 02052 */ 02053 __STATIC_INLINE void LL_RTC_ALMA_Enable(RTC_TypeDef *RTCx) 02054 { 02055 SET_BIT(RTCx->CR, RTC_CR_ALRAE); 02056 } 02057 02058 /** 02059 * @brief Disable Alarm A 02060 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02061 * @rmtoll RTC_CR ALRAE LL_RTC_ALMA_Disable 02062 * @param RTCx RTC Instance 02063 * @retval None 02064 */ 02065 __STATIC_INLINE void LL_RTC_ALMA_Disable(RTC_TypeDef *RTCx) 02066 { 02067 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAE); 02068 } 02069 02070 /** 02071 * @brief Specify the Alarm A masks. 02072 * @rmtoll RTC_ALRMAR MSK4 LL_RTC_ALMA_SetMask\n 02073 * RTC_ALRMAR MSK3 LL_RTC_ALMA_SetMask\n 02074 * RTC_ALRMAR MSK2 LL_RTC_ALMA_SetMask\n 02075 * RTC_ALRMAR MSK1 LL_RTC_ALMA_SetMask 02076 * @param RTCx RTC Instance 02077 * @param Mask This parameter can be a combination of the following values: 02078 * @arg @ref LL_RTC_ALMA_MASK_NONE 02079 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY 02080 * @arg @ref LL_RTC_ALMA_MASK_HOURS 02081 * @arg @ref LL_RTC_ALMA_MASK_MINUTES 02082 * @arg @ref LL_RTC_ALMA_MASK_SECONDS 02083 * @arg @ref LL_RTC_ALMA_MASK_ALL 02084 * @retval None 02085 */ 02086 __STATIC_INLINE void LL_RTC_ALMA_SetMask(RTC_TypeDef *RTCx, uint32_t Mask) 02087 { 02088 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1, Mask); 02089 } 02090 02091 /** 02092 * @brief Get the Alarm A masks. 02093 * @rmtoll RTC_ALRMAR MSK4 LL_RTC_ALMA_GetMask\n 02094 * RTC_ALRMAR MSK3 LL_RTC_ALMA_GetMask\n 02095 * RTC_ALRMAR MSK2 LL_RTC_ALMA_GetMask\n 02096 * RTC_ALRMAR MSK1 LL_RTC_ALMA_GetMask 02097 * @param RTCx RTC Instance 02098 * @retval Returned value can be can be a combination of the following values: 02099 * @arg @ref LL_RTC_ALMA_MASK_NONE 02100 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY 02101 * @arg @ref LL_RTC_ALMA_MASK_HOURS 02102 * @arg @ref LL_RTC_ALMA_MASK_MINUTES 02103 * @arg @ref LL_RTC_ALMA_MASK_SECONDS 02104 * @arg @ref LL_RTC_ALMA_MASK_ALL 02105 */ 02106 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMask(RTC_TypeDef *RTCx) 02107 { 02108 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1)); 02109 } 02110 02111 /** 02112 * @brief Enable AlarmA Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care) 02113 * @rmtoll RTC_ALRMAR WDSEL LL_RTC_ALMA_EnableWeekday 02114 * @param RTCx RTC Instance 02115 * @retval None 02116 */ 02117 __STATIC_INLINE void LL_RTC_ALMA_EnableWeekday(RTC_TypeDef *RTCx) 02118 { 02119 SET_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL); 02120 } 02121 02122 /** 02123 * @brief Disable AlarmA Week day selection (DU[3:0] represents the date ) 02124 * @rmtoll RTC_ALRMAR WDSEL LL_RTC_ALMA_DisableWeekday 02125 * @param RTCx RTC Instance 02126 * @retval None 02127 */ 02128 __STATIC_INLINE void LL_RTC_ALMA_DisableWeekday(RTC_TypeDef *RTCx) 02129 { 02130 CLEAR_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL); 02131 } 02132 02133 /** 02134 * @brief Set ALARM A Day in BCD format 02135 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format 02136 * @rmtoll RTC_ALRMAR DT LL_RTC_ALMA_SetDay\n 02137 * RTC_ALRMAR DU LL_RTC_ALMA_SetDay 02138 * @param RTCx RTC Instance 02139 * @param Day Value between Min_Data=0x01 and Max_Data=0x31 02140 * @retval None 02141 */ 02142 __STATIC_INLINE void LL_RTC_ALMA_SetDay(RTC_TypeDef *RTCx, uint32_t Day) 02143 { 02144 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU), 02145 (((Day & 0xF0U) << (RTC_ALRMAR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMAR_DU_Pos))); 02146 } 02147 02148 /** 02149 * @brief Get ALARM A Day in BCD format 02150 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format 02151 * @rmtoll RTC_ALRMAR DT LL_RTC_ALMA_GetDay\n 02152 * RTC_ALRMAR DU LL_RTC_ALMA_GetDay 02153 * @param RTCx RTC Instance 02154 * @retval Value between Min_Data=0x01 and Max_Data=0x31 02155 */ 02156 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetDay(RTC_TypeDef *RTCx) 02157 { 02158 return ((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU))) >> RTC_ALRMAR_DU_Pos); 02159 } 02160 02161 /** 02162 * @brief Set ALARM A Weekday 02163 * @rmtoll RTC_ALRMAR DU LL_RTC_ALMA_SetWeekDay 02164 * @param RTCx RTC Instance 02165 * @param WeekDay This parameter can be one of the following values: 02166 * @arg @ref LL_RTC_WEEKDAY_MONDAY 02167 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 02168 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 02169 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 02170 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 02171 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 02172 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 02173 * @retval None 02174 */ 02175 __STATIC_INLINE void LL_RTC_ALMA_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay) 02176 { 02177 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_DU, WeekDay << RTC_ALRMAR_DU_Pos); 02178 } 02179 02180 /** 02181 * @brief Get ALARM A Weekday 02182 * @rmtoll RTC_ALRMAR DU LL_RTC_ALMA_GetWeekDay 02183 * @param RTCx RTC Instance 02184 * @retval Returned value can be one of the following values: 02185 * @arg @ref LL_RTC_WEEKDAY_MONDAY 02186 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 02187 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 02188 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 02189 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 02190 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 02191 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 02192 */ 02193 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetWeekDay(RTC_TypeDef *RTCx) 02194 { 02195 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_DU) >> RTC_ALRMAR_DU_Pos); 02196 } 02197 02198 /** 02199 * @brief Set Alarm A time format (AM/24-hour or PM notation) 02200 * @rmtoll RTC_ALRMAR PM LL_RTC_ALMA_SetTimeFormat 02201 * @param RTCx RTC Instance 02202 * @param TimeFormat This parameter can be one of the following values: 02203 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM 02204 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM 02205 * @retval None 02206 */ 02207 __STATIC_INLINE void LL_RTC_ALMA_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat) 02208 { 02209 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM, TimeFormat); 02210 } 02211 02212 /** 02213 * @brief Get Alarm A time format (AM or PM notation) 02214 * @rmtoll RTC_ALRMAR PM LL_RTC_ALMA_GetTimeFormat 02215 * @param RTCx RTC Instance 02216 * @retval Returned value can be one of the following values: 02217 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM 02218 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM 02219 */ 02220 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTimeFormat(RTC_TypeDef *RTCx) 02221 { 02222 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_PM)); 02223 } 02224 02225 /** 02226 * @brief Set ALARM A Hours in BCD format 02227 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format 02228 * @rmtoll RTC_ALRMAR HT LL_RTC_ALMA_SetHour\n 02229 * RTC_ALRMAR HU LL_RTC_ALMA_SetHour 02230 * @param RTCx RTC Instance 02231 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 02232 * @retval None 02233 */ 02234 __STATIC_INLINE void LL_RTC_ALMA_SetHour(RTC_TypeDef *RTCx, uint32_t Hours) 02235 { 02236 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU), 02237 (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos))); 02238 } 02239 02240 /** 02241 * @brief Get ALARM A Hours in BCD format 02242 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format 02243 * @rmtoll RTC_ALRMAR HT LL_RTC_ALMA_GetHour\n 02244 * RTC_ALRMAR HU LL_RTC_ALMA_GetHour 02245 * @param RTCx RTC Instance 02246 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 02247 */ 02248 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetHour(RTC_TypeDef *RTCx) 02249 { 02250 return ((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU))) >> RTC_ALRMAR_HU_Pos); 02251 } 02252 02253 /** 02254 * @brief Set ALARM A Minutes in BCD format 02255 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format 02256 * @rmtoll RTC_ALRMAR MNT LL_RTC_ALMA_SetMinute\n 02257 * RTC_ALRMAR MNU LL_RTC_ALMA_SetMinute 02258 * @param RTCx RTC Instance 02259 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 02260 * @retval None 02261 */ 02262 __STATIC_INLINE void LL_RTC_ALMA_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes) 02263 { 02264 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU), 02265 (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos))); 02266 } 02267 02268 /** 02269 * @brief Get ALARM A Minutes in BCD format 02270 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format 02271 * @rmtoll RTC_ALRMAR MNT LL_RTC_ALMA_GetMinute\n 02272 * RTC_ALRMAR MNU LL_RTC_ALMA_GetMinute 02273 * @param RTCx RTC Instance 02274 * @retval Value between Min_Data=0x00 and Max_Data=0x59 02275 */ 02276 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMinute(RTC_TypeDef *RTCx) 02277 { 02278 return ((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU))) >> RTC_ALRMAR_MNU_Pos); 02279 } 02280 02281 /** 02282 * @brief Set ALARM A Seconds in BCD format 02283 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format 02284 * @rmtoll RTC_ALRMAR ST LL_RTC_ALMA_SetSecond\n 02285 * RTC_ALRMAR SU LL_RTC_ALMA_SetSecond 02286 * @param RTCx RTC Instance 02287 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 02288 * @retval None 02289 */ 02290 __STATIC_INLINE void LL_RTC_ALMA_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds) 02291 { 02292 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU), 02293 (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos))); 02294 } 02295 02296 /** 02297 * @brief Get ALARM A Seconds in BCD format 02298 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format 02299 * @rmtoll RTC_ALRMAR ST LL_RTC_ALMA_GetSecond\n 02300 * RTC_ALRMAR SU LL_RTC_ALMA_GetSecond 02301 * @param RTCx RTC Instance 02302 * @retval Value between Min_Data=0x00 and Max_Data=0x59 02303 */ 02304 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSecond(RTC_TypeDef *RTCx) 02305 { 02306 return ((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU))) >> RTC_ALRMAR_SU_Pos); 02307 } 02308 02309 /** 02310 * @brief Set Alarm A Time (hour, minute and second) in BCD format 02311 * @rmtoll RTC_ALRMAR PM LL_RTC_ALMA_ConfigTime\n 02312 * RTC_ALRMAR HT LL_RTC_ALMA_ConfigTime\n 02313 * RTC_ALRMAR HU LL_RTC_ALMA_ConfigTime\n 02314 * RTC_ALRMAR MNT LL_RTC_ALMA_ConfigTime\n 02315 * RTC_ALRMAR MNU LL_RTC_ALMA_ConfigTime\n 02316 * RTC_ALRMAR ST LL_RTC_ALMA_ConfigTime\n 02317 * RTC_ALRMAR SU LL_RTC_ALMA_ConfigTime 02318 * @param RTCx RTC Instance 02319 * @param Format12_24 This parameter can be one of the following values: 02320 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM 02321 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM 02322 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 02323 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 02324 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 02325 * @retval None 02326 */ 02327 __STATIC_INLINE void LL_RTC_ALMA_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds) 02328 { 02329 uint32_t temp = 0U; 02330 02331 temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos)) | \ 02332 (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)) | \ 02333 (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos)); 02334 02335 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); 02336 } 02337 02338 /** 02339 * @brief Get Alarm B Time (hour, minute and second) in BCD format 02340 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND 02341 * are available to get independently each parameter. 02342 * @rmtoll RTC_ALRMAR HT LL_RTC_ALMA_GetTime\n 02343 * RTC_ALRMAR HU LL_RTC_ALMA_GetTime\n 02344 * RTC_ALRMAR MNT LL_RTC_ALMA_GetTime\n 02345 * RTC_ALRMAR MNU LL_RTC_ALMA_GetTime\n 02346 * RTC_ALRMAR ST LL_RTC_ALMA_GetTime\n 02347 * RTC_ALRMAR SU LL_RTC_ALMA_GetTime 02348 * @param RTCx RTC Instance 02349 * @retval Combination of hours, minutes and seconds. 02350 */ 02351 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTime(RTC_TypeDef *RTCx) 02352 { 02353 return (uint32_t)((LL_RTC_ALMA_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMA_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMA_GetSecond(RTCx)); 02354 } 02355 02356 /** 02357 * @brief Set Alarm A Mask the most-significant bits starting at this bit 02358 * @note This register can be written only when ALRAE is reset in RTC_CR register, 02359 * or in initialization mode. 02360 * @rmtoll RTC_ALRMASSR MASKSS LL_RTC_ALMA_SetSubSecondMask 02361 * @param RTCx RTC Instance 02362 * @param Mask If binary mode is none, Value between Min_Data=0x0 and Max_Data=0xF 02363 * else Value between Min_Data=0x0 and Max_Data=0x3F 02364 * @retval None 02365 */ 02366 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask) 02367 { 02368 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS, Mask << RTC_ALRMASSR_MASKSS_Pos); 02369 } 02370 02371 /** 02372 * @brief Get Alarm A Mask the most-significant bits starting at this bit 02373 * @rmtoll RTC_ALRMASSR MASKSS LL_RTC_ALMA_GetSubSecondMask 02374 * @param RTCx RTC Instance 02375 * @retval If binary mode is none, Value between Min_Data=0x0 and Max_Data=0xF 02376 * else Value between Min_Data=0x0 and Max_Data=0x3F 02377 */ 02378 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecondMask(RTC_TypeDef *RTCx) 02379 { 02380 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS) >> RTC_ALRMASSR_MASKSS_Pos); 02381 } 02382 02383 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 02384 /** 02385 * @brief Set Alarm A Binary mode auto clear 02386 * @note This register can be written only when ALRAE is reset in RTC_CR register, 02387 * or in initialization mode. 02388 * @rmtoll RTC_ALRABINR SSCLR LL_RTC_ALMA_SetBinAutoClr 02389 * @param RTCx RTC Instance 02390 * @param BinaryAutoClr This parameter can be one of the following values: 02391 * @arg @ref LL_RTC_ALMA_SUBSECONDBIN_AUTOCLR_NO 02392 * @arg @ref LL_RTC_ALMA_SUBSECONDBIN_AUTOCLR_YES 02393 * @retval None 02394 */ 02395 __STATIC_INLINE void LL_RTC_ALMA_SetBinAutoClr(RTC_TypeDef *RTCx, uint32_t BinaryAutoClr) 02396 { 02397 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_SSCLR, BinaryAutoClr); 02398 } 02399 02400 /** 02401 * @brief Get Alarm A Binary mode auto clear 02402 * @rmtoll RTC_ALRABINR SSCLR LL_RTC_ALMA_GetBinAutoClr 02403 * @param RTCx RTC Instance 02404 * @retval It can be one of the following values: 02405 * @arg @ref LL_RTC_ALMA_SUBSECONDBIN_AUTOCLR_NO 02406 * @arg @ref LL_RTC_ALMA_SUBSECONDBIN_AUTOCLR_YES 02407 */ 02408 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetBinAutoClr(RTC_TypeDef *RTCx) 02409 { 02410 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_SSCLR)); 02411 } 02412 02413 /** 02414 * @brief Set Alarm A Sub seconds value 02415 * @rmtoll RTC_ALRMABINR SS LL_RTC_ALMA_SetSubSecond 02416 * @param RTCx RTC Instance 02417 * @param Subsecond If binary mode is none, Value between Min_Data=0x0 and Max_Data=0x7FFF 02418 * else Value between Min_Data=0x0 and Max_Data=0xFFFFFFFF 02419 * @retval None 02420 */ 02421 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond) 02422 { 02423 MODIFY_REG(RTCx->ALRABINR, RTC_ALRABINR_SS, Subsecond); 02424 } 02425 02426 /** 02427 * @brief Get Alarm A Sub seconds value 02428 * @rmtoll RTC_ALRMABINR SS LL_RTC_ALMA_GetSubSecond 02429 * @param RTCx RTC Instance 02430 * @retval If binary mode is none, Value between Min_Data=0x0 and Max_Data=0x7FFF 02431 * else Value between Min_Data=0x0 and Max_Data=0xFFFFFFFF 02432 */ 02433 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecond(RTC_TypeDef *RTCx) 02434 { 02435 return (uint32_t)(READ_BIT(RTCx->ALRABINR, RTC_ALRABINR_SS)); 02436 } 02437 #else /* #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 02438 02439 /** 02440 * @brief Set Alarm A Sub seconds value 02441 * @rmtoll RCT_ALRMASSR SS LL_RTC_ALMA_SetSubSecond 02442 * @param RTCx RTC Instance 02443 * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF 02444 * @retval None 02445 */ 02446 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond) 02447 { 02448 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_SS, Subsecond); 02449 } 02450 02451 /** 02452 * @brief Get Alarm A Sub seconds value 02453 * @rmtoll RCT_ALRMASSR SS LL_RTC_ALMA_GetSubSecond 02454 * @param RTCx RTC Instance 02455 * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF 02456 */ 02457 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecond(RTC_TypeDef *RTCx) 02458 { 02459 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_SS)); 02460 } 02461 #endif /* #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 02462 02463 /** 02464 * @} 02465 */ 02466 02467 /** @defgroup RTC_LL_EF_ALARMB ALARMB 02468 * @{ 02469 */ 02470 02471 /** 02472 * @brief Enable Alarm B 02473 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02474 * @rmtoll RTC_CR ALRBE LL_RTC_ALMB_Enable 02475 * @param RTCx RTC Instance 02476 * @retval None 02477 */ 02478 __STATIC_INLINE void LL_RTC_ALMB_Enable(RTC_TypeDef *RTCx) 02479 { 02480 SET_BIT(RTCx->CR, RTC_CR_ALRBE); 02481 } 02482 02483 /** 02484 * @brief Disable Alarm B 02485 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02486 * @rmtoll RTC_CR ALRBE LL_RTC_ALMB_Disable 02487 * @param RTCx RTC Instance 02488 * @retval None 02489 */ 02490 __STATIC_INLINE void LL_RTC_ALMB_Disable(RTC_TypeDef *RTCx) 02491 { 02492 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBE); 02493 } 02494 02495 /** 02496 * @brief Specify the Alarm B masks. 02497 * @rmtoll RTC_ALRMBR MSK4 LL_RTC_ALMB_SetMask\n 02498 * RTC_ALRMBR MSK3 LL_RTC_ALMB_SetMask\n 02499 * RTC_ALRMBR MSK2 LL_RTC_ALMB_SetMask\n 02500 * RTC_ALRMBR MSK1 LL_RTC_ALMB_SetMask 02501 * @param RTCx RTC Instance 02502 * @param Mask This parameter can be a combination of the following values: 02503 * @arg @ref LL_RTC_ALMB_MASK_NONE 02504 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY 02505 * @arg @ref LL_RTC_ALMB_MASK_HOURS 02506 * @arg @ref LL_RTC_ALMB_MASK_MINUTES 02507 * @arg @ref LL_RTC_ALMB_MASK_SECONDS 02508 * @arg @ref LL_RTC_ALMB_MASK_ALL 02509 * @retval None 02510 */ 02511 __STATIC_INLINE void LL_RTC_ALMB_SetMask(RTC_TypeDef *RTCx, uint32_t Mask) 02512 { 02513 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1, Mask); 02514 } 02515 02516 /** 02517 * @brief Get the Alarm B masks. 02518 * @rmtoll RTC_ALRMBR MSK4 LL_RTC_ALMB_GetMask\n 02519 * RTC_ALRMBR MSK3 LL_RTC_ALMB_GetMask\n 02520 * RTC_ALRMBR MSK2 LL_RTC_ALMB_GetMask\n 02521 * RTC_ALRMBR MSK1 LL_RTC_ALMB_GetMask 02522 * @param RTCx RTC Instance 02523 * @retval Returned value can be can be a combination of the following values: 02524 * @arg @ref LL_RTC_ALMB_MASK_NONE 02525 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY 02526 * @arg @ref LL_RTC_ALMB_MASK_HOURS 02527 * @arg @ref LL_RTC_ALMB_MASK_MINUTES 02528 * @arg @ref LL_RTC_ALMB_MASK_SECONDS 02529 * @arg @ref LL_RTC_ALMB_MASK_ALL 02530 */ 02531 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMask(RTC_TypeDef *RTCx) 02532 { 02533 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1)); 02534 } 02535 02536 /** 02537 * @brief Enable AlarmB Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care) 02538 * @rmtoll RTC_ALRMBR WDSEL LL_RTC_ALMB_EnableWeekday 02539 * @param RTCx RTC Instance 02540 * @retval None 02541 */ 02542 __STATIC_INLINE void LL_RTC_ALMB_EnableWeekday(RTC_TypeDef *RTCx) 02543 { 02544 SET_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL); 02545 } 02546 02547 /** 02548 * @brief Disable AlarmB Week day selection (DU[3:0] represents the date ) 02549 * @rmtoll RTC_ALRMBR WDSEL LL_RTC_ALMB_DisableWeekday 02550 * @param RTCx RTC Instance 02551 * @retval None 02552 */ 02553 __STATIC_INLINE void LL_RTC_ALMB_DisableWeekday(RTC_TypeDef *RTCx) 02554 { 02555 CLEAR_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL); 02556 } 02557 02558 /** 02559 * @brief Set ALARM B Day in BCD format 02560 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format 02561 * @rmtoll RTC_ALRMBR DT LL_RTC_ALMB_SetDay\n 02562 * RTC_ALRMBR DU LL_RTC_ALMB_SetDay 02563 * @param RTCx RTC Instance 02564 * @param Day Value between Min_Data=0x01 and Max_Data=0x31 02565 * @retval None 02566 */ 02567 __STATIC_INLINE void LL_RTC_ALMB_SetDay(RTC_TypeDef *RTCx, uint32_t Day) 02568 { 02569 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU), 02570 (((Day & 0xF0U) << (RTC_ALRMBR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMBR_DU_Pos))); 02571 } 02572 02573 /** 02574 * @brief Get ALARM B Day in BCD format 02575 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format 02576 * @rmtoll RTC_ALRMBR DT LL_RTC_ALMB_GetDay\n 02577 * RTC_ALRMBR DU LL_RTC_ALMB_GetDay 02578 * @param RTCx RTC Instance 02579 * @retval Value between Min_Data=0x01 and Max_Data=0x31 02580 */ 02581 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetDay(RTC_TypeDef *RTCx) 02582 { 02583 return ((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU))) >> RTC_ALRMBR_DU_Pos); 02584 } 02585 02586 /** 02587 * @brief Set ALARM B Weekday 02588 * @rmtoll RTC_ALRMBR DU LL_RTC_ALMB_SetWeekDay 02589 * @param RTCx RTC Instance 02590 * @param WeekDay This parameter can be one of the following values: 02591 * @arg @ref LL_RTC_WEEKDAY_MONDAY 02592 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 02593 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 02594 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 02595 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 02596 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 02597 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 02598 * @retval None 02599 */ 02600 __STATIC_INLINE void LL_RTC_ALMB_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay) 02601 { 02602 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_DU, WeekDay << RTC_ALRMBR_DU_Pos); 02603 } 02604 02605 /** 02606 * @brief Get ALARM B Weekday 02607 * @rmtoll RTC_ALRMBR DU LL_RTC_ALMB_GetWeekDay 02608 * @param RTCx RTC Instance 02609 * @retval Returned value can be one of the following values: 02610 * @arg @ref LL_RTC_WEEKDAY_MONDAY 02611 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 02612 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 02613 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 02614 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 02615 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 02616 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 02617 */ 02618 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetWeekDay(RTC_TypeDef *RTCx) 02619 { 02620 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_DU) >> RTC_ALRMBR_DU_Pos); 02621 } 02622 02623 /** 02624 * @brief Set ALARM B time format (AM/24-hour or PM notation) 02625 * @rmtoll RTC_ALRMBR PM LL_RTC_ALMB_SetTimeFormat 02626 * @param RTCx RTC Instance 02627 * @param TimeFormat This parameter can be one of the following values: 02628 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM 02629 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM 02630 * @retval None 02631 */ 02632 __STATIC_INLINE void LL_RTC_ALMB_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat) 02633 { 02634 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM, TimeFormat); 02635 } 02636 02637 /** 02638 * @brief Get ALARM B time format (AM or PM notation) 02639 * @rmtoll RTC_ALRMBR PM LL_RTC_ALMB_GetTimeFormat 02640 * @param RTCx RTC Instance 02641 * @retval Returned value can be one of the following values: 02642 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM 02643 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM 02644 */ 02645 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTimeFormat(RTC_TypeDef *RTCx) 02646 { 02647 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_PM)); 02648 } 02649 02650 /** 02651 * @brief Set ALARM B Hours in BCD format 02652 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format 02653 * @rmtoll RTC_ALRMBR HT LL_RTC_ALMB_SetHour\n 02654 * RTC_ALRMBR HU LL_RTC_ALMB_SetHour 02655 * @param RTCx RTC Instance 02656 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 02657 * @retval None 02658 */ 02659 __STATIC_INLINE void LL_RTC_ALMB_SetHour(RTC_TypeDef *RTCx, uint32_t Hours) 02660 { 02661 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU), 02662 (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos))); 02663 } 02664 02665 /** 02666 * @brief Get ALARM B Hours in BCD format 02667 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format 02668 * @rmtoll RTC_ALRMBR HT LL_RTC_ALMB_GetHour\n 02669 * RTC_ALRMBR HU LL_RTC_ALMB_GetHour 02670 * @param RTCx RTC Instance 02671 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 02672 */ 02673 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetHour(RTC_TypeDef *RTCx) 02674 { 02675 return ((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU))) >> RTC_ALRMBR_HU_Pos); 02676 } 02677 02678 /** 02679 * @brief Set ALARM B Minutes in BCD format 02680 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format 02681 * @rmtoll RTC_ALRMBR MNT LL_RTC_ALMB_SetMinute\n 02682 * RTC_ALRMBR MNU LL_RTC_ALMB_SetMinute 02683 * @param RTCx RTC Instance 02684 * @param Minutes between Min_Data=0x00 and Max_Data=0x59 02685 * @retval None 02686 */ 02687 __STATIC_INLINE void LL_RTC_ALMB_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes) 02688 { 02689 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU), 02690 (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos))); 02691 } 02692 02693 /** 02694 * @brief Get ALARM B Minutes in BCD format 02695 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format 02696 * @rmtoll RTC_ALRMBR MNT LL_RTC_ALMB_GetMinute\n 02697 * RTC_ALRMBR MNU LL_RTC_ALMB_GetMinute 02698 * @param RTCx RTC Instance 02699 * @retval Value between Min_Data=0x00 and Max_Data=0x59 02700 */ 02701 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMinute(RTC_TypeDef *RTCx) 02702 { 02703 return ((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU))) >> RTC_ALRMBR_MNU_Pos); 02704 } 02705 02706 /** 02707 * @brief Set ALARM B Seconds in BCD format 02708 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format 02709 * @rmtoll RTC_ALRMBR ST LL_RTC_ALMB_SetSecond\n 02710 * RTC_ALRMBR SU LL_RTC_ALMB_SetSecond 02711 * @param RTCx RTC Instance 02712 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 02713 * @retval None 02714 */ 02715 __STATIC_INLINE void LL_RTC_ALMB_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds) 02716 { 02717 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU), 02718 (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos))); 02719 } 02720 02721 /** 02722 * @brief Get ALARM B Seconds in BCD format 02723 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format 02724 * @rmtoll RTC_ALRMBR ST LL_RTC_ALMB_GetSecond\n 02725 * RTC_ALRMBR SU LL_RTC_ALMB_GetSecond 02726 * @param RTCx RTC Instance 02727 * @retval Value between Min_Data=0x00 and Max_Data=0x59 02728 */ 02729 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSecond(RTC_TypeDef *RTCx) 02730 { 02731 return ((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU))) >> RTC_ALRMBR_SU_Pos); 02732 } 02733 02734 /** 02735 * @brief Set Alarm B Time (hour, minute and second) in BCD format 02736 * @rmtoll RTC_ALRMBR PM LL_RTC_ALMB_ConfigTime\n 02737 * RTC_ALRMBR HT LL_RTC_ALMB_ConfigTime\n 02738 * RTC_ALRMBR HU LL_RTC_ALMB_ConfigTime\n 02739 * RTC_ALRMBR MNT LL_RTC_ALMB_ConfigTime\n 02740 * RTC_ALRMBR MNU LL_RTC_ALMB_ConfigTime\n 02741 * RTC_ALRMBR ST LL_RTC_ALMB_ConfigTime\n 02742 * RTC_ALRMBR SU LL_RTC_ALMB_ConfigTime 02743 * @param RTCx RTC Instance 02744 * @param Format12_24 This parameter can be one of the following values: 02745 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM 02746 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM 02747 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 02748 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 02749 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 02750 * @retval None 02751 */ 02752 __STATIC_INLINE void LL_RTC_ALMB_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds) 02753 { 02754 uint32_t temp = 0U; 02755 02756 temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos)) | \ 02757 (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)) | \ 02758 (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos)); 02759 02760 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); 02761 } 02762 02763 /** 02764 * @brief Get Alarm B Time (hour, minute and second) in BCD format 02765 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND 02766 * are available to get independently each parameter. 02767 * @rmtoll RTC_ALRMBR HT LL_RTC_ALMB_GetTime\n 02768 * RTC_ALRMBR HU LL_RTC_ALMB_GetTime\n 02769 * RTC_ALRMBR MNT LL_RTC_ALMB_GetTime\n 02770 * RTC_ALRMBR MNU LL_RTC_ALMB_GetTime\n 02771 * RTC_ALRMBR ST LL_RTC_ALMB_GetTime\n 02772 * RTC_ALRMBR SU LL_RTC_ALMB_GetTime 02773 * @param RTCx RTC Instance 02774 * @retval Combination of hours, minutes and seconds. 02775 */ 02776 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTime(RTC_TypeDef *RTCx) 02777 { 02778 return (uint32_t)((LL_RTC_ALMB_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMB_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMB_GetSecond(RTCx)); 02779 } 02780 02781 /** 02782 * @brief Set Alarm B Mask the most-significant bits starting at this bit 02783 * @note This register can be written only when ALRBE is reset in RTC_CR register, 02784 * or in initialization mode. 02785 * @rmtoll RTC_ALRMBSSR MASKSS LL_RTC_ALMB_SetSubSecondMask 02786 * @param RTCx RTC Instance 02787 * @param Mask If binary mode is none, Value between Min_Data=0x0 and Max_Data=0xF 02788 * else Value between Min_Data=0x0 and Max_Data=0x3F 02789 * @retval None 02790 */ 02791 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask) 02792 { 02793 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS, Mask << RTC_ALRMBSSR_MASKSS_Pos); 02794 } 02795 02796 /** 02797 * @brief Get Alarm B Mask the most-significant bits starting at this bit 02798 * @rmtoll RTC_ALRMBSSR MASKSS LL_RTC_ALMB_GetSubSecondMask 02799 * @param RTCx RTC Instance 02800 * @retval If binary mode is none, Value between Min_Data=0x0 and Max_Data=0xF 02801 * else Value between Min_Data=0x0 and Max_Data=0x3F 02802 */ 02803 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecondMask(RTC_TypeDef *RTCx) 02804 { 02805 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS) >> RTC_ALRMBSSR_MASKSS_Pos); 02806 } 02807 02808 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 02809 /** 02810 * @brief Set Alarm B Binary mode auto clear 02811 * @note This register can be written only when ALRBE is reset in RTC_CR register, 02812 * or in initialization mode. 02813 * @rmtoll RTC_ALRBBINR SSCLR LL_RTC_ALMB_SetBinAutoClr 02814 * @param RTCx RTC Instance 02815 * @param BinaryAutoClr This parameter can be one of the following values: 02816 * @arg @ref LL_RTC_ALMB_SUBSECONDBIN_AUTOCLR_NO 02817 * @arg @ref LL_RTC_ALMB_SUBSECONDBIN_AUTOCLR_YES 02818 * @retval None 02819 */ 02820 __STATIC_INLINE void LL_RTC_ALMB_SetBinAutoClr(RTC_TypeDef *RTCx, uint32_t BinaryAutoClr) 02821 { 02822 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_SSCLR, BinaryAutoClr); 02823 } 02824 02825 /** 02826 * @brief Get Alarm B Binary mode auto clear 02827 * @rmtoll RTC_ALRBBINR SSCLR LL_RTC_ALMB_GetBinAutoClr 02828 * @param RTCx RTC Instance 02829 * @retval It can be one of the following values: 02830 * @arg @ref LL_RTC_ALMB_SUBSECONDBIN_AUTOCLR_NO 02831 * @arg @ref LL_RTC_ALMB_SUBSECONDBIN_AUTOCLR_YES 02832 */ 02833 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetBinAutoClr(RTC_TypeDef *RTCx) 02834 { 02835 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_SSCLR)); 02836 } 02837 02838 /** 02839 * @brief Set Alarm B Sub seconds value 02840 * @rmtoll RTC_ALRMBBINR SS LL_RTC_ALMB_SetSubSecond 02841 * @param RTCx RTC Instance 02842 * @param Subsecond If binary mode is none, Value between Min_Data=0x0 and Max_Data=0x7FFF 02843 * else Value between Min_Data=0x0 and Max_Data=0xFFFFFFFF 02844 * @retval None 02845 */ 02846 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond) 02847 { 02848 MODIFY_REG(RTCx->ALRBBINR, RTC_ALRBBINR_SS, Subsecond); 02849 } 02850 02851 /** 02852 * @brief Get Alarm B Sub seconds value 02853 * @rmtoll RTC_ALRMBBINR SS LL_RTC_ALMB_GetSubSecond 02854 * @param RTCx RTC Instance 02855 * @retval If binary mode is none, Value between Min_Data=0x0 and Max_Data=0x7FFF 02856 * else Value between Min_Data=0x0 and Max_Data=0xFFFFFFFF 02857 */ 02858 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecond(RTC_TypeDef *RTCx) 02859 { 02860 return (uint32_t)(READ_BIT(RTCx->ALRBBINR, RTC_ALRBBINR_SS)); 02861 } 02862 #else /* #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 02863 02864 /** 02865 * @brief Set Alarm B Sub seconds value 02866 * @rmtoll RTC_ALRMBSSR SS LL_RTC_ALMB_SetSubSecond 02867 * @param RTCx RTC Instance 02868 * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF 02869 * @retval None 02870 */ 02871 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond) 02872 { 02873 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS, Subsecond); 02874 } 02875 02876 /** 02877 * @brief Get Alarm B Sub seconds value 02878 * @rmtoll RTC_ALRMBSSR SS LL_RTC_ALMB_GetSubSecond 02879 * @param RTCx RTC Instance 02880 * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF 02881 */ 02882 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecond(RTC_TypeDef *RTCx) 02883 { 02884 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS)); 02885 } 02886 #endif /* #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 02887 02888 /** 02889 * @} 02890 */ 02891 02892 /** @defgroup RTC_LL_EF_Timestamp Timestamp 02893 * @{ 02894 */ 02895 02896 /** 02897 * @brief Enable internal event timestamp 02898 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02899 * @rmtoll RTC_CR ITSE LL_RTC_TS_EnableInternalEvent 02900 * @param RTCx RTC Instance 02901 * @retval None 02902 */ 02903 __STATIC_INLINE void LL_RTC_TS_EnableInternalEvent(RTC_TypeDef *RTCx) 02904 { 02905 SET_BIT(RTCx->CR, RTC_CR_ITSE); 02906 } 02907 02908 /** 02909 * @brief Disable internal event timestamp 02910 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02911 * @rmtoll RTC_CR ITSE LL_RTC_TS_DisableInternalEvent 02912 * @param RTCx RTC Instance 02913 * @retval None 02914 */ 02915 __STATIC_INLINE void LL_RTC_TS_DisableInternalEvent(RTC_TypeDef *RTCx) 02916 { 02917 CLEAR_BIT(RTCx->CR, RTC_CR_ITSE); 02918 } 02919 02920 /** 02921 * @brief Enable Timestamp 02922 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02923 * @rmtoll RTC_CR ITSE LL_RTC_TS_Enable 02924 * @param RTCx RTC Instance 02925 * @retval None 02926 */ 02927 __STATIC_INLINE void LL_RTC_TS_Enable(RTC_TypeDef *RTCx) 02928 { 02929 SET_BIT(RTCx->CR, RTC_CR_TSE); 02930 } 02931 02932 /** 02933 * @brief Disable Timestamp 02934 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02935 * @rmtoll RTC_CR ITSE LL_RTC_TS_Disable 02936 * @param RTCx RTC Instance 02937 * @retval None 02938 */ 02939 __STATIC_INLINE void LL_RTC_TS_Disable(RTC_TypeDef *RTCx) 02940 { 02941 CLEAR_BIT(RTCx->CR, RTC_CR_TSE); 02942 } 02943 02944 /** 02945 * @brief Set Time-stamp event active edge 02946 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02947 * @note TSE must be reset when TSEDGE is changed to avoid unwanted TSF setting 02948 * @rmtoll RTC_CR ITSEDGE LL_RTC_TS_SetActiveEdge 02949 * @param RTCx RTC Instance 02950 * @param Edge This parameter can be one of the following values: 02951 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING 02952 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING 02953 * @retval None 02954 */ 02955 __STATIC_INLINE void LL_RTC_TS_SetActiveEdge(RTC_TypeDef *RTCx, uint32_t Edge) 02956 { 02957 MODIFY_REG(RTCx->CR, RTC_CR_TSEDGE, Edge); 02958 } 02959 02960 /** 02961 * @brief Get Time-stamp event active edge 02962 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02963 * @rmtoll RTC_CR ITSEDGE LL_RTC_TS_GetActiveEdge 02964 * @param RTCx RTC Instance 02965 * @retval Returned value can be one of the following values: 02966 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING 02967 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING 02968 */ 02969 __STATIC_INLINE uint32_t LL_RTC_TS_GetActiveEdge(RTC_TypeDef *RTCx) 02970 { 02971 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TSEDGE)); 02972 } 02973 02974 /** 02975 * @brief Get Timestamp AM/PM notation (AM or 24-hour format) 02976 * @rmtoll RTC_TSTR PM LL_RTC_TS_GetTimeFormat 02977 * @param RTCx RTC Instance 02978 * @retval Returned value can be one of the following values: 02979 * @arg @ref LL_RTC_TS_TIME_FORMAT_AM 02980 * @arg @ref LL_RTC_TS_TIME_FORMAT_PM 02981 */ 02982 __STATIC_INLINE uint32_t LL_RTC_TS_GetTimeFormat(RTC_TypeDef *RTCx) 02983 { 02984 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_PM)); 02985 } 02986 02987 /** 02988 * @brief Get Timestamp Hours in BCD format 02989 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format 02990 * @rmtoll RTC_TSTR HT LL_RTC_TS_GetHour\n 02991 * RTC_TSTR HU LL_RTC_TS_GetHour 02992 * @param RTCx RTC Instance 02993 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 02994 */ 02995 __STATIC_INLINE uint32_t LL_RTC_TS_GetHour(RTC_TypeDef *RTCx) 02996 { 02997 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_HT | RTC_TSTR_HU) >> RTC_TSTR_HU_Pos); 02998 } 02999 03000 /** 03001 * @brief Get Timestamp Minutes in BCD format 03002 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format 03003 * @rmtoll RTC_TSTR MNT LL_RTC_TS_GetMinute\n 03004 * RTC_TSTR HU LL_RTC_TS_GetMinute 03005 * @param RTCx RTC Instance 03006 * @retval Value between Min_Data=0x00 and Max_Data=0x59 03007 */ 03008 __STATIC_INLINE uint32_t LL_RTC_TS_GetMinute(RTC_TypeDef *RTCx) 03009 { 03010 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_MNT | RTC_TSTR_MNU) >> RTC_TSTR_MNU_Pos); 03011 } 03012 03013 /** 03014 * @brief Get Timestamp Seconds in BCD format 03015 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format 03016 * @rmtoll RTC_TSTR ST LL_RTC_TS_GetSecond\n 03017 * RTC_TSTR HU LL_RTC_TS_GetSecond 03018 * @param RTCx RTC Instance 03019 * @retval Value between Min_Data=0x00 and Max_Data=0x59 03020 */ 03021 __STATIC_INLINE uint32_t LL_RTC_TS_GetSecond(RTC_TypeDef *RTCx) 03022 { 03023 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_ST | RTC_TSTR_SU)); 03024 } 03025 03026 /** 03027 * @brief Get Timestamp time (hour, minute and second) in BCD format 03028 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND 03029 * are available to get independently each parameter. 03030 * @rmtoll RTC_TSTR HT LL_RTC_TS_GetTime\n 03031 * RTC_TSTR HU LL_RTC_TS_GetTime\n 03032 * RTC_TSTR MNT LL_RTC_TS_GetTime\n 03033 * RTC_TSTR MNU LL_RTC_TS_GetTime\n 03034 * RTC_TSTR ST LL_RTC_TS_GetTime\n 03035 * RTC_TSTR SU LL_RTC_TS_GetTime 03036 * @param RTCx RTC Instance 03037 * @retval Combination of hours, minutes and seconds. 03038 */ 03039 __STATIC_INLINE uint32_t LL_RTC_TS_GetTime(RTC_TypeDef *RTCx) 03040 { 03041 return (uint32_t)(READ_BIT(RTCx->TSTR, 03042 RTC_TSTR_HT | RTC_TSTR_HU | RTC_TSTR_MNT | RTC_TSTR_MNU | RTC_TSTR_ST | RTC_TSTR_SU)); 03043 } 03044 03045 /** 03046 * @brief Get Timestamp Week day 03047 * @rmtoll RTC_TSDR WDU LL_RTC_TS_GetWeekDay 03048 * @param RTCx RTC Instance 03049 * @retval Returned value can be one of the following values: 03050 * @arg @ref LL_RTC_WEEKDAY_MONDAY 03051 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 03052 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 03053 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 03054 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 03055 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 03056 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 03057 */ 03058 __STATIC_INLINE uint32_t LL_RTC_TS_GetWeekDay(RTC_TypeDef *RTCx) 03059 { 03060 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU) >> RTC_TSDR_WDU_Pos); 03061 } 03062 03063 /** 03064 * @brief Get Timestamp Month in BCD format 03065 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format 03066 * @rmtoll RTC_TSDR MT LL_RTC_TS_GetMonth\n 03067 * RTC_TSDR MU LL_RTC_TS_GetMonth 03068 * @param RTCx RTC Instance 03069 * @retval Returned value can be one of the following values: 03070 * @arg @ref LL_RTC_MONTH_JANUARY 03071 * @arg @ref LL_RTC_MONTH_FEBRUARY 03072 * @arg @ref LL_RTC_MONTH_MARCH 03073 * @arg @ref LL_RTC_MONTH_APRIL 03074 * @arg @ref LL_RTC_MONTH_MAY 03075 * @arg @ref LL_RTC_MONTH_JUNE 03076 * @arg @ref LL_RTC_MONTH_JULY 03077 * @arg @ref LL_RTC_MONTH_AUGUST 03078 * @arg @ref LL_RTC_MONTH_SEPTEMBER 03079 * @arg @ref LL_RTC_MONTH_OCTOBER 03080 * @arg @ref LL_RTC_MONTH_NOVEMBER 03081 * @arg @ref LL_RTC_MONTH_DECEMBER 03082 */ 03083 __STATIC_INLINE uint32_t LL_RTC_TS_GetMonth(RTC_TypeDef *RTCx) 03084 { 03085 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_MT | RTC_TSDR_MU) >> RTC_TSDR_MU_Pos); 03086 } 03087 03088 /** 03089 * @brief Get Timestamp Day in BCD format 03090 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format 03091 * @rmtoll RTC_TSDR DT LL_RTC_TS_GetDay\n 03092 * RTC_TSDR DU LL_RTC_TS_GetDay 03093 * @param RTCx RTC Instance 03094 * @retval Value between Min_Data=0x01 and Max_Data=0x31 03095 */ 03096 __STATIC_INLINE uint32_t LL_RTC_TS_GetDay(RTC_TypeDef *RTCx) 03097 { 03098 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_DT | RTC_TSDR_DU)); 03099 } 03100 03101 /** 03102 * @brief Get Timestamp date (WeekDay, Day and Month) in BCD format 03103 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_MONTH, 03104 * and __LL_RTC_GET_DAY are available to get independently each parameter. 03105 * @rmtoll RTC_TSDR WDU LL_RTC_TS_GetDate\n 03106 * RTC_TSDR MT LL_RTC_TS_GetDate\n 03107 * RTC_TSDR MU LL_RTC_TS_GetDate\n 03108 * RTC_TSDR DT LL_RTC_TS_GetDate\n 03109 * RTC_TSDR DU LL_RTC_TS_GetDate 03110 * @param RTCx RTC Instance 03111 * @retval Combination of Weekday, Day and Month 03112 */ 03113 __STATIC_INLINE uint32_t LL_RTC_TS_GetDate(RTC_TypeDef *RTCx) 03114 { 03115 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU | RTC_TSDR_MT | RTC_TSDR_MU | RTC_TSDR_DT | RTC_TSDR_DU)); 03116 } 03117 03118 /** 03119 * @brief Get time-stamp sub second value 03120 * @rmtoll RTC_TSSSR SS LL_RTC_TS_GetSubSecond 03121 * @param RTCx RTC Instance 03122 * @retval If binary mode is none, Value between Min_Data=0x0 and Max_Data=0x7FFF 03123 * else Value between Min_Data=0x0 and Max_Data=0xFFFFFFFF 03124 */ 03125 __STATIC_INLINE uint32_t LL_RTC_TS_GetSubSecond(RTC_TypeDef *RTCx) 03126 { 03127 return (uint32_t)(READ_BIT(RTCx->TSSSR, RTC_TSSSR_SS)); 03128 } 03129 03130 /** 03131 * @} 03132 */ 03133 03134 #if defined(RTC_WAKEUP_SUPPORT) 03135 /** @defgroup RTC_LL_EF_Wakeup Wakeup 03136 * @{ 03137 */ 03138 03139 /** 03140 * @brief Enable Wakeup timer 03141 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03142 * @rmtoll RTC_CR WUTE LL_RTC_WAKEUP_Enable 03143 * @param RTCx RTC Instance 03144 * @retval None 03145 */ 03146 __STATIC_INLINE void LL_RTC_WAKEUP_Enable(RTC_TypeDef *RTCx) 03147 { 03148 SET_BIT(RTCx->CR, RTC_CR_WUTE); 03149 } 03150 03151 /** 03152 * @brief Disable Wakeup timer 03153 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03154 * @rmtoll RTC_CR WUTE LL_RTC_WAKEUP_Disable 03155 * @param RTCx RTC Instance 03156 * @retval None 03157 */ 03158 __STATIC_INLINE void LL_RTC_WAKEUP_Disable(RTC_TypeDef *RTCx) 03159 { 03160 CLEAR_BIT(RTCx->CR, RTC_CR_WUTE); 03161 } 03162 03163 /** 03164 * @brief Check if Wakeup timer is enabled or not 03165 * @rmtoll RTC_CR WUTE LL_RTC_WAKEUP_IsEnabled 03166 * @param RTCx RTC Instance 03167 * @retval State of bit (1 or 0). 03168 */ 03169 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_IsEnabled(RTC_TypeDef *RTCx) 03170 { 03171 return (READ_BIT(RTCx->CR, RTC_CR_WUTE) == (RTC_CR_WUTE)); 03172 } 03173 03174 /** 03175 * @brief Select Wakeup clock 03176 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03177 * @note Bit can be written only when RTC_CR WUTE bit = 0 and RTC_ISR WUTWF bit = 1 03178 * @rmtoll RTC_CR WUCKSEL LL_RTC_WAKEUP_SetClock 03179 * @param RTCx RTC Instance 03180 * @param WakeupClock This parameter can be one of the following values: 03181 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16 03182 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8 03183 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4 03184 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2 03185 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE 03186 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT 03187 * @retval None 03188 */ 03189 __STATIC_INLINE void LL_RTC_WAKEUP_SetClock(RTC_TypeDef *RTCx, uint32_t WakeupClock) 03190 { 03191 MODIFY_REG(RTCx->CR, RTC_CR_WUCKSEL, WakeupClock); 03192 } 03193 03194 /** 03195 * @brief Get Wakeup clock 03196 * @rmtoll RTC_CR WUCKSEL LL_RTC_WAKEUP_GetClock 03197 * @param RTCx RTC Instance 03198 * @retval Returned value can be one of the following values: 03199 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16 03200 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8 03201 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4 03202 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2 03203 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE 03204 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT 03205 */ 03206 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetClock(RTC_TypeDef *RTCx) 03207 { 03208 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_WUCKSEL)); 03209 } 03210 03211 /** 03212 * @brief Set Wakeup auto-reload value 03213 * @note Bit can be written only when WUTWF is set to 1 in RTC_ISR 03214 * @rmtoll RTC_WUTR WUT LL_RTC_WAKEUP_SetAutoReload 03215 * @param RTCx RTC Instance 03216 * @param Value Value between Min_Data=0x00 and Max_Data=0xFFFF 03217 * @retval None 03218 */ 03219 __STATIC_INLINE void LL_RTC_WAKEUP_SetAutoReload(RTC_TypeDef *RTCx, uint32_t Value) 03220 { 03221 MODIFY_REG(RTCx->WUTR, RTC_WUTR_WUT, Value); 03222 } 03223 03224 /** 03225 * @brief Get Wakeup auto-reload value 03226 * @rmtoll RTC_WUTR WUT LL_RTC_WAKEUP_GetAutoReload 03227 * @param RTCx RTC Instance 03228 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF 03229 */ 03230 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetAutoReload(RTC_TypeDef *RTCx) 03231 { 03232 return (uint32_t)(READ_BIT(RTCx->WUTR, RTC_WUTR_WUT)); 03233 } 03234 03235 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 03236 /** 03237 * @brief Set Wakeup auto-clear value 03238 * @note Bit can be written only when WUTWF is set to 1 in RTC_ISR 03239 * @rmtoll RTC_WUTR WUTOCLR LL_RTC_WAKEUP_SetAutoClr 03240 * @param RTCx RTC Instance 03241 * @param Value Value between Min_Data=0x00 and Max_Data=0xFFFF 03242 * @retval None 03243 */ 03244 __STATIC_INLINE void LL_RTC_WAKEUP_SetAutoClr(RTC_TypeDef *RTCx, uint32_t Value) 03245 { 03246 MODIFY_REG(RTCx->WUTR, RTC_WUTR_WUTOCLR, (Value << RTC_WUTR_WUTOCLR_Pos)); 03247 } 03248 03249 /** 03250 * @brief Get Wakeup auto-clear value 03251 * @rmtoll RTC_WUTR WUTOCLR LL_RTC_WAKEUP_GetAutoClr 03252 * @param RTCx RTC Instance 03253 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF 03254 */ 03255 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetAutoClr(RTC_TypeDef *RTCx) 03256 { 03257 return (uint32_t)((READ_BIT(RTCx->WUTR, RTC_WUTR_WUTOCLR)) >> RTC_WUTR_WUTOCLR_Pos); 03258 } 03259 #endif /* defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 03260 03261 /** 03262 * @} 03263 */ 03264 #endif /* RTC_WAKEUP_SUPPORT */ 03265 03266 /** @defgroup RTC_LL_EF_Calibration Calibration 03267 * @{ 03268 */ 03269 03270 /** 03271 * @brief Set Calibration output frequency (1 Hz or 512 Hz) 03272 * @note Bits are write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03273 * @rmtoll RTC_CR COE LL_RTC_CAL_SetOutputFreq\n 03274 * RTC_CR COSEL LL_RTC_CAL_SetOutputFreq 03275 * @param RTCx RTC Instance 03276 * @param Frequency This parameter can be one of the following values: 03277 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE 03278 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ 03279 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ 03280 * @retval None 03281 */ 03282 __STATIC_INLINE void LL_RTC_CAL_SetOutputFreq(RTC_TypeDef *RTCx, uint32_t Frequency) 03283 { 03284 MODIFY_REG(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL, Frequency); 03285 } 03286 03287 /** 03288 * @brief Get Calibration output frequency (1 Hz or 512 Hz) 03289 * @rmtoll RTC_CR COE LL_RTC_CAL_GetOutputFreq\n 03290 * RTC_CR COSEL LL_RTC_CAL_GetOutputFreq 03291 * @param RTCx RTC Instance 03292 * @retval Returned value can be one of the following values: 03293 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE 03294 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ 03295 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ 03296 */ 03297 __STATIC_INLINE uint32_t LL_RTC_CAL_GetOutputFreq(RTC_TypeDef *RTCx) 03298 { 03299 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL)); 03300 } 03301 03302 /** 03303 * @brief Insert or not One RTCCLK pulse every 2exp11 pulses (frequency increased by 488.5 ppm) 03304 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03305 * @note Bit can be written only when RECALPF is set to 0 03306 * @rmtoll RTC_CALR CALP LL_RTC_CAL_SetPulse 03307 * @param RTCx RTC Instance 03308 * @param Pulse This parameter can be one of the following values: 03309 * @arg @ref LL_RTC_CALIB_INSERTPULSE_NONE 03310 * @arg @ref LL_RTC_CALIB_INSERTPULSE_SET 03311 * @retval None 03312 */ 03313 __STATIC_INLINE void LL_RTC_CAL_SetPulse(RTC_TypeDef *RTCx, uint32_t Pulse) 03314 { 03315 MODIFY_REG(RTCx->CALR, RTC_CALR_CALP, Pulse); 03316 } 03317 03318 /** 03319 * @brief Check if one RTCCLK has been inserted or not every 2exp11 pulses (frequency increased by 488.5 ppm) 03320 * @rmtoll RTC_CALR CALP LL_RTC_CAL_IsPulseInserted 03321 * @param RTCx RTC Instance 03322 * @retval State of bit (1 or 0). 03323 */ 03324 __STATIC_INLINE uint32_t LL_RTC_CAL_IsPulseInserted(RTC_TypeDef *RTCx) 03325 { 03326 return (READ_BIT(RTCx->CALR, RTC_CALR_CALP) == (RTC_CALR_CALP)); 03327 } 03328 03329 /** 03330 * @brief Set the calibration cycle period 03331 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03332 * @note Bit can be written only when RECALPF is set to 0 03333 * @rmtoll RTC_CALR CALW8 LL_RTC_CAL_SetPeriod\n 03334 * RTC_CALR CALW16 LL_RTC_CAL_SetPeriod 03335 * @param RTCx RTC Instance 03336 * @param Period This parameter can be one of the following values: 03337 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC 03338 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC 03339 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC 03340 * @retval None 03341 */ 03342 __STATIC_INLINE void LL_RTC_CAL_SetPeriod(RTC_TypeDef *RTCx, uint32_t Period) 03343 { 03344 MODIFY_REG(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16, Period); 03345 } 03346 03347 /** 03348 * @brief Get the calibration cycle period 03349 * @rmtoll RTC_CALR CALW8 LL_RTC_CAL_GetPeriod\n 03350 * RTC_CALR CALW16 LL_RTC_CAL_GetPeriod 03351 * @param RTCx RTC Instance 03352 * @retval Returned value can be one of the following values: 03353 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC 03354 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC 03355 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC 03356 */ 03357 __STATIC_INLINE uint32_t LL_RTC_CAL_GetPeriod(RTC_TypeDef *RTCx) 03358 { 03359 return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16)); 03360 } 03361 03362 /** 03363 * @brief Set Calibration minus 03364 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03365 * @note Bit can be written only when RECALPF is set to 0 03366 * @rmtoll RTC_CALR CALM LL_RTC_CAL_SetMinus 03367 * @param RTCx RTC Instance 03368 * @param CalibMinus Value between Min_Data=0x00 and Max_Data=0x1FF 03369 * @retval None 03370 */ 03371 __STATIC_INLINE void LL_RTC_CAL_SetMinus(RTC_TypeDef *RTCx, uint32_t CalibMinus) 03372 { 03373 MODIFY_REG(RTCx->CALR, RTC_CALR_CALM, CalibMinus); 03374 } 03375 03376 /** 03377 * @brief Get Calibration minus 03378 * @rmtoll RTC_CALR CALM LL_RTC_CAL_GetMinus 03379 * @param RTCx RTC Instance 03380 * @retval Value between Min_Data=0x00 and Max_Data= 0x1FF 03381 */ 03382 __STATIC_INLINE uint32_t LL_RTC_CAL_GetMinus(RTC_TypeDef *RTCx) 03383 { 03384 return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALM)); 03385 } 03386 03387 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 03388 /** 03389 * @brief Enable Calibration Low Power 03390 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03391 * @note Bit can be written only when RECALPF is set to 0 03392 * @rmtoll RTC_CALR LPCAL LL_RTC_CAL_LowPower_Enable 03393 * @param RTCx RTC Instance 03394 * @retval None 03395 */ 03396 __STATIC_INLINE void LL_RTC_CAL_LowPower_Enable(RTC_TypeDef *RTCx) 03397 { 03398 SET_BIT(RTCx->CALR, RTC_CALR_LPCAL); 03399 } 03400 03401 /** 03402 * @brief Disable Calibration Low Power 03403 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03404 * @note Bit can be written only when RECALPF is set to 0 03405 * @rmtoll RTC_CALR LPCAL LL_RTC_CAL_LowPower_Disable 03406 * @param RTCx RTC Instance 03407 * @retval None 03408 */ 03409 __STATIC_INLINE void LL_RTC_CAL_LowPower_Disable(RTC_TypeDef *RTCx) 03410 { 03411 CLEAR_BIT(RTCx->CALR, RTC_CALR_LPCAL); 03412 } 03413 03414 /** 03415 * @brief Check if Calibration Low Power is enabled or not 03416 * @rmtoll RTC_CALR LPCAL LL_RTC_CAL_LowPower_IsEnabled 03417 * @param RTCx RTC Instance 03418 * @retval State of bit (1 or 0). 03419 */ 03420 __STATIC_INLINE uint32_t LL_RTC_CAL_LowPower_IsEnabled(RTC_TypeDef *RTCx) 03421 { 03422 return (READ_BIT(RTCx->CALR, RTC_CALR_LPCAL) == (RTC_CALR_LPCAL)); 03423 } 03424 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 03425 /** 03426 * @} 03427 */ 03428 03429 03430 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 03431 /** 03432 * @brief Activate timestamp on tamper detection event 03433 * @rmtoll RTC_CR TAMPTS LL_RTC_TS_EnableOnTamper 03434 * @param RTCx RTC Instance 03435 * @retval None 03436 */ 03437 __STATIC_INLINE void LL_RTC_TS_EnableOnTamper(RTC_TypeDef *RTCx) 03438 { 03439 SET_BIT(RTCx->CR, RTC_CR_TAMPTS); 03440 } 03441 03442 /** 03443 * @brief Disable timestamp on tamper detection event 03444 * @rmtoll RTC_CR TAMPTS LL_RTC_TS_DisableOnTamper 03445 * @param RTCx RTC Instance 03446 * @retval None 03447 */ 03448 __STATIC_INLINE void LL_RTC_TS_DisableOnTamper(RTC_TypeDef *RTCx) 03449 { 03450 CLEAR_BIT(RTCx->CR, RTC_CR_TAMPTS); 03451 } 03452 03453 /** @defgroup RTC_LL_EF_Tamper Tamper 03454 * @{ 03455 */ 03456 03457 /** 03458 * @brief Enable TAMPx input detection 03459 * @rmtoll TAMP_CR1 TAMP1E LL_RTC_TAMPER_Enable\n 03460 * TAMP_CR1 TAMP2E LL_RTC_TAMPER_Enable 03461 * @param TAMPx TAMP Instance 03462 * @param Tamper This parameter can be a combination of the following values: 03463 * @arg @ref LL_RTC_TAMPER_1 03464 * @arg @ref LL_RTC_TAMPER_2 03465 * 03466 * @retval None 03467 */ 03468 __STATIC_INLINE void LL_RTC_TAMPER_Enable(TAMP_TypeDef *TAMPx, uint32_t Tamper) 03469 { 03470 SET_BIT(TAMPx->CR1, Tamper); 03471 } 03472 03473 /** 03474 * @brief Clear TAMPx input detection 03475 * @rmtoll TAMP_CR1 TAMP1E LL_RTC_TAMPER_Disable\n 03476 * TAMP_CR1 TAMP2E LL_RTC_TAMPER_Disable 03477 * @param TAMPx TAMP Instance 03478 * @param Tamper This parameter can be a combination of the following values: 03479 * @arg @ref LL_RTC_TAMPER_1 03480 * @arg @ref LL_RTC_TAMPER_2 03481 * 03482 * @retval None 03483 */ 03484 __STATIC_INLINE void LL_RTC_TAMPER_Disable(TAMP_TypeDef *TAMPx, uint32_t Tamper) 03485 { 03486 CLEAR_BIT(TAMPx->CR1, Tamper); 03487 } 03488 03489 /** 03490 * @brief Enable Tamper mask flag 03491 * @note Associated Tamper IT must not enabled when tamper mask is set. 03492 * @rmtoll TAMP_CR2 TAMP1MF LL_RTC_TAMPER_EnableMask\n 03493 * TAMP_CR2 TAMP2MF LL_RTC_TAMPER_EnableMask 03494 * @param TAMPx TAMP Instance 03495 * @param Mask This parameter can be a combination of the following values: 03496 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER1 03497 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER2 03498 * 03499 * @retval None 03500 */ 03501 __STATIC_INLINE void LL_RTC_TAMPER_EnableMask(TAMP_TypeDef *TAMPx, uint32_t Mask) 03502 { 03503 SET_BIT(TAMPx->CR2, Mask); 03504 } 03505 03506 /** 03507 * @brief Disable Tamper mask flag 03508 * @rmtoll TAMP_CR2 TAMP1MF LL_RTC_TAMPER_DisableMask\n 03509 * TAMP_CR2 TAMP2MF LL_RTC_TAMPER_DisableMask 03510 * @param TAMPx TAMP Instance 03511 * @param Mask This parameter can be a combination of the following values: 03512 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER1 03513 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER2 03514 * 03515 * @retval None 03516 */ 03517 __STATIC_INLINE void LL_RTC_TAMPER_DisableMask(TAMP_TypeDef *TAMPx, uint32_t Mask) 03518 { 03519 CLEAR_BIT(TAMPx->CR2, Mask); 03520 } 03521 03522 /** 03523 * @brief Enable backup register erase after Tamper event detection 03524 * @rmtoll TAMP_CR2 TAMP1NOERASE LL_RTC_TAMPER_EnableEraseBKP\n 03525 * TAMP_CR2 TAMP2NOERASE LL_RTC_TAMPER_EnableEraseBKP 03526 * @param TAMPx TAMP Instance 03527 * @param Tamper This parameter can be a combination of the following values: 03528 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1 03529 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2 03530 * 03531 * @retval None 03532 */ 03533 __STATIC_INLINE void LL_RTC_TAMPER_EnableEraseBKP(TAMP_TypeDef *TAMPx, uint32_t Tamper) 03534 { 03535 CLEAR_BIT(TAMPx->CR2, Tamper); 03536 } 03537 03538 /** 03539 * @brief Disable backup register erase after Tamper event detection 03540 * @rmtoll TAMP_CR2 TAMP1NOERASE LL_RTC_TAMPER_DisableEraseBKP\n 03541 * TAMP_CR2 TAMP2NOERASE LL_RTC_TAMPER_DisableEraseBKP 03542 * @param TAMPx TAMP Instance 03543 * @param Tamper This parameter can be a combination of the following values: 03544 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1 03545 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2 03546 * 03547 * @retval None 03548 */ 03549 __STATIC_INLINE void LL_RTC_TAMPER_DisableEraseBKP(TAMP_TypeDef *TAMPx, uint32_t Tamper) 03550 { 03551 SET_BIT(TAMPx->CR2, Tamper); 03552 } 03553 03554 /** 03555 * @brief Disable RTC_TAMPx pull-up disable (Disable precharge of RTC_TAMPx pins) 03556 * @rmtoll TAMP_FLTCR TAMPPUDIS LL_RTC_TAMPER_DisablePullUp 03557 * @param TAMPx TAMP Instance 03558 * @retval None 03559 */ 03560 __STATIC_INLINE void LL_RTC_TAMPER_DisablePullUp(TAMP_TypeDef *TAMPx) 03561 { 03562 SET_BIT(TAMPx->FLTCR, TAMP_FLTCR_TAMPPUDIS); 03563 } 03564 03565 /** 03566 * @brief Enable RTC_TAMPx pull-up disable ( Precharge RTC_TAMPx pins before sampling) 03567 * @rmtoll TAMP_FLTCR TAMPPUDIS LL_RTC_TAMPER_EnablePullUp 03568 * @param TAMPx TAMP Instance 03569 * @retval None 03570 */ 03571 __STATIC_INLINE void LL_RTC_TAMPER_EnablePullUp(TAMP_TypeDef *TAMPx) 03572 { 03573 CLEAR_BIT(TAMPx->FLTCR, TAMP_FLTCR_TAMPPUDIS); 03574 } 03575 03576 /** 03577 * @brief Set RTC_TAMPx precharge duration 03578 * @rmtoll TAMP_FLTCR TAMPPRCH LL_RTC_TAMPER_SetPrecharge 03579 * @param TAMPx TAMP Instance 03580 * @param Duration This parameter can be one of the following values: 03581 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK 03582 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK 03583 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK 03584 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK 03585 * @retval None 03586 */ 03587 __STATIC_INLINE void LL_RTC_TAMPER_SetPrecharge(TAMP_TypeDef *TAMPx, uint32_t Duration) 03588 { 03589 MODIFY_REG(TAMPx->FLTCR, TAMP_FLTCR_TAMPPRCH, Duration); 03590 } 03591 03592 /** 03593 * @brief Get RTC_TAMPx precharge duration 03594 * @rmtoll TAMP_FLTCR TAMPPRCH LL_RTC_TAMPER_GetPrecharge 03595 * @param TAMPx TAMP Instance 03596 * @retval Returned value can be one of the following values: 03597 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK 03598 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK 03599 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK 03600 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK 03601 */ 03602 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPrecharge(TAMP_TypeDef *TAMPx) 03603 { 03604 return (uint32_t)(READ_BIT(TAMPx->FLTCR, TAMP_FLTCR_TAMPPRCH)); 03605 } 03606 03607 /** 03608 * @brief Set RTC_TAMPx filter count 03609 * @rmtoll TAMP_FLTCR TAMPFLT LL_RTC_TAMPER_SetFilterCount 03610 * @param TAMPx TAMP Instance 03611 * @param FilterCount This parameter can be one of the following values: 03612 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE 03613 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE 03614 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE 03615 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE 03616 * @retval None 03617 */ 03618 __STATIC_INLINE void LL_RTC_TAMPER_SetFilterCount(TAMP_TypeDef *TAMPx, uint32_t FilterCount) 03619 { 03620 MODIFY_REG(TAMPx->FLTCR, TAMP_FLTCR_TAMPFLT, FilterCount); 03621 } 03622 03623 /** 03624 * @brief Get RTC_TAMPx filter count 03625 * @rmtoll TAMP_FLTCR TAMPFLT LL_RTC_TAMPER_GetFilterCount 03626 * @param TAMPx TAMP Instance 03627 * @retval Returned value can be one of the following values: 03628 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE 03629 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE 03630 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE 03631 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE 03632 */ 03633 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetFilterCount(TAMP_TypeDef *TAMPx) 03634 { 03635 return (uint32_t)(READ_BIT(TAMPx->FLTCR, TAMP_FLTCR_TAMPFLT)); 03636 } 03637 03638 /** 03639 * @brief Set Tamper sampling frequency 03640 * @rmtoll TAMP_FLTCR TAMPFREQ LL_RTC_TAMPER_SetSamplingFreq 03641 * @param TAMPx TAMP Instance 03642 * @param SamplingFreq This parameter can be one of the following values: 03643 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768 03644 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384 03645 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192 03646 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096 03647 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048 03648 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024 03649 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512 03650 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256 03651 * @retval None 03652 */ 03653 __STATIC_INLINE void LL_RTC_TAMPER_SetSamplingFreq(TAMP_TypeDef *TAMPx, uint32_t SamplingFreq) 03654 { 03655 MODIFY_REG(TAMPx->FLTCR, TAMP_FLTCR_TAMPFREQ, SamplingFreq); 03656 } 03657 03658 /** 03659 * @brief Get Tamper sampling frequency 03660 * @rmtoll TAMP_FLTCR TAMPFREQ LL_RTC_TAMPER_GetSamplingFreq 03661 * @param TAMPx TAMP Instance 03662 * @retval Returned value can be one of the following values: 03663 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768 03664 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384 03665 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192 03666 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096 03667 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048 03668 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024 03669 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512 03670 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256 03671 */ 03672 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetSamplingFreq(TAMP_TypeDef *TAMPx) 03673 { 03674 return (uint32_t)(READ_BIT(TAMPx->FLTCR, TAMP_FLTCR_TAMPFREQ)); 03675 } 03676 03677 /** 03678 * @brief Enable Active level for Tamper input 03679 * @rmtoll TAMP_CR2 TAMP1TRG LL_RTC_TAMPER_EnableActiveLevel\n 03680 * TAMP_CR2 TAMP2TRG LL_RTC_TAMPER_EnableActiveLevel 03681 * @param TAMPx TAMP Instance 03682 * @param Tamper This parameter can be a combination of the following values: 03683 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 03684 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 03685 * 03686 * @retval None 03687 */ 03688 __STATIC_INLINE void LL_RTC_TAMPER_EnableActiveLevel(TAMP_TypeDef *TAMPx, uint32_t Tamper) 03689 { 03690 SET_BIT(TAMPx->CR2, Tamper); 03691 } 03692 03693 /** 03694 * @brief Disable Active level for Tamper input 03695 * @rmtoll TAMP_CR2 TAMP1TRG LL_RTC_TAMPER_DisableActiveLevel\n 03696 * TAMP_CR2 TAMP2TRG LL_RTC_TAMPER_DisableActiveLevel 03697 * @param TAMPx TAMP Instance 03698 * @param Tamper This parameter can be a combination of the following values: 03699 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 03700 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 03701 * 03702 * @retval None 03703 */ 03704 __STATIC_INLINE void LL_RTC_TAMPER_DisableActiveLevel(TAMP_TypeDef *TAMPx, uint32_t Tamper) 03705 { 03706 CLEAR_BIT(TAMPx->CR2, Tamper); 03707 } 03708 03709 /** 03710 * @} 03711 */ 03712 03713 /** @defgroup RTC_LL_EF_Backup_Registers Backup_Registers 03714 * @{ 03715 */ 03716 03717 /** 03718 * @brief Writes a data in a specified Backup data register. 03719 * @rmtoll TAMP_BKPxR BKP LL_RTC_BKP_SetRegister 03720 * @param TAMPx RTC Instance 03721 * @param BackupRegister This parameter can be one of the following values: 03722 * @arg @ref LL_RTC_BKP_DR0 03723 * @arg @ref LL_RTC_BKP_DR1 03724 * @arg @ref LL_RTC_BKP_DR2 03725 * @arg @ref LL_RTC_BKP_DR3 03726 * @arg @ref LL_RTC_BKP_DR4 03727 * @param Data Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF 03728 * @retval None 03729 */ 03730 __STATIC_INLINE void LL_RTC_BKP_SetRegister(TAMP_TypeDef *TAMPx, uint32_t BackupRegister, uint32_t Data) 03731 { 03732 uint32_t tmp = 0U; 03733 03734 tmp = (uint32_t)(&(TAMPx->BKP0R)); 03735 tmp += (BackupRegister * 4U); 03736 03737 /* Write the specified register */ 03738 *(__IO uint32_t *)tmp = (uint32_t)Data; 03739 } 03740 03741 /** 03742 * @brief Reads data from the specified RTC Backup data Register. 03743 * @rmtoll TAMP_BKPxR BKP LL_RTC_BKP_GetRegister 03744 * @param TAMPx RTC Instance 03745 * @param BackupRegister This parameter can be one of the following values: 03746 * @arg @ref LL_RTC_BKP_DR0 03747 * @arg @ref LL_RTC_BKP_DR1 03748 * @arg @ref LL_RTC_BKP_DR2 03749 * @arg @ref LL_RTC_BKP_DR3 03750 * @arg @ref LL_RTC_BKP_DR4 03751 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF 03752 */ 03753 __STATIC_INLINE uint32_t LL_RTC_BKP_GetRegister(TAMP_TypeDef *TAMPx, uint32_t BackupRegister) 03754 { 03755 uint32_t tmp = 0U; 03756 03757 tmp = (uint32_t)(&(TAMPx->BKP0R)); 03758 tmp += (BackupRegister * 4U); 03759 03760 /* Read the specified register */ 03761 return (*(__IO uint32_t *)tmp); 03762 } 03763 03764 /** 03765 * @} 03766 */ 03767 03768 /** @defgroup RTC_LL_EF_FLAG_Management FLAG_Management 03769 * @{ 03770 */ 03771 03772 /** 03773 * @brief Get Internal Time-stamp flag 03774 * @rmtoll RTC_SR ITSF LL_RTC_IsActiveFlag_ITS 03775 * @param RTCx RTC Instance 03776 * @retval State of bit (1 or 0). 03777 */ 03778 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITS(RTC_TypeDef *RTCx) 03779 { 03780 return (READ_BIT(RTCx->SR, RTC_SR_ITSF) == (RTC_SR_ITSF)); 03781 } 03782 03783 /** 03784 * @brief Get Recalibration pending Flag 03785 * @rmtoll RTC_ICSR RECALPF LL_RTC_IsActiveFlag_RECALP 03786 * @param RTCx RTC Instance 03787 * @retval State of bit (1 or 0). 03788 */ 03789 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RECALP(RTC_TypeDef *RTCx) 03790 { 03791 return (READ_BIT(RTCx->ICSR, RTC_ICSR_RECALPF) == (RTC_ICSR_RECALPF)); 03792 } 03793 03794 /** 03795 * @brief Get Time-stamp overflow flag 03796 * @rmtoll RTC_SR TSOVF LL_RTC_IsActiveFlag_TSOV 03797 * @param RTCx RTC Instance 03798 * @retval State of bit (1 or 0). 03799 */ 03800 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOV(RTC_TypeDef *RTCx) 03801 { 03802 return (READ_BIT(RTCx->SR, RTC_SR_TSOVF) == (RTC_SR_TSOVF)); 03803 } 03804 03805 /** 03806 * @brief Get Time-stamp flag 03807 * @rmtoll RTC_SR TSF LL_RTC_IsActiveFlag_TS 03808 * @param RTCx RTC Instance 03809 * @retval State of bit (1 or 0). 03810 */ 03811 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TS(RTC_TypeDef *RTCx) 03812 { 03813 return (READ_BIT(RTCx->SR, RTC_SR_TSF) == (RTC_SR_TSF)); 03814 } 03815 03816 /** 03817 * @brief Get Wakeup timer flag 03818 * @rmtoll RTC_SR WUTF LL_RTC_IsActiveFlag_WUT 03819 * @param RTCx RTC Instance 03820 * @retval State of bit (1 or 0). 03821 */ 03822 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUT(RTC_TypeDef *RTCx) 03823 { 03824 return (READ_BIT(RTCx->SR, RTC_SR_WUTF) == (RTC_SR_WUTF)); 03825 } 03826 03827 /** 03828 * @brief Get Alarm B flag 03829 * @rmtoll RTC_SR ALRBF LL_RTC_IsActiveFlag_ALRB 03830 * @param RTCx RTC Instance 03831 * @retval State of bit (1 or 0). 03832 */ 03833 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRB(RTC_TypeDef *RTCx) 03834 { 03835 return (READ_BIT(RTCx->SR, RTC_SR_ALRBF) == (RTC_SR_ALRBF)); 03836 } 03837 03838 /** 03839 * @brief Get Alarm A flag 03840 * @rmtoll RTC_SR ALRAF LL_RTC_IsActiveFlag_ALRA 03841 * @param RTCx RTC Instance 03842 * @retval State of bit (1 or 0). 03843 */ 03844 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRA(RTC_TypeDef *RTCx) 03845 { 03846 return (READ_BIT(RTCx->SR, RTC_SR_ALRAF) == (RTC_SR_ALRAF)); 03847 } 03848 03849 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 03850 /** 03851 * @brief Get SSR Underflow flag 03852 * @rmtoll RTC_SR SSRUF LL_RTC_IsActiveFlag_SSRU 03853 * @param RTCx RTC Instance 03854 * @retval State of bit (1 or 0). 03855 */ 03856 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SSRU(RTC_TypeDef *RTCx) 03857 { 03858 return ((READ_BIT(RTCx->SR, RTC_SR_SSRUF) == (RTC_SR_SSRUF)) ? 1U : 0U); 03859 } 03860 #endif 03861 03862 /** 03863 * @brief Clear Internal Time-stamp flag 03864 * @rmtoll RTC_SCR CITSF LL_RTC_ClearFlag_ITS 03865 * @param RTCx RTC Instance 03866 * @retval None 03867 */ 03868 __STATIC_INLINE void LL_RTC_ClearFlag_ITS(RTC_TypeDef *RTCx) 03869 { 03870 SET_BIT(RTCx->SCR, RTC_SCR_CITSF); 03871 } 03872 03873 /** 03874 * @brief Clear Time-stamp overflow flag 03875 * @rmtoll RTC_SCR CTSOVF LL_RTC_ClearFlag_TSOV 03876 * @param RTCx RTC Instance 03877 * @retval None 03878 */ 03879 __STATIC_INLINE void LL_RTC_ClearFlag_TSOV(RTC_TypeDef *RTCx) 03880 { 03881 SET_BIT(RTCx->SCR, RTC_SCR_CTSOVF); 03882 } 03883 03884 /** 03885 * @brief Clear Time-stamp flag 03886 * @rmtoll RTC_SCR CTSF LL_RTC_ClearFlag_TS 03887 * @param RTCx RTC Instance 03888 * @retval None 03889 */ 03890 __STATIC_INLINE void LL_RTC_ClearFlag_TS(RTC_TypeDef *RTCx) 03891 { 03892 SET_BIT(RTCx->SCR, RTC_SCR_CTSF); 03893 } 03894 03895 /** 03896 * @brief Clear Wakeup timer flag 03897 * @rmtoll RTC_SCR CWUTF LL_RTC_ClearFlag_WUT 03898 * @param RTCx RTC Instance 03899 * @retval None 03900 */ 03901 __STATIC_INLINE void LL_RTC_ClearFlag_WUT(RTC_TypeDef *RTCx) 03902 { 03903 SET_BIT(RTCx->SCR, RTC_SCR_CWUTF); 03904 } 03905 03906 /** 03907 * @brief Clear Alarm B flag 03908 * @rmtoll RTC_SCR CALRBF LL_RTC_ClearFlag_ALRB 03909 * @param RTCx RTC Instance 03910 * @retval None 03911 */ 03912 __STATIC_INLINE void LL_RTC_ClearFlag_ALRB(RTC_TypeDef *RTCx) 03913 { 03914 SET_BIT(RTCx->SCR, RTC_SCR_CALRBF); 03915 } 03916 03917 /** 03918 * @brief Clear Alarm A flag 03919 * @rmtoll RTC_SCR CALRAF LL_RTC_ClearFlag_ALRA 03920 * @param RTCx RTC Instance 03921 * @retval None 03922 */ 03923 __STATIC_INLINE void LL_RTC_ClearFlag_ALRA(RTC_TypeDef *RTCx) 03924 { 03925 SET_BIT(RTCx->SCR, RTC_SCR_CALRAF); 03926 } 03927 03928 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 03929 /** 03930 * @brief Clear SSR Underflow flag 03931 * @rmtoll RTC_SCR CSSRUF LL_RTC_ClearFlag_SSRU 03932 * @param RTCx RTC Instance 03933 * @retval None 03934 */ 03935 __STATIC_INLINE void LL_RTC_ClearFlag_SSRU(RTC_TypeDef *RTCx) 03936 { 03937 WRITE_REG(RTCx->SCR, RTC_SCR_CSSRUF); 03938 } 03939 #endif /* #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 03940 03941 03942 /** 03943 * @brief Get Initialization flag 03944 * @rmtoll RTC_ICSR INITF LL_RTC_IsActiveFlag_INIT 03945 * @param RTCx RTC Instance 03946 * @retval State of bit (1 or 0). 03947 */ 03948 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INIT(RTC_TypeDef *RTCx) 03949 { 03950 return (READ_BIT(RTCx->ICSR, RTC_ICSR_INITF) == (RTC_ICSR_INITF)); 03951 } 03952 03953 /** 03954 * @brief Get Registers synchronization flag 03955 * @rmtoll RTC_ICSR RSF LL_RTC_IsActiveFlag_RS 03956 * @param RTCx RTC Instance 03957 * @retval State of bit (1 or 0). 03958 */ 03959 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RS(RTC_TypeDef *RTCx) 03960 { 03961 return (READ_BIT(RTCx->ICSR, RTC_ICSR_RSF) == (RTC_ICSR_RSF)); 03962 } 03963 03964 /** 03965 * @brief Clear Registers synchronization flag 03966 * @rmtoll RTC_ICSR RSF LL_RTC_ClearFlag_RS 03967 * @param RTCx RTC Instance 03968 * @retval None 03969 */ 03970 __STATIC_INLINE void LL_RTC_ClearFlag_RS(RTC_TypeDef *RTCx) 03971 { 03972 WRITE_REG(RTCx->ICSR, (~((RTC_ICSR_RSF | RTC_ICSR_INIT) & 0x000000FFU) | (RTCx->ICSR & RTC_ICSR_INIT))); 03973 } 03974 03975 /** 03976 * @brief Get Initialization status flag 03977 * @rmtoll RTC_ICSR INITS LL_RTC_IsActiveFlag_INITS 03978 * @param RTCx RTC Instance 03979 * @retval State of bit (1 or 0). 03980 */ 03981 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INITS(RTC_TypeDef *RTCx) 03982 { 03983 return (READ_BIT(RTCx->ICSR, RTC_ICSR_INITS) == (RTC_ICSR_INITS)); 03984 } 03985 03986 /** 03987 * @brief Get Shift operation pending flag 03988 * @rmtoll RTC_ICSR SHPF LL_RTC_IsActiveFlag_SHP 03989 * @param RTCx RTC Instance 03990 * @retval State of bit (1 or 0). 03991 */ 03992 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SHP(RTC_TypeDef *RTCx) 03993 { 03994 return (READ_BIT(RTCx->ICSR, RTC_ICSR_SHPF) == (RTC_ICSR_SHPF)); 03995 } 03996 03997 /** 03998 * @brief Get Wakeup timer write flag 03999 * @rmtoll RTC_ICSR WUTWF LL_RTC_IsActiveFlag_WUTW 04000 * @param RTCx RTC Instance 04001 * @retval State of bit (1 or 0). 04002 */ 04003 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTW(RTC_TypeDef *RTCx) 04004 { 04005 return (READ_BIT(RTCx->ICSR, RTC_ICSR_WUTWF) == (RTC_ICSR_WUTWF)); 04006 } 04007 04008 /** 04009 * @brief Get Alarm A masked flag. 04010 * @rmtoll RTC_MISR ALRAMF LL_RTC_IsActiveFlag_ALRAM 04011 * @param RTCx RTC Instance 04012 * @retval State of bit (1 or 0). 04013 */ 04014 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAM(RTC_TypeDef *RTCx) 04015 { 04016 return (READ_BIT(RTCx->MISR, RTC_MISR_ALRAMF) == (RTC_MISR_ALRAMF)); 04017 } 04018 04019 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 04020 /** 04021 * @brief Get SSR Underflow masked flag. 04022 * @rmtoll RTC_MISR SSRUMF LL_RTC_IsActiveFlag_SSRUM 04023 * @param RTCx RTC Instance 04024 * @retval State of bit (1 or 0). 04025 */ 04026 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SSRUM(RTC_TypeDef *RTCx) 04027 { 04028 return ((READ_BIT(RTCx->MISR, RTC_MISR_SSRUMF) == (RTC_MISR_SSRUMF)) ? 1U : 0U); 04029 } 04030 #endif 04031 04032 /** 04033 * @brief Get Alarm B masked flag. 04034 * @rmtoll RTC_MISR ALRBMF LL_RTC_IsActiveFlag_ALRBM 04035 * @param RTCx RTC Instance 04036 * @retval State of bit (1 or 0). 04037 */ 04038 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBM(RTC_TypeDef *RTCx) 04039 { 04040 return (READ_BIT(RTCx->MISR, RTC_MISR_ALRBMF) == (RTC_MISR_ALRBMF)); 04041 } 04042 04043 /** 04044 * @brief Get Wakeup timer masked flag. 04045 * @rmtoll RTC_MISR WUTMF LL_RTC_IsActiveFlag_WUTM 04046 * @param RTCx RTC Instance 04047 * @retval State of bit (1 or 0). 04048 */ 04049 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTM(RTC_TypeDef *RTCx) 04050 { 04051 return (READ_BIT(RTCx->MISR, RTC_MISR_WUTMF) == (RTC_MISR_WUTMF)); 04052 } 04053 04054 /** 04055 * @brief Get Time-stamp masked flag. 04056 * @rmtoll RTC_MISR TSMF LL_RTC_IsActiveFlag_TSM 04057 * @param RTCx RTC Instance 04058 * @retval State of bit (1 or 0). 04059 */ 04060 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSM(RTC_TypeDef *RTCx) 04061 { 04062 return (READ_BIT(RTCx->MISR, RTC_MISR_TSMF) == (RTC_MISR_TSMF)); 04063 } 04064 04065 /** 04066 * @brief Get Time-stamp overflow masked flag. 04067 * @rmtoll RTC_MISR TSOVMF LL_RTC_IsActiveFlag_TSOVM 04068 * @param RTCx RTC Instance 04069 * @retval State of bit (1 or 0). 04070 */ 04071 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOVM(RTC_TypeDef *RTCx) 04072 { 04073 return (READ_BIT(RTCx->MISR, RTC_MISR_TSOVMF) == (RTC_MISR_TSOVMF)); 04074 } 04075 04076 /** 04077 * @brief Get Internal Time-stamp masked flag. 04078 * @rmtoll RTC_MISR ITSMF LL_RTC_IsActiveFlag_ITSM 04079 * @param RTCx RTC Instance 04080 * @retval State of bit (1 or 0). 04081 */ 04082 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITSM(RTC_TypeDef *RTCx) 04083 { 04084 return (READ_BIT(RTCx->MISR, RTC_MISR_ITSMF) == (RTC_MISR_ITSMF)); 04085 } 04086 04087 /** 04088 * @brief Get tamper 1 detection flag. 04089 * @rmtoll TAMP_SR TAMP1F LL_RTC_IsActiveFlag_TAMP1 04090 * @param TAMPx TAMP Instance 04091 * @retval State of bit (1 or 0). 04092 */ 04093 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1(TAMP_TypeDef *TAMPx) 04094 { 04095 return (READ_BIT(TAMPx->SR, TAMP_SR_TAMP1F) == (TAMP_SR_TAMP1F)); 04096 } 04097 04098 /** 04099 * @brief Get tamper 2 detection flag. 04100 * @rmtoll TAMP_SR TAMP2F LL_RTC_IsActiveFlag_TAMP2 04101 * @param TAMPx TAMP Instance 04102 * @retval State of bit (1 or 0). 04103 */ 04104 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2(TAMP_TypeDef *TAMPx) 04105 { 04106 return (READ_BIT(TAMPx->SR, TAMP_SR_TAMP2F) == (TAMP_SR_TAMP2F)); 04107 } 04108 04109 #if defined(RTC_TAMPER3_SUPPORT) 04110 /** 04111 * @brief Get tamper 3 detection flag. 04112 * @rmtoll TAMP_SR TAMP3F LL_RTC_IsActiveFlag_TAMP3 04113 * @param TAMPx TAMP Instance 04114 * @retval State of bit (1 or 0). 04115 */ 04116 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3(TAMP_TypeDef *TAMPx) 04117 { 04118 return (READ_BIT(TAMPx->SR, TAMP_SR_TAMP3F) == (TAMP_SR_TAMP3F)); 04119 } 04120 #endif 04121 04122 /** 04123 * @brief Get tamper 1 interrupt masked flag. 04124 * @rmtoll TAMP_MISR TAMP1MF LL_RTC_IsActiveFlag_TAMP1M 04125 * @param TAMPx TAMP Instance 04126 * @retval State of bit (1 or 0). 04127 */ 04128 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1M(TAMP_TypeDef *TAMPx) 04129 { 04130 return (READ_BIT(TAMPx->MISR, TAMP_MISR_TAMP1MF) == (TAMP_MISR_TAMP1MF)); 04131 } 04132 04133 /** 04134 * @brief Get tamper 2 interrupt masked flag. 04135 * @rmtoll TAMP_MISR TAMP2MF LL_RTC_IsActiveFlag_TAMP2M 04136 * @param TAMPx TAMP Instance 04137 * @retval State of bit (1 or 0). 04138 */ 04139 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2M(TAMP_TypeDef *TAMPx) 04140 { 04141 return (READ_BIT(TAMPx->MISR, TAMP_MISR_TAMP2MF) == (TAMP_MISR_TAMP2MF)); 04142 } 04143 04144 #if defined(RTC_TAMPER3_SUPPORT) 04145 /** 04146 * @brief Get tamper 3 interrupt masked flag. 04147 * @rmtoll TAMP_MISR TAMP3MF LL_RTC_IsActiveFlag_TAMP3M 04148 * @param TAMPx TAMP Instance 04149 * @retval State of bit (1 or 0). 04150 */ 04151 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3M(TAMP_TypeDef *TAMPx) 04152 { 04153 return (READ_BIT(TAMPx->MISR, TAMP_MISR_TAMP3MF) == (TAMP_MISR_TAMP3MF)); 04154 } 04155 #endif 04156 04157 04158 /** 04159 * @brief Clear tamper 1 detection flag. 04160 * @rmtoll TAMP_SCR CTAMP1F LL_RTC_ClearFlag_TAMP1 04161 * @param TAMPx TAMP Instance 04162 * @retval None 04163 */ 04164 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP1(TAMP_TypeDef *TAMPx) 04165 { 04166 SET_BIT(TAMPx->SCR, TAMP_SCR_CTAMP1F); 04167 } 04168 04169 /** 04170 * @brief Clear tamper 2 detection flag. 04171 * @rmtoll TAMP_SCR CTAMP2F LL_RTC_ClearFlag_TAMP2 04172 * @param TAMPx TAMP Instance 04173 * @retval None 04174 */ 04175 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP2(TAMP_TypeDef *TAMPx) 04176 { 04177 SET_BIT(TAMPx->SCR, TAMP_SCR_CTAMP2F); 04178 } 04179 04180 #if defined(RTC_TAMPER3_SUPPORT) 04181 /** 04182 * @brief Clear tamper 3 detection flag. 04183 * @rmtoll TAMP_SCR CTAMP3F LL_RTC_ClearFlag_TAMP3 04184 * @param TAMPx TAMP Instance 04185 * @retval None 04186 */ 04187 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP3(TAMP_TypeDef *TAMPx) 04188 { 04189 SET_BIT(TAMPx->SCR, TAMP_SCR_CTAMP3F); 04190 } 04191 #endif 04192 04193 /** 04194 * @} 04195 */ 04196 04197 /** @defgroup RTC_LL_EF_IT_Management IT_Management 04198 * @{ 04199 */ 04200 04201 /** 04202 * @brief Enable Time-stamp interrupt 04203 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 04204 * @rmtoll RTC_CR TSIE LL_RTC_EnableIT_TS 04205 * @param RTCx RTC Instance 04206 * @retval None 04207 */ 04208 __STATIC_INLINE void LL_RTC_EnableIT_TS(RTC_TypeDef *RTCx) 04209 { 04210 SET_BIT(RTCx->CR, RTC_CR_TSIE); 04211 } 04212 04213 /** 04214 * @brief Disable Time-stamp interrupt 04215 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 04216 * @rmtoll RTC_CR TSIE LL_RTC_DisableIT_TS 04217 * @param RTCx RTC Instance 04218 * @retval None 04219 */ 04220 __STATIC_INLINE void LL_RTC_DisableIT_TS(RTC_TypeDef *RTCx) 04221 { 04222 CLEAR_BIT(RTCx->CR, RTC_CR_TSIE); 04223 } 04224 04225 /** 04226 * @brief Enable Wakeup timer interrupt 04227 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 04228 * @rmtoll RTC_CR WUTIE LL_RTC_EnableIT_WUT 04229 * @param RTCx RTC Instance 04230 * @retval None 04231 */ 04232 __STATIC_INLINE void LL_RTC_EnableIT_WUT(RTC_TypeDef *RTCx) 04233 { 04234 SET_BIT(RTCx->CR, RTC_CR_WUTIE); 04235 } 04236 04237 /** 04238 * @brief Disable Wakeup timer interrupt 04239 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 04240 * @rmtoll RTC_CR WUTIE LL_RTC_DisableIT_WUT 04241 * @param RTCx RTC Instance 04242 * @retval None 04243 */ 04244 __STATIC_INLINE void LL_RTC_DisableIT_WUT(RTC_TypeDef *RTCx) 04245 { 04246 CLEAR_BIT(RTCx->CR, RTC_CR_WUTIE); 04247 } 04248 04249 /** 04250 * @brief Enable Alarm B interrupt 04251 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 04252 * @rmtoll RTC_CR ALRBIE LL_RTC_EnableIT_ALRB 04253 * @param RTCx RTC Instance 04254 * @retval None 04255 */ 04256 __STATIC_INLINE void LL_RTC_EnableIT_ALRB(RTC_TypeDef *RTCx) 04257 { 04258 SET_BIT(RTCx->CR, RTC_CR_ALRBIE); 04259 } 04260 04261 /** 04262 * @brief Disable Alarm B interrupt 04263 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 04264 * @rmtoll RTC_CR ALRBIE LL_RTC_DisableIT_ALRB 04265 * @param RTCx RTC Instance 04266 * @retval None 04267 */ 04268 __STATIC_INLINE void LL_RTC_DisableIT_ALRB(RTC_TypeDef *RTCx) 04269 { 04270 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBIE); 04271 } 04272 04273 /** 04274 * @brief Enable Alarm A interrupt 04275 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 04276 * @rmtoll RTC_CR ALRAIE LL_RTC_EnableIT_ALRA 04277 * @param RTCx RTC Instance 04278 * @retval None 04279 */ 04280 __STATIC_INLINE void LL_RTC_EnableIT_ALRA(RTC_TypeDef *RTCx) 04281 { 04282 SET_BIT(RTCx->CR, RTC_CR_ALRAIE); 04283 } 04284 04285 /** 04286 * @brief Disable Alarm A interrupt 04287 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 04288 * @rmtoll RTC_CR ALRAIE LL_RTC_DisableIT_ALRA 04289 * @param RTCx RTC Instance 04290 * @retval None 04291 */ 04292 __STATIC_INLINE void LL_RTC_DisableIT_ALRA(RTC_TypeDef *RTCx) 04293 { 04294 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAIE); 04295 } 04296 04297 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 04298 /** 04299 * @brief Enable SSR Underflow interrupt 04300 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 04301 * @rmtoll RTC_CR SSRUIE LL_RTC_EnableIT_SSRU 04302 * @param RTCx RTC Instance 04303 * @retval None 04304 */ 04305 __STATIC_INLINE void LL_RTC_EnableIT_SSRU(RTC_TypeDef *RTCx) 04306 { 04307 SET_BIT(RTCx->CR, RTC_CR_SSRUIE); 04308 } 04309 04310 /** 04311 * @brief Disable SSR Underflow interrupt 04312 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 04313 * @rmtoll RTC_CR SSRUIE LL_RTC_DisableIT_SSRU 04314 * @param RTCx RTC Instance 04315 * @retval None 04316 */ 04317 __STATIC_INLINE void LL_RTC_DisableIT_SSRU(RTC_TypeDef *RTCx) 04318 { 04319 CLEAR_BIT(RTCx->CR, RTC_CR_SSRUIE); 04320 } 04321 04322 /** 04323 * @brief Check if SSR Underflow interrupt is enabled or not 04324 * @rmtoll RTC_CR SSRUIE LL_RTC_IsEnabledIT_SSRU 04325 * @param RTCx RTC Instance 04326 * @retval State of bit (1 or 0). 04327 */ 04328 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_SSRU(RTC_TypeDef *RTCx) 04329 { 04330 return ((READ_BIT(RTCx->CR, RTC_CR_SSRUIE) == (RTC_CR_SSRUIE)) ? 1U : 0U); 04331 } 04332 #endif /* #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 04333 04334 /** 04335 * @brief Check if Time-stamp interrupt is enabled or not 04336 * @rmtoll RTC_CR TSIE LL_RTC_IsEnabledIT_TS 04337 * @param RTCx RTC Instance 04338 * @retval State of bit (1 or 0). 04339 */ 04340 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TS(RTC_TypeDef *RTCx) 04341 { 04342 return (READ_BIT(RTCx->CR, RTC_CR_TSIE) == (RTC_CR_TSIE)); 04343 } 04344 04345 /** 04346 * @brief Check if Wakeup timer interrupt is enabled or not 04347 * @rmtoll RTC_CR WUTIE LL_RTC_IsEnabledIT_WUT 04348 * @param RTCx RTC Instance 04349 * @retval State of bit (1 or 0). 04350 */ 04351 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_WUT(RTC_TypeDef *RTCx) 04352 { 04353 return (READ_BIT(RTCx->CR, RTC_CR_WUTIE) == (RTC_CR_WUTIE)); 04354 } 04355 04356 /** 04357 * @brief Check if Alarm B interrupt is enabled or not 04358 * @rmtoll RTC_CR ALRBIE LL_RTC_IsEnabledIT_ALRB 04359 * @param RTCx RTC Instance 04360 * @retval State of bit (1 or 0). 04361 */ 04362 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRB(RTC_TypeDef *RTCx) 04363 { 04364 return (READ_BIT(RTCx->CR, RTC_CR_ALRBIE) == (RTC_CR_ALRBIE)); 04365 } 04366 04367 /** 04368 * @brief Check if Alarm A interrupt is enabled or not 04369 * @rmtoll RTC_CR ALRAIE LL_RTC_IsEnabledIT_ALRA 04370 * @param RTCx RTC Instance 04371 * @retval State of bit (1 or 0). 04372 */ 04373 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRA(RTC_TypeDef *RTCx) 04374 { 04375 return (READ_BIT(RTCx->CR, RTC_CR_ALRAIE) == (RTC_CR_ALRAIE)); 04376 } 04377 04378 /** 04379 * @brief Enable tamper 1 interrupt. 04380 * @rmtoll TAMP_IER TAMP1IE LL_RTC_EnableIT_TAMP1 04381 * @param TAMPx TAMP Instance 04382 * @retval None 04383 */ 04384 __STATIC_INLINE void LL_RTC_EnableIT_TAMP1(TAMP_TypeDef *TAMPx) 04385 { 04386 SET_BIT(TAMPx->IER, TAMP_IER_TAMP1IE); 04387 } 04388 04389 /** 04390 * @brief Disable tamper 1 interrupt. 04391 * @rmtoll TAMP_IER TAMP1IE LL_RTC_DisableIT_TAMP1 04392 * @param TAMPx TAMP Instance 04393 * @retval None 04394 */ 04395 __STATIC_INLINE void LL_RTC_DisableIT_TAMP1(TAMP_TypeDef *TAMPx) 04396 { 04397 CLEAR_BIT(TAMPx->IER, TAMP_IER_TAMP1IE); 04398 } 04399 04400 /** 04401 * @brief Enable tamper 2 interrupt. 04402 * @rmtoll TAMP_IER TAMP2IE LL_RTC_EnableIT_TAMP2 04403 * @param TAMPx TAMP Instance 04404 * @retval None 04405 */ 04406 __STATIC_INLINE void LL_RTC_EnableIT_TAMP2(TAMP_TypeDef *TAMPx) 04407 { 04408 SET_BIT(TAMPx->IER, TAMP_IER_TAMP2IE); 04409 } 04410 04411 /** 04412 * @brief Disable tamper 2 interrupt. 04413 * @rmtoll TAMP_IER TAMP2IE LL_RTC_DisableIT_TAMP2 04414 * @param TAMPx TAMP Instance 04415 * @retval None 04416 */ 04417 __STATIC_INLINE void LL_RTC_DisableIT_TAMP2(TAMP_TypeDef *TAMPx) 04418 { 04419 CLEAR_BIT(TAMPx->IER, TAMP_IER_TAMP2IE); 04420 } 04421 04422 /** 04423 * @brief Check if tamper 1 interrupt is enabled or not. 04424 * @rmtoll TAMP_IER TAMP1IE LL_RTC_IsEnabledIT_TAMP1 04425 * @param TAMPx TAMP Instance 04426 * @retval State of bit (1 or 0). 04427 */ 04428 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP1(TAMP_TypeDef *TAMPx) 04429 { 04430 return (READ_BIT(TAMPx->IER, TAMP_IER_TAMP1IE) == (TAMP_IER_TAMP1IE)); 04431 } 04432 04433 /** 04434 * @brief Check if tamper 2 interrupt is enabled or not. 04435 * @rmtoll TAMP_IER TAMP2IE LL_RTC_IsEnabledIT_TAMP2 04436 * @param TAMPx TAMP Instance 04437 * @retval State of bit (1 or 0). 04438 */ 04439 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP2(TAMP_TypeDef *TAMPx) 04440 { 04441 return (READ_BIT(TAMPx->IER, TAMP_IER_TAMP2IE) == (TAMP_IER_TAMP2IE)); 04442 } 04443 04444 #if defined(RTC_TAMPER3_SUPPORT) 04445 /** 04446 * @brief Enable tamper 3 interrupt. 04447 * @rmtoll TAMP_IER TAMP3IE LL_RTC_EnableIT_TAMP3 04448 * @param TAMPx TAMP Instance 04449 * @retval None 04450 */ 04451 __STATIC_INLINE void LL_RTC_EnableIT_TAMP3(TAMP_TypeDef *TAMPx) 04452 { 04453 SET_BIT(TAMPx->IER, TAMP_IER_TAMP3IE); 04454 } 04455 04456 /** 04457 * @brief Disable tamper 3 interrupt. 04458 * @rmtoll TAMP_IER TAMP3IE LL_RTC_DisableIT_TAMP3 04459 * @param TAMPx TAMP Instance 04460 * @retval None 04461 */ 04462 __STATIC_INLINE void LL_RTC_DisableIT_TAMP3(TAMP_TypeDef *TAMPx) 04463 { 04464 CLEAR_BIT(TAMPx->IER, TAMP_IER_TAMP3IE); 04465 } 04466 04467 /** 04468 * @brief Check if tamper 3 interrupt is enabled or not. 04469 * @rmtoll TAMP_IER TAMP3IE LL_RTC_IsEnabledIT_TAMP3 04470 * @param TAMPx TAMP Instance 04471 * @retval State of bit (1 or 0). 04472 */ 04473 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP3(TAMP_TypeDef *TAMPx) 04474 { 04475 return (READ_BIT(TAMPx->IER, TAMP_IER_TAMP3IE) == (TAMP_IER_TAMP3IE)); 04476 } 04477 #endif 04478 04479 /** 04480 * @} 04481 */ 04482 04483 #else /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 04484 04485 #if defined(RTC_TAMPCR_TAMPTS) 04486 /** 04487 * @brief Activate timestamp on tamper detection event 04488 * @rmtoll RTC_CR TAMPTS LL_RTC_TS_EnableOnTamper 04489 * @param RTCx RTC Instance 04490 * @retval None 04491 */ 04492 __STATIC_INLINE void LL_RTC_TS_EnableOnTamper(RTC_TypeDef *RTCx) 04493 { 04494 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPTS); 04495 } 04496 04497 /** 04498 * @brief Disable timestamp on tamper detection event 04499 * @rmtoll RTC_CR TAMPTS LL_RTC_TS_DisableOnTamper 04500 * @param RTCx RTC Instance 04501 * @retval None 04502 */ 04503 __STATIC_INLINE void LL_RTC_TS_DisableOnTamper(RTC_TypeDef *RTCx) 04504 { 04505 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPTS); 04506 } 04507 #endif /* RTC_TAMPCR_TAMPTS */ 04508 04509 /** @defgroup RTC_LL_EF_Tamper Tamper 04510 * @{ 04511 */ 04512 04513 /** 04514 * @brief Enable RTC_TAMPx input detection 04515 * @rmtoll TAMPCR TAMP1E LL_RTC_TAMPER_Enable\n 04516 * TAMPCR TAMP2E LL_RTC_TAMPER_Enable\n 04517 * TAMPCR TAMP3E LL_RTC_TAMPER_Enable 04518 * @param RTCx RTC Instance 04519 * @param Tamper This parameter can be a combination of the following values: 04520 * @arg @ref LL_RTC_TAMPER_1 04521 * @arg @ref LL_RTC_TAMPER_2 04522 * @arg @ref LL_RTC_TAMPER_3 04523 * 04524 * @retval None 04525 */ 04526 __STATIC_INLINE void LL_RTC_TAMPER_Enable(RTC_TypeDef *RTCx, uint32_t Tamper) 04527 { 04528 SET_BIT(RTCx->TAMPCR, Tamper); 04529 } 04530 04531 /** 04532 * @brief Clear RTC_TAMPx input detection 04533 * @rmtoll TAMPCR TAMP1E LL_RTC_TAMPER_Disable\n 04534 * TAMPCR TAMP2E LL_RTC_TAMPER_Disable\n 04535 * TAMPCR TAMP3E LL_RTC_TAMPER_Disable 04536 * @param RTCx RTC Instance 04537 * @param Tamper This parameter can be a combination of the following values: 04538 * @arg @ref LL_RTC_TAMPER_1 04539 * @arg @ref LL_RTC_TAMPER_2 04540 * @arg @ref LL_RTC_TAMPER_3 04541 * 04542 * @retval None 04543 */ 04544 __STATIC_INLINE void LL_RTC_TAMPER_Disable(RTC_TypeDef *RTCx, uint32_t Tamper) 04545 { 04546 CLEAR_BIT(RTCx->TAMPCR, Tamper); 04547 } 04548 04549 /** 04550 * @brief Enable Tamper mask flag 04551 * @note Associated Tamper IT must not enabled when tamper mask is set. 04552 * @rmtoll TAMPCR TAMP1MF LL_RTC_TAMPER_EnableMask\n 04553 * TAMPCR TAMP2MF LL_RTC_TAMPER_EnableMask\n 04554 * TAMPCR TAMP3MF LL_RTC_TAMPER_EnableMask 04555 * @param RTCx RTC Instance 04556 * @param Mask This parameter can be a combination of the following values: 04557 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER1 04558 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER2 04559 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER3 04560 * 04561 * @retval None 04562 */ 04563 __STATIC_INLINE void LL_RTC_TAMPER_EnableMask(RTC_TypeDef *RTCx, uint32_t Mask) 04564 { 04565 SET_BIT(RTCx->TAMPCR, Mask); 04566 } 04567 04568 /** 04569 * @brief Disable Tamper mask flag 04570 * @rmtoll TAMPCR TAMP1MF LL_RTC_TAMPER_DisableMask\n 04571 * TAMPCR TAMP2MF LL_RTC_TAMPER_DisableMask\n 04572 * TAMPCR TAMP3MF LL_RTC_TAMPER_DisableMask 04573 * @param RTCx RTC Instance 04574 * @param Mask This parameter can be a combination of the following values: 04575 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER1 04576 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER2 04577 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER3 04578 * 04579 * @retval None 04580 */ 04581 __STATIC_INLINE void LL_RTC_TAMPER_DisableMask(RTC_TypeDef *RTCx, uint32_t Mask) 04582 { 04583 CLEAR_BIT(RTCx->TAMPCR, Mask); 04584 } 04585 04586 /** 04587 * @brief Enable backup register erase after Tamper event detection 04588 * @rmtoll TAMPCR TAMP1NOERASE LL_RTC_TAMPER_EnableEraseBKP\n 04589 * TAMPCR TAMP2NOERASE LL_RTC_TAMPER_EnableEraseBKP\n 04590 * TAMPCR TAMP3NOERASE LL_RTC_TAMPER_EnableEraseBKP 04591 * @param RTCx RTC Instance 04592 * @param Tamper This parameter can be a combination of the following values: 04593 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1 04594 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2 04595 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER3 04596 * 04597 * @retval None 04598 */ 04599 __STATIC_INLINE void LL_RTC_TAMPER_EnableEraseBKP(RTC_TypeDef *RTCx, uint32_t Tamper) 04600 { 04601 CLEAR_BIT(RTCx->TAMPCR, Tamper); 04602 } 04603 04604 /** 04605 * @brief Disable backup register erase after Tamper event detection 04606 * @rmtoll TAMPCR TAMP1NOERASE LL_RTC_TAMPER_DisableEraseBKP\n 04607 * TAMPCR TAMP2NOERASE LL_RTC_TAMPER_DisableEraseBKP\n 04608 * TAMPCR TAMP3NOERASE LL_RTC_TAMPER_DisableEraseBKP 04609 * @param RTCx RTC Instance 04610 * @param Tamper This parameter can be a combination of the following values: 04611 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1 04612 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2 04613 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER3 04614 * 04615 * @retval None 04616 */ 04617 __STATIC_INLINE void LL_RTC_TAMPER_DisableEraseBKP(RTC_TypeDef *RTCx, uint32_t Tamper) 04618 { 04619 SET_BIT(RTCx->TAMPCR, Tamper); 04620 } 04621 04622 #if defined(RTC_TAMPCR_TAMPPUDIS) 04623 /** 04624 * @brief Disable RTC_TAMPx pull-up disable (Disable precharge of RTC_TAMPx pins) 04625 * @rmtoll TAMPCR TAMPPUDIS LL_RTC_TAMPER_DisablePullUp 04626 * @param RTCx RTC Instance 04627 * @retval None 04628 */ 04629 __STATIC_INLINE void LL_RTC_TAMPER_DisablePullUp(RTC_TypeDef *RTCx) 04630 { 04631 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPPUDIS); 04632 } 04633 04634 /** 04635 * @brief Enable RTC_TAMPx pull-up disable ( Precharge RTC_TAMPx pins before sampling) 04636 * @rmtoll TAMPCR TAMPPUDIS LL_RTC_TAMPER_EnablePullUp 04637 * @param RTCx RTC Instance 04638 * @retval None 04639 */ 04640 __STATIC_INLINE void LL_RTC_TAMPER_EnablePullUp(RTC_TypeDef *RTCx) 04641 { 04642 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPPUDIS); 04643 } 04644 #endif /* RTC_TAMPCR_TAMPPUDIS */ 04645 04646 #if defined(RTC_TAMPCR_TAMPPRCH) 04647 /** 04648 * @brief Set RTC_TAMPx precharge duration 04649 * @rmtoll TAMPCR TAMPPRCH LL_RTC_TAMPER_SetPrecharge 04650 * @param RTCx RTC Instance 04651 * @param Duration This parameter can be one of the following values: 04652 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK 04653 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK 04654 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK 04655 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK 04656 * @retval None 04657 */ 04658 __STATIC_INLINE void LL_RTC_TAMPER_SetPrecharge(RTC_TypeDef *RTCx, uint32_t Duration) 04659 { 04660 MODIFY_REG(RTCx->TAMPCR, RTC_TAMPCR_TAMPPRCH, Duration); 04661 } 04662 04663 /** 04664 * @brief Get RTC_TAMPx precharge duration 04665 * @rmtoll TAMPCR TAMPPRCH LL_RTC_TAMPER_GetPrecharge 04666 * @param RTCx RTC Instance 04667 * @retval Returned value can be one of the following values: 04668 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK 04669 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK 04670 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK 04671 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK 04672 */ 04673 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPrecharge(RTC_TypeDef *RTCx) 04674 { 04675 return (uint32_t)(READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPPRCH)); 04676 } 04677 #endif /* RTC_TAMPCR_TAMPPRCH */ 04678 04679 #if defined(RTC_TAMPCR_TAMPFLT) 04680 /** 04681 * @brief Set RTC_TAMPx filter count 04682 * @rmtoll TAMPCR TAMPFLT LL_RTC_TAMPER_SetFilterCount 04683 * @param RTCx RTC Instance 04684 * @param FilterCount This parameter can be one of the following values: 04685 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE 04686 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE 04687 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE 04688 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE 04689 * @retval None 04690 */ 04691 __STATIC_INLINE void LL_RTC_TAMPER_SetFilterCount(RTC_TypeDef *RTCx, uint32_t FilterCount) 04692 { 04693 MODIFY_REG(RTCx->TAMPCR, RTC_TAMPCR_TAMPFLT, FilterCount); 04694 } 04695 04696 /** 04697 * @brief Get RTC_TAMPx filter count 04698 * @rmtoll TAMPCR TAMPFLT LL_RTC_TAMPER_GetFilterCount 04699 * @param RTCx RTC Instance 04700 * @retval Returned value can be one of the following values: 04701 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE 04702 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE 04703 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE 04704 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE 04705 */ 04706 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetFilterCount(RTC_TypeDef *RTCx) 04707 { 04708 return (uint32_t)(READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPFLT)); 04709 } 04710 #endif /* RTC_TAMPCR_TAMPFLT */ 04711 04712 #if defined(RTC_TAMPCR_TAMPFREQ) 04713 /** 04714 * @brief Set Tamper sampling frequency 04715 * @rmtoll TAMPCR TAMPFREQ LL_RTC_TAMPER_SetSamplingFreq 04716 * @param RTCx RTC Instance 04717 * @param SamplingFreq This parameter can be one of the following values: 04718 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768 04719 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384 04720 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192 04721 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096 04722 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048 04723 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024 04724 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512 04725 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256 04726 * @retval None 04727 */ 04728 __STATIC_INLINE void LL_RTC_TAMPER_SetSamplingFreq(RTC_TypeDef *RTCx, uint32_t SamplingFreq) 04729 { 04730 MODIFY_REG(RTCx->TAMPCR, RTC_TAMPCR_TAMPFREQ, SamplingFreq); 04731 } 04732 04733 /** 04734 * @brief Get Tamper sampling frequency 04735 * @rmtoll TAMPCR TAMPFREQ LL_RTC_TAMPER_GetSamplingFreq 04736 * @param RTCx RTC Instance 04737 * @retval Returned value can be one of the following values: 04738 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768 04739 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384 04740 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192 04741 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096 04742 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048 04743 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024 04744 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512 04745 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256 04746 */ 04747 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetSamplingFreq(RTC_TypeDef *RTCx) 04748 { 04749 return (uint32_t)(READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPFREQ)); 04750 } 04751 #endif /* RTC_TAMPCR_TAMPFREQ */ 04752 04753 /** 04754 * @brief Enable Active level for Tamper input 04755 * @rmtoll TAMPCR TAMP1TRG LL_RTC_TAMPER_EnableActiveLevel\n 04756 * TAMPCR TAMP2TRG LL_RTC_TAMPER_EnableActiveLevel\n 04757 * TAMPCR TAMP3TRG LL_RTC_TAMPER_EnableActiveLevel 04758 * @param RTCx RTC Instance 04759 * @param Tamper This parameter can be a combination of the following values: 04760 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 04761 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 04762 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 04763 * 04764 * @retval None 04765 */ 04766 __STATIC_INLINE void LL_RTC_TAMPER_EnableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper) 04767 { 04768 SET_BIT(RTCx->TAMPCR, Tamper); 04769 } 04770 04771 /** 04772 * @brief Disable Active level for Tamper input 04773 * @rmtoll TAMPCR TAMP1TRG LL_RTC_TAMPER_DisableActiveLevel\n 04774 * TAMPCR TAMP2TRG LL_RTC_TAMPER_DisableActiveLevel\n 04775 * TAMPCR TAMP3TRG LL_RTC_TAMPER_DisableActiveLevel 04776 * @param RTCx RTC Instance 04777 * @param Tamper This parameter can be a combination of the following values: 04778 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 04779 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 04780 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 04781 * 04782 * @retval None 04783 */ 04784 __STATIC_INLINE void LL_RTC_TAMPER_DisableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper) 04785 { 04786 CLEAR_BIT(RTCx->TAMPCR, Tamper); 04787 } 04788 04789 /** 04790 * @} 04791 */ 04792 04793 #if defined(RTC_BACKUP_SUPPORT) 04794 /** @defgroup RTC_LL_EF_Backup_Registers Backup_Registers 04795 * @{ 04796 */ 04797 04798 /** 04799 * @brief Writes a data in a specified RTC Backup data register. 04800 * @rmtoll BKPxR BKP LL_RTC_BAK_SetRegister 04801 * @param RTCx RTC Instance 04802 * @param BackupRegister This parameter can be one of the following values: 04803 * @arg @ref LL_RTC_BKP_DR0 04804 * @arg @ref LL_RTC_BKP_DR1 04805 * @arg @ref LL_RTC_BKP_DR2 04806 * @arg @ref LL_RTC_BKP_DR3 04807 * @arg @ref LL_RTC_BKP_DR4 04808 * @arg @ref LL_RTC_BKP_DR5 04809 * @arg @ref LL_RTC_BKP_DR6 04810 * @arg @ref LL_RTC_BKP_DR7 04811 * @arg @ref LL_RTC_BKP_DR8 04812 * @arg @ref LL_RTC_BKP_DR9 04813 * @arg @ref LL_RTC_BKP_DR10 04814 * @arg @ref LL_RTC_BKP_DR11 04815 * @arg @ref LL_RTC_BKP_DR12 04816 * @arg @ref LL_RTC_BKP_DR13 04817 * @arg @ref LL_RTC_BKP_DR14 04818 * @arg @ref LL_RTC_BKP_DR15 04819 * @arg @ref LL_RTC_BKP_DR16 04820 * @arg @ref LL_RTC_BKP_DR17 04821 * @arg @ref LL_RTC_BKP_DR18 04822 * @arg @ref LL_RTC_BKP_DR19 04823 * @arg @ref LL_RTC_BKP_DR20 04824 * @arg @ref LL_RTC_BKP_DR21 04825 * @arg @ref LL_RTC_BKP_DR22 04826 * @arg @ref LL_RTC_BKP_DR23 04827 * @arg @ref LL_RTC_BKP_DR24 04828 * @arg @ref LL_RTC_BKP_DR25 04829 * @arg @ref LL_RTC_BKP_DR26 04830 * @arg @ref LL_RTC_BKP_DR27 04831 * @arg @ref LL_RTC_BKP_DR28 04832 * @arg @ref LL_RTC_BKP_DR29 04833 * @arg @ref LL_RTC_BKP_DR30 04834 * @arg @ref LL_RTC_BKP_DR31 04835 * @param Data Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF 04836 * @retval None 04837 */ 04838 __STATIC_INLINE void LL_RTC_BAK_SetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister, uint32_t Data) 04839 { 04840 uint32_t tmp = 0U; 04841 04842 tmp = (uint32_t)(&(RTCx->BKP0R)); 04843 tmp += (BackupRegister * 4U); 04844 04845 /* Write the specified register */ 04846 *(__IO uint32_t *)tmp = (uint32_t)Data; 04847 } 04848 04849 /** 04850 * @brief Reads data from the specified RTC Backup data Register. 04851 * @rmtoll BKPxR BKP LL_RTC_BAK_GetRegister 04852 * @param RTCx RTC Instance 04853 * @param BackupRegister This parameter can be one of the following values: 04854 * @arg @ref LL_RTC_BKP_DR0 04855 * @arg @ref LL_RTC_BKP_DR1 04856 * @arg @ref LL_RTC_BKP_DR2 04857 * @arg @ref LL_RTC_BKP_DR3 04858 * @arg @ref LL_RTC_BKP_DR4 04859 * @arg @ref LL_RTC_BKP_DR5 04860 * @arg @ref LL_RTC_BKP_DR6 04861 * @arg @ref LL_RTC_BKP_DR7 04862 * @arg @ref LL_RTC_BKP_DR8 04863 * @arg @ref LL_RTC_BKP_DR9 04864 * @arg @ref LL_RTC_BKP_DR10 04865 * @arg @ref LL_RTC_BKP_DR11 04866 * @arg @ref LL_RTC_BKP_DR12 04867 * @arg @ref LL_RTC_BKP_DR13 04868 * @arg @ref LL_RTC_BKP_DR14 04869 * @arg @ref LL_RTC_BKP_DR15 04870 * @arg @ref LL_RTC_BKP_DR16 04871 * @arg @ref LL_RTC_BKP_DR17 04872 * @arg @ref LL_RTC_BKP_DR18 04873 * @arg @ref LL_RTC_BKP_DR19 04874 * @arg @ref LL_RTC_BKP_DR20 04875 * @arg @ref LL_RTC_BKP_DR21 04876 * @arg @ref LL_RTC_BKP_DR22 04877 * @arg @ref LL_RTC_BKP_DR23 04878 * @arg @ref LL_RTC_BKP_DR24 04879 * @arg @ref LL_RTC_BKP_DR25 04880 * @arg @ref LL_RTC_BKP_DR26 04881 * @arg @ref LL_RTC_BKP_DR27 04882 * @arg @ref LL_RTC_BKP_DR28 04883 * @arg @ref LL_RTC_BKP_DR29 04884 * @arg @ref LL_RTC_BKP_DR30 04885 * @arg @ref LL_RTC_BKP_DR31 04886 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF 04887 */ 04888 __STATIC_INLINE uint32_t LL_RTC_BAK_GetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister) 04889 { 04890 uint32_t tmp = 0U; 04891 04892 tmp = (uint32_t)(&(RTCx->BKP0R)); 04893 tmp += (BackupRegister * 4U); 04894 04895 /* Read the specified register */ 04896 return (*(__IO uint32_t *)tmp); 04897 } 04898 04899 /** 04900 * @} 04901 */ 04902 #endif /* RTC_BACKUP_SUPPORT */ 04903 04904 /** @defgroup RTC_LL_EF_FLAG_Management FLAG_Management 04905 * @{ 04906 */ 04907 04908 /** 04909 * @brief Get Internal Time-stamp flag 04910 * @rmtoll RTC_SR ITSF LL_RTC_IsActiveFlag_ITS 04911 * @param RTCx RTC Instance 04912 * @retval State of bit (1 or 0). 04913 */ 04914 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITS(RTC_TypeDef *RTCx) 04915 { 04916 return (READ_BIT(RTCx->ISR, RTC_ISR_ITSF) == (RTC_ISR_ITSF)); 04917 } 04918 04919 /** 04920 * @brief Get Recalibration pending Flag 04921 * @rmtoll ISR RECALPF LL_RTC_IsActiveFlag_RECALP 04922 * @param RTCx RTC Instance 04923 * @retval State of bit (1 or 0). 04924 */ 04925 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RECALP(RTC_TypeDef *RTCx) 04926 { 04927 return (READ_BIT(RTCx->ISR, RTC_ISR_RECALPF) == (RTC_ISR_RECALPF)); 04928 } 04929 04930 #if defined(RTC_TAMPER3_SUPPORT) 04931 /** 04932 * @brief Get RTC_TAMP3 detection flag 04933 * @rmtoll ISR TAMP3F LL_RTC_IsActiveFlag_TAMP3 04934 * @param RTCx RTC Instance 04935 * @retval State of bit (1 or 0). 04936 */ 04937 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3(RTC_TypeDef *RTCx) 04938 { 04939 return (READ_BIT(RTCx->ISR, RTC_ISR_TAMP3F) == (RTC_ISR_TAMP3F)); 04940 } 04941 #endif /* RTC_TAMPER3_SUPPORT */ 04942 04943 #if defined(RTC_TAMPER2_SUPPORT) 04944 /** 04945 * @brief Get RTC_TAMP2 detection flag 04946 * @rmtoll ISR TAMP2F LL_RTC_IsActiveFlag_TAMP2 04947 * @param RTCx RTC Instance 04948 * @retval State of bit (1 or 0). 04949 */ 04950 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2(RTC_TypeDef *RTCx) 04951 { 04952 return (READ_BIT(RTCx->ISR, RTC_ISR_TAMP2F) == (RTC_ISR_TAMP2F)); 04953 } 04954 #endif /* RTC_TAMPER2_SUPPORT */ 04955 04956 #if defined(RTC_TAMPER1_SUPPORT) 04957 /** 04958 * @brief Get RTC_TAMP1 detection flag 04959 * @rmtoll ISR TAMP1F LL_RTC_IsActiveFlag_TAMP1 04960 * @param RTCx RTC Instance 04961 * @retval State of bit (1 or 0). 04962 */ 04963 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1(RTC_TypeDef *RTCx) 04964 { 04965 return (READ_BIT(RTCx->ISR, RTC_ISR_TAMP1F) == (RTC_ISR_TAMP1F)); 04966 } 04967 #endif /* RTC_TAMPER1_SUPPORT */ 04968 04969 /** 04970 * @brief Get Time-stamp overflow flag 04971 * @rmtoll ISR TSOVF LL_RTC_IsActiveFlag_TSOV 04972 * @param RTCx RTC Instance 04973 * @retval State of bit (1 or 0). 04974 */ 04975 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOV(RTC_TypeDef *RTCx) 04976 { 04977 return (READ_BIT(RTCx->ISR, RTC_ISR_TSOVF) == (RTC_ISR_TSOVF)); 04978 } 04979 04980 /** 04981 * @brief Get Time-stamp flag 04982 * @rmtoll ISR TSF LL_RTC_IsActiveFlag_TS 04983 * @param RTCx RTC Instance 04984 * @retval State of bit (1 or 0). 04985 */ 04986 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TS(RTC_TypeDef *RTCx) 04987 { 04988 return (READ_BIT(RTCx->ISR, RTC_ISR_TSF) == (RTC_ISR_TSF)); 04989 } 04990 04991 #if defined(RTC_WAKEUP_SUPPORT) 04992 /** 04993 * @brief Get Wakeup timer flag 04994 * @rmtoll ISR WUTF LL_RTC_IsActiveFlag_WUT 04995 * @param RTCx RTC Instance 04996 * @retval State of bit (1 or 0). 04997 */ 04998 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUT(RTC_TypeDef *RTCx) 04999 { 05000 return (READ_BIT(RTCx->ISR, RTC_ISR_WUTF) == (RTC_ISR_WUTF)); 05001 } 05002 #endif /* RTC_WAKEUP_SUPPORT */ 05003 05004 /** 05005 * @brief Get Alarm B flag 05006 * @rmtoll ISR ALRBF LL_RTC_IsActiveFlag_ALRB 05007 * @param RTCx RTC Instance 05008 * @retval State of bit (1 or 0). 05009 */ 05010 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRB(RTC_TypeDef *RTCx) 05011 { 05012 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRBF) == (RTC_ISR_ALRBF)); 05013 } 05014 05015 /** 05016 * @brief Get Alarm A flag 05017 * @rmtoll ISR ALRAF LL_RTC_IsActiveFlag_ALRA 05018 * @param RTCx RTC Instance 05019 * @retval State of bit (1 or 0). 05020 */ 05021 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRA(RTC_TypeDef *RTCx) 05022 { 05023 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRAF) == (RTC_ISR_ALRAF)); 05024 } 05025 05026 /** 05027 * @brief Clear Internal Time-stamp flag 05028 * @rmtoll ISR ITSF LL_RTC_ClearFlag_ITS 05029 * @param RTCx RTC Instance 05030 * @retval None 05031 */ 05032 __STATIC_INLINE void LL_RTC_ClearFlag_ITS(RTC_TypeDef *RTCx) 05033 { 05034 WRITE_REG(RTCx->ISR, (~((RTC_ISR_ITSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 05035 } 05036 05037 #if defined(RTC_TAMPER3_SUPPORT) 05038 /** 05039 * @brief Clear RTC_TAMP3 detection flag 05040 * @rmtoll ISR TAMP3F LL_RTC_ClearFlag_TAMP3 05041 * @param RTCx RTC Instance 05042 * @retval None 05043 */ 05044 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP3(RTC_TypeDef *RTCx) 05045 { 05046 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP3F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 05047 } 05048 #endif /* RTC_TAMPER3_SUPPORT */ 05049 05050 #if defined(RTC_TAMPER2_SUPPORT) 05051 /** 05052 * @brief Clear RTC_TAMP2 detection flag 05053 * @rmtoll ISR TAMP2F LL_RTC_ClearFlag_TAMP2 05054 * @param RTCx RTC Instance 05055 * @retval None 05056 */ 05057 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP2(RTC_TypeDef *RTCx) 05058 { 05059 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP2F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 05060 } 05061 #endif /* RTC_TAMPER2_SUPPORT */ 05062 05063 #if defined(RTC_TAMPER1_SUPPORT) 05064 /** 05065 * @brief Clear RTC_TAMP1 detection flag 05066 * @rmtoll ISR TAMP1F LL_RTC_ClearFlag_TAMP1 05067 * @param RTCx RTC Instance 05068 * @retval None 05069 */ 05070 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP1(RTC_TypeDef *RTCx) 05071 { 05072 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP1F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 05073 } 05074 #endif /* RTC_TAMPER1_SUPPORT */ 05075 05076 /** 05077 * @brief Clear Time-stamp overflow flag 05078 * @rmtoll ISR TSOVF LL_RTC_ClearFlag_TSOV 05079 * @param RTCx RTC Instance 05080 * @retval None 05081 */ 05082 __STATIC_INLINE void LL_RTC_ClearFlag_TSOV(RTC_TypeDef *RTCx) 05083 { 05084 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSOVF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 05085 } 05086 05087 /** 05088 * @brief Clear Time-stamp flag 05089 * @rmtoll ISR TSF LL_RTC_ClearFlag_TS 05090 * @param RTCx RTC Instance 05091 * @retval None 05092 */ 05093 __STATIC_INLINE void LL_RTC_ClearFlag_TS(RTC_TypeDef *RTCx) 05094 { 05095 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 05096 } 05097 05098 #if defined(RTC_WAKEUP_SUPPORT) 05099 /** 05100 * @brief Clear Wakeup timer flag 05101 * @rmtoll ISR WUTF LL_RTC_ClearFlag_WUT 05102 * @param RTCx RTC Instance 05103 * @retval None 05104 */ 05105 __STATIC_INLINE void LL_RTC_ClearFlag_WUT(RTC_TypeDef *RTCx) 05106 { 05107 WRITE_REG(RTCx->ISR, (~((RTC_ISR_WUTF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 05108 } 05109 #endif /* RTC_WAKEUP_SUPPORT */ 05110 05111 /** 05112 * @brief Clear Alarm B flag 05113 * @rmtoll ISR ALRBF LL_RTC_ClearFlag_ALRB 05114 * @param RTCx RTC Instance 05115 * @retval None 05116 */ 05117 __STATIC_INLINE void LL_RTC_ClearFlag_ALRB(RTC_TypeDef *RTCx) 05118 { 05119 WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRBF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 05120 } 05121 05122 /** 05123 * @brief Clear Alarm A flag 05124 * @rmtoll ISR ALRAF LL_RTC_ClearFlag_ALRA 05125 * @param RTCx RTC Instance 05126 * @retval None 05127 */ 05128 __STATIC_INLINE void LL_RTC_ClearFlag_ALRA(RTC_TypeDef *RTCx) 05129 { 05130 WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRAF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 05131 } 05132 05133 /** 05134 * @brief Get Initialization flag 05135 * @rmtoll ISR INITF LL_RTC_IsActiveFlag_INIT 05136 * @param RTCx RTC Instance 05137 * @retval State of bit (1 or 0). 05138 */ 05139 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INIT(RTC_TypeDef *RTCx) 05140 { 05141 return (READ_BIT(RTCx->ISR, RTC_ISR_INITF) == (RTC_ISR_INITF)); 05142 } 05143 05144 /** 05145 * @brief Get Registers synchronization flag 05146 * @rmtoll ISR RSF LL_RTC_IsActiveFlag_RS 05147 * @param RTCx RTC Instance 05148 * @retval State of bit (1 or 0). 05149 */ 05150 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RS(RTC_TypeDef *RTCx) 05151 { 05152 return (READ_BIT(RTCx->ISR, RTC_ISR_RSF) == (RTC_ISR_RSF)); 05153 } 05154 05155 /** 05156 * @brief Clear Registers synchronization flag 05157 * @rmtoll ISR RSF LL_RTC_ClearFlag_RS 05158 * @param RTCx RTC Instance 05159 * @retval None 05160 */ 05161 __STATIC_INLINE void LL_RTC_ClearFlag_RS(RTC_TypeDef *RTCx) 05162 { 05163 WRITE_REG(RTCx->ISR, (~((RTC_ISR_RSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 05164 } 05165 05166 /** 05167 * @brief Get Initialization status flag 05168 * @rmtoll ISR INITS LL_RTC_IsActiveFlag_INITS 05169 * @param RTCx RTC Instance 05170 * @retval State of bit (1 or 0). 05171 */ 05172 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INITS(RTC_TypeDef *RTCx) 05173 { 05174 return (READ_BIT(RTCx->ISR, RTC_ISR_INITS) == (RTC_ISR_INITS)); 05175 } 05176 05177 /** 05178 * @brief Get Shift operation pending flag 05179 * @rmtoll ISR SHPF LL_RTC_IsActiveFlag_SHP 05180 * @param RTCx RTC Instance 05181 * @retval State of bit (1 or 0). 05182 */ 05183 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SHP(RTC_TypeDef *RTCx) 05184 { 05185 return (READ_BIT(RTCx->ISR, RTC_ISR_SHPF) == (RTC_ISR_SHPF)); 05186 } 05187 05188 #if defined(RTC_WAKEUP_SUPPORT) 05189 /** 05190 * @brief Get Wakeup timer write flag 05191 * @rmtoll ISR WUTWF LL_RTC_IsActiveFlag_WUTW 05192 * @param RTCx RTC Instance 05193 * @retval State of bit (1 or 0). 05194 */ 05195 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTW(RTC_TypeDef *RTCx) 05196 { 05197 return (READ_BIT(RTCx->ISR, RTC_ISR_WUTWF) == (RTC_ISR_WUTWF)); 05198 } 05199 #endif /* RTC_WAKEUP_SUPPORT */ 05200 05201 /** 05202 * @brief Get Alarm B write flag 05203 * @rmtoll ISR ALRBWF LL_RTC_IsActiveFlag_ALRBW 05204 * @param RTCx RTC Instance 05205 * @retval State of bit (1 or 0). 05206 */ 05207 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBW(RTC_TypeDef *RTCx) 05208 { 05209 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRBWF) == (RTC_ISR_ALRBWF)); 05210 } 05211 05212 /** 05213 * @brief Get Alarm A write flag 05214 * @rmtoll ISR ALRAWF LL_RTC_IsActiveFlag_ALRAW 05215 * @param RTCx RTC Instance 05216 * @retval State of bit (1 or 0). 05217 */ 05218 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAW(RTC_TypeDef *RTCx) 05219 { 05220 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRAWF) == (RTC_ISR_ALRAWF)); 05221 } 05222 05223 /** 05224 * @} 05225 */ 05226 05227 /** @defgroup RTC_LL_EF_IT_Management IT_Management 05228 * @{ 05229 */ 05230 05231 /** 05232 * @brief Enable Time-stamp interrupt 05233 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 05234 * @rmtoll RTC_CR TSIE LL_RTC_EnableIT_TS 05235 * @param RTCx RTC Instance 05236 * @retval None 05237 */ 05238 __STATIC_INLINE void LL_RTC_EnableIT_TS(RTC_TypeDef *RTCx) 05239 { 05240 SET_BIT(RTCx->CR, RTC_CR_TSIE); 05241 } 05242 05243 /** 05244 * @brief Disable Time-stamp interrupt 05245 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 05246 * @rmtoll RTC_CR TSIE LL_RTC_DisableIT_TS 05247 * @param RTCx RTC Instance 05248 * @retval None 05249 */ 05250 __STATIC_INLINE void LL_RTC_DisableIT_TS(RTC_TypeDef *RTCx) 05251 { 05252 CLEAR_BIT(RTCx->CR, RTC_CR_TSIE); 05253 } 05254 05255 #if defined(RTC_WAKEUP_SUPPORT) 05256 /** 05257 * @brief Enable Wakeup timer interrupt 05258 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 05259 * @rmtoll RTC_CR WUTIE LL_RTC_EnableIT_WUT 05260 * @param RTCx RTC Instance 05261 * @retval None 05262 */ 05263 __STATIC_INLINE void LL_RTC_EnableIT_WUT(RTC_TypeDef *RTCx) 05264 { 05265 SET_BIT(RTCx->CR, RTC_CR_WUTIE); 05266 } 05267 05268 /** 05269 * @brief Disable Wakeup timer interrupt 05270 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 05271 * @rmtoll RTC_CR WUTIE LL_RTC_DisableIT_WUT 05272 * @param RTCx RTC Instance 05273 * @retval None 05274 */ 05275 __STATIC_INLINE void LL_RTC_DisableIT_WUT(RTC_TypeDef *RTCx) 05276 { 05277 CLEAR_BIT(RTCx->CR, RTC_CR_WUTIE); 05278 } 05279 #endif /* RTC_WAKEUP_SUPPORT */ 05280 05281 /** 05282 * @brief Enable Alarm B interrupt 05283 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 05284 * @rmtoll RTC_CR ALRBIE LL_RTC_EnableIT_ALRB 05285 * @param RTCx RTC Instance 05286 * @retval None 05287 */ 05288 __STATIC_INLINE void LL_RTC_EnableIT_ALRB(RTC_TypeDef *RTCx) 05289 { 05290 SET_BIT(RTCx->CR, RTC_CR_ALRBIE); 05291 } 05292 05293 /** 05294 * @brief Disable Alarm B interrupt 05295 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 05296 * @rmtoll RTC_CR ALRBIE LL_RTC_DisableIT_ALRB 05297 * @param RTCx RTC Instance 05298 * @retval None 05299 */ 05300 __STATIC_INLINE void LL_RTC_DisableIT_ALRB(RTC_TypeDef *RTCx) 05301 { 05302 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBIE); 05303 } 05304 05305 /** 05306 * @brief Enable Alarm A interrupt 05307 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 05308 * @rmtoll RTC_CR ALRAIE LL_RTC_EnableIT_ALRA 05309 * @param RTCx RTC Instance 05310 * @retval None 05311 */ 05312 __STATIC_INLINE void LL_RTC_EnableIT_ALRA(RTC_TypeDef *RTCx) 05313 { 05314 SET_BIT(RTCx->CR, RTC_CR_ALRAIE); 05315 } 05316 05317 /** 05318 * @brief Disable Alarm A interrupt 05319 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 05320 * @rmtoll RTC_CR ALRAIE LL_RTC_DisableIT_ALRA 05321 * @param RTCx RTC Instance 05322 * @retval None 05323 */ 05324 __STATIC_INLINE void LL_RTC_DisableIT_ALRA(RTC_TypeDef *RTCx) 05325 { 05326 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAIE); 05327 } 05328 05329 05330 #if defined(RTC_TAMPER3_SUPPORT) 05331 /** 05332 * @brief Enable Tamper 3 interrupt 05333 * @rmtoll TAMPCR TAMP3IE LL_RTC_EnableIT_TAMP3 05334 * @param RTCx RTC Instance 05335 * @retval None 05336 */ 05337 __STATIC_INLINE void LL_RTC_EnableIT_TAMP3(RTC_TypeDef *RTCx) 05338 { 05339 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP3IE); 05340 } 05341 05342 /** 05343 * @brief Disable Tamper 3 interrupt 05344 * @rmtoll TAMPCR TAMP3IE LL_RTC_DisableIT_TAMP3 05345 * @param RTCx RTC Instance 05346 * @retval None 05347 */ 05348 __STATIC_INLINE void LL_RTC_DisableIT_TAMP3(RTC_TypeDef *RTCx) 05349 { 05350 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP3IE); 05351 } 05352 #endif /* RTC_TAMPER3_SUPPORT */ 05353 05354 #if defined(RTC_TAMPER2_SUPPORT) 05355 /** 05356 * @brief Enable Tamper 2 interrupt 05357 * @rmtoll TAMPCR TAMP2IE LL_RTC_EnableIT_TAMP2 05358 * @param RTCx RTC Instance 05359 * @retval None 05360 */ 05361 __STATIC_INLINE void LL_RTC_EnableIT_TAMP2(RTC_TypeDef *RTCx) 05362 { 05363 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP2IE); 05364 } 05365 05366 /** 05367 * @brief Disable Tamper 2 interrupt 05368 * @rmtoll TAMPCR TAMP2IE LL_RTC_DisableIT_TAMP2 05369 * @param RTCx RTC Instance 05370 * @retval None 05371 */ 05372 __STATIC_INLINE void LL_RTC_DisableIT_TAMP2(RTC_TypeDef *RTCx) 05373 { 05374 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP2IE); 05375 } 05376 #endif /* RTC_TAMPER2_SUPPORT */ 05377 05378 #if defined(RTC_TAMPER1_SUPPORT) 05379 /** 05380 * @brief Enable Tamper 1 interrupt 05381 * @rmtoll TAMPCR TAMP1IE LL_RTC_EnableIT_TAMP1 05382 * @param RTCx RTC Instance 05383 * @retval None 05384 */ 05385 __STATIC_INLINE void LL_RTC_EnableIT_TAMP1(RTC_TypeDef *RTCx) 05386 { 05387 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP1IE); 05388 } 05389 05390 /** 05391 * @brief Disable Tamper 1 interrupt 05392 * @rmtoll TAMPCR TAMP1IE LL_RTC_DisableIT_TAMP1 05393 * @param RTCx RTC Instance 05394 * @retval None 05395 */ 05396 __STATIC_INLINE void LL_RTC_DisableIT_TAMP1(RTC_TypeDef *RTCx) 05397 { 05398 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP1IE); 05399 } 05400 #endif /* RTC_TAMPER1_SUPPORT */ 05401 05402 /** 05403 * @brief Enable all Tamper Interrupt 05404 * @rmtoll TAMPCR TAMPIE LL_RTC_EnableIT_TAMP 05405 * @param RTCx RTC Instance 05406 * @retval None 05407 */ 05408 __STATIC_INLINE void LL_RTC_EnableIT_TAMP(RTC_TypeDef *RTCx) 05409 { 05410 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPIE); 05411 } 05412 05413 /** 05414 * @brief Disable all Tamper Interrupt 05415 * @rmtoll TAMPCR TAMPIE LL_RTC_DisableIT_TAMP 05416 * @param RTCx RTC Instance 05417 * @retval None 05418 */ 05419 __STATIC_INLINE void LL_RTC_DisableIT_TAMP(RTC_TypeDef *RTCx) 05420 { 05421 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPIE); 05422 } 05423 05424 /** 05425 * @brief Check if Time-stamp interrupt is enabled or not 05426 * @rmtoll CR TSIE LL_RTC_IsEnabledIT_TS 05427 * @param RTCx RTC Instance 05428 * @retval State of bit (1 or 0). 05429 */ 05430 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TS(RTC_TypeDef *RTCx) 05431 { 05432 return (READ_BIT(RTCx->CR, RTC_CR_TSIE) == (RTC_CR_TSIE)); 05433 } 05434 05435 #if defined(RTC_WAKEUP_SUPPORT) 05436 /** 05437 * @brief Check if Wakeup timer interrupt is enabled or not 05438 * @rmtoll CR WUTIE LL_RTC_IsEnabledIT_WUT 05439 * @param RTCx RTC Instance 05440 * @retval State of bit (1 or 0). 05441 */ 05442 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_WUT(RTC_TypeDef *RTCx) 05443 { 05444 return (READ_BIT(RTCx->CR, RTC_CR_WUTIE) == (RTC_CR_WUTIE)); 05445 } 05446 #endif /* RTC_WAKEUP_SUPPORT */ 05447 05448 /** 05449 * @brief Check if Alarm B interrupt is enabled or not 05450 * @rmtoll CR ALRBIE LL_RTC_IsEnabledIT_ALRB 05451 * @param RTCx RTC Instance 05452 * @retval State of bit (1 or 0). 05453 */ 05454 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRB(RTC_TypeDef *RTCx) 05455 { 05456 return (READ_BIT(RTCx->CR, RTC_CR_ALRBIE) == (RTC_CR_ALRBIE)); 05457 } 05458 05459 /** 05460 * @brief Check if Alarm A interrupt is enabled or not 05461 * @rmtoll CR ALRAIE LL_RTC_IsEnabledIT_ALRA 05462 * @param RTCx RTC Instance 05463 * @retval State of bit (1 or 0). 05464 */ 05465 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRA(RTC_TypeDef *RTCx) 05466 { 05467 return (READ_BIT(RTCx->CR, RTC_CR_ALRAIE) == (RTC_CR_ALRAIE)); 05468 } 05469 05470 #if defined(RTC_TAMPER3_SUPPORT) 05471 /** 05472 * @brief Check if Tamper 3 interrupt is enabled or not 05473 * @rmtoll TAMPCR TAMP3IE LL_RTC_IsEnabledIT_TAMP3 05474 * @param RTCx RTC Instance 05475 * @retval State of bit (1 or 0). 05476 */ 05477 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP3(RTC_TypeDef *RTCx) 05478 { 05479 return (READ_BIT(RTCx->TAMPCR, 05480 RTC_TAMPCR_TAMP3IE) == (RTC_TAMPCR_TAMP3IE)); 05481 } 05482 #endif /* RTC_TAMPER3_SUPPORT */ 05483 05484 #if defined(RTC_TAMPER2_SUPPORT) 05485 /** 05486 * @brief Check if Tamper 2 interrupt is enabled or not 05487 * @rmtoll TAMPCR TAMP2IE LL_RTC_IsEnabledIT_TAMP2 05488 * @param RTCx RTC Instance 05489 * @retval State of bit (1 or 0). 05490 */ 05491 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP2(RTC_TypeDef *RTCx) 05492 { 05493 return (READ_BIT(RTCx->TAMPCR, 05494 RTC_TAMPCR_TAMP2IE) == (RTC_TAMPCR_TAMP2IE)); 05495 05496 } 05497 #endif /* RTC_TAMPER2_SUPPORT */ 05498 05499 #if defined(RTC_TAMPER1_SUPPORT) 05500 /** 05501 * @brief Check if Tamper 1 interrupt is enabled or not 05502 * @rmtoll TAMPCR TAMP1IE LL_RTC_IsEnabledIT_TAMP1 05503 * @param RTCx RTC Instance 05504 * @retval State of bit (1 or 0). 05505 */ 05506 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP1(RTC_TypeDef *RTCx) 05507 { 05508 return (READ_BIT(RTCx->TAMPCR, 05509 RTC_TAMPCR_TAMP1IE) == (RTC_TAMPCR_TAMP1IE)); 05510 } 05511 #endif /* RTC_TAMPER1_SUPPORT */ 05512 05513 /** 05514 * @brief Check if all the TAMPER interrupts are enabled or not 05515 * @rmtoll TAMPCR TAMPIE LL_RTC_IsEnabledIT_TAMP 05516 * @param RTCx RTC Instance 05517 * @retval State of bit (1 or 0). 05518 */ 05519 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP(RTC_TypeDef *RTCx) 05520 { 05521 return (READ_BIT(RTCx->TAMPCR, 05522 RTC_TAMPCR_TAMPIE) == (RTC_TAMPCR_TAMPIE)); 05523 } 05524 05525 /** 05526 * @} 05527 */ 05528 05529 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 05530 05531 #if defined(USE_FULL_LL_DRIVER) 05532 /** @defgroup RTC_LL_EF_Init Initialization and de-initialization functions 05533 * @{ 05534 */ 05535 05536 ErrorStatus LL_RTC_DeInit(RTC_TypeDef *RTCx); 05537 ErrorStatus LL_RTC_Init(RTC_TypeDef *RTCx, LL_RTC_InitTypeDef *RTC_InitStruct); 05538 void LL_RTC_StructInit(LL_RTC_InitTypeDef *RTC_InitStruct); 05539 ErrorStatus LL_RTC_TIME_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_TimeTypeDef *RTC_TimeStruct); 05540 void LL_RTC_TIME_StructInit(LL_RTC_TimeTypeDef *RTC_TimeStruct); 05541 ErrorStatus LL_RTC_DATE_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_DateTypeDef *RTC_DateStruct); 05542 void LL_RTC_DATE_StructInit(LL_RTC_DateTypeDef *RTC_DateStruct); 05543 ErrorStatus LL_RTC_ALMA_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct); 05544 ErrorStatus LL_RTC_ALMB_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct); 05545 void LL_RTC_ALMA_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct); 05546 void LL_RTC_ALMB_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct); 05547 ErrorStatus LL_RTC_EnterInitMode(RTC_TypeDef *RTCx); 05548 ErrorStatus LL_RTC_ExitInitMode(RTC_TypeDef *RTCx); 05549 ErrorStatus LL_RTC_WaitForSynchro(RTC_TypeDef *RTCx); 05550 05551 /** 05552 * @} 05553 */ 05554 #endif /* USE_FULL_LL_DRIVER */ 05555 05556 /** 05557 * @} 05558 */ 05559 05560 /** 05561 * @} 05562 */ 05563 05564 #endif /* defined(RTC) */ 05565 05566 /** 05567 * @} 05568 */ 05569 05570 #ifdef __cplusplus 05571 } 05572 #endif 05573 05574 #endif /* STM32L4xx_LL_RTC_H */