STM32L486xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_hal_rtc.h 00004 * @author MCD Application Team 00005 * @brief Header file of RTC HAL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> 00010 * 00011 * Redistribution and use in source and binary forms, with or without modification, 00012 * are permitted provided that the following conditions are met: 00013 * 1. Redistributions of source code must retain the above copyright notice, 00014 * this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright notice, 00016 * this list of conditions and the following disclaimer in the documentation 00017 * and/or other materials provided with the distribution. 00018 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00019 * may be used to endorse or promote products derived from this software 00020 * without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00023 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00025 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00026 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00027 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00028 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00030 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 * 00033 ****************************************************************************** 00034 */ 00035 00036 /* Define to prevent recursive inclusion -------------------------------------*/ 00037 #ifndef __STM32L4xx_HAL_RTC_H 00038 #define __STM32L4xx_HAL_RTC_H 00039 00040 #ifdef __cplusplus 00041 extern "C" { 00042 #endif 00043 00044 /* Includes ------------------------------------------------------------------*/ 00045 #include "stm32l4xx_hal_def.h" 00046 00047 /** @addtogroup STM32L4xx_HAL_Driver 00048 * @{ 00049 */ 00050 00051 /** @addtogroup RTC 00052 * @{ 00053 */ 00054 00055 /* Exported types ------------------------------------------------------------*/ 00056 /** @defgroup RTC_Exported_Types RTC Exported Types 00057 * @{ 00058 */ 00059 /** 00060 * @brief HAL State structures definition 00061 */ 00062 typedef enum 00063 { 00064 HAL_RTC_STATE_RESET = 0x00, /*!< RTC not yet initialized or disabled */ 00065 HAL_RTC_STATE_READY = 0x01, /*!< RTC initialized and ready for use */ 00066 HAL_RTC_STATE_BUSY = 0x02, /*!< RTC process is ongoing */ 00067 HAL_RTC_STATE_TIMEOUT = 0x03, /*!< RTC timeout state */ 00068 HAL_RTC_STATE_ERROR = 0x04 /*!< RTC error state */ 00069 00070 }HAL_RTCStateTypeDef; 00071 00072 /** 00073 * @brief RTC Configuration Structure definition 00074 */ 00075 typedef struct 00076 { 00077 uint32_t HourFormat; /*!< Specifies the RTC Hour Format. 00078 This parameter can be a value of @ref RTC_Hour_Formats */ 00079 00080 uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value. 00081 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F */ 00082 00083 uint32_t SynchPrediv; /*!< Specifies the RTC Synchronous Predivider value. 00084 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF */ 00085 00086 uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC output. 00087 This parameter can be a value of @ref RTCEx_Output_selection_Definitions */ 00088 00089 uint32_t OutPutRemap; /*!< Specifies the remap for RTC output. 00090 This parameter can be a value of @ref RTC_Output_ALARM_OUT_Remap */ 00091 00092 uint32_t OutPutPolarity; /*!< Specifies the polarity of the output signal. 00093 This parameter can be a value of @ref RTC_Output_Polarity_Definitions */ 00094 00095 uint32_t OutPutType; /*!< Specifies the RTC Output Pin mode. 00096 This parameter can be a value of @ref RTC_Output_Type_ALARM_OUT */ 00097 }RTC_InitTypeDef; 00098 00099 /** 00100 * @brief RTC Time structure definition 00101 */ 00102 typedef struct 00103 { 00104 uint8_t Hours; /*!< Specifies the RTC Time Hour. 00105 This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the RTC_HourFormat_12 is selected. 00106 This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the RTC_HourFormat_24 is selected */ 00107 00108 uint8_t Minutes; /*!< Specifies the RTC Time Minutes. 00109 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */ 00110 00111 uint8_t Seconds; /*!< Specifies the RTC Time Seconds. 00112 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */ 00113 00114 uint8_t TimeFormat; /*!< Specifies the RTC AM/PM Time. 00115 This parameter can be a value of @ref RTC_AM_PM_Definitions */ 00116 00117 uint32_t SubSeconds; /*!< Specifies the RTC_SSR RTC Sub Second register content. 00118 This parameter corresponds to a time unit range between [0-1] Second 00119 with [1 Sec / SecondFraction +1] granularity */ 00120 00121 uint32_t SecondFraction; /*!< Specifies the range or granularity of Sub Second register content 00122 corresponding to Synchronous pre-scaler factor value (PREDIV_S) 00123 This parameter corresponds to a time unit range between [0-1] Second 00124 with [1 Sec / SecondFraction +1] granularity. 00125 This field will be used only by HAL_RTC_GetTime function */ 00126 00127 uint32_t DayLightSaving; /*!< Specifies RTC_DayLightSaveOperation: the value of hour adjustment. 00128 This parameter can be a value of @ref RTC_DayLightSaving_Definitions */ 00129 00130 uint32_t StoreOperation; /*!< Specifies RTC_StoreOperation value to be written in the BCK bit 00131 in CR register to store the operation. 00132 This parameter can be a value of @ref RTC_StoreOperation_Definitions */ 00133 }RTC_TimeTypeDef; 00134 00135 /** 00136 * @brief RTC Date structure definition 00137 */ 00138 typedef struct 00139 { 00140 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay. 00141 This parameter can be a value of @ref RTC_WeekDay_Definitions */ 00142 00143 uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format). 00144 This parameter can be a value of @ref RTC_Month_Date_Definitions */ 00145 00146 uint8_t Date; /*!< Specifies the RTC Date. 00147 This parameter must be a number between Min_Data = 1 and Max_Data = 31 */ 00148 00149 uint8_t Year; /*!< Specifies the RTC Date Year. 00150 This parameter must be a number between Min_Data = 0 and Max_Data = 99 */ 00151 00152 }RTC_DateTypeDef; 00153 00154 /** 00155 * @brief RTC Alarm structure definition 00156 */ 00157 typedef struct 00158 { 00159 RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */ 00160 00161 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks. 00162 This parameter can be a value of @ref RTC_AlarmMask_Definitions */ 00163 00164 uint32_t AlarmSubSecondMask; /*!< Specifies the RTC Alarm SubSeconds Masks. 00165 This parameter can be a value of @ref RTC_Alarm_Sub_Seconds_Masks_Definitions */ 00166 00167 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on Date or WeekDay. 00168 This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */ 00169 00170 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Date/WeekDay. 00171 If the Alarm Date is selected, this parameter must be set to a value in the 1-31 range. 00172 If the Alarm WeekDay is selected, this parameter can be a value of @ref RTC_WeekDay_Definitions */ 00173 00174 uint32_t Alarm; /*!< Specifies the alarm . 00175 This parameter can be a value of @ref RTC_Alarms_Definitions */ 00176 }RTC_AlarmTypeDef; 00177 00178 /** 00179 * @brief RTC Handle Structure definition 00180 */ 00181 typedef struct __RTC_HandleTypeDef 00182 { 00183 RTC_TypeDef *Instance; /*!< Register base address */ 00184 00185 RTC_InitTypeDef Init; /*!< RTC required parameters */ 00186 00187 HAL_LockTypeDef Lock; /*!< RTC locking object */ 00188 00189 __IO HAL_RTCStateTypeDef State; /*!< Time communication state */ 00190 00191 #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) 00192 void (* AlarmAEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Alarm A Event callback */ 00193 00194 void (* AlarmBEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Alarm B Event callback */ 00195 00196 void (* TimeStampEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC TimeStamp Event callback */ 00197 00198 void (* WakeUpTimerEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC WakeUpTimer Event callback */ 00199 00200 #if defined(RTC_TAMPER1_SUPPORT) 00201 void (* Tamper1EventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Tamper 1 Event callback */ 00202 #endif /* RTC_TAMPER1_SUPPORT */ 00203 00204 void (* Tamper2EventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Tamper 2 Event callback */ 00205 00206 #if defined(RTC_TAMPER3_SUPPORT) 00207 void (* Tamper3EventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Tamper 3 Event callback */ 00208 #endif /* RTC_TAMPER3_SUPPORT */ 00209 00210 void (* MspInitCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Msp Init callback */ 00211 00212 void (* MspDeInitCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Msp DeInit callback */ 00213 00214 #endif /* (USE_HAL_RTC_REGISTER_CALLBACKS) */ 00215 00216 }RTC_HandleTypeDef; 00217 00218 #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) 00219 /** 00220 * @brief HAL LPTIM Callback ID enumeration definition 00221 */ 00222 typedef enum 00223 { 00224 HAL_RTC_ALARM_A_EVENT_CB_ID = 0x00U, /*!< RTC Alarm A Event Callback ID */ 00225 HAL_RTC_ALARM_B_EVENT_CB_ID = 0x01U, /*!< RTC Alarm B Event Callback ID */ 00226 HAL_RTC_TIMESTAMP_EVENT_CB_ID = 0x02U, /*!< RTC TimeStamp Event Callback ID */ 00227 HAL_RTC_WAKEUPTIMER_EVENT_CB_ID = 0x03U, /*!< RTC WakeUp Timer Event Callback ID */ 00228 #if defined(RTC_TAMPER1_SUPPORT) 00229 HAL_RTC_TAMPER1_EVENT_CB_ID = 0x04U, /*!< RTC Tamper 1 Callback ID */ 00230 #endif /* RTC_TAMPER1_SUPPORT */ 00231 HAL_RTC_TAMPER2_EVENT_CB_ID = 0x05U, /*!< RTC Tamper 2 Callback ID */ 00232 #if defined(RTC_TAMPER3_SUPPORT) 00233 HAL_RTC_TAMPER3_EVENT_CB_ID = 0x06U, /*!< RTC Tamper 3 Callback ID */ 00234 #endif /* RTC_TAMPER3_SUPPORT */ 00235 HAL_RTC_MSPINIT_CB_ID = 0x0EU, /*!< RTC Msp Init callback ID */ 00236 HAL_RTC_MSPDEINIT_CB_ID = 0x0FU /*!< RTC Msp DeInit callback ID */ 00237 }HAL_RTC_CallbackIDTypeDef; 00238 00239 /** 00240 * @brief HAL RTC Callback pointer definition 00241 */ 00242 typedef void (*pRTC_CallbackTypeDef)(RTC_HandleTypeDef * hrtc); /*!< pointer to an RTC callback function */ 00243 #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */ 00244 00245 /** 00246 * @} 00247 */ 00248 00249 /* Exported constants --------------------------------------------------------*/ 00250 /** @defgroup RTC_Exported_Constants RTC Exported Constants 00251 * @{ 00252 */ 00253 00254 /** @defgroup RTC_Hour_Formats RTC Hour Formats 00255 * @{ 00256 */ 00257 #define RTC_HOURFORMAT_24 ((uint32_t)0x00000000) 00258 #define RTC_HOURFORMAT_12 ((uint32_t)0x00000040) 00259 /** 00260 * @} 00261 */ 00262 00263 /** @defgroup RTC_Output_Polarity_Definitions RTC Output Polarity Definitions 00264 * @{ 00265 */ 00266 #define RTC_OUTPUT_POLARITY_HIGH ((uint32_t)0x00000000) 00267 #define RTC_OUTPUT_POLARITY_LOW ((uint32_t)0x00100000) 00268 /** 00269 * @} 00270 */ 00271 00272 /** @defgroup RTC_Output_Type_ALARM_OUT RTC Output Type ALARM OUT 00273 * @{ 00274 */ 00275 #define RTC_OUTPUT_TYPE_OPENDRAIN ((uint32_t)0x00000000) 00276 #define RTC_OUTPUT_TYPE_PUSHPULL ((uint32_t)RTC_OR_ALARMOUTTYPE) 00277 /** 00278 * @} 00279 */ 00280 00281 /** @defgroup RTC_Output_ALARM_OUT_Remap RTC Output ALARM OUT Remap 00282 * @{ 00283 */ 00284 #define RTC_OUTPUT_REMAP_NONE ((uint32_t)0x00000000) 00285 #define RTC_OUTPUT_REMAP_POS1 ((uint32_t)RTC_OR_OUT_RMP) 00286 /** 00287 * @} 00288 */ 00289 00290 /** @defgroup RTC_AM_PM_Definitions RTC AM PM Definitions 00291 * @{ 00292 */ 00293 #define RTC_HOURFORMAT12_AM ((uint8_t)0x00) 00294 #define RTC_HOURFORMAT12_PM ((uint8_t)0x40) 00295 /** 00296 * @} 00297 */ 00298 00299 /** @defgroup RTC_DayLightSaving_Definitions RTC DayLight Saving Definitions 00300 * @{ 00301 */ 00302 #define RTC_DAYLIGHTSAVING_SUB1H ((uint32_t)0x00020000) 00303 #define RTC_DAYLIGHTSAVING_ADD1H ((uint32_t)0x00010000) 00304 #define RTC_DAYLIGHTSAVING_NONE ((uint32_t)0x00000000) 00305 /** 00306 * @} 00307 */ 00308 00309 /** @defgroup RTC_StoreOperation_Definitions RTC Store Operation Definitions 00310 * @{ 00311 */ 00312 #define RTC_STOREOPERATION_RESET ((uint32_t)0x00000000) 00313 #define RTC_STOREOPERATION_SET ((uint32_t)0x00040000) 00314 /** 00315 * @} 00316 */ 00317 00318 /** @defgroup RTC_Input_parameter_format_definitions RTC Input Parameter Format Definitions 00319 * @{ 00320 */ 00321 #define RTC_FORMAT_BIN ((uint32_t)0x00000000) 00322 #define RTC_FORMAT_BCD ((uint32_t)0x00000001) 00323 /** 00324 * @} 00325 */ 00326 00327 /** @defgroup RTC_Month_Date_Definitions RTC Month Date Definitions 00328 * @{ 00329 */ 00330 00331 /* Coded in BCD format */ 00332 #define RTC_MONTH_JANUARY ((uint8_t)0x01) 00333 #define RTC_MONTH_FEBRUARY ((uint8_t)0x02) 00334 #define RTC_MONTH_MARCH ((uint8_t)0x03) 00335 #define RTC_MONTH_APRIL ((uint8_t)0x04) 00336 #define RTC_MONTH_MAY ((uint8_t)0x05) 00337 #define RTC_MONTH_JUNE ((uint8_t)0x06) 00338 #define RTC_MONTH_JULY ((uint8_t)0x07) 00339 #define RTC_MONTH_AUGUST ((uint8_t)0x08) 00340 #define RTC_MONTH_SEPTEMBER ((uint8_t)0x09) 00341 #define RTC_MONTH_OCTOBER ((uint8_t)0x10) 00342 #define RTC_MONTH_NOVEMBER ((uint8_t)0x11) 00343 #define RTC_MONTH_DECEMBER ((uint8_t)0x12) 00344 /** 00345 * @} 00346 */ 00347 00348 /** @defgroup RTC_WeekDay_Definitions RTC WeekDay Definitions 00349 * @{ 00350 */ 00351 #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01) 00352 #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02) 00353 #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03) 00354 #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04) 00355 #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05) 00356 #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06) 00357 #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x07) 00358 /** 00359 * @} 00360 */ 00361 00362 /** @defgroup RTC_AlarmDateWeekDay_Definitions RTC Alarm Date WeekDay Definitions 00363 * @{ 00364 */ 00365 #define RTC_ALARMDATEWEEKDAYSEL_DATE ((uint32_t)0x00000000) 00366 #define RTC_ALARMDATEWEEKDAYSEL_WEEKDAY ((uint32_t)0x40000000) 00367 /** 00368 * @} 00369 */ 00370 00371 00372 /** @defgroup RTC_AlarmMask_Definitions RTC Alarm Mask Definitions 00373 * @{ 00374 */ 00375 #define RTC_ALARMMASK_NONE ((uint32_t)0x00000000) 00376 #define RTC_ALARMMASK_DATEWEEKDAY RTC_ALRMAR_MSK4 00377 #define RTC_ALARMMASK_HOURS RTC_ALRMAR_MSK3 00378 #define RTC_ALARMMASK_MINUTES RTC_ALRMAR_MSK2 00379 #define RTC_ALARMMASK_SECONDS RTC_ALRMAR_MSK1 00380 #define RTC_ALARMMASK_ALL ((uint32_t)0x80808080) 00381 /** 00382 * @} 00383 */ 00384 00385 /** @defgroup RTC_Alarms_Definitions RTC Alarms Definitions 00386 * @{ 00387 */ 00388 #define RTC_ALARM_A RTC_CR_ALRAE 00389 #define RTC_ALARM_B RTC_CR_ALRBE 00390 /** 00391 * @} 00392 */ 00393 00394 /** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions RTC Alarm Sub Seconds Masks Definitions 00395 * @{ 00396 */ 00397 #define RTC_ALARMSUBSECONDMASK_ALL ((uint32_t)0x00000000) /*!< All Alarm SS fields are masked. 00398 There is no comparison on sub seconds 00399 for Alarm */ 00400 #define RTC_ALARMSUBSECONDMASK_SS14_1 ((uint32_t)0x01000000) /*!< SS[14:1] are don't care in Alarm 00401 comparison. Only SS[0] is compared. */ 00402 #define RTC_ALARMSUBSECONDMASK_SS14_2 ((uint32_t)0x02000000) /*!< SS[14:2] are don't care in Alarm 00403 comparison. Only SS[1:0] are compared */ 00404 #define RTC_ALARMSUBSECONDMASK_SS14_3 ((uint32_t)0x03000000) /*!< SS[14:3] are don't care in Alarm 00405 comparison. Only SS[2:0] are compared */ 00406 #define RTC_ALARMSUBSECONDMASK_SS14_4 ((uint32_t)0x04000000) /*!< SS[14:4] are don't care in Alarm 00407 comparison. Only SS[3:0] are compared */ 00408 #define RTC_ALARMSUBSECONDMASK_SS14_5 ((uint32_t)0x05000000) /*!< SS[14:5] are don't care in Alarm 00409 comparison. Only SS[4:0] are compared */ 00410 #define RTC_ALARMSUBSECONDMASK_SS14_6 ((uint32_t)0x06000000) /*!< SS[14:6] are don't care in Alarm 00411 comparison. Only SS[5:0] are compared */ 00412 #define RTC_ALARMSUBSECONDMASK_SS14_7 ((uint32_t)0x07000000) /*!< SS[14:7] are don't care in Alarm 00413 comparison. Only SS[6:0] are compared */ 00414 #define RTC_ALARMSUBSECONDMASK_SS14_8 ((uint32_t)0x08000000) /*!< SS[14:8] are don't care in Alarm 00415 comparison. Only SS[7:0] are compared */ 00416 #define RTC_ALARMSUBSECONDMASK_SS14_9 ((uint32_t)0x09000000) /*!< SS[14:9] are don't care in Alarm 00417 comparison. Only SS[8:0] are compared */ 00418 #define RTC_ALARMSUBSECONDMASK_SS14_10 ((uint32_t)0x0A000000) /*!< SS[14:10] are don't care in Alarm 00419 comparison. Only SS[9:0] are compared */ 00420 #define RTC_ALARMSUBSECONDMASK_SS14_11 ((uint32_t)0x0B000000) /*!< SS[14:11] are don't care in Alarm 00421 comparison. Only SS[10:0] are compared */ 00422 #define RTC_ALARMSUBSECONDMASK_SS14_12 ((uint32_t)0x0C000000) /*!< SS[14:12] are don't care in Alarm 00423 comparison. Only SS[11:0] are compared */ 00424 #define RTC_ALARMSUBSECONDMASK_SS14_13 ((uint32_t)0x0D000000) /*!< SS[14:13] are don't care in Alarm 00425 comparison. Only SS[12:0] are compared */ 00426 #define RTC_ALARMSUBSECONDMASK_SS14 ((uint32_t)0x0E000000) /*!< SS[14] is don't care in Alarm 00427 comparison. Only SS[13:0] are compared */ 00428 #define RTC_ALARMSUBSECONDMASK_NONE ((uint32_t)0x0F000000) /*!< SS[14:0] are compared and must match 00429 to activate alarm. */ 00430 /** 00431 * @} 00432 */ 00433 00434 /** @defgroup RTC_Interrupts_Definitions RTC Interrupts Definitions 00435 * @{ 00436 */ 00437 #define RTC_IT_TS ((uint32_t)RTC_CR_TSIE) /*!< Enable Timestamp Interrupt */ 00438 #define RTC_IT_WUT ((uint32_t)RTC_CR_WUTIE) /*!< Enable Wakeup timer Interrupt */ 00439 #define RTC_IT_ALRA ((uint32_t)RTC_CR_ALRAIE) /*!< Enable Alarm A Interrupt */ 00440 #define RTC_IT_ALRB ((uint32_t)RTC_CR_ALRBIE) /*!< Enable Alarm B Interrupt */ 00441 #define RTC_IT_TAMP ((uint32_t)RTC_TAMPCR_TAMPIE) /*!< Enable all Tamper Interrupt */ 00442 #define RTC_IT_TAMP1 ((uint32_t)RTC_TAMPCR_TAMP1IE) /*!< Enable Tamper 1 Interrupt */ 00443 #define RTC_IT_TAMP2 ((uint32_t)RTC_TAMPCR_TAMP2IE) /*!< Enable Tamper 2 Interrupt */ 00444 #define RTC_IT_TAMP3 ((uint32_t)RTC_TAMPCR_TAMP3IE) /*!< Enable Tamper 3 Interrupt */ 00445 /** 00446 * @} 00447 */ 00448 00449 /** @defgroup RTC_Flags_Definitions RTC Flags Definitions 00450 * @{ 00451 */ 00452 #define RTC_FLAG_RECALPF ((uint32_t)RTC_ISR_RECALPF) 00453 #define RTC_FLAG_TAMP3F ((uint32_t)RTC_ISR_TAMP3F) 00454 #define RTC_FLAG_TAMP2F ((uint32_t)RTC_ISR_TAMP2F) 00455 #define RTC_FLAG_TAMP1F ((uint32_t)RTC_ISR_TAMP1F) 00456 #define RTC_FLAG_TSOVF ((uint32_t)RTC_ISR_TSOVF) 00457 #define RTC_FLAG_TSF ((uint32_t)RTC_ISR_TSF) 00458 #define RTC_FLAG_ITSF ((uint32_t)RTC_ISR_ITSF) 00459 #define RTC_FLAG_WUTF ((uint32_t)RTC_ISR_WUTF) 00460 #define RTC_FLAG_ALRBF ((uint32_t)RTC_ISR_ALRBF) 00461 #define RTC_FLAG_ALRAF ((uint32_t)RTC_ISR_ALRAF) 00462 #define RTC_FLAG_INITF ((uint32_t)RTC_ISR_INITF) 00463 #define RTC_FLAG_RSF ((uint32_t)RTC_ISR_RSF) 00464 #define RTC_FLAG_INITS ((uint32_t)RTC_ISR_INITS) 00465 #define RTC_FLAG_SHPF ((uint32_t)RTC_ISR_SHPF) 00466 #define RTC_FLAG_WUTWF ((uint32_t)RTC_ISR_WUTWF) 00467 #define RTC_FLAG_ALRBWF ((uint32_t)RTC_ISR_ALRBWF) 00468 #define RTC_FLAG_ALRAWF ((uint32_t)RTC_ISR_ALRAWF) 00469 /** 00470 * @} 00471 */ 00472 00473 /** 00474 * @} 00475 */ 00476 00477 /* Exported macros -----------------------------------------------------------*/ 00478 /** @defgroup RTC_Exported_Macros RTC Exported Macros 00479 * @{ 00480 */ 00481 00482 /** @brief Reset RTC handle state. 00483 * @param __HANDLE__: RTC handle. 00484 * @retval None 00485 */ 00486 #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) 00487 #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) do{\ 00488 (__HANDLE__)->State = HAL_RTC_STATE_RESET;\ 00489 (__HANDLE__)->MspInitCallback = NULL;\ 00490 (__HANDLE__)->MspDeInitCallback = NULL;\ 00491 }while(0) 00492 #else 00493 #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET) 00494 #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */ 00495 00496 /** 00497 * @brief Disable the write protection for RTC registers. 00498 * @param __HANDLE__: specifies the RTC handle. 00499 * @retval None 00500 */ 00501 #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) \ 00502 do{ \ 00503 (__HANDLE__)->Instance->WPR = 0xCA; \ 00504 (__HANDLE__)->Instance->WPR = 0x53; \ 00505 } while(0) 00506 00507 /** 00508 * @brief Enable the write protection for RTC registers. 00509 * @param __HANDLE__: specifies the RTC handle. 00510 * @retval None 00511 */ 00512 #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) \ 00513 do{ \ 00514 (__HANDLE__)->Instance->WPR = 0xFF; \ 00515 } while(0) 00516 00517 00518 /** 00519 * @brief Enable the RTC ALARMA peripheral. 00520 * @param __HANDLE__: specifies the RTC handle. 00521 * @retval None 00522 */ 00523 #define __HAL_RTC_ALARMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRAE)) 00524 00525 /** 00526 * @brief Disable the RTC ALARMA peripheral. 00527 * @param __HANDLE__: specifies the RTC handle. 00528 * @retval None 00529 */ 00530 #define __HAL_RTC_ALARMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRAE)) 00531 00532 /** 00533 * @brief Enable the RTC ALARMB peripheral. 00534 * @param __HANDLE__: specifies the RTC handle. 00535 * @retval None 00536 */ 00537 #define __HAL_RTC_ALARMB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRBE)) 00538 00539 /** 00540 * @brief Disable the RTC ALARMB peripheral. 00541 * @param __HANDLE__: specifies the RTC handle. 00542 * @retval None 00543 */ 00544 #define __HAL_RTC_ALARMB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRBE)) 00545 00546 /** 00547 * @brief Enable the RTC Alarm interrupt. 00548 * @param __HANDLE__: specifies the RTC handle. 00549 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled. 00550 * This parameter can be any combination of the following values: 00551 * @arg RTC_IT_ALRA: Alarm A interrupt 00552 * @arg RTC_IT_ALRB: Alarm B interrupt 00553 * @retval None 00554 */ 00555 #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) 00556 00557 /** 00558 * @brief Disable the RTC Alarm interrupt. 00559 * @param __HANDLE__: specifies the RTC handle. 00560 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled. 00561 * This parameter can be any combination of the following values: 00562 * @arg RTC_IT_ALRA: Alarm A interrupt 00563 * @arg RTC_IT_ALRB: Alarm B interrupt 00564 * @retval None 00565 */ 00566 #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) 00567 00568 /** 00569 * @brief Check whether the specified RTC Alarm interrupt has occurred or not. 00570 * @param __HANDLE__: specifies the RTC handle. 00571 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check. 00572 * This parameter can be: 00573 * @arg RTC_IT_ALRA: Alarm A interrupt 00574 * @arg RTC_IT_ALRB: Alarm B interrupt 00575 * @retval None 00576 */ 00577 #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR)& ((__INTERRUPT__)>> 4)) != RESET) ? SET : RESET) 00578 00579 /** 00580 * @brief Get the selected RTC Alarm's flag status. 00581 * @param __HANDLE__: specifies the RTC handle. 00582 * @param __FLAG__: specifies the RTC Alarm Flag sources to check. 00583 * This parameter can be: 00584 * @arg RTC_FLAG_ALRAF 00585 * @arg RTC_FLAG_ALRBF 00586 * @arg RTC_FLAG_ALRAWF 00587 * @arg RTC_FLAG_ALRBWF 00588 * @retval None 00589 */ 00590 #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET) 00591 00592 /** 00593 * @brief Clear the RTC Alarm's pending flags. 00594 * @param __HANDLE__: specifies the RTC handle. 00595 * @param __FLAG__: specifies the RTC Alarm Flag sources to clear. 00596 * This parameter can be: 00597 * @arg RTC_FLAG_ALRAF 00598 * @arg RTC_FLAG_ALRBF 00599 * @retval None 00600 */ 00601 #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 00602 00603 /** 00604 * @brief Check whether the specified RTC Alarm interrupt is enabled or not. 00605 * @param __HANDLE__: specifies the RTC handle. 00606 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check. 00607 * This parameter can be: 00608 * @arg RTC_IT_ALRA: Alarm A interrupt 00609 * @arg RTC_IT_ALRB: Alarm B interrupt 00610 * @retval None 00611 */ 00612 #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET) 00613 00614 /** 00615 * @brief Enable interrupt on the RTC Alarm associated Exti line. 00616 * @retval None 00617 */ 00618 #define __HAL_RTC_ALARM_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_ALARM_EVENT) 00619 00620 /** 00621 * @brief Disable interrupt on the RTC Alarm associated Exti line. 00622 * @retval None 00623 */ 00624 #define __HAL_RTC_ALARM_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_ALARM_EVENT)) 00625 00626 /** 00627 * @brief Enable event on the RTC Alarm associated Exti line. 00628 * @retval None 00629 */ 00630 #define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_ALARM_EVENT) 00631 00632 /** 00633 * @brief Disable event on the RTC Alarm associated Exti line. 00634 * @retval None 00635 */ 00636 #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_ALARM_EVENT)) 00637 00638 /** 00639 * @brief Enable falling edge trigger on the RTC Alarm associated Exti line. 00640 * @retval None 00641 */ 00642 #define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR1 |= RTC_EXTI_LINE_ALARM_EVENT) 00643 00644 /** 00645 * @brief Disable falling edge trigger on the RTC Alarm associated Exti line. 00646 * @retval None 00647 */ 00648 #define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR1 &= ~(RTC_EXTI_LINE_ALARM_EVENT)) 00649 00650 /** 00651 * @brief Enable rising edge trigger on the RTC Alarm associated Exti line. 00652 * @retval None 00653 */ 00654 #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR1 |= RTC_EXTI_LINE_ALARM_EVENT) 00655 00656 /** 00657 * @brief Disable rising edge trigger on the RTC Alarm associated Exti line. 00658 * @retval None 00659 */ 00660 #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR1 &= ~(RTC_EXTI_LINE_ALARM_EVENT)) 00661 00662 /** 00663 * @brief Enable rising & falling edge trigger on the RTC Alarm associated Exti line. 00664 * @retval None 00665 */ 00666 #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() do { \ 00667 __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE(); \ 00668 __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE(); \ 00669 } while(0) 00670 00671 /** 00672 * @brief Disable rising & falling edge trigger on the RTC Alarm associated Exti line. 00673 * @retval None 00674 */ 00675 #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() do { \ 00676 __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE(); \ 00677 __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE(); \ 00678 } while(0) 00679 00680 /** 00681 * @brief Check whether the RTC Alarm associated Exti line interrupt flag is set or not. 00682 * @retval Line Status. 00683 */ 00684 #define __HAL_RTC_ALARM_EXTI_GET_FLAG() (EXTI->PR1 & RTC_EXTI_LINE_ALARM_EVENT) 00685 00686 /** 00687 * @brief Clear the RTC Alarm associated Exti line flag. 00688 * @retval None 00689 */ 00690 #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI->PR1 = RTC_EXTI_LINE_ALARM_EVENT) 00691 00692 /** 00693 * @brief Generate a Software interrupt on RTC Alarm associated Exti line. 00694 * @retval None 00695 */ 00696 #define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() (EXTI->SWIER1 |= RTC_EXTI_LINE_ALARM_EVENT) 00697 00698 /** 00699 * @} 00700 */ 00701 00702 /* Include RTC HAL Extended module */ 00703 #include "stm32l4xx_hal_rtc_ex.h" 00704 00705 /* Exported functions --------------------------------------------------------*/ 00706 /** @addtogroup RTC_Exported_Functions 00707 * @{ 00708 */ 00709 00710 /** @addtogroup RTC_Exported_Functions_Group1 00711 * @{ 00712 */ 00713 /* Initialization and de-initialization functions ****************************/ 00714 HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc); 00715 HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc); 00716 void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc); 00717 void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc); 00718 00719 /* Callbacks Register/UnRegister functions ***********************************/ 00720 #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) 00721 HAL_StatusTypeDef HAL_RTC_RegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID, pRTC_CallbackTypeDef pCallback); 00722 HAL_StatusTypeDef HAL_RTC_UnRegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID); 00723 #endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */ 00724 00725 /** 00726 * @} 00727 */ 00728 00729 /** @addtogroup RTC_Exported_Functions_Group2 00730 * @{ 00731 */ 00732 /* RTC Time and Date functions ************************************************/ 00733 HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format); 00734 HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format); 00735 HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format); 00736 HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format); 00737 /** 00738 * @} 00739 */ 00740 00741 /** @addtogroup RTC_Exported_Functions_Group3 00742 * @{ 00743 */ 00744 /* RTC Alarm functions ********************************************************/ 00745 HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format); 00746 HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format); 00747 HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm); 00748 HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format); 00749 void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc); 00750 HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 00751 void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc); 00752 /** 00753 * @} 00754 */ 00755 00756 /** @addtogroup RTC_Exported_Functions_Group4 00757 * @{ 00758 */ 00759 /* Peripheral Control functions ***********************************************/ 00760 HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc); 00761 /** 00762 * @} 00763 */ 00764 00765 /** @addtogroup RTC_Exported_Functions_Group5 00766 * @{ 00767 */ 00768 /* Peripheral State functions *************************************************/ 00769 HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc); 00770 00771 /** 00772 * @} 00773 */ 00774 00775 /** 00776 * @} 00777 */ 00778 00779 /* Private types -------------------------------------------------------------*/ 00780 /* Private variables ---------------------------------------------------------*/ 00781 /* Private constants ---------------------------------------------------------*/ 00782 /** @defgroup RTC_Private_Constants RTC Private Constants 00783 * @{ 00784 */ 00785 /* Masks Definition */ 00786 #define RTC_TR_RESERVED_MASK 0x007F7F7FU 00787 #define RTC_DR_RESERVED_MASK 0x00FFFF3FU 00788 #define RTC_INIT_MASK 0xFFFFFFFFU 00789 #define RTC_RSF_MASK 0xFFFFFF5FU 00790 00791 #define RTC_TIMEOUT_VALUE 1000 00792 00793 #define RTC_EXTI_LINE_ALARM_EVENT ((uint32_t)0x00040000) /*!< External interrupt line 18 Connected to the RTC Alarm event */ 00794 00795 /** 00796 * @} 00797 */ 00798 00799 /* Private macros ------------------------------------------------------------*/ 00800 /** @defgroup RTC_Private_Macros RTC Private Macros 00801 * @{ 00802 */ 00803 00804 /** @defgroup RTC_IS_RTC_Definitions RTC Private macros to check input parameters 00805 * @{ 00806 */ 00807 00808 #define IS_RTC_HOUR_FORMAT(FORMAT) (((FORMAT) == RTC_HOURFORMAT_12) || \ 00809 ((FORMAT) == RTC_HOURFORMAT_24)) 00810 00811 #define IS_RTC_OUTPUT_POL(POL) (((POL) == RTC_OUTPUT_POLARITY_HIGH) || \ 00812 ((POL) == RTC_OUTPUT_POLARITY_LOW)) 00813 00814 #define IS_RTC_OUTPUT_TYPE(TYPE) (((TYPE) == RTC_OUTPUT_TYPE_OPENDRAIN) || \ 00815 ((TYPE) == RTC_OUTPUT_TYPE_PUSHPULL)) 00816 00817 #define IS_RTC_OUTPUT_REMAP(REMAP) (((REMAP) == RTC_OUTPUT_REMAP_NONE) || \ 00818 ((REMAP) == RTC_OUTPUT_REMAP_POS1)) 00819 00820 #define IS_RTC_HOURFORMAT12(PM) (((PM) == RTC_HOURFORMAT12_AM) || ((PM) == RTC_HOURFORMAT12_PM)) 00821 00822 #define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DAYLIGHTSAVING_SUB1H) || \ 00823 ((SAVE) == RTC_DAYLIGHTSAVING_ADD1H) || \ 00824 ((SAVE) == RTC_DAYLIGHTSAVING_NONE)) 00825 00826 #define IS_RTC_STORE_OPERATION(OPERATION) (((OPERATION) == RTC_STOREOPERATION_RESET) || \ 00827 ((OPERATION) == RTC_STOREOPERATION_SET)) 00828 00829 #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD)) 00830 00831 #define IS_RTC_YEAR(YEAR) ((YEAR) <= (uint32_t)99) 00832 00833 #define IS_RTC_MONTH(MONTH) (((MONTH) >= (uint32_t)1) && ((MONTH) <= (uint32_t)12)) 00834 00835 #define IS_RTC_DATE(DATE) (((DATE) >= (uint32_t)1) && ((DATE) <= (uint32_t)31)) 00836 00837 #define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \ 00838 ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \ 00839 ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \ 00840 ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \ 00841 ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \ 00842 ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \ 00843 ((WEEKDAY) == RTC_WEEKDAY_SUNDAY)) 00844 00845 #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) >(uint32_t) 0) && ((DATE) <= (uint32_t)31)) 00846 00847 #define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \ 00848 ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \ 00849 ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \ 00850 ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \ 00851 ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \ 00852 ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \ 00853 ((WEEKDAY) == RTC_WEEKDAY_SUNDAY)) 00854 00855 #define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL) (((SEL) == RTC_ALARMDATEWEEKDAYSEL_DATE) || \ 00856 ((SEL) == RTC_ALARMDATEWEEKDAYSEL_WEEKDAY)) 00857 00858 #define IS_RTC_ALARM_MASK(MASK) (((MASK) & 0x7F7F7F7F) == (uint32_t)RESET) 00859 00860 #define IS_RTC_ALARM(ALARM) (((ALARM) == RTC_ALARM_A) || ((ALARM) == RTC_ALARM_B)) 00861 00862 #define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= (uint32_t)0x00007FFF) 00863 00864 #define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_ALARMSUBSECONDMASK_ALL) || \ 00865 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_1) || \ 00866 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_2) || \ 00867 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_3) || \ 00868 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_4) || \ 00869 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_5) || \ 00870 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_6) || \ 00871 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_7) || \ 00872 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_8) || \ 00873 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_9) || \ 00874 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_10) || \ 00875 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_11) || \ 00876 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_12) || \ 00877 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_13) || \ 00878 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14) || \ 00879 ((MASK) == RTC_ALARMSUBSECONDMASK_NONE)) 00880 00881 #define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= (uint32_t)0x7F) 00882 00883 #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= (uint32_t)0x7FFF) 00884 00885 #define IS_RTC_HOUR12(HOUR) (((HOUR) > (uint32_t)0) && ((HOUR) <= (uint32_t)12)) 00886 00887 #define IS_RTC_HOUR24(HOUR) ((HOUR) <= (uint32_t)23) 00888 00889 #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= (uint32_t)59) 00890 00891 #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= (uint32_t)59) 00892 00893 /** 00894 * @} 00895 */ 00896 00897 /** 00898 * @} 00899 */ 00900 00901 /* Private functions ---------------------------------------------------------*/ 00902 /** @addtogroup RTC_Private_Functions 00903 * @{ 00904 */ 00905 00906 HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef* hrtc); 00907 uint8_t RTC_ByteToBcd2(uint8_t Value); 00908 uint8_t RTC_Bcd2ToByte(uint8_t Value); 00909 00910 /** 00911 * @} 00912 */ 00913 00914 /** 00915 * @} 00916 */ 00917 00918 /** 00919 * @} 00920 */ 00921 00922 #ifdef __cplusplus 00923 } 00924 #endif 00925 00926 #endif /* __STM32L4xx_HAL_RTC_H */ 00927 00928 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/