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