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