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