STM32F479xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f4xx_ll_rtc.h 00004 * @author MCD Application Team 00005 * @brief Header file of RTC LL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * <h2><center>© Copyright (c) 2017 STMicroelectronics. 00010 * All rights reserved.</center></h2> 00011 * 00012 * This software component is licensed by ST under BSD 3-Clause license, 00013 * the "License"; You may not use this file except in compliance with the 00014 * License. You may obtain a copy of the License at: 00015 * opensource.org/licenses/BSD-3-Clause 00016 * 00017 ****************************************************************************** 00018 */ 00019 00020 /* Define to prevent recursive inclusion -------------------------------------*/ 00021 #ifndef __STM32F4xx_LL_RTC_H 00022 #define __STM32F4xx_LL_RTC_H 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 /* Includes ------------------------------------------------------------------*/ 00029 #include "stm32f4xx.h" 00030 00031 /** @addtogroup STM32F4xx_LL_Driver 00032 * @{ 00033 */ 00034 00035 #if defined(RTC) 00036 00037 /** @defgroup RTC_LL RTC 00038 * @{ 00039 */ 00040 00041 /* Private types -------------------------------------------------------------*/ 00042 /* Private variables ---------------------------------------------------------*/ 00043 /* Private constants ---------------------------------------------------------*/ 00044 /** @defgroup RTC_LL_Private_Constants RTC Private Constants 00045 * @{ 00046 */ 00047 /* Masks Definition */ 00048 #define RTC_INIT_MASK 0xFFFFFFFFU 00049 #define RTC_RSF_MASK 0xFFFFFF5FU 00050 00051 /* Write protection defines */ 00052 #define RTC_WRITE_PROTECTION_DISABLE ((uint8_t)0xFFU) 00053 #define RTC_WRITE_PROTECTION_ENABLE_1 ((uint8_t)0xCAU) 00054 #define RTC_WRITE_PROTECTION_ENABLE_2 ((uint8_t)0x53U) 00055 00056 /* Defines used to combine date & time */ 00057 #define RTC_OFFSET_WEEKDAY 24U 00058 #define RTC_OFFSET_DAY 16U 00059 #define RTC_OFFSET_MONTH 8U 00060 #define RTC_OFFSET_HOUR 16U 00061 #define RTC_OFFSET_MINUTE 8U 00062 00063 /** 00064 * @} 00065 */ 00066 00067 /* Private macros ------------------------------------------------------------*/ 00068 #if defined(USE_FULL_LL_DRIVER) 00069 /** @defgroup RTC_LL_Private_Macros RTC Private Macros 00070 * @{ 00071 */ 00072 /** 00073 * @} 00074 */ 00075 #endif /*USE_FULL_LL_DRIVER*/ 00076 00077 /* Exported types ------------------------------------------------------------*/ 00078 #if defined(USE_FULL_LL_DRIVER) 00079 /** @defgroup RTC_LL_ES_INIT RTC Exported Init structure 00080 * @{ 00081 */ 00082 00083 /** 00084 * @brief RTC Init structures definition 00085 */ 00086 typedef struct 00087 { 00088 uint32_t HourFormat; /*!< Specifies the RTC Hours Format. 00089 This parameter can be a value of @ref RTC_LL_EC_HOURFORMAT 00090 00091 This feature can be modified afterwards using unitary function 00092 @ref LL_RTC_SetHourFormat(). */ 00093 00094 uint32_t AsynchPrescaler; /*!< Specifies the RTC Asynchronous Predivider value. 00095 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F 00096 00097 This feature can be modified afterwards using unitary function 00098 @ref LL_RTC_SetAsynchPrescaler(). */ 00099 00100 uint32_t SynchPrescaler; /*!< Specifies the RTC Synchronous Predivider value. 00101 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF 00102 00103 This feature can be modified afterwards using unitary function 00104 @ref LL_RTC_SetSynchPrescaler(). */ 00105 } LL_RTC_InitTypeDef; 00106 00107 /** 00108 * @brief RTC Time structure definition 00109 */ 00110 typedef struct 00111 { 00112 uint32_t TimeFormat; /*!< Specifies the RTC AM/PM Time. 00113 This parameter can be a value of @ref RTC_LL_EC_TIME_FORMAT 00114 00115 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetFormat(). */ 00116 00117 uint8_t Hours; /*!< Specifies the RTC Time Hours. 00118 This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the @ref LL_RTC_TIME_FORMAT_PM is selected. 00119 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. 00120 00121 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetHour(). */ 00122 00123 uint8_t Minutes; /*!< Specifies the RTC Time Minutes. 00124 This parameter must be a number between Min_Data = 0 and Max_Data = 59 00125 00126 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetMinute(). */ 00127 00128 uint8_t Seconds; /*!< Specifies the RTC Time Seconds. 00129 This parameter must be a number between Min_Data = 0 and Max_Data = 59 00130 00131 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetSecond(). */ 00132 } LL_RTC_TimeTypeDef; 00133 00134 /** 00135 * @brief RTC Date structure definition 00136 */ 00137 typedef struct 00138 { 00139 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay. 00140 This parameter can be a value of @ref RTC_LL_EC_WEEKDAY 00141 00142 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetWeekDay(). */ 00143 00144 uint8_t Month; /*!< Specifies the RTC Date Month. 00145 This parameter can be a value of @ref RTC_LL_EC_MONTH 00146 00147 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetMonth(). */ 00148 00149 uint8_t Day; /*!< Specifies the RTC Date Day. 00150 This parameter must be a number between Min_Data = 1 and Max_Data = 31 00151 00152 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetDay(). */ 00153 00154 uint8_t Year; /*!< Specifies the RTC Date Year. 00155 This parameter must be a number between Min_Data = 0 and Max_Data = 99 00156 00157 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetYear(). */ 00158 } LL_RTC_DateTypeDef; 00159 00160 /** 00161 * @brief RTC Alarm structure definition 00162 */ 00163 typedef struct 00164 { 00165 LL_RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members. */ 00166 00167 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks. 00168 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. 00169 00170 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetMask() for ALARM A 00171 or @ref LL_RTC_ALMB_SetMask() for ALARM B 00172 */ 00173 00174 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on day or WeekDay. 00175 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 00176 00177 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_EnableWeekday() or @ref LL_RTC_ALMA_DisableWeekday() 00178 for ALARM A or @ref LL_RTC_ALMB_EnableWeekday() or @ref LL_RTC_ALMB_DisableWeekday() for ALARM B 00179 */ 00180 00181 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Day/WeekDay. 00182 If AlarmDateWeekDaySel set to day, this parameter must be a number between Min_Data = 1 and Max_Data = 31. 00183 00184 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetDay() 00185 for ALARM A or @ref LL_RTC_ALMB_SetDay() for ALARM B. 00186 00187 If AlarmDateWeekDaySel set to Weekday, this parameter can be a value of @ref RTC_LL_EC_WEEKDAY. 00188 00189 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetWeekDay() 00190 for ALARM A or @ref LL_RTC_ALMB_SetWeekDay() for ALARM B. 00191 */ 00192 } LL_RTC_AlarmTypeDef; 00193 00194 /** 00195 * @} 00196 */ 00197 #endif /* USE_FULL_LL_DRIVER */ 00198 00199 /* Exported constants --------------------------------------------------------*/ 00200 /** @defgroup RTC_LL_Exported_Constants RTC Exported Constants 00201 * @{ 00202 */ 00203 00204 #if defined(USE_FULL_LL_DRIVER) 00205 /** @defgroup RTC_LL_EC_FORMAT FORMAT 00206 * @{ 00207 */ 00208 #define LL_RTC_FORMAT_BIN 0x000000000U /*!< Binary data format */ 00209 #define LL_RTC_FORMAT_BCD 0x000000001U /*!< BCD data format */ 00210 /** 00211 * @} 00212 */ 00213 00214 /** @defgroup RTC_LL_EC_ALMA_WEEKDAY_SELECTION RTC Alarm A Date WeekDay 00215 * @{ 00216 */ 00217 #define LL_RTC_ALMA_DATEWEEKDAYSEL_DATE 0x00000000U /*!< Alarm A Date is selected */ 00218 #define LL_RTC_ALMA_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMAR_WDSEL /*!< Alarm A WeekDay is selected */ 00219 /** 00220 * @} 00221 */ 00222 00223 /** @defgroup RTC_LL_EC_ALMB_WEEKDAY_SELECTION RTC Alarm B Date WeekDay 00224 * @{ 00225 */ 00226 #define LL_RTC_ALMB_DATEWEEKDAYSEL_DATE 0x00000000U /*!< Alarm B Date is selected */ 00227 #define LL_RTC_ALMB_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMBR_WDSEL /*!< Alarm B WeekDay is selected */ 00228 /** 00229 * @} 00230 */ 00231 00232 #endif /* USE_FULL_LL_DRIVER */ 00233 00234 /** @defgroup RTC_LL_EC_GET_FLAG Get Flags Defines 00235 * @brief Flags defines which can be used with LL_RTC_ReadReg function 00236 * @{ 00237 */ 00238 #define LL_RTC_ISR_RECALPF RTC_ISR_RECALPF 00239 #define LL_RTC_ISR_TAMP3F RTC_ISR_TAMP3F 00240 #define LL_RTC_ISR_TAMP2F RTC_ISR_TAMP2F 00241 #define LL_RTC_ISR_TAMP1F RTC_ISR_TAMP1F 00242 #define LL_RTC_ISR_TSOVF RTC_ISR_TSOVF 00243 #define LL_RTC_ISR_TSF RTC_ISR_TSF 00244 #define LL_RTC_ISR_WUTF RTC_ISR_WUTF 00245 #define LL_RTC_ISR_ALRBF RTC_ISR_ALRBF 00246 #define LL_RTC_ISR_ALRAF RTC_ISR_ALRAF 00247 #define LL_RTC_ISR_INITF RTC_ISR_INITF 00248 #define LL_RTC_ISR_RSF RTC_ISR_RSF 00249 #define LL_RTC_ISR_INITS RTC_ISR_INITS 00250 #define LL_RTC_ISR_SHPF RTC_ISR_SHPF 00251 #define LL_RTC_ISR_WUTWF RTC_ISR_WUTWF 00252 #define LL_RTC_ISR_ALRBWF RTC_ISR_ALRBWF 00253 #define LL_RTC_ISR_ALRAWF RTC_ISR_ALRAWF 00254 /** 00255 * @} 00256 */ 00257 00258 /** @defgroup RTC_LL_EC_IT IT Defines 00259 * @brief IT defines which can be used with LL_RTC_ReadReg and LL_RTC_WriteReg functions 00260 * @{ 00261 */ 00262 #define LL_RTC_CR_TSIE RTC_CR_TSIE 00263 #define LL_RTC_CR_WUTIE RTC_CR_WUTIE 00264 #define LL_RTC_CR_ALRBIE RTC_CR_ALRBIE 00265 #define LL_RTC_CR_ALRAIE RTC_CR_ALRAIE 00266 #define LL_RTC_TAFCR_TAMPIE RTC_TAFCR_TAMPIE 00267 /** 00268 * @} 00269 */ 00270 00271 /** @defgroup RTC_LL_EC_WEEKDAY WEEK DAY 00272 * @{ 00273 */ 00274 #define LL_RTC_WEEKDAY_MONDAY ((uint8_t)0x01U) /*!< Monday */ 00275 #define LL_RTC_WEEKDAY_TUESDAY ((uint8_t)0x02U) /*!< Tuesday */ 00276 #define LL_RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03U) /*!< Wednesday */ 00277 #define LL_RTC_WEEKDAY_THURSDAY ((uint8_t)0x04U) /*!< Thrusday */ 00278 #define LL_RTC_WEEKDAY_FRIDAY ((uint8_t)0x05U) /*!< Friday */ 00279 #define LL_RTC_WEEKDAY_SATURDAY ((uint8_t)0x06U) /*!< Saturday */ 00280 #define LL_RTC_WEEKDAY_SUNDAY ((uint8_t)0x07U) /*!< Sunday */ 00281 /** 00282 * @} 00283 */ 00284 00285 /** @defgroup RTC_LL_EC_MONTH MONTH 00286 * @{ 00287 */ 00288 #define LL_RTC_MONTH_JANUARY ((uint8_t)0x01U) /*!< January */ 00289 #define LL_RTC_MONTH_FEBRUARY ((uint8_t)0x02U) /*!< February */ 00290 #define LL_RTC_MONTH_MARCH ((uint8_t)0x03U) /*!< March */ 00291 #define LL_RTC_MONTH_APRIL ((uint8_t)0x04U) /*!< April */ 00292 #define LL_RTC_MONTH_MAY ((uint8_t)0x05U) /*!< May */ 00293 #define LL_RTC_MONTH_JUNE ((uint8_t)0x06U) /*!< June */ 00294 #define LL_RTC_MONTH_JULY ((uint8_t)0x07U) /*!< July */ 00295 #define LL_RTC_MONTH_AUGUST ((uint8_t)0x08U) /*!< August */ 00296 #define LL_RTC_MONTH_SEPTEMBER ((uint8_t)0x09U) /*!< September */ 00297 #define LL_RTC_MONTH_OCTOBER ((uint8_t)0x10U) /*!< October */ 00298 #define LL_RTC_MONTH_NOVEMBER ((uint8_t)0x11U) /*!< November */ 00299 #define LL_RTC_MONTH_DECEMBER ((uint8_t)0x12U) /*!< December */ 00300 /** 00301 * @} 00302 */ 00303 00304 /** @defgroup RTC_LL_EC_HOURFORMAT HOUR FORMAT 00305 * @{ 00306 */ 00307 #define LL_RTC_HOURFORMAT_24HOUR 0x00000000U /*!< 24 hour/day format */ 00308 #define LL_RTC_HOURFORMAT_AMPM RTC_CR_FMT /*!< AM/PM hour format */ 00309 /** 00310 * @} 00311 */ 00312 00313 /** @defgroup RTC_LL_EC_ALARMOUT ALARM OUTPUT 00314 * @{ 00315 */ 00316 #define LL_RTC_ALARMOUT_DISABLE 0x00000000U /*!< Output disabled */ 00317 #define LL_RTC_ALARMOUT_ALMA RTC_CR_OSEL_0 /*!< Alarm A output enabled */ 00318 #define LL_RTC_ALARMOUT_ALMB RTC_CR_OSEL_1 /*!< Alarm B output enabled */ 00319 #define LL_RTC_ALARMOUT_WAKEUP RTC_CR_OSEL /*!< Wakeup output enabled */ 00320 /** 00321 * @} 00322 */ 00323 00324 /** @defgroup RTC_LL_EC_ALARM_OUTPUTTYPE ALARM OUTPUT TYPE 00325 * @{ 00326 */ 00327 #define LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN 0x00000000U /*!< RTC_ALARM, when mapped on PC13, is open-drain output */ 00328 #define LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL RTC_TAFCR_ALARMOUTTYPE /*!< RTC_ALARM, when mapped on PC13, is push-pull output */ 00329 /** 00330 * @} 00331 */ 00332 00333 /** @defgroup RTC_LL_EC_PIN PIN 00334 * @{ 00335 */ 00336 #define LL_RTC_PIN_PC13 RTC_TAFCR_PC13MODE /*!< PC13 is forced to push-pull output if all RTC alternate functions are disabled */ 00337 #define LL_RTC_PIN_PC14 RTC_TAFCR_PC14MODE /*!< PC14 is forced to push-pull output if LSE is disabled */ 00338 #define LL_RTC_PIN_PC15 RTC_TAFCR_PC15MODE /*!< PC15 is forced to push-pull output if LSE is disabled */ 00339 /** 00340 * @} 00341 */ 00342 00343 /** @defgroup RTC_LL_EC_OUTPUTPOLARITY_PIN OUTPUT POLARITY PIN 00344 * @{ 00345 */ 00346 #define LL_RTC_OUTPUTPOLARITY_PIN_HIGH 0x00000000U /*!< Pin is high when ALRAF/ALRBF/WUTF is asserted (depending on OSEL)*/ 00347 #define LL_RTC_OUTPUTPOLARITY_PIN_LOW RTC_CR_POL /*!< Pin is low when ALRAF/ALRBF/WUTF is asserted (depending on OSEL) */ 00348 /** 00349 * @} 00350 */ 00351 00352 /** @defgroup RTC_LL_EC_TIME_FORMAT TIME FORMAT 00353 * @{ 00354 */ 00355 #define LL_RTC_TIME_FORMAT_AM_OR_24 0x00000000U /*!< AM or 24-hour format */ 00356 #define LL_RTC_TIME_FORMAT_PM RTC_TR_PM /*!< PM */ 00357 /** 00358 * @} 00359 */ 00360 00361 /** @defgroup RTC_LL_EC_SHIFT_SECOND SHIFT SECOND 00362 * @{ 00363 */ 00364 #define LL_RTC_SHIFT_SECOND_DELAY 0x00000000U /* Delay (seconds) = SUBFS / (PREDIV_S + 1) */ 00365 #define LL_RTC_SHIFT_SECOND_ADVANCE RTC_SHIFTR_ADD1S /* Advance (seconds) = (1 - (SUBFS / (PREDIV_S + 1))) */ 00366 /** 00367 * @} 00368 */ 00369 00370 /** @defgroup RTC_LL_EC_ALMA_MASK ALARMA MASK 00371 * @{ 00372 */ 00373 #define LL_RTC_ALMA_MASK_NONE 0x00000000U /*!< No masks applied on Alarm A*/ 00374 #define LL_RTC_ALMA_MASK_DATEWEEKDAY RTC_ALRMAR_MSK4 /*!< Date/day do not care in Alarm A comparison */ 00375 #define LL_RTC_ALMA_MASK_HOURS RTC_ALRMAR_MSK3 /*!< Hours do not care in Alarm A comparison */ 00376 #define LL_RTC_ALMA_MASK_MINUTES RTC_ALRMAR_MSK2 /*!< Minutes do not care in Alarm A comparison */ 00377 #define LL_RTC_ALMA_MASK_SECONDS RTC_ALRMAR_MSK1 /*!< Seconds do not care in Alarm A comparison */ 00378 #define LL_RTC_ALMA_MASK_ALL (RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1) /*!< Masks all */ 00379 /** 00380 * @} 00381 */ 00382 00383 /** @defgroup RTC_LL_EC_ALMA_TIME_FORMAT ALARMA TIME FORMAT 00384 * @{ 00385 */ 00386 #define LL_RTC_ALMA_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */ 00387 #define LL_RTC_ALMA_TIME_FORMAT_PM RTC_ALRMAR_PM /*!< PM */ 00388 /** 00389 * @} 00390 */ 00391 00392 /** @defgroup RTC_LL_EC_ALMB_MASK ALARMB MASK 00393 * @{ 00394 */ 00395 #define LL_RTC_ALMB_MASK_NONE 0x00000000U /*!< No masks applied on Alarm B*/ 00396 #define LL_RTC_ALMB_MASK_DATEWEEKDAY RTC_ALRMBR_MSK4 /*!< Date/day do not care in Alarm B comparison */ 00397 #define LL_RTC_ALMB_MASK_HOURS RTC_ALRMBR_MSK3 /*!< Hours do not care in Alarm B comparison */ 00398 #define LL_RTC_ALMB_MASK_MINUTES RTC_ALRMBR_MSK2 /*!< Minutes do not care in Alarm B comparison */ 00399 #define LL_RTC_ALMB_MASK_SECONDS RTC_ALRMBR_MSK1 /*!< Seconds do not care in Alarm B comparison */ 00400 #define LL_RTC_ALMB_MASK_ALL (RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1) /*!< Masks all */ 00401 /** 00402 * @} 00403 */ 00404 00405 /** @defgroup RTC_LL_EC_ALMB_TIME_FORMAT ALARMB TIME FORMAT 00406 * @{ 00407 */ 00408 #define LL_RTC_ALMB_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */ 00409 #define LL_RTC_ALMB_TIME_FORMAT_PM RTC_ALRMBR_PM /*!< PM */ 00410 /** 00411 * @} 00412 */ 00413 00414 /** @defgroup RTC_LL_EC_TIMESTAMP_EDGE TIMESTAMP EDGE 00415 * @{ 00416 */ 00417 #define LL_RTC_TIMESTAMP_EDGE_RISING 0x00000000U /*!< RTC_TS input rising edge generates a time-stamp event */ 00418 #define LL_RTC_TIMESTAMP_EDGE_FALLING RTC_CR_TSEDGE /*!< RTC_TS input falling edge generates a time-stamp even */ 00419 /** 00420 * @} 00421 */ 00422 00423 /** @defgroup RTC_LL_EC_TS_TIME_FORMAT TIMESTAMP TIME FORMAT 00424 * @{ 00425 */ 00426 #define LL_RTC_TS_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */ 00427 #define LL_RTC_TS_TIME_FORMAT_PM RTC_TSTR_PM /*!< PM */ 00428 /** 00429 * @} 00430 */ 00431 00432 /** @defgroup RTC_LL_EC_TAMPER TAMPER 00433 * @{ 00434 */ 00435 #define LL_RTC_TAMPER_1 RTC_TAFCR_TAMP1E /*!< RTC_TAMP1 input detection */ 00436 #if defined(RTC_TAMPER2_SUPPORT) 00437 #define LL_RTC_TAMPER_2 RTC_TAFCR_TAMP2E /*!< RTC_TAMP2 input detection */ 00438 #endif /* RTC_TAMPER2_SUPPORT */ 00439 /** 00440 * @} 00441 */ 00442 00443 /** @defgroup RTC_LL_EC_TAMPER_MASK TAMPER MASK 00444 * @{ 00445 */ 00446 #define LL_RTC_TAMPER_MASK_TAMPER1 RTC_TAFCR_TAMP1MF /*!< Tamper 1 event generates a trigger event. TAMP1F is masked and internally cleared by hardware.The backup registers are not erased */ 00447 #if defined(RTC_TAMPER2_SUPPORT) 00448 #define LL_RTC_TAMPER_MASK_TAMPER2 RTC_TAFCR_TAMP2MF /*!< Tamper 2 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */ 00449 #endif /* RTC_TAMPER2_SUPPORT */ 00450 /** 00451 * @} 00452 */ 00453 00454 /** @defgroup RTC_LL_EC_TAMPER_NOERASE TAMPER NO ERASE 00455 * @{ 00456 */ 00457 #define LL_RTC_TAMPER_NOERASE_TAMPER1 RTC_TAFCR_TAMP1NOERASE /*!< Tamper 1 event does not erase the backup registers. */ 00458 #if defined(RTC_TAMPER2_SUPPORT) 00459 #define LL_RTC_TAMPER_NOERASE_TAMPER2 RTC_TAFCR_TAMP2NOERASE /*!< Tamper 2 event does not erase the backup registers. */ 00460 #endif /* RTC_TAMPER2_SUPPORT */ 00461 /** 00462 * @} 00463 */ 00464 00465 #if defined(RTC_TAFCR_TAMPPRCH) 00466 /** @defgroup RTC_LL_EC_TAMPER_DURATION TAMPER DURATION 00467 * @{ 00468 */ 00469 #define LL_RTC_TAMPER_DURATION_1RTCCLK 0x00000000U /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle */ 00470 #define LL_RTC_TAMPER_DURATION_2RTCCLK RTC_TAFCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */ 00471 #define LL_RTC_TAMPER_DURATION_4RTCCLK RTC_TAFCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */ 00472 #define LL_RTC_TAMPER_DURATION_8RTCCLK RTC_TAFCR_TAMPPRCH /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */ 00473 /** 00474 * @} 00475 */ 00476 #endif /* RTC_TAFCR_TAMPPRCH */ 00477 00478 #if defined(RTC_TAFCR_TAMPFLT) 00479 /** @defgroup RTC_LL_EC_TAMPER_FILTER TAMPER FILTER 00480 * @{ 00481 */ 00482 #define LL_RTC_TAMPER_FILTER_DISABLE 0x00000000U /*!< Tamper filter is disabled */ 00483 #define LL_RTC_TAMPER_FILTER_2SAMPLE RTC_TAFCR_TAMPFLT_0 /*!< Tamper is activated after 2 consecutive samples at the active level */ 00484 #define LL_RTC_TAMPER_FILTER_4SAMPLE RTC_TAFCR_TAMPFLT_1 /*!< Tamper is activated after 4 consecutive samples at the active level */ 00485 #define LL_RTC_TAMPER_FILTER_8SAMPLE RTC_TAFCR_TAMPFLT /*!< Tamper is activated after 8 consecutive samples at the active level. */ 00486 /** 00487 * @} 00488 */ 00489 #endif /* RTC_TAFCR_TAMPFLT */ 00490 00491 #if defined(RTC_TAFCR_TAMPFREQ) 00492 /** @defgroup RTC_LL_EC_TAMPER_SAMPLFREQDIV TAMPER SAMPLING FREQUENCY DIVIDER 00493 * @{ 00494 */ 00495 #define LL_RTC_TAMPER_SAMPLFREQDIV_32768 0x00000000U /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 32768 */ 00496 #define LL_RTC_TAMPER_SAMPLFREQDIV_16384 RTC_TAFCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 16384 */ 00497 #define LL_RTC_TAMPER_SAMPLFREQDIV_8192 RTC_TAFCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 8192 */ 00498 #define LL_RTC_TAMPER_SAMPLFREQDIV_4096 (RTC_TAFCR_TAMPFREQ_1 | RTC_TAFCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 4096 */ 00499 #define LL_RTC_TAMPER_SAMPLFREQDIV_2048 RTC_TAFCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 2048 */ 00500 #define LL_RTC_TAMPER_SAMPLFREQDIV_1024 (RTC_TAFCR_TAMPFREQ_2 | RTC_TAFCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 1024 */ 00501 #define LL_RTC_TAMPER_SAMPLFREQDIV_512 (RTC_TAFCR_TAMPFREQ_2 | RTC_TAFCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 512 */ 00502 #define LL_RTC_TAMPER_SAMPLFREQDIV_256 RTC_TAFCR_TAMPFREQ /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 256 */ 00503 /** 00504 * @} 00505 */ 00506 #endif /* RTC_TAFCR_TAMPFREQ */ 00507 00508 /** @defgroup RTC_LL_EC_TAMPER_ACTIVELEVEL TAMPER ACTIVE LEVEL 00509 * @{ 00510 */ 00511 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 RTC_TAFCR_TAMP1TRG /*!< RTC_TAMP1 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/ 00512 #if defined(RTC_TAMPER2_SUPPORT) 00513 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 RTC_TAFCR_TAMP2TRG /*!< RTC_TAMP2 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/ 00514 #endif /* RTC_TAMPER2_SUPPORT */ 00515 /** 00516 * @} 00517 */ 00518 00519 /** @defgroup RTC_LL_EC_WAKEUPCLOCK_DIV WAKEUP CLOCK DIV 00520 * @{ 00521 */ 00522 #define LL_RTC_WAKEUPCLOCK_DIV_16 0x00000000U /*!< RTC/16 clock is selected */ 00523 #define LL_RTC_WAKEUPCLOCK_DIV_8 (RTC_CR_WUCKSEL_0) /*!< RTC/8 clock is selected */ 00524 #define LL_RTC_WAKEUPCLOCK_DIV_4 (RTC_CR_WUCKSEL_1) /*!< RTC/4 clock is selected */ 00525 #define LL_RTC_WAKEUPCLOCK_DIV_2 (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_0) /*!< RTC/2 clock is selected */ 00526 #define LL_RTC_WAKEUPCLOCK_CKSPRE (RTC_CR_WUCKSEL_2) /*!< ck_spre (usually 1 Hz) clock is selected */ 00527 #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*/ 00528 /** 00529 * @} 00530 */ 00531 00532 /** @defgroup RTC_LL_EC_BKP BACKUP 00533 * @{ 00534 */ 00535 #define LL_RTC_BKP_DR0 0x00000000U 00536 #define LL_RTC_BKP_DR1 0x00000001U 00537 #define LL_RTC_BKP_DR2 0x00000002U 00538 #define LL_RTC_BKP_DR3 0x00000003U 00539 #define LL_RTC_BKP_DR4 0x00000004U 00540 #if RTC_BKP_NUMBER > 5 00541 #define LL_RTC_BKP_DR5 0x00000005U 00542 #define LL_RTC_BKP_DR6 0x00000006U 00543 #define LL_RTC_BKP_DR7 0x00000007U 00544 #define LL_RTC_BKP_DR8 0x00000008U 00545 #define LL_RTC_BKP_DR9 0x00000009U 00546 #define LL_RTC_BKP_DR10 0x0000000AU 00547 #define LL_RTC_BKP_DR11 0x0000000BU 00548 #define LL_RTC_BKP_DR12 0x0000000CU 00549 #define LL_RTC_BKP_DR13 0x0000000DU 00550 #define LL_RTC_BKP_DR14 0x0000000EU 00551 #define LL_RTC_BKP_DR15 0x0000000FU 00552 #endif /* RTC_BKP_NUMBER > 5 */ 00553 00554 #if RTC_BKP_NUMBER > 16 00555 #define LL_RTC_BKP_DR16 0x00000010U 00556 #define LL_RTC_BKP_DR17 0x00000011U 00557 #define LL_RTC_BKP_DR18 0x00000012U 00558 #define LL_RTC_BKP_DR19 0x00000013U 00559 #endif /* RTC_BKP_NUMBER > 16 */ 00560 /** 00561 * @} 00562 */ 00563 00564 /** @defgroup RTC_LL_EC_CALIB_OUTPUT Calibration output 00565 * @{ 00566 */ 00567 #define LL_RTC_CALIB_OUTPUT_NONE 0x00000000U /*!< Calibration output disabled */ 00568 #define LL_RTC_CALIB_OUTPUT_1HZ (RTC_CR_COE | RTC_CR_COSEL) /*!< Calibration output is 1 Hz */ 00569 #define LL_RTC_CALIB_OUTPUT_512HZ (RTC_CR_COE) /*!< Calibration output is 512 Hz */ 00570 /** 00571 * @} 00572 */ 00573 00574 /** @defgroup RTC_LL_EC_CALIB_SIGN Coarse digital calibration sign 00575 * @{ 00576 */ 00577 #define LL_RTC_CALIB_SIGN_POSITIVE 0x00000000U /*!< Positive calibration: calendar update frequency is increased */ 00578 #define LL_RTC_CALIB_SIGN_NEGATIVE RTC_CALIBR_DCS /*!< Negative calibration: calendar update frequency is decreased */ 00579 /** 00580 * @} 00581 */ 00582 00583 /** @defgroup RTC_LL_EC_CALIB_INSERTPULSE Calibration pulse insertion 00584 * @{ 00585 */ 00586 #define LL_RTC_CALIB_INSERTPULSE_NONE 0x00000000U /*!< No RTCCLK pulses are added */ 00587 #define LL_RTC_CALIB_INSERTPULSE_SET RTC_CALR_CALP /*!< One RTCCLK pulse is effectively inserted every 2exp11 pulses (frequency increased by 488.5 ppm) */ 00588 /** 00589 * @} 00590 */ 00591 00592 /** @defgroup RTC_LL_EC_CALIB_PERIOD Calibration period 00593 * @{ 00594 */ 00595 #define LL_RTC_CALIB_PERIOD_32SEC 0x00000000U /*!< Use a 32-second calibration cycle period */ 00596 #define LL_RTC_CALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< Use a 16-second calibration cycle period */ 00597 #define LL_RTC_CALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< Use a 8-second calibration cycle period */ 00598 /** 00599 * @} 00600 */ 00601 00602 /** @defgroup RTC_LL_EC_TSINSEL TIMESTAMP mapping 00603 * @{ 00604 */ 00605 #define LL_RTC_TimeStampPin_Default 0x00000000U /*!< Use RTC_AF1 as TIMESTAMP */ 00606 #if defined(RTC_AF2_SUPPORT) 00607 #define LL_RTC_TimeStampPin_Pos1 RTC_TAFCR_TSINSEL /*!< Use RTC_AF2 as TIMESTAMP */ 00608 #endif 00609 /** 00610 * @} 00611 */ 00612 00613 /** @defgroup RTC_LL_EC_TAMP1INSEL TAMPER1 mapping 00614 * @{ 00615 */ 00616 #define LL_RTC_TamperPin_Default 0x00000000U /*!< Use RTC_AF1 as TAMPER1 */ 00617 #if defined(RTC_AF2_SUPPORT) 00618 #define LL_RTC_TamperPin_Pos1 RTC_TAFCR_TAMP1INSEL /*!< Use RTC_AF2 as TAMPER1 */ 00619 #endif 00620 /** 00621 * @} 00622 */ 00623 00624 /** 00625 * @} 00626 */ 00627 00628 /* Exported macro ------------------------------------------------------------*/ 00629 /** @defgroup RTC_LL_Exported_Macros RTC Exported Macros 00630 * @{ 00631 */ 00632 00633 /** @defgroup RTC_LL_EM_WRITE_READ Common Write and read registers Macros 00634 * @{ 00635 */ 00636 00637 /** 00638 * @brief Write a value in RTC register 00639 * @param __INSTANCE__ RTC Instance 00640 * @param __REG__ Register to be written 00641 * @param __VALUE__ Value to be written in the register 00642 * @retval None 00643 */ 00644 #define LL_RTC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) 00645 00646 /** 00647 * @brief Read a value in RTC register 00648 * @param __INSTANCE__ RTC Instance 00649 * @param __REG__ Register to be read 00650 * @retval Register value 00651 */ 00652 #define LL_RTC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) 00653 /** 00654 * @} 00655 */ 00656 00657 /** @defgroup RTC_LL_EM_Convert Convert helper Macros 00658 * @{ 00659 */ 00660 00661 /** 00662 * @brief Helper macro to convert a value from 2 digit decimal format to BCD format 00663 * @param __VALUE__ Byte to be converted 00664 * @retval Converted byte 00665 */ 00666 #define __LL_RTC_CONVERT_BIN2BCD(__VALUE__) (uint8_t)((((__VALUE__) / 10U) << 4U) | ((__VALUE__) % 10U)) 00667 00668 /** 00669 * @brief Helper macro to convert a value from BCD format to 2 digit decimal format 00670 * @param __VALUE__ BCD value to be converted 00671 * @retval Converted byte 00672 */ 00673 #define __LL_RTC_CONVERT_BCD2BIN(__VALUE__) (uint8_t)(((uint8_t)((__VALUE__) & (uint8_t)0xF0U) >> (uint8_t)0x4U) * 10U + ((__VALUE__) & (uint8_t)0x0FU)) 00674 00675 /** 00676 * @} 00677 */ 00678 00679 /** @defgroup RTC_LL_EM_Date Date helper Macros 00680 * @{ 00681 */ 00682 00683 /** 00684 * @brief Helper macro to retrieve weekday. 00685 * @param __RTC_DATE__ Date returned by @ref LL_RTC_DATE_Get function. 00686 * @retval Returned value can be one of the following values: 00687 * @arg @ref LL_RTC_WEEKDAY_MONDAY 00688 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 00689 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 00690 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 00691 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 00692 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 00693 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 00694 */ 00695 #define __LL_RTC_GET_WEEKDAY(__RTC_DATE__) (((__RTC_DATE__) >> RTC_OFFSET_WEEKDAY) & 0x000000FFU) 00696 00697 /** 00698 * @brief Helper macro to retrieve Year in BCD format 00699 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get 00700 * @retval Year in BCD format (0x00 . . . 0x99) 00701 */ 00702 #define __LL_RTC_GET_YEAR(__RTC_DATE__) ((__RTC_DATE__) & 0x000000FFU) 00703 00704 /** 00705 * @brief Helper macro to retrieve Month in BCD format 00706 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get 00707 * @retval Returned value can be one of the following values: 00708 * @arg @ref LL_RTC_MONTH_JANUARY 00709 * @arg @ref LL_RTC_MONTH_FEBRUARY 00710 * @arg @ref LL_RTC_MONTH_MARCH 00711 * @arg @ref LL_RTC_MONTH_APRIL 00712 * @arg @ref LL_RTC_MONTH_MAY 00713 * @arg @ref LL_RTC_MONTH_JUNE 00714 * @arg @ref LL_RTC_MONTH_JULY 00715 * @arg @ref LL_RTC_MONTH_AUGUST 00716 * @arg @ref LL_RTC_MONTH_SEPTEMBER 00717 * @arg @ref LL_RTC_MONTH_OCTOBER 00718 * @arg @ref LL_RTC_MONTH_NOVEMBER 00719 * @arg @ref LL_RTC_MONTH_DECEMBER 00720 */ 00721 #define __LL_RTC_GET_MONTH(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_MONTH) & 0x000000FFU) 00722 00723 /** 00724 * @brief Helper macro to retrieve Day in BCD format 00725 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get 00726 * @retval Day in BCD format (0x01 . . . 0x31) 00727 */ 00728 #define __LL_RTC_GET_DAY(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_DAY) & 0x000000FFU) 00729 00730 /** 00731 * @} 00732 */ 00733 00734 /** @defgroup RTC_LL_EM_Time Time helper Macros 00735 * @{ 00736 */ 00737 00738 /** 00739 * @brief Helper macro to retrieve hour in BCD format 00740 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function 00741 * @retval Hours in BCD format (0x01. . .0x12 or between Min_Data=0x00 and Max_Data=0x23) 00742 */ 00743 #define __LL_RTC_GET_HOUR(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_HOUR) & 0x000000FFU) 00744 00745 /** 00746 * @brief Helper macro to retrieve minute in BCD format 00747 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function 00748 * @retval Minutes in BCD format (0x00. . .0x59) 00749 */ 00750 #define __LL_RTC_GET_MINUTE(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_MINUTE) & 0x000000FFU) 00751 00752 /** 00753 * @brief Helper macro to retrieve second in BCD format 00754 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function 00755 * @retval Seconds in format (0x00. . .0x59) 00756 */ 00757 #define __LL_RTC_GET_SECOND(__RTC_TIME__) ((__RTC_TIME__) & 0x000000FFU) 00758 00759 /** 00760 * @} 00761 */ 00762 00763 /** 00764 * @} 00765 */ 00766 00767 /* Exported functions --------------------------------------------------------*/ 00768 /** @defgroup RTC_LL_Exported_Functions RTC Exported Functions 00769 * @{ 00770 */ 00771 00772 /** @defgroup RTC_LL_EF_Configuration Configuration 00773 * @{ 00774 */ 00775 00776 /** 00777 * @brief Set Hours format (24 hour/day or AM/PM hour format) 00778 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 00779 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 00780 * @rmtoll CR FMT LL_RTC_SetHourFormat 00781 * @param RTCx RTC Instance 00782 * @param HourFormat This parameter can be one of the following values: 00783 * @arg @ref LL_RTC_HOURFORMAT_24HOUR 00784 * @arg @ref LL_RTC_HOURFORMAT_AMPM 00785 * @retval None 00786 */ 00787 __STATIC_INLINE void LL_RTC_SetHourFormat(RTC_TypeDef *RTCx, uint32_t HourFormat) 00788 { 00789 MODIFY_REG(RTCx->CR, RTC_CR_FMT, HourFormat); 00790 } 00791 00792 /** 00793 * @brief Get Hours format (24 hour/day or AM/PM hour format) 00794 * @rmtoll CR FMT LL_RTC_GetHourFormat 00795 * @param RTCx RTC Instance 00796 * @retval Returned value can be one of the following values: 00797 * @arg @ref LL_RTC_HOURFORMAT_24HOUR 00798 * @arg @ref LL_RTC_HOURFORMAT_AMPM 00799 */ 00800 __STATIC_INLINE uint32_t LL_RTC_GetHourFormat(RTC_TypeDef *RTCx) 00801 { 00802 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_FMT)); 00803 } 00804 00805 /** 00806 * @brief Select the flag to be routed to RTC_ALARM output 00807 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 00808 * @rmtoll CR OSEL LL_RTC_SetAlarmOutEvent 00809 * @param RTCx RTC Instance 00810 * @param AlarmOutput This parameter can be one of the following values: 00811 * @arg @ref LL_RTC_ALARMOUT_DISABLE 00812 * @arg @ref LL_RTC_ALARMOUT_ALMA 00813 * @arg @ref LL_RTC_ALARMOUT_ALMB 00814 * @arg @ref LL_RTC_ALARMOUT_WAKEUP 00815 * @retval None 00816 */ 00817 __STATIC_INLINE void LL_RTC_SetAlarmOutEvent(RTC_TypeDef *RTCx, uint32_t AlarmOutput) 00818 { 00819 MODIFY_REG(RTCx->CR, RTC_CR_OSEL, AlarmOutput); 00820 } 00821 00822 /** 00823 * @brief Get the flag to be routed to RTC_ALARM output 00824 * @rmtoll CR OSEL LL_RTC_GetAlarmOutEvent 00825 * @param RTCx RTC Instance 00826 * @retval Returned value can be one of the following values: 00827 * @arg @ref LL_RTC_ALARMOUT_DISABLE 00828 * @arg @ref LL_RTC_ALARMOUT_ALMA 00829 * @arg @ref LL_RTC_ALARMOUT_ALMB 00830 * @arg @ref LL_RTC_ALARMOUT_WAKEUP 00831 */ 00832 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutEvent(RTC_TypeDef *RTCx) 00833 { 00834 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_OSEL)); 00835 } 00836 00837 /** 00838 * @brief Set RTC_ALARM output type (ALARM in push-pull or open-drain output) 00839 * @note Used only when RTC_ALARM is mapped on PC13 00840 * @note If all RTC alternate functions are disabled and PC13MODE = 1, PC13VALUE configures the 00841 * PC13 output data 00842 * @rmtoll TAFCR ALARMOUTTYPE LL_RTC_SetAlarmOutputType 00843 * @param RTCx RTC Instance 00844 * @param Output This parameter can be one of the following values: 00845 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN 00846 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL 00847 * @retval None 00848 */ 00849 __STATIC_INLINE void LL_RTC_SetAlarmOutputType(RTC_TypeDef *RTCx, uint32_t Output) 00850 { 00851 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_ALARMOUTTYPE, Output); 00852 } 00853 00854 /** 00855 * @brief Get RTC_ALARM output type (ALARM in push-pull or open-drain output) 00856 * @note used only when RTC_ALARM is mapped on PC13 00857 * @note If all RTC alternate functions are disabled and PC13MODE = 1, PC13VALUE configures the 00858 * PC13 output data 00859 * @rmtoll TAFCR ALARMOUTTYPE LL_RTC_GetAlarmOutputType 00860 * @param RTCx RTC Instance 00861 * @retval Returned value can be one of the following values: 00862 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN 00863 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL 00864 */ 00865 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutputType(RTC_TypeDef *RTCx) 00866 { 00867 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_ALARMOUTTYPE)); 00868 } 00869 00870 /** 00871 * @brief Enable push-pull output on PC13, PC14 and/or PC15 00872 * @note PC13 forced to push-pull output if all RTC alternate functions are disabled 00873 * @note PC14 and PC15 forced to push-pull output if LSE is disabled 00874 * @rmtoll TAFCR PC13MODE LL_RTC_EnablePushPullMode\n 00875 * @rmtoll TAFCR PC14MODE LL_RTC_EnablePushPullMode\n 00876 * @rmtoll TAFCR PC15MODE LL_RTC_EnablePushPullMode 00877 * @param RTCx RTC Instance 00878 * @param PinMask This parameter can be a combination of the following values: 00879 * @arg @ref LL_RTC_PIN_PC13 00880 * @arg @ref LL_RTC_PIN_PC14 00881 * @arg @ref LL_RTC_PIN_PC15 00882 * @retval None 00883 */ 00884 __STATIC_INLINE void LL_RTC_EnablePushPullMode(RTC_TypeDef *RTCx, uint32_t PinMask) 00885 { 00886 SET_BIT(RTCx->TAFCR, PinMask); 00887 } 00888 00889 /** 00890 * @brief Disable push-pull output on PC13, PC14 and/or PC15 00891 * @note PC13, PC14 and/or PC15 are controlled by the GPIO configuration registers. 00892 * Consequently PC13, PC14 and/or PC15 are floating in Standby mode. 00893 * @rmtoll TAFCR PC13MODE LL_RTC_DisablePushPullMode\n 00894 * TAFCR PC14MODE LL_RTC_DisablePushPullMode\n 00895 * TAFCR PC15MODE LL_RTC_DisablePushPullMode 00896 * @param RTCx RTC Instance 00897 * @param PinMask This parameter can be a combination of the following values: 00898 * @arg @ref LL_RTC_PIN_PC13 00899 * @arg @ref LL_RTC_PIN_PC14 00900 * @arg @ref LL_RTC_PIN_PC15 00901 * @retval None 00902 */ 00903 __STATIC_INLINE void LL_RTC_DisablePushPullMode(RTC_TypeDef* RTCx, uint32_t PinMask) 00904 { 00905 CLEAR_BIT(RTCx->TAFCR, PinMask); 00906 } 00907 00908 /** 00909 * @brief Set PC14 and/or PC15 to high level. 00910 * @note Output data configuration is possible if the LSE is disabled and PushPull output is enabled (through @ref LL_RTC_EnablePushPullMode) 00911 * @rmtoll TAFCR PC14VALUE LL_RTC_SetOutputPin\n 00912 * TAFCR PC15VALUE LL_RTC_SetOutputPin 00913 * @param RTCx RTC Instance 00914 * @param PinMask This parameter can be a combination of the following values: 00915 * @arg @ref LL_RTC_PIN_PC14 00916 * @arg @ref LL_RTC_PIN_PC15 00917 * @retval None 00918 */ 00919 __STATIC_INLINE void LL_RTC_SetOutputPin(RTC_TypeDef* RTCx, uint32_t PinMask) 00920 { 00921 SET_BIT(RTCx->TAFCR, (PinMask >> 1)); 00922 } 00923 00924 /** 00925 * @brief Set PC14 and/or PC15 to low level. 00926 * @note Output data configuration is possible if the LSE is disabled and PushPull output is enabled (through @ref LL_RTC_EnablePushPullMode) 00927 * @rmtoll TAFCR PC14VALUE LL_RTC_ResetOutputPin\n 00928 * TAFCR PC15VALUE LL_RTC_ResetOutputPin 00929 * @param RTCx RTC Instance 00930 * @param PinMask This parameter can be a combination of the following values: 00931 * @arg @ref LL_RTC_PIN_PC14 00932 * @arg @ref LL_RTC_PIN_PC15 00933 * @retval None 00934 */ 00935 __STATIC_INLINE void LL_RTC_ResetOutputPin(RTC_TypeDef* RTCx, uint32_t PinMask) 00936 { 00937 CLEAR_BIT(RTCx->TAFCR, (PinMask >> 1)); 00938 } 00939 00940 /** 00941 * @brief Enable initialization mode 00942 * @note Initialization mode is used to program time and date register (RTC_TR and RTC_DR) 00943 * and prescaler register (RTC_PRER). 00944 * Counters are stopped and start counting from the new value when INIT is reset. 00945 * @rmtoll ISR INIT LL_RTC_EnableInitMode 00946 * @param RTCx RTC Instance 00947 * @retval None 00948 */ 00949 __STATIC_INLINE void LL_RTC_EnableInitMode(RTC_TypeDef *RTCx) 00950 { 00951 /* Set the Initialization mode */ 00952 WRITE_REG(RTCx->ISR, RTC_INIT_MASK); 00953 } 00954 00955 /** 00956 * @brief Disable initialization mode (Free running mode) 00957 * @rmtoll ISR INIT LL_RTC_DisableInitMode 00958 * @param RTCx RTC Instance 00959 * @retval None 00960 */ 00961 __STATIC_INLINE void LL_RTC_DisableInitMode(RTC_TypeDef *RTCx) 00962 { 00963 /* Exit Initialization mode */ 00964 WRITE_REG(RTCx->ISR, (uint32_t)~RTC_ISR_INIT); 00965 } 00966 00967 /** 00968 * @brief Set Output polarity (pin is low when ALRAF/ALRBF/WUTF is asserted) 00969 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 00970 * @rmtoll CR POL LL_RTC_SetOutputPolarity 00971 * @param RTCx RTC Instance 00972 * @param Polarity This parameter can be one of the following values: 00973 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH 00974 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW 00975 * @retval None 00976 */ 00977 __STATIC_INLINE void LL_RTC_SetOutputPolarity(RTC_TypeDef *RTCx, uint32_t Polarity) 00978 { 00979 MODIFY_REG(RTCx->CR, RTC_CR_POL, Polarity); 00980 } 00981 00982 /** 00983 * @brief Get Output polarity 00984 * @rmtoll CR POL LL_RTC_GetOutputPolarity 00985 * @param RTCx RTC Instance 00986 * @retval Returned value can be one of the following values: 00987 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH 00988 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW 00989 */ 00990 __STATIC_INLINE uint32_t LL_RTC_GetOutputPolarity(RTC_TypeDef *RTCx) 00991 { 00992 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_POL)); 00993 } 00994 00995 /** 00996 * @brief Enable Bypass the shadow registers 00997 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 00998 * @rmtoll CR BYPSHAD LL_RTC_EnableShadowRegBypass 00999 * @param RTCx RTC Instance 01000 * @retval None 01001 */ 01002 __STATIC_INLINE void LL_RTC_EnableShadowRegBypass(RTC_TypeDef *RTCx) 01003 { 01004 SET_BIT(RTCx->CR, RTC_CR_BYPSHAD); 01005 } 01006 01007 /** 01008 * @brief Disable Bypass the shadow registers 01009 * @rmtoll CR BYPSHAD LL_RTC_DisableShadowRegBypass 01010 * @param RTCx RTC Instance 01011 * @retval None 01012 */ 01013 __STATIC_INLINE void LL_RTC_DisableShadowRegBypass(RTC_TypeDef *RTCx) 01014 { 01015 CLEAR_BIT(RTCx->CR, RTC_CR_BYPSHAD); 01016 } 01017 01018 /** 01019 * @brief Check if Shadow registers bypass is enabled or not. 01020 * @rmtoll CR BYPSHAD LL_RTC_IsShadowRegBypassEnabled 01021 * @param RTCx RTC Instance 01022 * @retval State of bit (1 or 0). 01023 */ 01024 __STATIC_INLINE uint32_t LL_RTC_IsShadowRegBypassEnabled(RTC_TypeDef *RTCx) 01025 { 01026 return (READ_BIT(RTCx->CR, RTC_CR_BYPSHAD) == (RTC_CR_BYPSHAD)); 01027 } 01028 01029 /** 01030 * @brief Enable RTC_REFIN reference clock detection (50 or 60 Hz) 01031 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01032 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 01033 * @rmtoll CR REFCKON LL_RTC_EnableRefClock 01034 * @param RTCx RTC Instance 01035 * @retval None 01036 */ 01037 __STATIC_INLINE void LL_RTC_EnableRefClock(RTC_TypeDef *RTCx) 01038 { 01039 SET_BIT(RTCx->CR, RTC_CR_REFCKON); 01040 } 01041 01042 /** 01043 * @brief Disable RTC_REFIN reference clock detection (50 or 60 Hz) 01044 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01045 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 01046 * @rmtoll CR REFCKON LL_RTC_DisableRefClock 01047 * @param RTCx RTC Instance 01048 * @retval None 01049 */ 01050 __STATIC_INLINE void LL_RTC_DisableRefClock(RTC_TypeDef *RTCx) 01051 { 01052 CLEAR_BIT(RTCx->CR, RTC_CR_REFCKON); 01053 } 01054 01055 /** 01056 * @brief Set Asynchronous prescaler factor 01057 * @rmtoll PRER PREDIV_A LL_RTC_SetAsynchPrescaler 01058 * @param RTCx RTC Instance 01059 * @param AsynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7F 01060 * @retval None 01061 */ 01062 __STATIC_INLINE void LL_RTC_SetAsynchPrescaler(RTC_TypeDef *RTCx, uint32_t AsynchPrescaler) 01063 { 01064 MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_A, AsynchPrescaler << RTC_PRER_PREDIV_A_Pos); 01065 } 01066 01067 /** 01068 * @brief Set Synchronous prescaler factor 01069 * @rmtoll PRER PREDIV_S LL_RTC_SetSynchPrescaler 01070 * @param RTCx RTC Instance 01071 * @param SynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7FFF 01072 * @retval None 01073 */ 01074 __STATIC_INLINE void LL_RTC_SetSynchPrescaler(RTC_TypeDef *RTCx, uint32_t SynchPrescaler) 01075 { 01076 MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_S, SynchPrescaler); 01077 } 01078 01079 /** 01080 * @brief Get Asynchronous prescaler factor 01081 * @rmtoll PRER PREDIV_A LL_RTC_GetAsynchPrescaler 01082 * @param RTCx RTC Instance 01083 * @retval Value between Min_Data = 0 and Max_Data = 0x7F 01084 */ 01085 __STATIC_INLINE uint32_t LL_RTC_GetAsynchPrescaler(RTC_TypeDef *RTCx) 01086 { 01087 return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_A) >> RTC_PRER_PREDIV_A_Pos); 01088 } 01089 01090 /** 01091 * @brief Get Synchronous prescaler factor 01092 * @rmtoll PRER PREDIV_S LL_RTC_GetSynchPrescaler 01093 * @param RTCx RTC Instance 01094 * @retval Value between Min_Data = 0 and Max_Data = 0x7FFF 01095 */ 01096 __STATIC_INLINE uint32_t LL_RTC_GetSynchPrescaler(RTC_TypeDef *RTCx) 01097 { 01098 return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_S)); 01099 } 01100 01101 /** 01102 * @brief Enable the write protection for RTC registers. 01103 * @rmtoll WPR KEY LL_RTC_EnableWriteProtection 01104 * @param RTCx RTC Instance 01105 * @retval None 01106 */ 01107 __STATIC_INLINE void LL_RTC_EnableWriteProtection(RTC_TypeDef *RTCx) 01108 { 01109 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_DISABLE); 01110 } 01111 01112 /** 01113 * @brief Disable the write protection for RTC registers. 01114 * @rmtoll WPR KEY LL_RTC_DisableWriteProtection 01115 * @param RTCx RTC Instance 01116 * @retval None 01117 */ 01118 __STATIC_INLINE void LL_RTC_DisableWriteProtection(RTC_TypeDef *RTCx) 01119 { 01120 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_1); 01121 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_2); 01122 } 01123 01124 /** 01125 * @} 01126 */ 01127 01128 /** @defgroup RTC_LL_EF_Time Time 01129 * @{ 01130 */ 01131 01132 /** 01133 * @brief Set time format (AM/24-hour or PM notation) 01134 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01135 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 01136 * @rmtoll TR PM LL_RTC_TIME_SetFormat 01137 * @param RTCx RTC Instance 01138 * @param TimeFormat This parameter can be one of the following values: 01139 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24 01140 * @arg @ref LL_RTC_TIME_FORMAT_PM 01141 * @retval None 01142 */ 01143 __STATIC_INLINE void LL_RTC_TIME_SetFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat) 01144 { 01145 MODIFY_REG(RTCx->TR, RTC_TR_PM, TimeFormat); 01146 } 01147 01148 /** 01149 * @brief Get time format (AM or PM notation) 01150 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01151 * before reading this bit 01152 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar 01153 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). 01154 * @rmtoll TR PM LL_RTC_TIME_GetFormat 01155 * @param RTCx RTC Instance 01156 * @retval Returned value can be one of the following values: 01157 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24 01158 * @arg @ref LL_RTC_TIME_FORMAT_PM 01159 */ 01160 __STATIC_INLINE uint32_t LL_RTC_TIME_GetFormat(RTC_TypeDef *RTCx) 01161 { 01162 return (uint32_t)(READ_BIT(RTCx->TR, RTC_TR_PM)); 01163 } 01164 01165 /** 01166 * @brief Set Hours in BCD format 01167 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01168 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 01169 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert hour from binary to BCD format 01170 * @rmtoll TR HT LL_RTC_TIME_SetHour\n 01171 * TR HU LL_RTC_TIME_SetHour 01172 * @param RTCx RTC Instance 01173 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 01174 * @retval None 01175 */ 01176 __STATIC_INLINE void LL_RTC_TIME_SetHour(RTC_TypeDef *RTCx, uint32_t Hours) 01177 { 01178 MODIFY_REG(RTCx->TR, (RTC_TR_HT | RTC_TR_HU), 01179 (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos))); 01180 } 01181 01182 /** 01183 * @brief Get Hours in BCD format 01184 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01185 * before reading this bit 01186 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar 01187 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). 01188 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert hour from BCD to 01189 * Binary format 01190 * @rmtoll TR HT LL_RTC_TIME_GetHour\n 01191 * TR HU LL_RTC_TIME_GetHour 01192 * @param RTCx RTC Instance 01193 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 01194 */ 01195 __STATIC_INLINE uint32_t LL_RTC_TIME_GetHour(RTC_TypeDef *RTCx) 01196 { 01197 return (uint32_t)((READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU))) >> RTC_TR_HU_Pos); 01198 } 01199 01200 /** 01201 * @brief Set Minutes in BCD format 01202 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01203 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 01204 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format 01205 * @rmtoll TR MNT LL_RTC_TIME_SetMinute\n 01206 * TR MNU LL_RTC_TIME_SetMinute 01207 * @param RTCx RTC Instance 01208 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 01209 * @retval None 01210 */ 01211 __STATIC_INLINE void LL_RTC_TIME_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes) 01212 { 01213 MODIFY_REG(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU), 01214 (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos))); 01215 } 01216 01217 /** 01218 * @brief Get Minutes in BCD format 01219 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01220 * before reading this bit 01221 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar 01222 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). 01223 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert minute from BCD 01224 * to Binary format 01225 * @rmtoll TR MNT LL_RTC_TIME_GetMinute\n 01226 * TR MNU LL_RTC_TIME_GetMinute 01227 * @param RTCx RTC Instance 01228 * @retval Value between Min_Data=0x00 and Max_Data=0x59 01229 */ 01230 __STATIC_INLINE uint32_t LL_RTC_TIME_GetMinute(RTC_TypeDef *RTCx) 01231 { 01232 return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU))>> RTC_TR_MNU_Pos); 01233 } 01234 01235 /** 01236 * @brief Set Seconds in BCD format 01237 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01238 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 01239 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format 01240 * @rmtoll TR ST LL_RTC_TIME_SetSecond\n 01241 * TR SU LL_RTC_TIME_SetSecond 01242 * @param RTCx RTC Instance 01243 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 01244 * @retval None 01245 */ 01246 __STATIC_INLINE void LL_RTC_TIME_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds) 01247 { 01248 MODIFY_REG(RTCx->TR, (RTC_TR_ST | RTC_TR_SU), 01249 (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos))); 01250 } 01251 01252 /** 01253 * @brief Get Seconds in BCD format 01254 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01255 * before reading this bit 01256 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar 01257 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). 01258 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD 01259 * to Binary format 01260 * @rmtoll TR ST LL_RTC_TIME_GetSecond\n 01261 * TR SU LL_RTC_TIME_GetSecond 01262 * @param RTCx RTC Instance 01263 * @retval Value between Min_Data=0x00 and Max_Data=0x59 01264 */ 01265 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSecond(RTC_TypeDef *RTCx) 01266 { 01267 return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_ST | RTC_TR_SU)) >> RTC_TR_SU_Pos); 01268 } 01269 01270 /** 01271 * @brief Set time (hour, minute and second) in BCD format 01272 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01273 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 01274 * @note TimeFormat and Hours should follow the same format 01275 * @rmtoll TR PM LL_RTC_TIME_Config\n 01276 * TR HT LL_RTC_TIME_Config\n 01277 * TR HU LL_RTC_TIME_Config\n 01278 * TR MNT LL_RTC_TIME_Config\n 01279 * TR MNU LL_RTC_TIME_Config\n 01280 * TR ST LL_RTC_TIME_Config\n 01281 * TR SU LL_RTC_TIME_Config 01282 * @param RTCx RTC Instance 01283 * @param Format12_24 This parameter can be one of the following values: 01284 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24 01285 * @arg @ref LL_RTC_TIME_FORMAT_PM 01286 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 01287 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 01288 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 01289 * @retval None 01290 */ 01291 __STATIC_INLINE void LL_RTC_TIME_Config(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds) 01292 { 01293 register uint32_t temp = 0U; 01294 01295 temp = Format12_24 | \ 01296 (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos)) | \ 01297 (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)) | \ 01298 (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos)); 01299 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); 01300 } 01301 01302 /** 01303 * @brief Get time (hour, minute and second) in BCD format 01304 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01305 * before reading this bit 01306 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar 01307 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)). 01308 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND 01309 * are available to get independently each parameter. 01310 * @rmtoll TR HT LL_RTC_TIME_Get\n 01311 * TR HU LL_RTC_TIME_Get\n 01312 * TR MNT LL_RTC_TIME_Get\n 01313 * TR MNU LL_RTC_TIME_Get\n 01314 * TR ST LL_RTC_TIME_Get\n 01315 * TR SU LL_RTC_TIME_Get 01316 * @param RTCx RTC Instance 01317 * @retval Combination of hours, minutes and seconds (Format: 0x00HHMMSS). 01318 */ 01319 __STATIC_INLINE uint32_t LL_RTC_TIME_Get(RTC_TypeDef *RTCx) 01320 { 01321 register uint32_t temp = 0U; 01322 01323 temp = READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU)); 01324 return (uint32_t)((((((temp & RTC_TR_HT) >> RTC_TR_HT_Pos) << 4U) | ((temp & RTC_TR_HU) >> RTC_TR_HU_Pos)) << RTC_OFFSET_HOUR) | \ 01325 (((((temp & RTC_TR_MNT) >> RTC_TR_MNT_Pos) << 4U) | ((temp & RTC_TR_MNU) >> RTC_TR_MNU_Pos)) << RTC_OFFSET_MINUTE) | \ 01326 ((((temp & RTC_TR_ST) >> RTC_TR_ST_Pos) << 4U) | ((temp & RTC_TR_SU) >> RTC_TR_SU_Pos))); 01327 } 01328 01329 /** 01330 * @brief Memorize whether the daylight saving time change has been performed 01331 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01332 * @rmtoll CR BKP LL_RTC_TIME_EnableDayLightStore 01333 * @param RTCx RTC Instance 01334 * @retval None 01335 */ 01336 __STATIC_INLINE void LL_RTC_TIME_EnableDayLightStore(RTC_TypeDef *RTCx) 01337 { 01338 SET_BIT(RTCx->CR, RTC_CR_BKP); 01339 } 01340 01341 /** 01342 * @brief Disable memorization whether the daylight saving time change has been performed. 01343 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01344 * @rmtoll CR BKP LL_RTC_TIME_DisableDayLightStore 01345 * @param RTCx RTC Instance 01346 * @retval None 01347 */ 01348 __STATIC_INLINE void LL_RTC_TIME_DisableDayLightStore(RTC_TypeDef *RTCx) 01349 { 01350 CLEAR_BIT(RTCx->CR, RTC_CR_BKP); 01351 } 01352 01353 /** 01354 * @brief Check if RTC Day Light Saving stored operation has been enabled or not 01355 * @rmtoll CR BKP LL_RTC_TIME_IsDayLightStoreEnabled 01356 * @param RTCx RTC Instance 01357 * @retval State of bit (1 or 0). 01358 */ 01359 __STATIC_INLINE uint32_t LL_RTC_TIME_IsDayLightStoreEnabled(RTC_TypeDef *RTCx) 01360 { 01361 return (READ_BIT(RTCx->CR, RTC_CR_BKP) == (RTC_CR_BKP)); 01362 } 01363 01364 /** 01365 * @brief Subtract 1 hour (winter time change) 01366 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01367 * @rmtoll CR SUB1H LL_RTC_TIME_DecHour 01368 * @param RTCx RTC Instance 01369 * @retval None 01370 */ 01371 __STATIC_INLINE void LL_RTC_TIME_DecHour(RTC_TypeDef *RTCx) 01372 { 01373 SET_BIT(RTCx->CR, RTC_CR_SUB1H); 01374 } 01375 01376 /** 01377 * @brief Add 1 hour (summer time change) 01378 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01379 * @rmtoll CR ADD1H LL_RTC_TIME_IncHour 01380 * @param RTCx RTC Instance 01381 * @retval None 01382 */ 01383 __STATIC_INLINE void LL_RTC_TIME_IncHour(RTC_TypeDef *RTCx) 01384 { 01385 SET_BIT(RTCx->CR, RTC_CR_ADD1H); 01386 } 01387 01388 /** 01389 * @brief Get Sub second value in the synchronous prescaler counter. 01390 * @note You can use both SubSeconds value and SecondFraction (PREDIV_S through 01391 * LL_RTC_GetSynchPrescaler function) terms returned to convert Calendar 01392 * SubSeconds value in second fraction ratio with time unit following 01393 * generic formula: 01394 * ==> Seconds fraction ratio * time_unit= [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit 01395 * This conversion can be performed only if no shift operation is pending 01396 * (ie. SHFP=0) when PREDIV_S >= SS. 01397 * @rmtoll SSR SS LL_RTC_TIME_GetSubSecond 01398 * @param RTCx RTC Instance 01399 * @retval Sub second value (number between 0 and 65535) 01400 */ 01401 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSubSecond(RTC_TypeDef *RTCx) 01402 { 01403 return (uint32_t)(READ_BIT(RTCx->SSR, RTC_SSR_SS)); 01404 } 01405 01406 /** 01407 * @brief Synchronize to a remote clock with a high degree of precision. 01408 * @note This operation effectively subtracts from (delays) or advance the clock of a fraction of a second. 01409 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01410 * @note When REFCKON is set, firmware must not write to Shift control register. 01411 * @rmtoll SHIFTR ADD1S LL_RTC_TIME_Synchronize\n 01412 * SHIFTR SUBFS LL_RTC_TIME_Synchronize 01413 * @param RTCx RTC Instance 01414 * @param ShiftSecond This parameter can be one of the following values: 01415 * @arg @ref LL_RTC_SHIFT_SECOND_DELAY 01416 * @arg @ref LL_RTC_SHIFT_SECOND_ADVANCE 01417 * @param Fraction Number of Seconds Fractions (any value from 0 to 0x7FFF) 01418 * @retval None 01419 */ 01420 __STATIC_INLINE void LL_RTC_TIME_Synchronize(RTC_TypeDef *RTCx, uint32_t ShiftSecond, uint32_t Fraction) 01421 { 01422 WRITE_REG(RTCx->SHIFTR, ShiftSecond | Fraction); 01423 } 01424 01425 /** 01426 * @} 01427 */ 01428 01429 /** @defgroup RTC_LL_EF_Date Date 01430 * @{ 01431 */ 01432 01433 /** 01434 * @brief Set Year in BCD format 01435 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Year from binary to BCD format 01436 * @rmtoll DR YT LL_RTC_DATE_SetYear\n 01437 * DR YU LL_RTC_DATE_SetYear 01438 * @param RTCx RTC Instance 01439 * @param Year Value between Min_Data=0x00 and Max_Data=0x99 01440 * @retval None 01441 */ 01442 __STATIC_INLINE void LL_RTC_DATE_SetYear(RTC_TypeDef *RTCx, uint32_t Year) 01443 { 01444 MODIFY_REG(RTCx->DR, (RTC_DR_YT | RTC_DR_YU), 01445 (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos))); 01446 } 01447 01448 /** 01449 * @brief Get Year in BCD format 01450 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01451 * before reading this bit 01452 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Year from BCD to Binary format 01453 * @rmtoll DR YT LL_RTC_DATE_GetYear\n 01454 * DR YU LL_RTC_DATE_GetYear 01455 * @param RTCx RTC Instance 01456 * @retval Value between Min_Data=0x00 and Max_Data=0x99 01457 */ 01458 __STATIC_INLINE uint32_t LL_RTC_DATE_GetYear(RTC_TypeDef *RTCx) 01459 { 01460 return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_YT | RTC_DR_YU))) >> RTC_DR_YU_Pos); 01461 } 01462 01463 /** 01464 * @brief Set Week day 01465 * @rmtoll DR WDU LL_RTC_DATE_SetWeekDay 01466 * @param RTCx RTC Instance 01467 * @param WeekDay This parameter can be one of the following values: 01468 * @arg @ref LL_RTC_WEEKDAY_MONDAY 01469 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 01470 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 01471 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 01472 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 01473 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 01474 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 01475 * @retval None 01476 */ 01477 __STATIC_INLINE void LL_RTC_DATE_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay) 01478 { 01479 MODIFY_REG(RTCx->DR, RTC_DR_WDU, WeekDay << RTC_DR_WDU_Pos); 01480 } 01481 01482 /** 01483 * @brief Get Week day 01484 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01485 * before reading this bit 01486 * @rmtoll DR WDU LL_RTC_DATE_GetWeekDay 01487 * @param RTCx RTC Instance 01488 * @retval Returned value can be one of the following values: 01489 * @arg @ref LL_RTC_WEEKDAY_MONDAY 01490 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 01491 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 01492 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 01493 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 01494 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 01495 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 01496 */ 01497 __STATIC_INLINE uint32_t LL_RTC_DATE_GetWeekDay(RTC_TypeDef *RTCx) 01498 { 01499 return (uint32_t)(READ_BIT(RTCx->DR, RTC_DR_WDU) >> RTC_DR_WDU_Pos); 01500 } 01501 01502 /** 01503 * @brief Set Month in BCD format 01504 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Month from binary to BCD format 01505 * @rmtoll DR MT LL_RTC_DATE_SetMonth\n 01506 * DR MU LL_RTC_DATE_SetMonth 01507 * @param RTCx RTC Instance 01508 * @param Month This parameter can be one of the following values: 01509 * @arg @ref LL_RTC_MONTH_JANUARY 01510 * @arg @ref LL_RTC_MONTH_FEBRUARY 01511 * @arg @ref LL_RTC_MONTH_MARCH 01512 * @arg @ref LL_RTC_MONTH_APRIL 01513 * @arg @ref LL_RTC_MONTH_MAY 01514 * @arg @ref LL_RTC_MONTH_JUNE 01515 * @arg @ref LL_RTC_MONTH_JULY 01516 * @arg @ref LL_RTC_MONTH_AUGUST 01517 * @arg @ref LL_RTC_MONTH_SEPTEMBER 01518 * @arg @ref LL_RTC_MONTH_OCTOBER 01519 * @arg @ref LL_RTC_MONTH_NOVEMBER 01520 * @arg @ref LL_RTC_MONTH_DECEMBER 01521 * @retval None 01522 */ 01523 __STATIC_INLINE void LL_RTC_DATE_SetMonth(RTC_TypeDef *RTCx, uint32_t Month) 01524 { 01525 MODIFY_REG(RTCx->DR, (RTC_DR_MT | RTC_DR_MU), 01526 (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos))); 01527 } 01528 01529 /** 01530 * @brief Get Month in BCD format 01531 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01532 * before reading this bit 01533 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format 01534 * @rmtoll DR MT LL_RTC_DATE_GetMonth\n 01535 * DR MU LL_RTC_DATE_GetMonth 01536 * @param RTCx RTC Instance 01537 * @retval Returned value can be one of the following values: 01538 * @arg @ref LL_RTC_MONTH_JANUARY 01539 * @arg @ref LL_RTC_MONTH_FEBRUARY 01540 * @arg @ref LL_RTC_MONTH_MARCH 01541 * @arg @ref LL_RTC_MONTH_APRIL 01542 * @arg @ref LL_RTC_MONTH_MAY 01543 * @arg @ref LL_RTC_MONTH_JUNE 01544 * @arg @ref LL_RTC_MONTH_JULY 01545 * @arg @ref LL_RTC_MONTH_AUGUST 01546 * @arg @ref LL_RTC_MONTH_SEPTEMBER 01547 * @arg @ref LL_RTC_MONTH_OCTOBER 01548 * @arg @ref LL_RTC_MONTH_NOVEMBER 01549 * @arg @ref LL_RTC_MONTH_DECEMBER 01550 */ 01551 __STATIC_INLINE uint32_t LL_RTC_DATE_GetMonth(RTC_TypeDef *RTCx) 01552 { 01553 return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_MT | RTC_DR_MU)))>> RTC_DR_MU_Pos); 01554 } 01555 01556 /** 01557 * @brief Set Day in BCD format 01558 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format 01559 * @rmtoll DR DT LL_RTC_DATE_SetDay\n 01560 * DR DU LL_RTC_DATE_SetDay 01561 * @param RTCx RTC Instance 01562 * @param Day Value between Min_Data=0x01 and Max_Data=0x31 01563 * @retval None 01564 */ 01565 __STATIC_INLINE void LL_RTC_DATE_SetDay(RTC_TypeDef *RTCx, uint32_t Day) 01566 { 01567 MODIFY_REG(RTCx->DR, (RTC_DR_DT | RTC_DR_DU), 01568 (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos))); 01569 } 01570 01571 /** 01572 * @brief Get Day in BCD format 01573 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01574 * before reading this bit 01575 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format 01576 * @rmtoll DR DT LL_RTC_DATE_GetDay\n 01577 * DR DU LL_RTC_DATE_GetDay 01578 * @param RTCx RTC Instance 01579 * @retval Value between Min_Data=0x01 and Max_Data=0x31 01580 */ 01581 __STATIC_INLINE uint32_t LL_RTC_DATE_GetDay(RTC_TypeDef *RTCx) 01582 { 01583 return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_DT | RTC_DR_DU))) >> RTC_DR_DU_Pos); 01584 } 01585 01586 /** 01587 * @brief Set date (WeekDay, Day, Month and Year) in BCD format 01588 * @rmtoll DR WDU LL_RTC_DATE_Config\n 01589 * DR MT LL_RTC_DATE_Config\n 01590 * DR MU LL_RTC_DATE_Config\n 01591 * DR DT LL_RTC_DATE_Config\n 01592 * DR DU LL_RTC_DATE_Config\n 01593 * DR YT LL_RTC_DATE_Config\n 01594 * DR YU LL_RTC_DATE_Config 01595 * @param RTCx RTC Instance 01596 * @param WeekDay This parameter can be one of the following values: 01597 * @arg @ref LL_RTC_WEEKDAY_MONDAY 01598 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 01599 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 01600 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 01601 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 01602 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 01603 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 01604 * @param Day Value between Min_Data=0x01 and Max_Data=0x31 01605 * @param Month This parameter can be one of the following values: 01606 * @arg @ref LL_RTC_MONTH_JANUARY 01607 * @arg @ref LL_RTC_MONTH_FEBRUARY 01608 * @arg @ref LL_RTC_MONTH_MARCH 01609 * @arg @ref LL_RTC_MONTH_APRIL 01610 * @arg @ref LL_RTC_MONTH_MAY 01611 * @arg @ref LL_RTC_MONTH_JUNE 01612 * @arg @ref LL_RTC_MONTH_JULY 01613 * @arg @ref LL_RTC_MONTH_AUGUST 01614 * @arg @ref LL_RTC_MONTH_SEPTEMBER 01615 * @arg @ref LL_RTC_MONTH_OCTOBER 01616 * @arg @ref LL_RTC_MONTH_NOVEMBER 01617 * @arg @ref LL_RTC_MONTH_DECEMBER 01618 * @param Year Value between Min_Data=0x00 and Max_Data=0x99 01619 * @retval None 01620 */ 01621 __STATIC_INLINE void LL_RTC_DATE_Config(RTC_TypeDef *RTCx, uint32_t WeekDay, uint32_t Day, uint32_t Month, uint32_t Year) 01622 { 01623 register uint32_t temp = 0U; 01624 01625 temp = (WeekDay << RTC_DR_WDU_Pos) | \ 01626 (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos)) | \ 01627 (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)) | \ 01628 (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos)); 01629 01630 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); 01631 } 01632 01633 /** 01634 * @brief Get date (WeekDay, Day, Month and Year) in BCD format 01635 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set 01636 * before reading this bit 01637 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_YEAR, __LL_RTC_GET_MONTH, 01638 * and __LL_RTC_GET_DAY are available to get independently each parameter. 01639 * @rmtoll DR WDU LL_RTC_DATE_Get\n 01640 * DR MT LL_RTC_DATE_Get\n 01641 * DR MU LL_RTC_DATE_Get\n 01642 * DR DT LL_RTC_DATE_Get\n 01643 * DR DU LL_RTC_DATE_Get\n 01644 * DR YT LL_RTC_DATE_Get\n 01645 * DR YU LL_RTC_DATE_Get 01646 * @param RTCx RTC Instance 01647 * @retval Combination of WeekDay, Day, Month and Year (Format: 0xWWDDMMYY). 01648 */ 01649 __STATIC_INLINE uint32_t LL_RTC_DATE_Get(RTC_TypeDef *RTCx) 01650 { 01651 register uint32_t temp = 0U; 01652 01653 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)); 01654 return (uint32_t)((((temp & RTC_DR_WDU) >> RTC_DR_WDU_Pos) << RTC_OFFSET_WEEKDAY) | \ 01655 (((((temp & RTC_DR_DT) >> RTC_DR_DT_Pos) << 4U) | ((temp & RTC_DR_DU) >> RTC_DR_DU_Pos)) << RTC_OFFSET_DAY) | \ 01656 (((((temp & RTC_DR_MT) >> RTC_DR_MT_Pos) << 4U) | ((temp & RTC_DR_MU) >> RTC_DR_MU_Pos)) << RTC_OFFSET_MONTH) | \ 01657 ((((temp & RTC_DR_YT) >> RTC_DR_YT_Pos) << 4U) | ((temp & RTC_DR_YU) >> RTC_DR_YU_Pos))); 01658 } 01659 01660 /** 01661 * @} 01662 */ 01663 01664 /** @defgroup RTC_LL_EF_ALARMA ALARMA 01665 * @{ 01666 */ 01667 01668 /** 01669 * @brief Enable Alarm A 01670 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01671 * @rmtoll CR ALRAE LL_RTC_ALMA_Enable 01672 * @param RTCx RTC Instance 01673 * @retval None 01674 */ 01675 __STATIC_INLINE void LL_RTC_ALMA_Enable(RTC_TypeDef *RTCx) 01676 { 01677 SET_BIT(RTCx->CR, RTC_CR_ALRAE); 01678 } 01679 01680 /** 01681 * @brief Disable Alarm A 01682 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 01683 * @rmtoll CR ALRAE LL_RTC_ALMA_Disable 01684 * @param RTCx RTC Instance 01685 * @retval None 01686 */ 01687 __STATIC_INLINE void LL_RTC_ALMA_Disable(RTC_TypeDef *RTCx) 01688 { 01689 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAE); 01690 } 01691 01692 /** 01693 * @brief Specify the Alarm A masks. 01694 * @rmtoll ALRMAR MSK4 LL_RTC_ALMA_SetMask\n 01695 * ALRMAR MSK3 LL_RTC_ALMA_SetMask\n 01696 * ALRMAR MSK2 LL_RTC_ALMA_SetMask\n 01697 * ALRMAR MSK1 LL_RTC_ALMA_SetMask 01698 * @param RTCx RTC Instance 01699 * @param Mask This parameter can be a combination of the following values: 01700 * @arg @ref LL_RTC_ALMA_MASK_NONE 01701 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY 01702 * @arg @ref LL_RTC_ALMA_MASK_HOURS 01703 * @arg @ref LL_RTC_ALMA_MASK_MINUTES 01704 * @arg @ref LL_RTC_ALMA_MASK_SECONDS 01705 * @arg @ref LL_RTC_ALMA_MASK_ALL 01706 * @retval None 01707 */ 01708 __STATIC_INLINE void LL_RTC_ALMA_SetMask(RTC_TypeDef *RTCx, uint32_t Mask) 01709 { 01710 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1, Mask); 01711 } 01712 01713 /** 01714 * @brief Get the Alarm A masks. 01715 * @rmtoll ALRMAR MSK4 LL_RTC_ALMA_GetMask\n 01716 * ALRMAR MSK3 LL_RTC_ALMA_GetMask\n 01717 * ALRMAR MSK2 LL_RTC_ALMA_GetMask\n 01718 * ALRMAR MSK1 LL_RTC_ALMA_GetMask 01719 * @param RTCx RTC Instance 01720 * @retval Returned value can be can be a combination of the following values: 01721 * @arg @ref LL_RTC_ALMA_MASK_NONE 01722 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY 01723 * @arg @ref LL_RTC_ALMA_MASK_HOURS 01724 * @arg @ref LL_RTC_ALMA_MASK_MINUTES 01725 * @arg @ref LL_RTC_ALMA_MASK_SECONDS 01726 * @arg @ref LL_RTC_ALMA_MASK_ALL 01727 */ 01728 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMask(RTC_TypeDef *RTCx) 01729 { 01730 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1)); 01731 } 01732 01733 /** 01734 * @brief Enable AlarmA Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care) 01735 * @rmtoll ALRMAR WDSEL LL_RTC_ALMA_EnableWeekday 01736 * @param RTCx RTC Instance 01737 * @retval None 01738 */ 01739 __STATIC_INLINE void LL_RTC_ALMA_EnableWeekday(RTC_TypeDef *RTCx) 01740 { 01741 SET_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL); 01742 } 01743 01744 /** 01745 * @brief Disable AlarmA Week day selection (DU[3:0] represents the date ) 01746 * @rmtoll ALRMAR WDSEL LL_RTC_ALMA_DisableWeekday 01747 * @param RTCx RTC Instance 01748 * @retval None 01749 */ 01750 __STATIC_INLINE void LL_RTC_ALMA_DisableWeekday(RTC_TypeDef *RTCx) 01751 { 01752 CLEAR_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL); 01753 } 01754 01755 /** 01756 * @brief Set ALARM A Day in BCD format 01757 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format 01758 * @rmtoll ALRMAR DT LL_RTC_ALMA_SetDay\n 01759 * ALRMAR DU LL_RTC_ALMA_SetDay 01760 * @param RTCx RTC Instance 01761 * @param Day Value between Min_Data=0x01 and Max_Data=0x31 01762 * @retval None 01763 */ 01764 __STATIC_INLINE void LL_RTC_ALMA_SetDay(RTC_TypeDef *RTCx, uint32_t Day) 01765 { 01766 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU), 01767 (((Day & 0xF0U) << (RTC_ALRMAR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMAR_DU_Pos))); 01768 } 01769 01770 /** 01771 * @brief Get ALARM A Day in BCD format 01772 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format 01773 * @rmtoll ALRMAR DT LL_RTC_ALMA_GetDay\n 01774 * ALRMAR DU LL_RTC_ALMA_GetDay 01775 * @param RTCx RTC Instance 01776 * @retval Value between Min_Data=0x01 and Max_Data=0x31 01777 */ 01778 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetDay(RTC_TypeDef *RTCx) 01779 { 01780 return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU))) >> RTC_ALRMAR_DU_Pos); 01781 } 01782 01783 /** 01784 * @brief Set ALARM A Weekday 01785 * @rmtoll ALRMAR DU LL_RTC_ALMA_SetWeekDay 01786 * @param RTCx RTC Instance 01787 * @param WeekDay This parameter can be one of the following values: 01788 * @arg @ref LL_RTC_WEEKDAY_MONDAY 01789 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 01790 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 01791 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 01792 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 01793 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 01794 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 01795 * @retval None 01796 */ 01797 __STATIC_INLINE void LL_RTC_ALMA_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay) 01798 { 01799 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_DU, WeekDay << RTC_ALRMAR_DU_Pos); 01800 } 01801 01802 /** 01803 * @brief Get ALARM A Weekday 01804 * @rmtoll ALRMAR DU LL_RTC_ALMA_GetWeekDay 01805 * @param RTCx RTC Instance 01806 * @retval Returned value can be one of the following values: 01807 * @arg @ref LL_RTC_WEEKDAY_MONDAY 01808 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 01809 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 01810 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 01811 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 01812 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 01813 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 01814 */ 01815 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetWeekDay(RTC_TypeDef *RTCx) 01816 { 01817 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_DU) >> RTC_ALRMAR_DU_Pos); 01818 } 01819 01820 /** 01821 * @brief Set Alarm A time format (AM/24-hour or PM notation) 01822 * @rmtoll ALRMAR PM LL_RTC_ALMA_SetTimeFormat 01823 * @param RTCx RTC Instance 01824 * @param TimeFormat This parameter can be one of the following values: 01825 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM 01826 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM 01827 * @retval None 01828 */ 01829 __STATIC_INLINE void LL_RTC_ALMA_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat) 01830 { 01831 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM, TimeFormat); 01832 } 01833 01834 /** 01835 * @brief Get Alarm A time format (AM or PM notation) 01836 * @rmtoll ALRMAR PM LL_RTC_ALMA_GetTimeFormat 01837 * @param RTCx RTC Instance 01838 * @retval Returned value can be one of the following values: 01839 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM 01840 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM 01841 */ 01842 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTimeFormat(RTC_TypeDef *RTCx) 01843 { 01844 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_PM)); 01845 } 01846 01847 /** 01848 * @brief Set ALARM A Hours in BCD format 01849 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format 01850 * @rmtoll ALRMAR HT LL_RTC_ALMA_SetHour\n 01851 * ALRMAR HU LL_RTC_ALMA_SetHour 01852 * @param RTCx RTC Instance 01853 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 01854 * @retval None 01855 */ 01856 __STATIC_INLINE void LL_RTC_ALMA_SetHour(RTC_TypeDef *RTCx, uint32_t Hours) 01857 { 01858 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU), 01859 (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos))); 01860 } 01861 01862 /** 01863 * @brief Get ALARM A Hours in BCD format 01864 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format 01865 * @rmtoll ALRMAR HT LL_RTC_ALMA_GetHour\n 01866 * ALRMAR HU LL_RTC_ALMA_GetHour 01867 * @param RTCx RTC Instance 01868 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 01869 */ 01870 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetHour(RTC_TypeDef *RTCx) 01871 { 01872 return (uint32_t)(( READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU))) >> RTC_ALRMAR_HU_Pos); 01873 } 01874 01875 /** 01876 * @brief Set ALARM A Minutes in BCD format 01877 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format 01878 * @rmtoll ALRMAR MNT LL_RTC_ALMA_SetMinute\n 01879 * ALRMAR MNU LL_RTC_ALMA_SetMinute 01880 * @param RTCx RTC Instance 01881 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 01882 * @retval None 01883 */ 01884 __STATIC_INLINE void LL_RTC_ALMA_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes) 01885 { 01886 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU), 01887 (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos))); 01888 } 01889 01890 /** 01891 * @brief Get ALARM A Minutes in BCD format 01892 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format 01893 * @rmtoll ALRMAR MNT LL_RTC_ALMA_GetMinute\n 01894 * ALRMAR MNU LL_RTC_ALMA_GetMinute 01895 * @param RTCx RTC Instance 01896 * @retval Value between Min_Data=0x00 and Max_Data=0x59 01897 */ 01898 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMinute(RTC_TypeDef *RTCx) 01899 { 01900 return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU))) >> RTC_ALRMAR_MNU_Pos); 01901 } 01902 01903 /** 01904 * @brief Set ALARM A Seconds in BCD format 01905 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format 01906 * @rmtoll ALRMAR ST LL_RTC_ALMA_SetSecond\n 01907 * ALRMAR SU LL_RTC_ALMA_SetSecond 01908 * @param RTCx RTC Instance 01909 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 01910 * @retval None 01911 */ 01912 __STATIC_INLINE void LL_RTC_ALMA_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds) 01913 { 01914 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU), 01915 (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos))); 01916 } 01917 01918 /** 01919 * @brief Get ALARM A Seconds in BCD format 01920 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format 01921 * @rmtoll ALRMAR ST LL_RTC_ALMA_GetSecond\n 01922 * ALRMAR SU LL_RTC_ALMA_GetSecond 01923 * @param RTCx RTC Instance 01924 * @retval Value between Min_Data=0x00 and Max_Data=0x59 01925 */ 01926 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSecond(RTC_TypeDef *RTCx) 01927 { 01928 return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU))) >> RTC_ALRMAR_SU_Pos); 01929 } 01930 01931 /** 01932 * @brief Set Alarm A Time (hour, minute and second) in BCD format 01933 * @rmtoll ALRMAR PM LL_RTC_ALMA_ConfigTime\n 01934 * ALRMAR HT LL_RTC_ALMA_ConfigTime\n 01935 * ALRMAR HU LL_RTC_ALMA_ConfigTime\n 01936 * ALRMAR MNT LL_RTC_ALMA_ConfigTime\n 01937 * ALRMAR MNU LL_RTC_ALMA_ConfigTime\n 01938 * ALRMAR ST LL_RTC_ALMA_ConfigTime\n 01939 * ALRMAR SU LL_RTC_ALMA_ConfigTime 01940 * @param RTCx RTC Instance 01941 * @param Format12_24 This parameter can be one of the following values: 01942 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM 01943 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM 01944 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 01945 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 01946 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 01947 * @retval None 01948 */ 01949 __STATIC_INLINE void LL_RTC_ALMA_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds) 01950 { 01951 register uint32_t temp = 0U; 01952 01953 temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos)) | \ 01954 (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)) | \ 01955 (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos)); 01956 01957 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); 01958 } 01959 01960 /** 01961 * @brief Get Alarm B Time (hour, minute and second) in BCD format 01962 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND 01963 * are available to get independently each parameter. 01964 * @rmtoll ALRMAR HT LL_RTC_ALMA_GetTime\n 01965 * ALRMAR HU LL_RTC_ALMA_GetTime\n 01966 * ALRMAR MNT LL_RTC_ALMA_GetTime\n 01967 * ALRMAR MNU LL_RTC_ALMA_GetTime\n 01968 * ALRMAR ST LL_RTC_ALMA_GetTime\n 01969 * ALRMAR SU LL_RTC_ALMA_GetTime 01970 * @param RTCx RTC Instance 01971 * @retval Combination of hours, minutes and seconds. 01972 */ 01973 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTime(RTC_TypeDef *RTCx) 01974 { 01975 return (uint32_t)((LL_RTC_ALMA_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMA_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMA_GetSecond(RTCx)); 01976 } 01977 01978 /** 01979 * @brief Set Alarm A Mask the most-significant bits starting at this bit 01980 * @note This register can be written only when ALRAE is reset in RTC_CR register, 01981 * or in initialization mode. 01982 * @rmtoll ALRMASSR MASKSS LL_RTC_ALMA_SetSubSecondMask 01983 * @param RTCx RTC Instance 01984 * @param Mask Value between Min_Data=0x00 and Max_Data=0xF 01985 * @retval None 01986 */ 01987 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask) 01988 { 01989 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS, Mask << RTC_ALRMASSR_MASKSS_Pos); 01990 } 01991 01992 /** 01993 * @brief Get Alarm A Mask the most-significant bits starting at this bit 01994 * @rmtoll ALRMASSR MASKSS LL_RTC_ALMA_GetSubSecondMask 01995 * @param RTCx RTC Instance 01996 * @retval Value between Min_Data=0x00 and Max_Data=0xF 01997 */ 01998 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecondMask(RTC_TypeDef *RTCx) 01999 { 02000 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS) >> RTC_ALRMASSR_MASKSS_Pos); 02001 } 02002 02003 /** 02004 * @brief Set Alarm A Sub seconds value 02005 * @rmtoll ALRMASSR SS LL_RTC_ALMA_SetSubSecond 02006 * @param RTCx RTC Instance 02007 * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF 02008 * @retval None 02009 */ 02010 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond) 02011 { 02012 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_SS, Subsecond); 02013 } 02014 02015 /** 02016 * @brief Get Alarm A Sub seconds value 02017 * @rmtoll ALRMASSR SS LL_RTC_ALMA_GetSubSecond 02018 * @param RTCx RTC Instance 02019 * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF 02020 */ 02021 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecond(RTC_TypeDef *RTCx) 02022 { 02023 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_SS)); 02024 } 02025 02026 /** 02027 * @} 02028 */ 02029 02030 /** @defgroup RTC_LL_EF_ALARMB ALARMB 02031 * @{ 02032 */ 02033 02034 /** 02035 * @brief Enable Alarm B 02036 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02037 * @rmtoll CR ALRBE LL_RTC_ALMB_Enable 02038 * @param RTCx RTC Instance 02039 * @retval None 02040 */ 02041 __STATIC_INLINE void LL_RTC_ALMB_Enable(RTC_TypeDef *RTCx) 02042 { 02043 SET_BIT(RTCx->CR, RTC_CR_ALRBE); 02044 } 02045 02046 /** 02047 * @brief Disable Alarm B 02048 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02049 * @rmtoll CR ALRBE LL_RTC_ALMB_Disable 02050 * @param RTCx RTC Instance 02051 * @retval None 02052 */ 02053 __STATIC_INLINE void LL_RTC_ALMB_Disable(RTC_TypeDef *RTCx) 02054 { 02055 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBE); 02056 } 02057 02058 /** 02059 * @brief Specify the Alarm B masks. 02060 * @rmtoll ALRMBR MSK4 LL_RTC_ALMB_SetMask\n 02061 * ALRMBR MSK3 LL_RTC_ALMB_SetMask\n 02062 * ALRMBR MSK2 LL_RTC_ALMB_SetMask\n 02063 * ALRMBR MSK1 LL_RTC_ALMB_SetMask 02064 * @param RTCx RTC Instance 02065 * @param Mask This parameter can be a combination of the following values: 02066 * @arg @ref LL_RTC_ALMB_MASK_NONE 02067 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY 02068 * @arg @ref LL_RTC_ALMB_MASK_HOURS 02069 * @arg @ref LL_RTC_ALMB_MASK_MINUTES 02070 * @arg @ref LL_RTC_ALMB_MASK_SECONDS 02071 * @arg @ref LL_RTC_ALMB_MASK_ALL 02072 * @retval None 02073 */ 02074 __STATIC_INLINE void LL_RTC_ALMB_SetMask(RTC_TypeDef *RTCx, uint32_t Mask) 02075 { 02076 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1, Mask); 02077 } 02078 02079 /** 02080 * @brief Get the Alarm B masks. 02081 * @rmtoll ALRMBR MSK4 LL_RTC_ALMB_GetMask\n 02082 * ALRMBR MSK3 LL_RTC_ALMB_GetMask\n 02083 * ALRMBR MSK2 LL_RTC_ALMB_GetMask\n 02084 * ALRMBR MSK1 LL_RTC_ALMB_GetMask 02085 * @param RTCx RTC Instance 02086 * @retval Returned value can be can be a combination of the following values: 02087 * @arg @ref LL_RTC_ALMB_MASK_NONE 02088 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY 02089 * @arg @ref LL_RTC_ALMB_MASK_HOURS 02090 * @arg @ref LL_RTC_ALMB_MASK_MINUTES 02091 * @arg @ref LL_RTC_ALMB_MASK_SECONDS 02092 * @arg @ref LL_RTC_ALMB_MASK_ALL 02093 */ 02094 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMask(RTC_TypeDef *RTCx) 02095 { 02096 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1)); 02097 } 02098 02099 /** 02100 * @brief Enable AlarmB Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care) 02101 * @rmtoll ALRMBR WDSEL LL_RTC_ALMB_EnableWeekday 02102 * @param RTCx RTC Instance 02103 * @retval None 02104 */ 02105 __STATIC_INLINE void LL_RTC_ALMB_EnableWeekday(RTC_TypeDef *RTCx) 02106 { 02107 SET_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL); 02108 } 02109 02110 /** 02111 * @brief Disable AlarmB Week day selection (DU[3:0] represents the date ) 02112 * @rmtoll ALRMBR WDSEL LL_RTC_ALMB_DisableWeekday 02113 * @param RTCx RTC Instance 02114 * @retval None 02115 */ 02116 __STATIC_INLINE void LL_RTC_ALMB_DisableWeekday(RTC_TypeDef *RTCx) 02117 { 02118 CLEAR_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL); 02119 } 02120 02121 /** 02122 * @brief Set ALARM B Day in BCD format 02123 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format 02124 * @rmtoll ALRMBR DT LL_RTC_ALMB_SetDay\n 02125 * ALRMBR DU LL_RTC_ALMB_SetDay 02126 * @param RTCx RTC Instance 02127 * @param Day Value between Min_Data=0x01 and Max_Data=0x31 02128 * @retval None 02129 */ 02130 __STATIC_INLINE void LL_RTC_ALMB_SetDay(RTC_TypeDef *RTCx, uint32_t Day) 02131 { 02132 MODIFY_REG(RTC->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU), 02133 (((Day & 0xF0U) << (RTC_ALRMBR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMBR_DU_Pos))); 02134 } 02135 02136 /** 02137 * @brief Get ALARM B Day in BCD format 02138 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format 02139 * @rmtoll ALRMBR DT LL_RTC_ALMB_GetDay\n 02140 * ALRMBR DU LL_RTC_ALMB_GetDay 02141 * @param RTCx RTC Instance 02142 * @retval Value between Min_Data=0x01 and Max_Data=0x31 02143 */ 02144 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetDay(RTC_TypeDef *RTCx) 02145 { 02146 return (uint32_t)(( READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU))) >> RTC_ALRMBR_DU_Pos); 02147 } 02148 02149 /** 02150 * @brief Set ALARM B Weekday 02151 * @rmtoll ALRMBR DU LL_RTC_ALMB_SetWeekDay 02152 * @param RTCx RTC Instance 02153 * @param WeekDay This parameter can be one of the following values: 02154 * @arg @ref LL_RTC_WEEKDAY_MONDAY 02155 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 02156 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 02157 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 02158 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 02159 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 02160 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 02161 * @retval None 02162 */ 02163 __STATIC_INLINE void LL_RTC_ALMB_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay) 02164 { 02165 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_DU, WeekDay << RTC_ALRMBR_DU_Pos); 02166 } 02167 02168 /** 02169 * @brief Get ALARM B Weekday 02170 * @rmtoll ALRMBR DU LL_RTC_ALMB_GetWeekDay 02171 * @param RTCx RTC Instance 02172 * @retval Returned value can be one of the following values: 02173 * @arg @ref LL_RTC_WEEKDAY_MONDAY 02174 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 02175 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 02176 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 02177 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 02178 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 02179 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 02180 */ 02181 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetWeekDay(RTC_TypeDef *RTCx) 02182 { 02183 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_DU) >> RTC_ALRMBR_DU_Pos); 02184 } 02185 02186 /** 02187 * @brief Set ALARM B time format (AM/24-hour or PM notation) 02188 * @rmtoll ALRMBR PM LL_RTC_ALMB_SetTimeFormat 02189 * @param RTCx RTC Instance 02190 * @param TimeFormat This parameter can be one of the following values: 02191 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM 02192 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM 02193 * @retval None 02194 */ 02195 __STATIC_INLINE void LL_RTC_ALMB_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat) 02196 { 02197 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM, TimeFormat); 02198 } 02199 02200 /** 02201 * @brief Get ALARM B time format (AM or PM notation) 02202 * @rmtoll ALRMBR PM LL_RTC_ALMB_GetTimeFormat 02203 * @param RTCx RTC Instance 02204 * @retval Returned value can be one of the following values: 02205 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM 02206 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM 02207 */ 02208 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTimeFormat(RTC_TypeDef *RTCx) 02209 { 02210 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_PM)); 02211 } 02212 02213 /** 02214 * @brief Set ALARM B Hours in BCD format 02215 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format 02216 * @rmtoll ALRMBR HT LL_RTC_ALMB_SetHour\n 02217 * ALRMBR HU LL_RTC_ALMB_SetHour 02218 * @param RTCx RTC Instance 02219 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 02220 * @retval None 02221 */ 02222 __STATIC_INLINE void LL_RTC_ALMB_SetHour(RTC_TypeDef *RTCx, uint32_t Hours) 02223 { 02224 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU), 02225 (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos))); 02226 } 02227 02228 /** 02229 * @brief Get ALARM B Hours in BCD format 02230 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format 02231 * @rmtoll ALRMBR HT LL_RTC_ALMB_GetHour\n 02232 * ALRMBR HU LL_RTC_ALMB_GetHour 02233 * @param RTCx RTC Instance 02234 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 02235 */ 02236 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetHour(RTC_TypeDef *RTCx) 02237 { 02238 return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU))) >> RTC_ALRMBR_HU_Pos); 02239 } 02240 02241 /** 02242 * @brief Set ALARM B Minutes in BCD format 02243 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format 02244 * @rmtoll ALRMBR MNT LL_RTC_ALMB_SetMinute\n 02245 * ALRMBR MNU LL_RTC_ALMB_SetMinute 02246 * @param RTCx RTC Instance 02247 * @param Minutes between Min_Data=0x00 and Max_Data=0x59 02248 * @retval None 02249 */ 02250 __STATIC_INLINE void LL_RTC_ALMB_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes) 02251 { 02252 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU), 02253 (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos))); 02254 } 02255 02256 /** 02257 * @brief Get ALARM B Minutes in BCD format 02258 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format 02259 * @rmtoll ALRMBR MNT LL_RTC_ALMB_GetMinute\n 02260 * ALRMBR MNU LL_RTC_ALMB_GetMinute 02261 * @param RTCx RTC Instance 02262 * @retval Value between Min_Data=0x00 and Max_Data=0x59 02263 */ 02264 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMinute(RTC_TypeDef *RTCx) 02265 { 02266 return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU))) >> RTC_ALRMBR_MNU_Pos); 02267 } 02268 02269 /** 02270 * @brief Set ALARM B Seconds in BCD format 02271 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format 02272 * @rmtoll ALRMBR ST LL_RTC_ALMB_SetSecond\n 02273 * ALRMBR SU LL_RTC_ALMB_SetSecond 02274 * @param RTCx RTC Instance 02275 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 02276 * @retval None 02277 */ 02278 __STATIC_INLINE void LL_RTC_ALMB_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds) 02279 { 02280 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU), 02281 (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos))); 02282 } 02283 02284 /** 02285 * @brief Get ALARM B Seconds in BCD format 02286 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format 02287 * @rmtoll ALRMBR ST LL_RTC_ALMB_GetSecond\n 02288 * ALRMBR SU LL_RTC_ALMB_GetSecond 02289 * @param RTCx RTC Instance 02290 * @retval Value between Min_Data=0x00 and Max_Data=0x59 02291 */ 02292 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSecond(RTC_TypeDef *RTCx) 02293 { 02294 register uint32_t temp = 0U; 02295 02296 temp = READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU)); 02297 return (uint32_t)((((temp & RTC_ALRMBR_ST) >> RTC_ALRMBR_ST_Pos) << 4U) | ((temp & RTC_ALRMBR_SU) >> RTC_ALRMBR_SU_Pos)); 02298 } 02299 02300 /** 02301 * @brief Set Alarm B Time (hour, minute and second) in BCD format 02302 * @rmtoll ALRMBR PM LL_RTC_ALMB_ConfigTime\n 02303 * ALRMBR HT LL_RTC_ALMB_ConfigTime\n 02304 * ALRMBR HU LL_RTC_ALMB_ConfigTime\n 02305 * ALRMBR MNT LL_RTC_ALMB_ConfigTime\n 02306 * ALRMBR MNU LL_RTC_ALMB_ConfigTime\n 02307 * ALRMBR ST LL_RTC_ALMB_ConfigTime\n 02308 * ALRMBR SU LL_RTC_ALMB_ConfigTime 02309 * @param RTCx RTC Instance 02310 * @param Format12_24 This parameter can be one of the following values: 02311 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM 02312 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM 02313 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 02314 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59 02315 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59 02316 * @retval None 02317 */ 02318 __STATIC_INLINE void LL_RTC_ALMB_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds) 02319 { 02320 register uint32_t temp = 0U; 02321 02322 temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos)) | \ 02323 (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)) | \ 02324 (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos)); 02325 02326 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); 02327 } 02328 02329 /** 02330 * @brief Get Alarm B Time (hour, minute and second) in BCD format 02331 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND 02332 * are available to get independently each parameter. 02333 * @rmtoll ALRMBR HT LL_RTC_ALMB_GetTime\n 02334 * ALRMBR HU LL_RTC_ALMB_GetTime\n 02335 * ALRMBR MNT LL_RTC_ALMB_GetTime\n 02336 * ALRMBR MNU LL_RTC_ALMB_GetTime\n 02337 * ALRMBR ST LL_RTC_ALMB_GetTime\n 02338 * ALRMBR SU LL_RTC_ALMB_GetTime 02339 * @param RTCx RTC Instance 02340 * @retval Combination of hours, minutes and seconds. 02341 */ 02342 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTime(RTC_TypeDef *RTCx) 02343 { 02344 return (uint32_t)((LL_RTC_ALMB_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMB_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMB_GetSecond(RTCx)); 02345 } 02346 02347 /** 02348 * @brief Set Alarm B Mask the most-significant bits starting at this bit 02349 * @note This register can be written only when ALRBE is reset in RTC_CR register, 02350 * or in initialization mode. 02351 * @rmtoll ALRMBSSR MASKSS LL_RTC_ALMB_SetSubSecondMask 02352 * @param RTCx RTC Instance 02353 * @param Mask Value between Min_Data=0x00 and Max_Data=0xF 02354 * @retval None 02355 */ 02356 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask) 02357 { 02358 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS, Mask << RTC_ALRMBSSR_MASKSS_Pos); 02359 } 02360 02361 /** 02362 * @brief Get Alarm B Mask the most-significant bits starting at this bit 02363 * @rmtoll ALRMBSSR MASKSS LL_RTC_ALMB_GetSubSecondMask 02364 * @param RTCx RTC Instance 02365 * @retval Value between Min_Data=0x00 and Max_Data=0xF 02366 */ 02367 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecondMask(RTC_TypeDef *RTCx) 02368 { 02369 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS) >> RTC_ALRMBSSR_MASKSS_Pos); 02370 } 02371 02372 /** 02373 * @brief Set Alarm B Sub seconds value 02374 * @rmtoll ALRMBSSR SS LL_RTC_ALMB_SetSubSecond 02375 * @param RTCx RTC Instance 02376 * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF 02377 * @retval None 02378 */ 02379 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond) 02380 { 02381 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS, Subsecond); 02382 } 02383 02384 /** 02385 * @brief Get Alarm B Sub seconds value 02386 * @rmtoll ALRMBSSR SS LL_RTC_ALMB_GetSubSecond 02387 * @param RTCx RTC Instance 02388 * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF 02389 */ 02390 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecond(RTC_TypeDef *RTCx) 02391 { 02392 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS)); 02393 } 02394 02395 /** 02396 * @} 02397 */ 02398 02399 /** @defgroup RTC_LL_EF_Timestamp Timestamp 02400 * @{ 02401 */ 02402 02403 /** 02404 * @brief Enable Timestamp 02405 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02406 * @rmtoll CR TSE LL_RTC_TS_Enable 02407 * @param RTCx RTC Instance 02408 * @retval None 02409 */ 02410 __STATIC_INLINE void LL_RTC_TS_Enable(RTC_TypeDef *RTCx) 02411 { 02412 SET_BIT(RTCx->CR, RTC_CR_TSE); 02413 } 02414 02415 /** 02416 * @brief Disable Timestamp 02417 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02418 * @rmtoll CR TSE LL_RTC_TS_Disable 02419 * @param RTCx RTC Instance 02420 * @retval None 02421 */ 02422 __STATIC_INLINE void LL_RTC_TS_Disable(RTC_TypeDef *RTCx) 02423 { 02424 CLEAR_BIT(RTCx->CR, RTC_CR_TSE); 02425 } 02426 02427 /** 02428 * @brief Set Time-stamp event active edge 02429 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02430 * @note TSE must be reset when TSEDGE is changed to avoid unwanted TSF setting 02431 * @rmtoll CR TSEDGE LL_RTC_TS_SetActiveEdge 02432 * @param RTCx RTC Instance 02433 * @param Edge This parameter can be one of the following values: 02434 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING 02435 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING 02436 * @retval None 02437 */ 02438 __STATIC_INLINE void LL_RTC_TS_SetActiveEdge(RTC_TypeDef *RTCx, uint32_t Edge) 02439 { 02440 MODIFY_REG(RTCx->CR, RTC_CR_TSEDGE, Edge); 02441 } 02442 02443 /** 02444 * @brief Get Time-stamp event active edge 02445 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02446 * @rmtoll CR TSEDGE LL_RTC_TS_GetActiveEdge 02447 * @param RTCx RTC Instance 02448 * @retval Returned value can be one of the following values: 02449 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING 02450 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING 02451 */ 02452 __STATIC_INLINE uint32_t LL_RTC_TS_GetActiveEdge(RTC_TypeDef *RTCx) 02453 { 02454 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TSEDGE)); 02455 } 02456 02457 /** 02458 * @brief Get Timestamp AM/PM notation (AM or 24-hour format) 02459 * @rmtoll TSTR PM LL_RTC_TS_GetTimeFormat 02460 * @param RTCx RTC Instance 02461 * @retval Returned value can be one of the following values: 02462 * @arg @ref LL_RTC_TS_TIME_FORMAT_AM 02463 * @arg @ref LL_RTC_TS_TIME_FORMAT_PM 02464 */ 02465 __STATIC_INLINE uint32_t LL_RTC_TS_GetTimeFormat(RTC_TypeDef *RTCx) 02466 { 02467 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_PM)); 02468 } 02469 02470 /** 02471 * @brief Get Timestamp Hours in BCD format 02472 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format 02473 * @rmtoll TSTR HT LL_RTC_TS_GetHour\n 02474 * TSTR HU LL_RTC_TS_GetHour 02475 * @param RTCx RTC Instance 02476 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23 02477 */ 02478 __STATIC_INLINE uint32_t LL_RTC_TS_GetHour(RTC_TypeDef *RTCx) 02479 { 02480 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_HT | RTC_TSTR_HU) >> RTC_TSTR_HU_Pos); 02481 } 02482 02483 /** 02484 * @brief Get Timestamp Minutes in BCD format 02485 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format 02486 * @rmtoll TSTR MNT LL_RTC_TS_GetMinute\n 02487 * TSTR MNU LL_RTC_TS_GetMinute 02488 * @param RTCx RTC Instance 02489 * @retval Value between Min_Data=0x00 and Max_Data=0x59 02490 */ 02491 __STATIC_INLINE uint32_t LL_RTC_TS_GetMinute(RTC_TypeDef *RTCx) 02492 { 02493 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_MNT | RTC_TSTR_MNU) >> RTC_TSTR_MNU_Pos); 02494 } 02495 02496 /** 02497 * @brief Get Timestamp Seconds in BCD format 02498 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format 02499 * @rmtoll TSTR ST LL_RTC_TS_GetSecond\n 02500 * TSTR SU LL_RTC_TS_GetSecond 02501 * @param RTCx RTC Instance 02502 * @retval Value between Min_Data=0x00 and Max_Data=0x59 02503 */ 02504 __STATIC_INLINE uint32_t LL_RTC_TS_GetSecond(RTC_TypeDef *RTCx) 02505 { 02506 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_ST | RTC_TSTR_SU)); 02507 } 02508 02509 /** 02510 * @brief Get Timestamp time (hour, minute and second) in BCD format 02511 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND 02512 * are available to get independently each parameter. 02513 * @rmtoll TSTR HT LL_RTC_TS_GetTime\n 02514 * TSTR HU LL_RTC_TS_GetTime\n 02515 * TSTR MNT LL_RTC_TS_GetTime\n 02516 * TSTR MNU LL_RTC_TS_GetTime\n 02517 * TSTR ST LL_RTC_TS_GetTime\n 02518 * TSTR SU LL_RTC_TS_GetTime 02519 * @param RTCx RTC Instance 02520 * @retval Combination of hours, minutes and seconds. 02521 */ 02522 __STATIC_INLINE uint32_t LL_RTC_TS_GetTime(RTC_TypeDef *RTCx) 02523 { 02524 return (uint32_t)(READ_BIT(RTCx->TSTR, 02525 RTC_TSTR_HT | RTC_TSTR_HU | RTC_TSTR_MNT | RTC_TSTR_MNU | RTC_TSTR_ST | RTC_TSTR_SU)); 02526 } 02527 02528 /** 02529 * @brief Get Timestamp Week day 02530 * @rmtoll TSDR WDU LL_RTC_TS_GetWeekDay 02531 * @param RTCx RTC Instance 02532 * @retval Returned value can be one of the following values: 02533 * @arg @ref LL_RTC_WEEKDAY_MONDAY 02534 * @arg @ref LL_RTC_WEEKDAY_TUESDAY 02535 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY 02536 * @arg @ref LL_RTC_WEEKDAY_THURSDAY 02537 * @arg @ref LL_RTC_WEEKDAY_FRIDAY 02538 * @arg @ref LL_RTC_WEEKDAY_SATURDAY 02539 * @arg @ref LL_RTC_WEEKDAY_SUNDAY 02540 */ 02541 __STATIC_INLINE uint32_t LL_RTC_TS_GetWeekDay(RTC_TypeDef *RTCx) 02542 { 02543 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU) >> RTC_TSDR_WDU_Pos); 02544 } 02545 02546 /** 02547 * @brief Get Timestamp Month in BCD format 02548 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format 02549 * @rmtoll TSDR MT LL_RTC_TS_GetMonth\n 02550 * TSDR MU LL_RTC_TS_GetMonth 02551 * @param RTCx RTC Instance 02552 * @retval Returned value can be one of the following values: 02553 * @arg @ref LL_RTC_MONTH_JANUARY 02554 * @arg @ref LL_RTC_MONTH_FEBRUARY 02555 * @arg @ref LL_RTC_MONTH_MARCH 02556 * @arg @ref LL_RTC_MONTH_APRIL 02557 * @arg @ref LL_RTC_MONTH_MAY 02558 * @arg @ref LL_RTC_MONTH_JUNE 02559 * @arg @ref LL_RTC_MONTH_JULY 02560 * @arg @ref LL_RTC_MONTH_AUGUST 02561 * @arg @ref LL_RTC_MONTH_SEPTEMBER 02562 * @arg @ref LL_RTC_MONTH_OCTOBER 02563 * @arg @ref LL_RTC_MONTH_NOVEMBER 02564 * @arg @ref LL_RTC_MONTH_DECEMBER 02565 */ 02566 __STATIC_INLINE uint32_t LL_RTC_TS_GetMonth(RTC_TypeDef *RTCx) 02567 { 02568 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_MT | RTC_TSDR_MU) >> RTC_TSDR_MU_Pos); 02569 } 02570 02571 /** 02572 * @brief Get Timestamp Day in BCD format 02573 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format 02574 * @rmtoll TSDR DT LL_RTC_TS_GetDay\n 02575 * TSDR DU LL_RTC_TS_GetDay 02576 * @param RTCx RTC Instance 02577 * @retval Value between Min_Data=0x01 and Max_Data=0x31 02578 */ 02579 __STATIC_INLINE uint32_t LL_RTC_TS_GetDay(RTC_TypeDef *RTCx) 02580 { 02581 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_DT | RTC_TSDR_DU)); 02582 } 02583 02584 /** 02585 * @brief Get Timestamp date (WeekDay, Day and Month) in BCD format 02586 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_MONTH, 02587 * and __LL_RTC_GET_DAY are available to get independently each parameter. 02588 * @rmtoll TSDR WDU LL_RTC_TS_GetDate\n 02589 * TSDR MT LL_RTC_TS_GetDate\n 02590 * TSDR MU LL_RTC_TS_GetDate\n 02591 * TSDR DT LL_RTC_TS_GetDate\n 02592 * TSDR DU LL_RTC_TS_GetDate 02593 * @param RTCx RTC Instance 02594 * @retval Combination of Weekday, Day and Month 02595 */ 02596 __STATIC_INLINE uint32_t LL_RTC_TS_GetDate(RTC_TypeDef *RTCx) 02597 { 02598 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU | RTC_TSDR_MT | RTC_TSDR_MU | RTC_TSDR_DT | RTC_TSDR_DU)); 02599 } 02600 02601 /** 02602 * @brief Get time-stamp sub second value 02603 * @rmtoll TSSSR SS LL_RTC_TS_GetSubSecond 02604 * @param RTCx RTC Instance 02605 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF 02606 */ 02607 __STATIC_INLINE uint32_t LL_RTC_TS_GetSubSecond(RTC_TypeDef *RTCx) 02608 { 02609 return (uint32_t)(READ_BIT(RTCx->TSSSR, RTC_TSSSR_SS)); 02610 } 02611 02612 #if defined(RTC_TAFCR_TAMPTS) 02613 /** 02614 * @brief Activate timestamp on tamper detection event 02615 * @rmtoll TAFCR TAMPTS LL_RTC_TS_EnableOnTamper 02616 * @param RTCx RTC Instance 02617 * @retval None 02618 */ 02619 __STATIC_INLINE void LL_RTC_TS_EnableOnTamper(RTC_TypeDef *RTCx) 02620 { 02621 SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPTS); 02622 } 02623 02624 /** 02625 * @brief Disable timestamp on tamper detection event 02626 * @rmtoll TAFCR TAMPTS LL_RTC_TS_DisableOnTamper 02627 * @param RTCx RTC Instance 02628 * @retval None 02629 */ 02630 __STATIC_INLINE void LL_RTC_TS_DisableOnTamper(RTC_TypeDef *RTCx) 02631 { 02632 CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPTS); 02633 } 02634 #endif /* RTC_TAFCR_TAMPTS */ 02635 02636 /** 02637 * @brief Set timestamp Pin 02638 * @rmtoll TAFCR TSINSEL LL_RTC_TS_SetPin 02639 * @param RTCx RTC Instance 02640 * @param TSPin specifies the RTC TimeStamp Pin. 02641 * This parameter can be one of the following values: 02642 * @arg LL_RTC_TimeStampPin_Default: RTC_AF1 is used as RTC TimeStamp. 02643 * @arg LL_RTC_TimeStampPin_Pos1: RTC_AF2 is selected as RTC TimeStamp. (*) 02644 * 02645 * (*) value not defined in all devices. 02646 * @retval None 02647 */ 02648 __STATIC_INLINE void LL_RTC_TS_SetPin(RTC_TypeDef *RTCx, uint32_t TSPin) 02649 { 02650 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TSINSEL , TSPin); 02651 } 02652 02653 /** 02654 * @brief Get timestamp Pin 02655 * @rmtoll TAFCR TSINSEL LL_RTC_TS_GetPin 02656 * @param RTCx RTC Instance 02657 * @retval Returned value can be one of the following values: 02658 * @arg LL_RTC_TimeStampPin_Default: RTC_AF1 is used as RTC TimeStamp Pin. 02659 * @arg LL_RTC_TimeStampPin_Pos1: RTC_AF2 is selected as RTC TimeStamp Pin. (*) 02660 * 02661 * (*) value not defined in all devices. 02662 * @retval None 02663 */ 02664 02665 __STATIC_INLINE uint32_t LL_RTC_TS_GetPin(RTC_TypeDef *RTCx) 02666 { 02667 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TSINSEL)); 02668 } 02669 02670 /** 02671 * @} 02672 */ 02673 02674 /** @defgroup RTC_LL_EF_Tamper Tamper 02675 * @{ 02676 */ 02677 02678 /** 02679 * @brief Enable RTC_TAMPx input detection 02680 * @rmtoll TAFCR TAMP1E LL_RTC_TAMPER_Enable\n 02681 * TAFCR TAMP2E LL_RTC_TAMPER_Enable\n 02682 * @param RTCx RTC Instance 02683 * @param Tamper This parameter can be a combination of the following values: 02684 * @arg @ref LL_RTC_TAMPER_1 02685 * @arg @ref LL_RTC_TAMPER_2 (*) 02686 * 02687 * (*) value not defined in all devices. 02688 * @retval None 02689 */ 02690 __STATIC_INLINE void LL_RTC_TAMPER_Enable(RTC_TypeDef *RTCx, uint32_t Tamper) 02691 { 02692 SET_BIT(RTCx->TAFCR, Tamper); 02693 } 02694 02695 /** 02696 * @brief Clear RTC_TAMPx input detection 02697 * @rmtoll TAFCR TAMP1E LL_RTC_TAMPER_Disable\n 02698 * TAFCR TAMP2E LL_RTC_TAMPER_Disable\n 02699 * @param RTCx RTC Instance 02700 * @param Tamper This parameter can be a combination of the following values: 02701 * @arg @ref LL_RTC_TAMPER_1 02702 * @arg @ref LL_RTC_TAMPER_2 (*) 02703 * 02704 * (*) value not defined in all devices. 02705 * @retval None 02706 */ 02707 __STATIC_INLINE void LL_RTC_TAMPER_Disable(RTC_TypeDef *RTCx, uint32_t Tamper) 02708 { 02709 CLEAR_BIT(RTCx->TAFCR, Tamper); 02710 } 02711 02712 #if defined(RTC_TAFCR_TAMPPUDIS) 02713 /** 02714 * @brief Disable RTC_TAMPx pull-up disable (Disable precharge of RTC_TAMPx pins) 02715 * @rmtoll TAFCR TAMPPUDIS LL_RTC_TAMPER_DisablePullUp 02716 * @param RTCx RTC Instance 02717 * @retval None 02718 */ 02719 __STATIC_INLINE void LL_RTC_TAMPER_DisablePullUp(RTC_TypeDef *RTCx) 02720 { 02721 SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPUDIS); 02722 } 02723 02724 /** 02725 * @brief Enable RTC_TAMPx pull-up disable ( Precharge RTC_TAMPx pins before sampling) 02726 * @rmtoll TAFCR TAMPPUDIS LL_RTC_TAMPER_EnablePullUp 02727 * @param RTCx RTC Instance 02728 * @retval None 02729 */ 02730 __STATIC_INLINE void LL_RTC_TAMPER_EnablePullUp(RTC_TypeDef *RTCx) 02731 { 02732 CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPUDIS); 02733 } 02734 #endif /* RTC_TAFCR_TAMPPUDIS */ 02735 02736 #if defined(RTC_TAFCR_TAMPPRCH) 02737 /** 02738 * @brief Set RTC_TAMPx precharge duration 02739 * @rmtoll TAFCR TAMPPRCH LL_RTC_TAMPER_SetPrecharge 02740 * @param RTCx RTC Instance 02741 * @param Duration This parameter can be one of the following values: 02742 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK 02743 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK 02744 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK 02745 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK 02746 * @retval None 02747 */ 02748 __STATIC_INLINE void LL_RTC_TAMPER_SetPrecharge(RTC_TypeDef *RTCx, uint32_t Duration) 02749 { 02750 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPPRCH, Duration); 02751 } 02752 02753 /** 02754 * @brief Get RTC_TAMPx precharge duration 02755 * @rmtoll TAFCR TAMPPRCH LL_RTC_TAMPER_GetPrecharge 02756 * @param RTCx RTC Instance 02757 * @retval Returned value can be one of the following values: 02758 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK 02759 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK 02760 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK 02761 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK 02762 */ 02763 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPrecharge(RTC_TypeDef *RTCx) 02764 { 02765 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPRCH)); 02766 } 02767 #endif /* RTC_TAFCR_TAMPPRCH */ 02768 02769 #if defined(RTC_TAFCR_TAMPFLT) 02770 /** 02771 * @brief Set RTC_TAMPx filter count 02772 * @rmtoll TAFCR TAMPFLT LL_RTC_TAMPER_SetFilterCount 02773 * @param RTCx RTC Instance 02774 * @param FilterCount This parameter can be one of the following values: 02775 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE 02776 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE 02777 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE 02778 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE 02779 * @retval None 02780 */ 02781 __STATIC_INLINE void LL_RTC_TAMPER_SetFilterCount(RTC_TypeDef *RTCx, uint32_t FilterCount) 02782 { 02783 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPFLT, FilterCount); 02784 } 02785 02786 /** 02787 * @brief Get RTC_TAMPx filter count 02788 * @rmtoll TAFCR TAMPFLT LL_RTC_TAMPER_GetFilterCount 02789 * @param RTCx RTC Instance 02790 * @retval Returned value can be one of the following values: 02791 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE 02792 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE 02793 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE 02794 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE 02795 */ 02796 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetFilterCount(RTC_TypeDef *RTCx) 02797 { 02798 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPFLT)); 02799 } 02800 #endif /* RTC_TAFCR_TAMPFLT */ 02801 02802 #if defined(RTC_TAFCR_TAMPFREQ) 02803 /** 02804 * @brief Set Tamper sampling frequency 02805 * @rmtoll TAFCR TAMPFREQ LL_RTC_TAMPER_SetSamplingFreq 02806 * @param RTCx RTC Instance 02807 * @param SamplingFreq This parameter can be one of the following values: 02808 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768 02809 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384 02810 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192 02811 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096 02812 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048 02813 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024 02814 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512 02815 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256 02816 * @retval None 02817 */ 02818 __STATIC_INLINE void LL_RTC_TAMPER_SetSamplingFreq(RTC_TypeDef *RTCx, uint32_t SamplingFreq) 02819 { 02820 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPFREQ, SamplingFreq); 02821 } 02822 02823 /** 02824 * @brief Get Tamper sampling frequency 02825 * @rmtoll TAFCR TAMPFREQ LL_RTC_TAMPER_GetSamplingFreq 02826 * @param RTCx RTC Instance 02827 * @retval Returned value can be one of the following values: 02828 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768 02829 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384 02830 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192 02831 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096 02832 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048 02833 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024 02834 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512 02835 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256 02836 */ 02837 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetSamplingFreq(RTC_TypeDef *RTCx) 02838 { 02839 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPFREQ)); 02840 } 02841 #endif /* RTC_TAFCR_TAMPFREQ */ 02842 02843 /** 02844 * @brief Enable Active level for Tamper input 02845 * @rmtoll TAFCR TAMP1TRG LL_RTC_TAMPER_EnableActiveLevel\n 02846 * TAFCR TAMP2TRG LL_RTC_TAMPER_EnableActiveLevel\n 02847 * @param RTCx RTC Instance 02848 * @param Tamper This parameter can be a combination of the following values: 02849 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 02850 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 (*) 02851 * 02852 * (*) value not defined in all devices. 02853 * @retval None 02854 */ 02855 __STATIC_INLINE void LL_RTC_TAMPER_EnableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper) 02856 { 02857 SET_BIT(RTCx->TAFCR, Tamper); 02858 } 02859 02860 /** 02861 * @brief Disable Active level for Tamper input 02862 * @rmtoll TAFCR TAMP1TRG LL_RTC_TAMPER_DisableActiveLevel\n 02863 * TAFCR TAMP2TRG LL_RTC_TAMPER_DisableActiveLevel\n 02864 * @param RTCx RTC Instance 02865 * @param Tamper This parameter can be a combination of the following values: 02866 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 02867 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 (*) 02868 * 02869 * (*) value not defined in all devices. 02870 * @retval None 02871 */ 02872 __STATIC_INLINE void LL_RTC_TAMPER_DisableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper) 02873 { 02874 CLEAR_BIT(RTCx->TAFCR, Tamper); 02875 } 02876 02877 /** 02878 * @brief Set Tamper Pin 02879 * @rmtoll TAFCR TAMP1INSEL LL_RTC_TAMPER_SetPin 02880 * @param RTCx RTC Instance 02881 * @param TamperPin specifies the RTC Tamper Pin. 02882 * This parameter can be one of the following values: 02883 * @arg LL_RTC_TamperPin_Default: RTC_AF1 is used as RTC Tamper. 02884 * @arg LL_RTC_TamperPin_Pos1: RTC_AF2 is selected as RTC Tamper. (*) 02885 * 02886 * (*) value not defined in all devices. 02887 * @retval None 02888 */ 02889 __STATIC_INLINE void LL_RTC_TAMPER_SetPin(RTC_TypeDef *RTCx, uint32_t TamperPin) 02890 { 02891 MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMP1INSEL , TamperPin); 02892 } 02893 02894 /** 02895 * @brief Get Tamper Pin 02896 * @rmtoll TAFCR TAMP1INSEL LL_RTC_TAMPER_GetPin 02897 * @param RTCx RTC Instance 02898 * @retval Returned value can be one of the following values: 02899 * @arg LL_RTC_TamperPin_Default: RTC_AF1 is used as RTC Tamper Pin. 02900 * @arg LL_RTC_TamperPin_Pos1: RTC_AF2 is selected as RTC Tamper Pin. (*) 02901 * 02902 * (*) value not defined in all devices. 02903 * @retval None 02904 */ 02905 02906 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPin(RTC_TypeDef *RTCx) 02907 { 02908 return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMP1INSEL)); 02909 } 02910 02911 /** 02912 * @} 02913 */ 02914 02915 /** @defgroup RTC_LL_EF_Wakeup Wakeup 02916 * @{ 02917 */ 02918 02919 /** 02920 * @brief Enable Wakeup timer 02921 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02922 * @rmtoll CR WUTE LL_RTC_WAKEUP_Enable 02923 * @param RTCx RTC Instance 02924 * @retval None 02925 */ 02926 __STATIC_INLINE void LL_RTC_WAKEUP_Enable(RTC_TypeDef *RTCx) 02927 { 02928 SET_BIT(RTCx->CR, RTC_CR_WUTE); 02929 } 02930 02931 /** 02932 * @brief Disable Wakeup timer 02933 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02934 * @rmtoll CR WUTE LL_RTC_WAKEUP_Disable 02935 * @param RTCx RTC Instance 02936 * @retval None 02937 */ 02938 __STATIC_INLINE void LL_RTC_WAKEUP_Disable(RTC_TypeDef *RTCx) 02939 { 02940 CLEAR_BIT(RTCx->CR, RTC_CR_WUTE); 02941 } 02942 02943 /** 02944 * @brief Check if Wakeup timer is enabled or not 02945 * @rmtoll CR WUTE LL_RTC_WAKEUP_IsEnabled 02946 * @param RTCx RTC Instance 02947 * @retval State of bit (1 or 0). 02948 */ 02949 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_IsEnabled(RTC_TypeDef *RTCx) 02950 { 02951 return (READ_BIT(RTCx->CR, RTC_CR_WUTE) == (RTC_CR_WUTE)); 02952 } 02953 02954 /** 02955 * @brief Select Wakeup clock 02956 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 02957 * @note Bit can be written only when RTC_CR WUTE bit = 0 and RTC_ISR WUTWF bit = 1 02958 * @rmtoll CR WUCKSEL LL_RTC_WAKEUP_SetClock 02959 * @param RTCx RTC Instance 02960 * @param WakeupClock This parameter can be one of the following values: 02961 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16 02962 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8 02963 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4 02964 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2 02965 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE 02966 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT 02967 * @retval None 02968 */ 02969 __STATIC_INLINE void LL_RTC_WAKEUP_SetClock(RTC_TypeDef *RTCx, uint32_t WakeupClock) 02970 { 02971 MODIFY_REG(RTCx->CR, RTC_CR_WUCKSEL, WakeupClock); 02972 } 02973 02974 /** 02975 * @brief Get Wakeup clock 02976 * @rmtoll CR WUCKSEL LL_RTC_WAKEUP_GetClock 02977 * @param RTCx RTC Instance 02978 * @retval Returned value can be one of the following values: 02979 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16 02980 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8 02981 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4 02982 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2 02983 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE 02984 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT 02985 */ 02986 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetClock(RTC_TypeDef *RTCx) 02987 { 02988 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_WUCKSEL)); 02989 } 02990 02991 /** 02992 * @brief Set Wakeup auto-reload value 02993 * @note Bit can be written only when WUTWF is set to 1 in RTC_ISR 02994 * @rmtoll WUTR WUT LL_RTC_WAKEUP_SetAutoReload 02995 * @param RTCx RTC Instance 02996 * @param Value Value between Min_Data=0x00 and Max_Data=0xFFFF 02997 * @retval None 02998 */ 02999 __STATIC_INLINE void LL_RTC_WAKEUP_SetAutoReload(RTC_TypeDef *RTCx, uint32_t Value) 03000 { 03001 MODIFY_REG(RTCx->WUTR, RTC_WUTR_WUT, Value); 03002 } 03003 03004 /** 03005 * @brief Get Wakeup auto-reload value 03006 * @rmtoll WUTR WUT LL_RTC_WAKEUP_GetAutoReload 03007 * @param RTCx RTC Instance 03008 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF 03009 */ 03010 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetAutoReload(RTC_TypeDef *RTCx) 03011 { 03012 return (uint32_t)(READ_BIT(RTCx->WUTR, RTC_WUTR_WUT)); 03013 } 03014 03015 /** 03016 * @} 03017 */ 03018 03019 /** @defgroup RTC_LL_EF_Backup_Registers Backup_Registers 03020 * @{ 03021 */ 03022 03023 /** 03024 * @brief Writes a data in a specified RTC Backup data register. 03025 * @rmtoll BKPxR BKP LL_RTC_BAK_SetRegister 03026 * @param RTCx RTC Instance 03027 * @param BackupRegister This parameter can be one of the following values: 03028 * @arg @ref LL_RTC_BKP_DR0 03029 * @arg @ref LL_RTC_BKP_DR1 03030 * @arg @ref LL_RTC_BKP_DR2 03031 * @arg @ref LL_RTC_BKP_DR3 03032 * @arg @ref LL_RTC_BKP_DR4 03033 * @arg @ref LL_RTC_BKP_DR5 03034 * @arg @ref LL_RTC_BKP_DR6 03035 * @arg @ref LL_RTC_BKP_DR7 03036 * @arg @ref LL_RTC_BKP_DR8 03037 * @arg @ref LL_RTC_BKP_DR9 03038 * @arg @ref LL_RTC_BKP_DR10 03039 * @arg @ref LL_RTC_BKP_DR11 03040 * @arg @ref LL_RTC_BKP_DR12 03041 * @arg @ref LL_RTC_BKP_DR13 03042 * @arg @ref LL_RTC_BKP_DR14 03043 * @arg @ref LL_RTC_BKP_DR15 03044 * @arg @ref LL_RTC_BKP_DR16 03045 * @arg @ref LL_RTC_BKP_DR17 03046 * @arg @ref LL_RTC_BKP_DR18 03047 * @arg @ref LL_RTC_BKP_DR19 03048 * @param Data Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF 03049 * @retval None 03050 */ 03051 __STATIC_INLINE void LL_RTC_BAK_SetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister, uint32_t Data) 03052 { 03053 register uint32_t tmp = 0U; 03054 03055 tmp = (uint32_t)(&(RTCx->BKP0R)); 03056 tmp += (BackupRegister * 4U); 03057 03058 /* Write the specified register */ 03059 *(__IO uint32_t *)tmp = (uint32_t)Data; 03060 } 03061 03062 /** 03063 * @brief Reads data from the specified RTC Backup data Register. 03064 * @rmtoll BKPxR BKP LL_RTC_BAK_GetRegister 03065 * @param RTCx RTC Instance 03066 * @param BackupRegister This parameter can be one of the following values: 03067 * @arg @ref LL_RTC_BKP_DR0 03068 * @arg @ref LL_RTC_BKP_DR1 03069 * @arg @ref LL_RTC_BKP_DR2 03070 * @arg @ref LL_RTC_BKP_DR3 03071 * @arg @ref LL_RTC_BKP_DR4 03072 * @arg @ref LL_RTC_BKP_DR5 03073 * @arg @ref LL_RTC_BKP_DR6 03074 * @arg @ref LL_RTC_BKP_DR7 03075 * @arg @ref LL_RTC_BKP_DR8 03076 * @arg @ref LL_RTC_BKP_DR9 03077 * @arg @ref LL_RTC_BKP_DR10 03078 * @arg @ref LL_RTC_BKP_DR11 03079 * @arg @ref LL_RTC_BKP_DR12 03080 * @arg @ref LL_RTC_BKP_DR13 03081 * @arg @ref LL_RTC_BKP_DR14 03082 * @arg @ref LL_RTC_BKP_DR15 03083 * @arg @ref LL_RTC_BKP_DR16 03084 * @arg @ref LL_RTC_BKP_DR17 03085 * @arg @ref LL_RTC_BKP_DR18 03086 * @arg @ref LL_RTC_BKP_DR19 03087 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF 03088 */ 03089 __STATIC_INLINE uint32_t LL_RTC_BAK_GetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister) 03090 { 03091 register uint32_t tmp = 0U; 03092 03093 tmp = (uint32_t)(&(RTCx->BKP0R)); 03094 tmp += (BackupRegister * 4U); 03095 03096 /* Read the specified register */ 03097 return (*(__IO uint32_t *)tmp); 03098 } 03099 03100 /** 03101 * @} 03102 */ 03103 03104 /** @defgroup RTC_LL_EF_Calibration Calibration 03105 * @{ 03106 */ 03107 03108 /** 03109 * @brief Set Calibration output frequency (1 Hz or 512 Hz) 03110 * @note Bits are write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03111 * @rmtoll CR COE LL_RTC_CAL_SetOutputFreq\n 03112 * CR COSEL LL_RTC_CAL_SetOutputFreq 03113 * @param RTCx RTC Instance 03114 * @param Frequency This parameter can be one of the following values: 03115 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE 03116 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ 03117 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ 03118 * @retval None 03119 */ 03120 __STATIC_INLINE void LL_RTC_CAL_SetOutputFreq(RTC_TypeDef *RTCx, uint32_t Frequency) 03121 { 03122 MODIFY_REG(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL, Frequency); 03123 } 03124 03125 /** 03126 * @brief Get Calibration output frequency (1 Hz or 512 Hz) 03127 * @rmtoll CR COE LL_RTC_CAL_GetOutputFreq\n 03128 * CR COSEL LL_RTC_CAL_GetOutputFreq 03129 * @param RTCx RTC Instance 03130 * @retval Returned value can be one of the following values: 03131 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE 03132 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ 03133 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ 03134 */ 03135 __STATIC_INLINE uint32_t LL_RTC_CAL_GetOutputFreq(RTC_TypeDef *RTCx) 03136 { 03137 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL)); 03138 } 03139 03140 /** 03141 * @brief Enable Coarse digital calibration 03142 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03143 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 03144 * @rmtoll CR DCE LL_RTC_CAL_EnableCoarseDigital 03145 * @param RTCx RTC Instance 03146 * @retval None 03147 */ 03148 __STATIC_INLINE void LL_RTC_CAL_EnableCoarseDigital(RTC_TypeDef *RTCx) 03149 { 03150 SET_BIT(RTCx->CR, RTC_CR_DCE); 03151 } 03152 03153 /** 03154 * @brief Disable Coarse digital calibration 03155 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03156 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 03157 * @rmtoll CR DCE LL_RTC_CAL_DisableCoarseDigital 03158 * @param RTCx RTC Instance 03159 * @retval None 03160 */ 03161 __STATIC_INLINE void LL_RTC_CAL_DisableCoarseDigital(RTC_TypeDef *RTCx) 03162 { 03163 CLEAR_BIT(RTCx->CR, RTC_CR_DCE); 03164 } 03165 03166 /** 03167 * @brief Set the coarse digital calibration 03168 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03169 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function) 03170 * @rmtoll CALIBR DCS LL_RTC_CAL_ConfigCoarseDigital\n 03171 * CALIBR DC LL_RTC_CAL_ConfigCoarseDigital 03172 * @param RTCx RTC Instance 03173 * @param Sign This parameter can be one of the following values: 03174 * @arg @ref LL_RTC_CALIB_SIGN_POSITIVE 03175 * @arg @ref LL_RTC_CALIB_SIGN_NEGATIVE 03176 * @param Value value of coarse calibration expressed in ppm (coded on 5 bits) 03177 * @note This Calibration value should be between 0 and 63 when using negative sign with a 2-ppm step. 03178 * @note This Calibration value should be between 0 and 126 when using positive sign with a 4-ppm step. 03179 * @retval None 03180 */ 03181 __STATIC_INLINE void LL_RTC_CAL_ConfigCoarseDigital(RTC_TypeDef* RTCx, uint32_t Sign, uint32_t Value) 03182 { 03183 MODIFY_REG(RTCx->CALIBR, RTC_CALIBR_DCS | RTC_CALIBR_DC, Sign | Value); 03184 } 03185 03186 /** 03187 * @brief Get the coarse digital calibration value 03188 * @rmtoll CALIBR DC LL_RTC_CAL_GetCoarseDigitalValue 03189 * @param RTCx RTC Instance 03190 * @retval value of coarse calibration expressed in ppm (coded on 5 bits) 03191 */ 03192 __STATIC_INLINE uint32_t LL_RTC_CAL_GetCoarseDigitalValue(RTC_TypeDef *RTCx) 03193 { 03194 return (uint32_t)(READ_BIT(RTCx->CALIBR, RTC_CALIBR_DC)); 03195 } 03196 03197 /** 03198 * @brief Get the coarse digital calibration sign 03199 * @rmtoll CALIBR DCS LL_RTC_CAL_GetCoarseDigitalSign 03200 * @param RTCx RTC Instance 03201 * @retval Returned value can be one of the following values: 03202 * @arg @ref LL_RTC_CALIB_SIGN_POSITIVE 03203 * @arg @ref LL_RTC_CALIB_SIGN_NEGATIVE 03204 */ 03205 __STATIC_INLINE uint32_t LL_RTC_CAL_GetCoarseDigitalSign(RTC_TypeDef* RTCx) 03206 { 03207 return (uint32_t)(READ_BIT(RTCx->CALIBR, RTC_CALIBR_DCS)); 03208 } 03209 03210 /** 03211 * @brief Insert or not One RTCCLK pulse every 2exp11 pulses (frequency increased by 488.5 ppm) 03212 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03213 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR 03214 * @rmtoll CALR CALP LL_RTC_CAL_SetPulse 03215 * @param RTCx RTC Instance 03216 * @param Pulse This parameter can be one of the following values: 03217 * @arg @ref LL_RTC_CALIB_INSERTPULSE_NONE 03218 * @arg @ref LL_RTC_CALIB_INSERTPULSE_SET 03219 * @retval None 03220 */ 03221 __STATIC_INLINE void LL_RTC_CAL_SetPulse(RTC_TypeDef *RTCx, uint32_t Pulse) 03222 { 03223 MODIFY_REG(RTCx->CALR, RTC_CALR_CALP, Pulse); 03224 } 03225 03226 /** 03227 * @brief Check if one RTCCLK has been inserted or not every 2exp11 pulses (frequency increased by 488.5 ppm) 03228 * @rmtoll CALR CALP LL_RTC_CAL_IsPulseInserted 03229 * @param RTCx RTC Instance 03230 * @retval State of bit (1 or 0). 03231 */ 03232 __STATIC_INLINE uint32_t LL_RTC_CAL_IsPulseInserted(RTC_TypeDef *RTCx) 03233 { 03234 return (READ_BIT(RTCx->CALR, RTC_CALR_CALP) == (RTC_CALR_CALP)); 03235 } 03236 03237 /** 03238 * @brief Set the calibration cycle period 03239 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03240 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR 03241 * @rmtoll CALR CALW8 LL_RTC_CAL_SetPeriod\n 03242 * CALR CALW16 LL_RTC_CAL_SetPeriod 03243 * @param RTCx RTC Instance 03244 * @param Period This parameter can be one of the following values: 03245 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC 03246 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC 03247 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC 03248 * @retval None 03249 */ 03250 __STATIC_INLINE void LL_RTC_CAL_SetPeriod(RTC_TypeDef *RTCx, uint32_t Period) 03251 { 03252 MODIFY_REG(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16, Period); 03253 } 03254 03255 /** 03256 * @brief Get the calibration cycle period 03257 * @rmtoll CALR CALW8 LL_RTC_CAL_GetPeriod\n 03258 * CALR CALW16 LL_RTC_CAL_GetPeriod 03259 * @param RTCx RTC Instance 03260 * @retval Returned value can be one of the following values: 03261 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC 03262 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC 03263 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC 03264 */ 03265 __STATIC_INLINE uint32_t LL_RTC_CAL_GetPeriod(RTC_TypeDef *RTCx) 03266 { 03267 return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16)); 03268 } 03269 03270 /** 03271 * @brief Set Calibration minus 03272 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03273 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR 03274 * @rmtoll CALR CALM LL_RTC_CAL_SetMinus 03275 * @param RTCx RTC Instance 03276 * @param CalibMinus Value between Min_Data=0x00 and Max_Data=0x1FF 03277 * @retval None 03278 */ 03279 __STATIC_INLINE void LL_RTC_CAL_SetMinus(RTC_TypeDef *RTCx, uint32_t CalibMinus) 03280 { 03281 MODIFY_REG(RTCx->CALR, RTC_CALR_CALM, CalibMinus); 03282 } 03283 03284 /** 03285 * @brief Get Calibration minus 03286 * @rmtoll CALR CALM LL_RTC_CAL_GetMinus 03287 * @param RTCx RTC Instance 03288 * @retval Value between Min_Data=0x00 and Max_Data= 0x1FF 03289 */ 03290 __STATIC_INLINE uint32_t LL_RTC_CAL_GetMinus(RTC_TypeDef *RTCx) 03291 { 03292 return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALM)); 03293 } 03294 03295 /** 03296 * @} 03297 */ 03298 03299 /** @defgroup RTC_LL_EF_FLAG_Management FLAG_Management 03300 * @{ 03301 */ 03302 03303 /** 03304 * @brief Get Recalibration pending Flag 03305 * @rmtoll ISR RECALPF LL_RTC_IsActiveFlag_RECALP 03306 * @param RTCx RTC Instance 03307 * @retval State of bit (1 or 0). 03308 */ 03309 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RECALP(RTC_TypeDef *RTCx) 03310 { 03311 return (READ_BIT(RTCx->ISR, RTC_ISR_RECALPF) == (RTC_ISR_RECALPF)); 03312 } 03313 03314 03315 #if defined(RTC_TAMPER2_SUPPORT) 03316 /** 03317 * @brief Get RTC_TAMP2 detection flag 03318 * @rmtoll ISR TAMP2F LL_RTC_IsActiveFlag_TAMP2 03319 * @param RTCx RTC Instance 03320 * @retval State of bit (1 or 0). 03321 */ 03322 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2(RTC_TypeDef *RTCx) 03323 { 03324 return (READ_BIT(RTCx->ISR, RTC_ISR_TAMP2F) == (RTC_ISR_TAMP2F)); 03325 } 03326 #endif /* RTC_TAMPER2_SUPPORT */ 03327 03328 /** 03329 * @brief Get RTC_TAMP1 detection flag 03330 * @rmtoll ISR TAMP1F LL_RTC_IsActiveFlag_TAMP1 03331 * @param RTCx RTC Instance 03332 * @retval State of bit (1 or 0). 03333 */ 03334 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1(RTC_TypeDef *RTCx) 03335 { 03336 return (READ_BIT(RTCx->ISR, RTC_ISR_TAMP1F) == (RTC_ISR_TAMP1F)); 03337 } 03338 03339 /** 03340 * @brief Get Time-stamp overflow flag 03341 * @rmtoll ISR TSOVF LL_RTC_IsActiveFlag_TSOV 03342 * @param RTCx RTC Instance 03343 * @retval State of bit (1 or 0). 03344 */ 03345 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOV(RTC_TypeDef *RTCx) 03346 { 03347 return (READ_BIT(RTCx->ISR, RTC_ISR_TSOVF) == (RTC_ISR_TSOVF)); 03348 } 03349 03350 /** 03351 * @brief Get Time-stamp flag 03352 * @rmtoll ISR TSF LL_RTC_IsActiveFlag_TS 03353 * @param RTCx RTC Instance 03354 * @retval State of bit (1 or 0). 03355 */ 03356 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TS(RTC_TypeDef *RTCx) 03357 { 03358 return (READ_BIT(RTCx->ISR, RTC_ISR_TSF) == (RTC_ISR_TSF)); 03359 } 03360 03361 /** 03362 * @brief Get Wakeup timer flag 03363 * @rmtoll ISR WUTF LL_RTC_IsActiveFlag_WUT 03364 * @param RTCx RTC Instance 03365 * @retval State of bit (1 or 0). 03366 */ 03367 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUT(RTC_TypeDef *RTCx) 03368 { 03369 return (READ_BIT(RTCx->ISR, RTC_ISR_WUTF) == (RTC_ISR_WUTF)); 03370 } 03371 03372 /** 03373 * @brief Get Alarm B flag 03374 * @rmtoll ISR ALRBF LL_RTC_IsActiveFlag_ALRB 03375 * @param RTCx RTC Instance 03376 * @retval State of bit (1 or 0). 03377 */ 03378 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRB(RTC_TypeDef *RTCx) 03379 { 03380 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRBF) == (RTC_ISR_ALRBF)); 03381 } 03382 03383 /** 03384 * @brief Get Alarm A flag 03385 * @rmtoll ISR ALRAF LL_RTC_IsActiveFlag_ALRA 03386 * @param RTCx RTC Instance 03387 * @retval State of bit (1 or 0). 03388 */ 03389 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRA(RTC_TypeDef *RTCx) 03390 { 03391 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRAF) == (RTC_ISR_ALRAF)); 03392 } 03393 03394 03395 #if defined(RTC_TAMPER2_SUPPORT) 03396 /** 03397 * @brief Clear RTC_TAMP2 detection flag 03398 * @rmtoll ISR TAMP2F LL_RTC_ClearFlag_TAMP2 03399 * @param RTCx RTC Instance 03400 * @retval None 03401 */ 03402 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP2(RTC_TypeDef *RTCx) 03403 { 03404 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP2F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 03405 } 03406 #endif /* RTC_TAMPER2_SUPPORT */ 03407 03408 /** 03409 * @brief Clear RTC_TAMP1 detection flag 03410 * @rmtoll ISR TAMP1F LL_RTC_ClearFlag_TAMP1 03411 * @param RTCx RTC Instance 03412 * @retval None 03413 */ 03414 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP1(RTC_TypeDef *RTCx) 03415 { 03416 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP1F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 03417 } 03418 03419 /** 03420 * @brief Clear Time-stamp overflow flag 03421 * @rmtoll ISR TSOVF LL_RTC_ClearFlag_TSOV 03422 * @param RTCx RTC Instance 03423 * @retval None 03424 */ 03425 __STATIC_INLINE void LL_RTC_ClearFlag_TSOV(RTC_TypeDef *RTCx) 03426 { 03427 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSOVF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 03428 } 03429 03430 /** 03431 * @brief Clear Time-stamp flag 03432 * @rmtoll ISR TSF LL_RTC_ClearFlag_TS 03433 * @param RTCx RTC Instance 03434 * @retval None 03435 */ 03436 __STATIC_INLINE void LL_RTC_ClearFlag_TS(RTC_TypeDef *RTCx) 03437 { 03438 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 03439 } 03440 03441 /** 03442 * @brief Clear Wakeup timer flag 03443 * @rmtoll ISR WUTF LL_RTC_ClearFlag_WUT 03444 * @param RTCx RTC Instance 03445 * @retval None 03446 */ 03447 __STATIC_INLINE void LL_RTC_ClearFlag_WUT(RTC_TypeDef *RTCx) 03448 { 03449 WRITE_REG(RTCx->ISR, (~((RTC_ISR_WUTF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 03450 } 03451 03452 /** 03453 * @brief Clear Alarm B flag 03454 * @rmtoll ISR ALRBF LL_RTC_ClearFlag_ALRB 03455 * @param RTCx RTC Instance 03456 * @retval None 03457 */ 03458 __STATIC_INLINE void LL_RTC_ClearFlag_ALRB(RTC_TypeDef *RTCx) 03459 { 03460 WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRBF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 03461 } 03462 03463 /** 03464 * @brief Clear Alarm A flag 03465 * @rmtoll ISR ALRAF LL_RTC_ClearFlag_ALRA 03466 * @param RTCx RTC Instance 03467 * @retval None 03468 */ 03469 __STATIC_INLINE void LL_RTC_ClearFlag_ALRA(RTC_TypeDef *RTCx) 03470 { 03471 WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRAF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 03472 } 03473 03474 /** 03475 * @brief Get Initialization flag 03476 * @rmtoll ISR INITF LL_RTC_IsActiveFlag_INIT 03477 * @param RTCx RTC Instance 03478 * @retval State of bit (1 or 0). 03479 */ 03480 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INIT(RTC_TypeDef *RTCx) 03481 { 03482 return (READ_BIT(RTCx->ISR, RTC_ISR_INITF) == (RTC_ISR_INITF)); 03483 } 03484 03485 /** 03486 * @brief Get Registers synchronization flag 03487 * @rmtoll ISR RSF LL_RTC_IsActiveFlag_RS 03488 * @param RTCx RTC Instance 03489 * @retval State of bit (1 or 0). 03490 */ 03491 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RS(RTC_TypeDef *RTCx) 03492 { 03493 return (READ_BIT(RTCx->ISR, RTC_ISR_RSF) == (RTC_ISR_RSF)); 03494 } 03495 03496 /** 03497 * @brief Clear Registers synchronization flag 03498 * @rmtoll ISR RSF LL_RTC_ClearFlag_RS 03499 * @param RTCx RTC Instance 03500 * @retval None 03501 */ 03502 __STATIC_INLINE void LL_RTC_ClearFlag_RS(RTC_TypeDef *RTCx) 03503 { 03504 WRITE_REG(RTCx->ISR, (~((RTC_ISR_RSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT))); 03505 } 03506 03507 /** 03508 * @brief Get Initialization status flag 03509 * @rmtoll ISR INITS LL_RTC_IsActiveFlag_INITS 03510 * @param RTCx RTC Instance 03511 * @retval State of bit (1 or 0). 03512 */ 03513 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INITS(RTC_TypeDef *RTCx) 03514 { 03515 return (READ_BIT(RTCx->ISR, RTC_ISR_INITS) == (RTC_ISR_INITS)); 03516 } 03517 03518 /** 03519 * @brief Get Shift operation pending flag 03520 * @rmtoll ISR SHPF LL_RTC_IsActiveFlag_SHP 03521 * @param RTCx RTC Instance 03522 * @retval State of bit (1 or 0). 03523 */ 03524 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SHP(RTC_TypeDef *RTCx) 03525 { 03526 return (READ_BIT(RTCx->ISR, RTC_ISR_SHPF) == (RTC_ISR_SHPF)); 03527 } 03528 03529 /** 03530 * @brief Get Wakeup timer write flag 03531 * @rmtoll ISR WUTWF LL_RTC_IsActiveFlag_WUTW 03532 * @param RTCx RTC Instance 03533 * @retval State of bit (1 or 0). 03534 */ 03535 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTW(RTC_TypeDef *RTCx) 03536 { 03537 return (READ_BIT(RTCx->ISR, RTC_ISR_WUTWF) == (RTC_ISR_WUTWF)); 03538 } 03539 03540 /** 03541 * @brief Get Alarm B write flag 03542 * @rmtoll ISR ALRBWF LL_RTC_IsActiveFlag_ALRBW 03543 * @param RTCx RTC Instance 03544 * @retval State of bit (1 or 0). 03545 */ 03546 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBW(RTC_TypeDef *RTCx) 03547 { 03548 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRBWF) == (RTC_ISR_ALRBWF)); 03549 } 03550 03551 /** 03552 * @brief Get Alarm A write flag 03553 * @rmtoll ISR ALRAWF LL_RTC_IsActiveFlag_ALRAW 03554 * @param RTCx RTC Instance 03555 * @retval State of bit (1 or 0). 03556 */ 03557 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAW(RTC_TypeDef *RTCx) 03558 { 03559 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRAWF) == (RTC_ISR_ALRAWF)); 03560 } 03561 03562 /** 03563 * @} 03564 */ 03565 03566 /** @defgroup RTC_LL_EF_IT_Management IT_Management 03567 * @{ 03568 */ 03569 03570 /** 03571 * @brief Enable Time-stamp interrupt 03572 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03573 * @rmtoll CR TSIE LL_RTC_EnableIT_TS 03574 * @param RTCx RTC Instance 03575 * @retval None 03576 */ 03577 __STATIC_INLINE void LL_RTC_EnableIT_TS(RTC_TypeDef *RTCx) 03578 { 03579 SET_BIT(RTCx->CR, RTC_CR_TSIE); 03580 } 03581 03582 /** 03583 * @brief Disable Time-stamp interrupt 03584 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03585 * @rmtoll CR TSIE LL_RTC_DisableIT_TS 03586 * @param RTCx RTC Instance 03587 * @retval None 03588 */ 03589 __STATIC_INLINE void LL_RTC_DisableIT_TS(RTC_TypeDef *RTCx) 03590 { 03591 CLEAR_BIT(RTCx->CR, RTC_CR_TSIE); 03592 } 03593 03594 /** 03595 * @brief Enable Wakeup timer interrupt 03596 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03597 * @rmtoll CR WUTIE LL_RTC_EnableIT_WUT 03598 * @param RTCx RTC Instance 03599 * @retval None 03600 */ 03601 __STATIC_INLINE void LL_RTC_EnableIT_WUT(RTC_TypeDef *RTCx) 03602 { 03603 SET_BIT(RTCx->CR, RTC_CR_WUTIE); 03604 } 03605 03606 /** 03607 * @brief Disable Wakeup timer interrupt 03608 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03609 * @rmtoll CR WUTIE LL_RTC_DisableIT_WUT 03610 * @param RTCx RTC Instance 03611 * @retval None 03612 */ 03613 __STATIC_INLINE void LL_RTC_DisableIT_WUT(RTC_TypeDef *RTCx) 03614 { 03615 CLEAR_BIT(RTCx->CR, RTC_CR_WUTIE); 03616 } 03617 03618 /** 03619 * @brief Enable Alarm B interrupt 03620 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03621 * @rmtoll CR ALRBIE LL_RTC_EnableIT_ALRB 03622 * @param RTCx RTC Instance 03623 * @retval None 03624 */ 03625 __STATIC_INLINE void LL_RTC_EnableIT_ALRB(RTC_TypeDef *RTCx) 03626 { 03627 SET_BIT(RTCx->CR, RTC_CR_ALRBIE); 03628 } 03629 03630 /** 03631 * @brief Disable Alarm B interrupt 03632 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03633 * @rmtoll CR ALRBIE LL_RTC_DisableIT_ALRB 03634 * @param RTCx RTC Instance 03635 * @retval None 03636 */ 03637 __STATIC_INLINE void LL_RTC_DisableIT_ALRB(RTC_TypeDef *RTCx) 03638 { 03639 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBIE); 03640 } 03641 03642 /** 03643 * @brief Enable Alarm A interrupt 03644 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03645 * @rmtoll CR ALRAIE LL_RTC_EnableIT_ALRA 03646 * @param RTCx RTC Instance 03647 * @retval None 03648 */ 03649 __STATIC_INLINE void LL_RTC_EnableIT_ALRA(RTC_TypeDef *RTCx) 03650 { 03651 SET_BIT(RTCx->CR, RTC_CR_ALRAIE); 03652 } 03653 03654 /** 03655 * @brief Disable Alarm A interrupt 03656 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before. 03657 * @rmtoll CR ALRAIE LL_RTC_DisableIT_ALRA 03658 * @param RTCx RTC Instance 03659 * @retval None 03660 */ 03661 __STATIC_INLINE void LL_RTC_DisableIT_ALRA(RTC_TypeDef *RTCx) 03662 { 03663 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAIE); 03664 } 03665 03666 /** 03667 * @brief Enable all Tamper Interrupt 03668 * @rmtoll TAFCR TAMPIE LL_RTC_EnableIT_TAMP 03669 * @param RTCx RTC Instance 03670 * @retval None 03671 */ 03672 __STATIC_INLINE void LL_RTC_EnableIT_TAMP(RTC_TypeDef *RTCx) 03673 { 03674 SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPIE); 03675 } 03676 03677 /** 03678 * @brief Disable all Tamper Interrupt 03679 * @rmtoll TAFCR TAMPIE LL_RTC_DisableIT_TAMP 03680 * @param RTCx RTC Instance 03681 * @retval None 03682 */ 03683 __STATIC_INLINE void LL_RTC_DisableIT_TAMP(RTC_TypeDef *RTCx) 03684 { 03685 CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPIE); 03686 } 03687 03688 /** 03689 * @brief Check if Time-stamp interrupt is enabled or not 03690 * @rmtoll CR TSIE LL_RTC_IsEnabledIT_TS 03691 * @param RTCx RTC Instance 03692 * @retval State of bit (1 or 0). 03693 */ 03694 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TS(RTC_TypeDef *RTCx) 03695 { 03696 return (READ_BIT(RTCx->CR, RTC_CR_TSIE) == (RTC_CR_TSIE)); 03697 } 03698 03699 /** 03700 * @brief Check if Wakeup timer interrupt is enabled or not 03701 * @rmtoll CR WUTIE LL_RTC_IsEnabledIT_WUT 03702 * @param RTCx RTC Instance 03703 * @retval State of bit (1 or 0). 03704 */ 03705 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_WUT(RTC_TypeDef *RTCx) 03706 { 03707 return (READ_BIT(RTCx->CR, RTC_CR_WUTIE) == (RTC_CR_WUTIE)); 03708 } 03709 03710 /** 03711 * @brief Check if Alarm B interrupt is enabled or not 03712 * @rmtoll CR ALRBIE LL_RTC_IsEnabledIT_ALRB 03713 * @param RTCx RTC Instance 03714 * @retval State of bit (1 or 0). 03715 */ 03716 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRB(RTC_TypeDef *RTCx) 03717 { 03718 return (READ_BIT(RTCx->CR, RTC_CR_ALRBIE) == (RTC_CR_ALRBIE)); 03719 } 03720 03721 /** 03722 * @brief Check if Alarm A interrupt is enabled or not 03723 * @rmtoll CR ALRAIE LL_RTC_IsEnabledIT_ALRA 03724 * @param RTCx RTC Instance 03725 * @retval State of bit (1 or 0). 03726 */ 03727 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRA(RTC_TypeDef *RTCx) 03728 { 03729 return (READ_BIT(RTCx->CR, RTC_CR_ALRAIE) == (RTC_CR_ALRAIE)); 03730 } 03731 03732 /** 03733 * @brief Check if all the TAMPER interrupts are enabled or not 03734 * @rmtoll TAFCR TAMPIE LL_RTC_IsEnabledIT_TAMP 03735 * @param RTCx RTC Instance 03736 * @retval State of bit (1 or 0). 03737 */ 03738 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP(RTC_TypeDef *RTCx) 03739 { 03740 return (READ_BIT(RTCx->TAFCR, 03741 RTC_TAFCR_TAMPIE) == (RTC_TAFCR_TAMPIE)); 03742 } 03743 03744 /** 03745 * @} 03746 */ 03747 03748 #if defined(USE_FULL_LL_DRIVER) 03749 /** @defgroup RTC_LL_EF_Init Initialization and de-initialization functions 03750 * @{ 03751 */ 03752 03753 ErrorStatus LL_RTC_DeInit(RTC_TypeDef *RTCx); 03754 ErrorStatus LL_RTC_Init(RTC_TypeDef *RTCx, LL_RTC_InitTypeDef *RTC_InitStruct); 03755 void LL_RTC_StructInit(LL_RTC_InitTypeDef *RTC_InitStruct); 03756 ErrorStatus LL_RTC_TIME_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_TimeTypeDef *RTC_TimeStruct); 03757 void LL_RTC_TIME_StructInit(LL_RTC_TimeTypeDef *RTC_TimeStruct); 03758 ErrorStatus LL_RTC_DATE_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_DateTypeDef *RTC_DateStruct); 03759 void LL_RTC_DATE_StructInit(LL_RTC_DateTypeDef *RTC_DateStruct); 03760 ErrorStatus LL_RTC_ALMA_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct); 03761 ErrorStatus LL_RTC_ALMB_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct); 03762 void LL_RTC_ALMA_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct); 03763 void LL_RTC_ALMB_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct); 03764 ErrorStatus LL_RTC_EnterInitMode(RTC_TypeDef *RTCx); 03765 ErrorStatus LL_RTC_ExitInitMode(RTC_TypeDef *RTCx); 03766 ErrorStatus LL_RTC_WaitForSynchro(RTC_TypeDef *RTCx); 03767 03768 /** 03769 * @} 03770 */ 03771 #endif /* USE_FULL_LL_DRIVER */ 03772 03773 /** 03774 * @} 03775 */ 03776 03777 /** 03778 * @} 03779 */ 03780 03781 #endif /* defined(RTC) */ 03782 03783 /** 03784 * @} 03785 */ 03786 03787 #ifdef __cplusplus 03788 } 03789 #endif 03790 03791 #endif /* __STM32F4xx_LL_RTC_H */ 03792 03793 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/