[303] | 1 | /**
|
---|
| 2 | ******************************************************************************
|
---|
| 3 | * @file stm32f4xx_hal_rtc.h
|
---|
| 4 | * @author MCD Application Team
|
---|
| 5 | * @version V1.4.1
|
---|
| 6 | * @date 09-October-2015
|
---|
| 7 | * @brief Header file of RTC HAL module.
|
---|
| 8 | ******************************************************************************
|
---|
| 9 | * @attention
|
---|
| 10 | *
|
---|
| 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
|
---|
| 12 | *
|
---|
| 13 | * Redistribution and use in source and binary forms, with or without modification,
|
---|
| 14 | * are permitted provided that the following conditions are met:
|
---|
| 15 | * 1. Redistributions of source code must retain the above copyright notice,
|
---|
| 16 | * this list of conditions and the following disclaimer.
|
---|
| 17 | * 2. Redistributions in binary form must reproduce the above copyright notice,
|
---|
| 18 | * this list of conditions and the following disclaimer in the documentation
|
---|
| 19 | * and/or other materials provided with the distribution.
|
---|
| 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
|
---|
| 21 | * may be used to endorse or promote products derived from this software
|
---|
| 22 | * without specific prior written permission.
|
---|
| 23 | *
|
---|
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
---|
| 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
| 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
| 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
---|
| 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
| 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
---|
| 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
---|
| 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
| 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
---|
| 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 34 | *
|
---|
| 35 | ******************************************************************************
|
---|
| 36 | */
|
---|
| 37 |
|
---|
| 38 | /* Define to prevent recursive inclusion -------------------------------------*/
|
---|
| 39 | #ifndef __STM32F4xx_HAL_RTC_H
|
---|
| 40 | #define __STM32F4xx_HAL_RTC_H
|
---|
| 41 |
|
---|
| 42 | #ifdef __cplusplus
|
---|
| 43 | extern "C" {
|
---|
| 44 | #endif
|
---|
| 45 |
|
---|
| 46 | /* Includes ------------------------------------------------------------------*/
|
---|
| 47 | #include "stm32f4xx_hal_def.h"
|
---|
| 48 |
|
---|
| 49 | /** @addtogroup STM32F4xx_HAL_Driver
|
---|
| 50 | * @{
|
---|
| 51 | */
|
---|
| 52 |
|
---|
| 53 | /** @addtogroup RTC
|
---|
| 54 | * @{
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | /* Exported types ------------------------------------------------------------*/
|
---|
| 58 | /** @defgroup RTC_Exported_Types RTC Exported Types
|
---|
| 59 | * @{
|
---|
| 60 | */
|
---|
| 61 |
|
---|
| 62 | /**
|
---|
| 63 | * @brief HAL State structures definition
|
---|
| 64 | */
|
---|
| 65 | typedef enum
|
---|
| 66 | {
|
---|
| 67 | HAL_RTC_STATE_RESET = 0x00, /*!< RTC not yet initialized or disabled */
|
---|
| 68 | HAL_RTC_STATE_READY = 0x01, /*!< RTC initialized and ready for use */
|
---|
| 69 | HAL_RTC_STATE_BUSY = 0x02, /*!< RTC process is ongoing */
|
---|
| 70 | HAL_RTC_STATE_TIMEOUT = 0x03, /*!< RTC timeout state */
|
---|
| 71 | HAL_RTC_STATE_ERROR = 0x04 /*!< RTC error state */
|
---|
| 72 |
|
---|
| 73 | }HAL_RTCStateTypeDef;
|
---|
| 74 |
|
---|
| 75 | /**
|
---|
| 76 | * @brief RTC Configuration Structure definition
|
---|
| 77 | */
|
---|
| 78 | typedef struct
|
---|
| 79 | {
|
---|
| 80 | uint32_t HourFormat; /*!< Specifies the RTC Hour Format.
|
---|
| 81 | This parameter can be a value of @ref RTC_Hour_Formats */
|
---|
| 82 |
|
---|
| 83 | uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value.
|
---|
| 84 | This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F */
|
---|
| 85 |
|
---|
| 86 | uint32_t SynchPrediv; /*!< Specifies the RTC Synchronous Predivider value.
|
---|
| 87 | This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF */
|
---|
| 88 |
|
---|
| 89 | uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC output.
|
---|
| 90 | This parameter can be a value of @ref RTC_Output_selection_Definitions */
|
---|
| 91 |
|
---|
| 92 | uint32_t OutPutPolarity; /*!< Specifies the polarity of the output signal.
|
---|
| 93 | This parameter can be a value of @ref RTC_Output_Polarity_Definitions */
|
---|
| 94 |
|
---|
| 95 | uint32_t OutPutType; /*!< Specifies the RTC Output Pin mode.
|
---|
| 96 | This parameter can be a value of @ref RTC_Output_Type_ALARM_OUT */
|
---|
| 97 | }RTC_InitTypeDef;
|
---|
| 98 |
|
---|
| 99 | /**
|
---|
| 100 | * @brief RTC Time structure definition
|
---|
| 101 | */
|
---|
| 102 | typedef struct
|
---|
| 103 | {
|
---|
| 104 | uint8_t Hours; /*!< Specifies the RTC Time Hour.
|
---|
| 105 | This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the RTC_HourFormat_12 is selected.
|
---|
| 106 | This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the RTC_HourFormat_24 is selected */
|
---|
| 107 |
|
---|
| 108 | uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
|
---|
| 109 | This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
|
---|
| 110 |
|
---|
| 111 | uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
|
---|
| 112 | This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
|
---|
| 113 |
|
---|
| 114 | uint8_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
|
---|
| 115 | This parameter can be a value of @ref RTC_AM_PM_Definitions */
|
---|
| 116 |
|
---|
| 117 | uint32_t SubSeconds; /*!< Specifies the RTC_SSR RTC Sub Second register content.
|
---|
| 118 | This parameter corresponds to a time unit range between [0-1] Second
|
---|
| 119 | with [1 Sec / SecondFraction +1] granularity */
|
---|
| 120 |
|
---|
| 121 | uint32_t SecondFraction; /*!< Specifies the range or granularity of Sub Second register content
|
---|
| 122 | corresponding to Synchronous pre-scaler factor value (PREDIV_S)
|
---|
| 123 | This parameter corresponds to a time unit range between [0-1] Second
|
---|
| 124 | with [1 Sec / SecondFraction +1] granularity.
|
---|
| 125 | This field will be used only by HAL_RTC_GetTime function */
|
---|
| 126 |
|
---|
| 127 | uint32_t DayLightSaving; /*!< Specifies DayLight Save Operation.
|
---|
| 128 | This parameter can be a value of @ref RTC_DayLightSaving_Definitions */
|
---|
| 129 |
|
---|
| 130 | uint32_t StoreOperation; /*!< Specifies RTC_StoreOperation value to be written in the BCK bit
|
---|
| 131 | in CR register to store the operation.
|
---|
| 132 | This parameter can be a value of @ref RTC_StoreOperation_Definitions */
|
---|
| 133 | }RTC_TimeTypeDef;
|
---|
| 134 |
|
---|
| 135 | /**
|
---|
| 136 | * @brief RTC Date structure definition
|
---|
| 137 | */
|
---|
| 138 | typedef struct
|
---|
| 139 | {
|
---|
| 140 | uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay.
|
---|
| 141 | This parameter can be a value of @ref RTC_WeekDay_Definitions */
|
---|
| 142 |
|
---|
| 143 | uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format).
|
---|
| 144 | This parameter can be a value of @ref RTC_Month_Date_Definitions */
|
---|
| 145 |
|
---|
| 146 | uint8_t Date; /*!< Specifies the RTC Date.
|
---|
| 147 | This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
|
---|
| 148 |
|
---|
| 149 | uint8_t Year; /*!< Specifies the RTC Date Year.
|
---|
| 150 | This parameter must be a number between Min_Data = 0 and Max_Data = 99 */
|
---|
| 151 |
|
---|
| 152 | }RTC_DateTypeDef;
|
---|
| 153 |
|
---|
| 154 | /**
|
---|
| 155 | * @brief RTC Alarm structure definition
|
---|
| 156 | */
|
---|
| 157 | typedef struct
|
---|
| 158 | {
|
---|
| 159 | RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */
|
---|
| 160 |
|
---|
| 161 | uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks.
|
---|
| 162 | This parameter can be a value of @ref RTC_AlarmMask_Definitions */
|
---|
| 163 |
|
---|
| 164 | uint32_t AlarmSubSecondMask; /*!< Specifies the RTC Alarm SubSeconds Masks.
|
---|
| 165 | This parameter can be a value of @ref RTC_Alarm_Sub_Seconds_Masks_Definitions */
|
---|
| 166 |
|
---|
| 167 | uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on Date or WeekDay.
|
---|
| 168 | This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */
|
---|
| 169 |
|
---|
| 170 | uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Date/WeekDay.
|
---|
| 171 | If the Alarm Date is selected, this parameter must be set to a value in the 1-31 range.
|
---|
| 172 | If the Alarm WeekDay is selected, this parameter can be a value of @ref RTC_WeekDay_Definitions */
|
---|
| 173 |
|
---|
| 174 | uint32_t Alarm; /*!< Specifies the alarm .
|
---|
| 175 | This parameter can be a value of @ref RTC_Alarms_Definitions */
|
---|
| 176 | }RTC_AlarmTypeDef;
|
---|
| 177 |
|
---|
| 178 | /**
|
---|
| 179 | * @brief RTC Handle Structure definition
|
---|
| 180 | */
|
---|
| 181 | typedef struct
|
---|
| 182 | {
|
---|
| 183 | RTC_TypeDef *Instance; /*!< Register base address */
|
---|
| 184 |
|
---|
| 185 | RTC_InitTypeDef Init; /*!< RTC required parameters */
|
---|
| 186 |
|
---|
| 187 | HAL_LockTypeDef Lock; /*!< RTC locking object */
|
---|
| 188 |
|
---|
| 189 | __IO HAL_RTCStateTypeDef State; /*!< Time communication state */
|
---|
| 190 |
|
---|
| 191 | }RTC_HandleTypeDef;
|
---|
| 192 |
|
---|
| 193 | /**
|
---|
| 194 | * @}
|
---|
| 195 | */
|
---|
| 196 |
|
---|
| 197 | /* Exported constants --------------------------------------------------------*/
|
---|
| 198 | /** @defgroup RTC_Exported_Constants RTC Exported Constants
|
---|
| 199 | * @{
|
---|
| 200 | */
|
---|
| 201 |
|
---|
| 202 | /** @defgroup RTC_Hour_Formats RTC Hour Formats
|
---|
| 203 | * @{
|
---|
| 204 | */
|
---|
| 205 | #define RTC_HOURFORMAT_24 ((uint32_t)0x00000000)
|
---|
| 206 | #define RTC_HOURFORMAT_12 ((uint32_t)0x00000040)
|
---|
| 207 | /**
|
---|
| 208 | * @}
|
---|
| 209 | */
|
---|
| 210 |
|
---|
| 211 | /** @defgroup RTC_Output_selection_Definitions RTC Output Selection Definitions
|
---|
| 212 | * @{
|
---|
| 213 | */
|
---|
| 214 | #define RTC_OUTPUT_DISABLE ((uint32_t)0x00000000)
|
---|
| 215 | #define RTC_OUTPUT_ALARMA ((uint32_t)0x00200000)
|
---|
| 216 | #define RTC_OUTPUT_ALARMB ((uint32_t)0x00400000)
|
---|
| 217 | #define RTC_OUTPUT_WAKEUP ((uint32_t)0x00600000)
|
---|
| 218 | /**
|
---|
| 219 | * @}
|
---|
| 220 | */
|
---|
| 221 |
|
---|
| 222 | /** @defgroup RTC_Output_Polarity_Definitions RTC Output Polarity Definitions
|
---|
| 223 | * @{
|
---|
| 224 | */
|
---|
| 225 | #define RTC_OUTPUT_POLARITY_HIGH ((uint32_t)0x00000000)
|
---|
| 226 | #define RTC_OUTPUT_POLARITY_LOW ((uint32_t)0x00100000)
|
---|
| 227 | /**
|
---|
| 228 | * @}
|
---|
| 229 | */
|
---|
| 230 |
|
---|
| 231 | /** @defgroup RTC_Output_Type_ALARM_OUT RTC Output Type ALARM OUT
|
---|
| 232 | * @{
|
---|
| 233 | */
|
---|
| 234 | #define RTC_OUTPUT_TYPE_OPENDRAIN ((uint32_t)0x00000000)
|
---|
| 235 | #define RTC_OUTPUT_TYPE_PUSHPULL ((uint32_t)0x00040000)
|
---|
| 236 | /**
|
---|
| 237 | * @}
|
---|
| 238 | */
|
---|
| 239 |
|
---|
| 240 | /** @defgroup RTC_AM_PM_Definitions RTC AM PM Definitions
|
---|
| 241 | * @{
|
---|
| 242 | */
|
---|
| 243 | #define RTC_HOURFORMAT12_AM ((uint8_t)0x00)
|
---|
| 244 | #define RTC_HOURFORMAT12_PM ((uint8_t)0x40)
|
---|
| 245 | /**
|
---|
| 246 | * @}
|
---|
| 247 | */
|
---|
| 248 |
|
---|
| 249 | /** @defgroup RTC_DayLightSaving_Definitions RTC DayLight Saving Definitions
|
---|
| 250 | * @{
|
---|
| 251 | */
|
---|
| 252 | #define RTC_DAYLIGHTSAVING_SUB1H ((uint32_t)0x00020000)
|
---|
| 253 | #define RTC_DAYLIGHTSAVING_ADD1H ((uint32_t)0x00010000)
|
---|
| 254 | #define RTC_DAYLIGHTSAVING_NONE ((uint32_t)0x00000000)
|
---|
| 255 | /**
|
---|
| 256 | * @}
|
---|
| 257 | */
|
---|
| 258 |
|
---|
| 259 | /** @defgroup RTC_StoreOperation_Definitions RTC Store Operation Definitions
|
---|
| 260 | * @{
|
---|
| 261 | */
|
---|
| 262 | #define RTC_STOREOPERATION_RESET ((uint32_t)0x00000000)
|
---|
| 263 | #define RTC_STOREOPERATION_SET ((uint32_t)0x00040000)
|
---|
| 264 | /**
|
---|
| 265 | * @}
|
---|
| 266 | */
|
---|
| 267 |
|
---|
| 268 | /** @defgroup RTC_Input_parameter_format_definitions RTC Input Parameter Format Definitions
|
---|
| 269 | * @{
|
---|
| 270 | */
|
---|
| 271 | #define RTC_FORMAT_BIN ((uint32_t)0x000000000)
|
---|
| 272 | #define RTC_FORMAT_BCD ((uint32_t)0x000000001)
|
---|
| 273 | /**
|
---|
| 274 | * @}
|
---|
| 275 | */
|
---|
| 276 |
|
---|
| 277 | /** @defgroup RTC_Month_Date_Definitions RTC Month Date Definitions
|
---|
| 278 | * @{
|
---|
| 279 | */
|
---|
| 280 | /* Coded in BCD format */
|
---|
| 281 | #define RTC_MONTH_JANUARY ((uint8_t)0x01)
|
---|
| 282 | #define RTC_MONTH_FEBRUARY ((uint8_t)0x02)
|
---|
| 283 | #define RTC_MONTH_MARCH ((uint8_t)0x03)
|
---|
| 284 | #define RTC_MONTH_APRIL ((uint8_t)0x04)
|
---|
| 285 | #define RTC_MONTH_MAY ((uint8_t)0x05)
|
---|
| 286 | #define RTC_MONTH_JUNE ((uint8_t)0x06)
|
---|
| 287 | #define RTC_MONTH_JULY ((uint8_t)0x07)
|
---|
| 288 | #define RTC_MONTH_AUGUST ((uint8_t)0x08)
|
---|
| 289 | #define RTC_MONTH_SEPTEMBER ((uint8_t)0x09)
|
---|
| 290 | #define RTC_MONTH_OCTOBER ((uint8_t)0x10)
|
---|
| 291 | #define RTC_MONTH_NOVEMBER ((uint8_t)0x11)
|
---|
| 292 | #define RTC_MONTH_DECEMBER ((uint8_t)0x12)
|
---|
| 293 | /**
|
---|
| 294 | * @}
|
---|
| 295 | */
|
---|
| 296 |
|
---|
| 297 | /** @defgroup RTC_WeekDay_Definitions RTC WeekDay Definitions
|
---|
| 298 | * @{
|
---|
| 299 | */
|
---|
| 300 | #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01)
|
---|
| 301 | #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02)
|
---|
| 302 | #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03)
|
---|
| 303 | #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04)
|
---|
| 304 | #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05)
|
---|
| 305 | #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06)
|
---|
| 306 | #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x07)
|
---|
| 307 | /**
|
---|
| 308 | * @}
|
---|
| 309 | */
|
---|
| 310 |
|
---|
| 311 | /** @defgroup RTC_AlarmDateWeekDay_Definitions RTC Alarm Date WeekDay Definitions
|
---|
| 312 | * @{
|
---|
| 313 | */
|
---|
| 314 | #define RTC_ALARMDATEWEEKDAYSEL_DATE ((uint32_t)0x00000000)
|
---|
| 315 | #define RTC_ALARMDATEWEEKDAYSEL_WEEKDAY ((uint32_t)0x40000000)
|
---|
| 316 | /**
|
---|
| 317 | * @}
|
---|
| 318 | */
|
---|
| 319 |
|
---|
| 320 | /** @defgroup RTC_AlarmMask_Definitions RTC Alarm Mask Definitions
|
---|
| 321 | * @{
|
---|
| 322 | */
|
---|
| 323 | #define RTC_ALARMMASK_NONE ((uint32_t)0x00000000)
|
---|
| 324 | #define RTC_ALARMMASK_DATEWEEKDAY RTC_ALRMAR_MSK4
|
---|
| 325 | #define RTC_ALARMMASK_HOURS RTC_ALRMAR_MSK3
|
---|
| 326 | #define RTC_ALARMMASK_MINUTES RTC_ALRMAR_MSK2
|
---|
| 327 | #define RTC_ALARMMASK_SECONDS RTC_ALRMAR_MSK1
|
---|
| 328 | #define RTC_ALARMMASK_ALL ((uint32_t)0x80808080)
|
---|
| 329 | /**
|
---|
| 330 | * @}
|
---|
| 331 | */
|
---|
| 332 |
|
---|
| 333 | /** @defgroup RTC_Alarms_Definitions RTC Alarms Definitions
|
---|
| 334 | * @{
|
---|
| 335 | */
|
---|
| 336 | #define RTC_ALARM_A RTC_CR_ALRAE
|
---|
| 337 | #define RTC_ALARM_B RTC_CR_ALRBE
|
---|
| 338 | /**
|
---|
| 339 | * @}
|
---|
| 340 | */
|
---|
| 341 |
|
---|
| 342 | /** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions RTC Alarm Sub Seconds Masks Definitions
|
---|
| 343 | * @{
|
---|
| 344 | */
|
---|
| 345 | #define RTC_ALARMSUBSECONDMASK_ALL ((uint32_t)0x00000000) /*!< All Alarm SS fields are masked.
|
---|
| 346 | There is no comparison on sub seconds
|
---|
| 347 | for Alarm */
|
---|
| 348 | #define RTC_ALARMSUBSECONDMASK_SS14_1 ((uint32_t)0x01000000) /*!< SS[14:1] are don't care in Alarm
|
---|
| 349 | comparison. Only SS[0] is compared. */
|
---|
| 350 | #define RTC_ALARMSUBSECONDMASK_SS14_2 ((uint32_t)0x02000000) /*!< SS[14:2] are don't care in Alarm
|
---|
| 351 | comparison. Only SS[1:0] are compared */
|
---|
| 352 | #define RTC_ALARMSUBSECONDMASK_SS14_3 ((uint32_t)0x03000000) /*!< SS[14:3] are don't care in Alarm
|
---|
| 353 | comparison. Only SS[2:0] are compared */
|
---|
| 354 | #define RTC_ALARMSUBSECONDMASK_SS14_4 ((uint32_t)0x04000000) /*!< SS[14:4] are don't care in Alarm
|
---|
| 355 | comparison. Only SS[3:0] are compared */
|
---|
| 356 | #define RTC_ALARMSUBSECONDMASK_SS14_5 ((uint32_t)0x05000000) /*!< SS[14:5] are don't care in Alarm
|
---|
| 357 | comparison. Only SS[4:0] are compared */
|
---|
| 358 | #define RTC_ALARMSUBSECONDMASK_SS14_6 ((uint32_t)0x06000000) /*!< SS[14:6] are don't care in Alarm
|
---|
| 359 | comparison. Only SS[5:0] are compared */
|
---|
| 360 | #define RTC_ALARMSUBSECONDMASK_SS14_7 ((uint32_t)0x07000000) /*!< SS[14:7] are don't care in Alarm
|
---|
| 361 | comparison. Only SS[6:0] are compared */
|
---|
| 362 | #define RTC_ALARMSUBSECONDMASK_SS14_8 ((uint32_t)0x08000000) /*!< SS[14:8] are don't care in Alarm
|
---|
| 363 | comparison. Only SS[7:0] are compared */
|
---|
| 364 | #define RTC_ALARMSUBSECONDMASK_SS14_9 ((uint32_t)0x09000000) /*!< SS[14:9] are don't care in Alarm
|
---|
| 365 | comparison. Only SS[8:0] are compared */
|
---|
| 366 | #define RTC_ALARMSUBSECONDMASK_SS14_10 ((uint32_t)0x0A000000) /*!< SS[14:10] are don't care in Alarm
|
---|
| 367 | comparison. Only SS[9:0] are compared */
|
---|
| 368 | #define RTC_ALARMSUBSECONDMASK_SS14_11 ((uint32_t)0x0B000000) /*!< SS[14:11] are don't care in Alarm
|
---|
| 369 | comparison. Only SS[10:0] are compared */
|
---|
| 370 | #define RTC_ALARMSUBSECONDMASK_SS14_12 ((uint32_t)0x0C000000) /*!< SS[14:12] are don't care in Alarm
|
---|
| 371 | comparison.Only SS[11:0] are compared */
|
---|
| 372 | #define RTC_ALARMSUBSECONDMASK_SS14_13 ((uint32_t)0x0D000000) /*!< SS[14:13] are don't care in Alarm
|
---|
| 373 | comparison. Only SS[12:0] are compared */
|
---|
| 374 | #define RTC_ALARMSUBSECONDMASK_SS14 ((uint32_t)0x0E000000) /*!< SS[14] is don't care in Alarm
|
---|
| 375 | comparison.Only SS[13:0] are compared */
|
---|
| 376 | #define RTC_ALARMSUBSECONDMASK_NONE ((uint32_t)0x0F000000) /*!< SS[14:0] are compared and must match
|
---|
| 377 | to activate alarm. */
|
---|
| 378 | /**
|
---|
| 379 | * @}
|
---|
| 380 | */
|
---|
| 381 |
|
---|
| 382 | /** @defgroup RTC_Interrupts_Definitions RTC Interrupts Definitions
|
---|
| 383 | * @{
|
---|
| 384 | */
|
---|
| 385 | #define RTC_IT_TS ((uint32_t)0x00008000)
|
---|
| 386 | #define RTC_IT_WUT ((uint32_t)0x00004000)
|
---|
| 387 | #define RTC_IT_ALRB ((uint32_t)0x00002000)
|
---|
| 388 | #define RTC_IT_ALRA ((uint32_t)0x00001000)
|
---|
| 389 | #define RTC_IT_TAMP ((uint32_t)0x00000004) /* Used only to Enable the Tamper Interrupt */
|
---|
| 390 | #define RTC_IT_TAMP1 ((uint32_t)0x00020000)
|
---|
| 391 | #define RTC_IT_TAMP2 ((uint32_t)0x00040000)
|
---|
| 392 | /**
|
---|
| 393 | * @}
|
---|
| 394 | */
|
---|
| 395 |
|
---|
| 396 | /** @defgroup RTC_Flags_Definitions RTC Flags Definitions
|
---|
| 397 | * @{
|
---|
| 398 | */
|
---|
| 399 | #define RTC_FLAG_RECALPF ((uint32_t)0x00010000)
|
---|
| 400 | #define RTC_FLAG_TAMP2F ((uint32_t)0x00004000)
|
---|
| 401 | #define RTC_FLAG_TAMP1F ((uint32_t)0x00002000)
|
---|
| 402 | #define RTC_FLAG_TSOVF ((uint32_t)0x00001000)
|
---|
| 403 | #define RTC_FLAG_TSF ((uint32_t)0x00000800)
|
---|
| 404 | #define RTC_FLAG_WUTF ((uint32_t)0x00000400)
|
---|
| 405 | #define RTC_FLAG_ALRBF ((uint32_t)0x00000200)
|
---|
| 406 | #define RTC_FLAG_ALRAF ((uint32_t)0x00000100)
|
---|
| 407 | #define RTC_FLAG_INITF ((uint32_t)0x00000040)
|
---|
| 408 | #define RTC_FLAG_RSF ((uint32_t)0x00000020)
|
---|
| 409 | #define RTC_FLAG_INITS ((uint32_t)0x00000010)
|
---|
| 410 | #define RTC_FLAG_SHPF ((uint32_t)0x00000008)
|
---|
| 411 | #define RTC_FLAG_WUTWF ((uint32_t)0x00000004)
|
---|
| 412 | #define RTC_FLAG_ALRBWF ((uint32_t)0x00000002)
|
---|
| 413 | #define RTC_FLAG_ALRAWF ((uint32_t)0x00000001)
|
---|
| 414 | /**
|
---|
| 415 | * @}
|
---|
| 416 | */
|
---|
| 417 |
|
---|
| 418 | /**
|
---|
| 419 | * @}
|
---|
| 420 | */
|
---|
| 421 |
|
---|
| 422 | /* Exported macro ------------------------------------------------------------*/
|
---|
| 423 | /** @defgroup RTC_Exported_Macros RTC Exported Macros
|
---|
| 424 | * @{
|
---|
| 425 | */
|
---|
| 426 |
|
---|
| 427 | /** @brief Reset RTC handle state
|
---|
| 428 | * @param __HANDLE__: specifies the RTC handle.
|
---|
| 429 | * @retval None
|
---|
| 430 | */
|
---|
| 431 | #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET)
|
---|
| 432 |
|
---|
| 433 | /**
|
---|
| 434 | * @brief Disable the write protection for RTC registers.
|
---|
| 435 | * @param __HANDLE__: specifies the RTC handle.
|
---|
| 436 | * @retval None
|
---|
| 437 | */
|
---|
| 438 | #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) \
|
---|
| 439 | do{ \
|
---|
| 440 | (__HANDLE__)->Instance->WPR = 0xCA; \
|
---|
| 441 | (__HANDLE__)->Instance->WPR = 0x53; \
|
---|
| 442 | } while(0)
|
---|
| 443 |
|
---|
| 444 | /**
|
---|
| 445 | * @brief Enable the write protection for RTC registers.
|
---|
| 446 | * @param __HANDLE__: specifies the RTC handle.
|
---|
| 447 | * @retval None
|
---|
| 448 | */
|
---|
| 449 | #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) \
|
---|
| 450 | do{ \
|
---|
| 451 | (__HANDLE__)->Instance->WPR = 0xFF; \
|
---|
| 452 | } while(0)
|
---|
| 453 |
|
---|
| 454 | /**
|
---|
| 455 | * @brief Enable the RTC ALARMA peripheral.
|
---|
| 456 | * @param __HANDLE__: specifies the RTC handle.
|
---|
| 457 | * @retval None
|
---|
| 458 | */
|
---|
| 459 | #define __HAL_RTC_ALARMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRAE))
|
---|
| 460 |
|
---|
| 461 | /**
|
---|
| 462 | * @brief Disable the RTC ALARMA peripheral.
|
---|
| 463 | * @param __HANDLE__: specifies the RTC handle.
|
---|
| 464 | * @retval None
|
---|
| 465 | */
|
---|
| 466 | #define __HAL_RTC_ALARMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRAE))
|
---|
| 467 |
|
---|
| 468 | /**
|
---|
| 469 | * @brief Enable the RTC ALARMB peripheral.
|
---|
| 470 | * @param __HANDLE__: specifies the RTC handle.
|
---|
| 471 | * @retval None
|
---|
| 472 | */
|
---|
| 473 | #define __HAL_RTC_ALARMB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRBE))
|
---|
| 474 |
|
---|
| 475 | /**
|
---|
| 476 | * @brief Disable the RTC ALARMB peripheral.
|
---|
| 477 | * @param __HANDLE__: specifies the RTC handle.
|
---|
| 478 | * @retval None
|
---|
| 479 | */
|
---|
| 480 | #define __HAL_RTC_ALARMB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRBE))
|
---|
| 481 |
|
---|
| 482 | /**
|
---|
| 483 | * @brief Enable the RTC Alarm interrupt.
|
---|
| 484 | * @param __HANDLE__: specifies the RTC handle.
|
---|
| 485 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
|
---|
| 486 | * This parameter can be any combination of the following values:
|
---|
| 487 | * @arg RTC_IT_ALRA: Alarm A interrupt
|
---|
| 488 | * @arg RTC_IT_ALRB: Alarm B interrupt
|
---|
| 489 | * @retval None
|
---|
| 490 | */
|
---|
| 491 | #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
|
---|
| 492 |
|
---|
| 493 | /**
|
---|
| 494 | * @brief Disable the RTC Alarm interrupt.
|
---|
| 495 | * @param __HANDLE__: specifies the RTC handle.
|
---|
| 496 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
|
---|
| 497 | * This parameter can be any combination of the following values:
|
---|
| 498 | * @arg RTC_IT_ALRA: Alarm A interrupt
|
---|
| 499 | * @arg RTC_IT_ALRB: Alarm B interrupt
|
---|
| 500 | * @retval None
|
---|
| 501 | */
|
---|
| 502 | #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
|
---|
| 503 |
|
---|
| 504 | /**
|
---|
| 505 | * @brief Check whether the specified RTC Alarm interrupt has occurred or not.
|
---|
| 506 | * @param __HANDLE__: specifies the RTC handle.
|
---|
| 507 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt to check.
|
---|
| 508 | * This parameter can be:
|
---|
| 509 | * @arg RTC_IT_ALRA: Alarm A interrupt
|
---|
| 510 | * @arg RTC_IT_ALRB: Alarm B interrupt
|
---|
| 511 | * @retval None
|
---|
| 512 | */
|
---|
| 513 | #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR)& ((__INTERRUPT__)>> 4)) != RESET)? SET : RESET)
|
---|
| 514 |
|
---|
| 515 | /**
|
---|
| 516 | * @brief Get the selected RTC Alarm's flag status.
|
---|
| 517 | * @param __HANDLE__: specifies the RTC handle.
|
---|
| 518 | * @param __FLAG__: specifies the RTC Alarm Flag to check.
|
---|
| 519 | * This parameter can be:
|
---|
| 520 | * @arg RTC_FLAG_ALRAF
|
---|
| 521 | * @arg RTC_FLAG_ALRBF
|
---|
| 522 | * @arg RTC_FLAG_ALRAWF
|
---|
| 523 | * @arg RTC_FLAG_ALRBWF
|
---|
| 524 | * @retval None
|
---|
| 525 | */
|
---|
| 526 | #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
|
---|
| 527 |
|
---|
| 528 | /**
|
---|
| 529 | * @brief Clear the RTC Alarm's pending flags.
|
---|
| 530 | * @param __HANDLE__: specifies the RTC handle.
|
---|
| 531 | * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
|
---|
| 532 | * This parameter can be:
|
---|
| 533 | * @arg RTC_FLAG_ALRAF
|
---|
| 534 | * @arg RTC_FLAG_ALRBF
|
---|
| 535 | * @retval None
|
---|
| 536 | */
|
---|
| 537 | #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
|
---|
| 538 |
|
---|
| 539 |
|
---|
| 540 | /**
|
---|
| 541 | * @brief Check whether the specified RTC Alarm interrupt has been enabled or not.
|
---|
| 542 | * @param __HANDLE__: specifies the RTC handle.
|
---|
| 543 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check.
|
---|
| 544 | * This parameter can be:
|
---|
| 545 | * @arg RTC_IT_ALRA: Alarm A interrupt
|
---|
| 546 | * @arg RTC_IT_ALRB: Alarm B interrupt
|
---|
| 547 | * @retval None
|
---|
| 548 | */
|
---|
| 549 | #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
|
---|
| 550 |
|
---|
| 551 | /**
|
---|
| 552 | * @brief Enable interrupt on the RTC Alarm associated Exti line.
|
---|
| 553 | * @retval None
|
---|
| 554 | */
|
---|
| 555 | #define __HAL_RTC_ALARM_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_ALARM_EVENT)
|
---|
| 556 |
|
---|
| 557 | /**
|
---|
| 558 | * @brief Disable interrupt on the RTC Alarm associated Exti line.
|
---|
| 559 | * @retval None
|
---|
| 560 | */
|
---|
| 561 | #define __HAL_RTC_ALARM_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
|
---|
| 562 |
|
---|
| 563 | /**
|
---|
| 564 | * @brief Enable event on the RTC Alarm associated Exti line.
|
---|
| 565 | * @retval None.
|
---|
| 566 | */
|
---|
| 567 | #define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_ALARM_EVENT)
|
---|
| 568 |
|
---|
| 569 | /**
|
---|
| 570 | * @brief Disable event on the RTC Alarm associated Exti line.
|
---|
| 571 | * @retval None.
|
---|
| 572 | */
|
---|
| 573 | #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
|
---|
| 574 |
|
---|
| 575 | /**
|
---|
| 576 | * @brief Enable falling edge trigger on the RTC Alarm associated Exti line.
|
---|
| 577 | * @retval None.
|
---|
| 578 | */
|
---|
| 579 | #define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_ALARM_EVENT)
|
---|
| 580 |
|
---|
| 581 | /**
|
---|
| 582 | * @brief Disable falling edge trigger on the RTC Alarm associated Exti line.
|
---|
| 583 | * @retval None.
|
---|
| 584 | */
|
---|
| 585 | #define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
|
---|
| 586 |
|
---|
| 587 | /**
|
---|
| 588 | * @brief Enable rising edge trigger on the RTC Alarm associated Exti line.
|
---|
| 589 | * @retval None.
|
---|
| 590 | */
|
---|
| 591 | #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_ALARM_EVENT)
|
---|
| 592 |
|
---|
| 593 | /**
|
---|
| 594 | * @brief Disable rising edge trigger on the RTC Alarm associated Exti line.
|
---|
| 595 | * @retval None.
|
---|
| 596 | */
|
---|
| 597 | #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
|
---|
| 598 |
|
---|
| 599 | /**
|
---|
| 600 | * @brief Enable rising & falling edge trigger on the RTC Alarm associated Exti line.
|
---|
| 601 | * @retval None.
|
---|
| 602 | */
|
---|
| 603 | #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE();
|
---|
| 604 |
|
---|
| 605 | /**
|
---|
| 606 | * @brief Disable rising & falling edge trigger on the RTC Alarm associated Exti line.
|
---|
| 607 | * @retval None.
|
---|
| 608 | */
|
---|
| 609 | #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE();
|
---|
| 610 |
|
---|
| 611 | /**
|
---|
| 612 | * @brief Check whether the RTC Alarm associated Exti line interrupt flag is set or not.
|
---|
| 613 | * @retval Line Status.
|
---|
| 614 | */
|
---|
| 615 | #define __HAL_RTC_ALARM_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_ALARM_EVENT)
|
---|
| 616 |
|
---|
| 617 | /**
|
---|
| 618 | * @brief Clear the RTC Alarm associated Exti line flag.
|
---|
| 619 | * @retval None.
|
---|
| 620 | */
|
---|
| 621 | #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_ALARM_EVENT)
|
---|
| 622 |
|
---|
| 623 | /**
|
---|
| 624 | * @brief Generate a Software interrupt on RTC Alarm associated Exti line.
|
---|
| 625 | * @retval None.
|
---|
| 626 | */
|
---|
| 627 | #define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_ALARM_EVENT)
|
---|
| 628 | /**
|
---|
| 629 | * @}
|
---|
| 630 | */
|
---|
| 631 |
|
---|
| 632 | /* Include RTC HAL Extension module */
|
---|
| 633 | #include "stm32f4xx_hal_rtc_ex.h"
|
---|
| 634 |
|
---|
| 635 | /* Exported functions --------------------------------------------------------*/
|
---|
| 636 | /** @addtogroup RTC_Exported_Functions
|
---|
| 637 | * @{
|
---|
| 638 | */
|
---|
| 639 |
|
---|
| 640 | /** @addtogroup RTC_Exported_Functions_Group1
|
---|
| 641 | * @{
|
---|
| 642 | */
|
---|
| 643 | /* Initialization and de-initialization functions ****************************/
|
---|
| 644 | HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc);
|
---|
| 645 | HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc);
|
---|
| 646 | void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc);
|
---|
| 647 | void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc);
|
---|
| 648 | /**
|
---|
| 649 | * @}
|
---|
| 650 | */
|
---|
| 651 |
|
---|
| 652 | /** @addtogroup RTC_Exported_Functions_Group2
|
---|
| 653 | * @{
|
---|
| 654 | */
|
---|
| 655 | /* RTC Time and Date functions ************************************************/
|
---|
| 656 | HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
|
---|
| 657 | HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
|
---|
| 658 | HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
|
---|
| 659 | HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
|
---|
| 660 | /**
|
---|
| 661 | * @}
|
---|
| 662 | */
|
---|
| 663 |
|
---|
| 664 | /** @addtogroup RTC_Exported_Functions_Group3
|
---|
| 665 | * @{
|
---|
| 666 | */
|
---|
| 667 | /* RTC Alarm functions ********************************************************/
|
---|
| 668 | HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
|
---|
| 669 | HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
|
---|
| 670 | HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm);
|
---|
| 671 | HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format);
|
---|
| 672 | void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc);
|
---|
| 673 | HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
|
---|
| 674 | void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc);
|
---|
| 675 | /**
|
---|
| 676 | * @}
|
---|
| 677 | */
|
---|
| 678 |
|
---|
| 679 | /** @addtogroup RTC_Exported_Functions_Group4
|
---|
| 680 | * @{
|
---|
| 681 | */
|
---|
| 682 | /* Peripheral Control functions ***********************************************/
|
---|
| 683 | HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc);
|
---|
| 684 | /**
|
---|
| 685 | * @}
|
---|
| 686 | */
|
---|
| 687 |
|
---|
| 688 | /** @addtogroup RTC_Exported_Functions_Group5
|
---|
| 689 | * @{
|
---|
| 690 | */
|
---|
| 691 | /* Peripheral State functions *************************************************/
|
---|
| 692 | HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
|
---|
| 693 | /**
|
---|
| 694 | * @}
|
---|
| 695 | */
|
---|
| 696 |
|
---|
| 697 | /**
|
---|
| 698 | * @}
|
---|
| 699 | */
|
---|
| 700 |
|
---|
| 701 | /* Private types -------------------------------------------------------------*/
|
---|
| 702 | /* Private variables ---------------------------------------------------------*/
|
---|
| 703 | /* Private constants ---------------------------------------------------------*/
|
---|
| 704 | /** @defgroup RTC_Private_Constants RTC Private Constants
|
---|
| 705 | * @{
|
---|
| 706 | */
|
---|
| 707 | /* Masks Definition */
|
---|
| 708 | #define RTC_TR_RESERVED_MASK ((uint32_t)0x007F7F7F)
|
---|
| 709 | #define RTC_DR_RESERVED_MASK ((uint32_t)0x00FFFF3F)
|
---|
| 710 | #define RTC_INIT_MASK ((uint32_t)0xFFFFFFFF)
|
---|
| 711 | #define RTC_RSF_MASK ((uint32_t)0xFFFFFF5F)
|
---|
| 712 | #define RTC_FLAGS_MASK ((uint32_t)(RTC_FLAG_TSOVF | RTC_FLAG_TSF | RTC_FLAG_WUTF | \
|
---|
| 713 | RTC_FLAG_ALRBF | RTC_FLAG_ALRAF | RTC_FLAG_INITF | \
|
---|
| 714 | RTC_FLAG_RSF | RTC_FLAG_INITS | RTC_FLAG_WUTWF | \
|
---|
| 715 | RTC_FLAG_ALRBWF | RTC_FLAG_ALRAWF | RTC_FLAG_TAMP1F | \
|
---|
| 716 | RTC_FLAG_RECALPF | RTC_FLAG_SHPF))
|
---|
| 717 |
|
---|
| 718 | #define RTC_TIMEOUT_VALUE 1000
|
---|
| 719 |
|
---|
| 720 | #define RTC_EXTI_LINE_ALARM_EVENT ((uint32_t)EXTI_IMR_MR17) /*!< External interrupt line 17 Connected to the RTC Alarm event */
|
---|
| 721 | /**
|
---|
| 722 | * @}
|
---|
| 723 | */
|
---|
| 724 |
|
---|
| 725 | /* Private macros ------------------------------------------------------------*/
|
---|
| 726 | /** @defgroup RTC_Private_Macros RTC Private Macros
|
---|
| 727 | * @{
|
---|
| 728 | */
|
---|
| 729 |
|
---|
| 730 | /** @defgroup RTC_IS_RTC_Definitions RTC Private macros to check input parameters
|
---|
| 731 | * @{
|
---|
| 732 | */
|
---|
| 733 | #define IS_RTC_HOUR_FORMAT(FORMAT) (((FORMAT) == RTC_HOURFORMAT_12) || \
|
---|
| 734 | ((FORMAT) == RTC_HOURFORMAT_24))
|
---|
| 735 | #define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_OUTPUT_DISABLE) || \
|
---|
| 736 | ((OUTPUT) == RTC_OUTPUT_ALARMA) || \
|
---|
| 737 | ((OUTPUT) == RTC_OUTPUT_ALARMB) || \
|
---|
| 738 | ((OUTPUT) == RTC_OUTPUT_WAKEUP))
|
---|
| 739 | #define IS_RTC_OUTPUT_POL(POL) (((POL) == RTC_OUTPUT_POLARITY_HIGH) || \
|
---|
| 740 | ((POL) == RTC_OUTPUT_POLARITY_LOW))
|
---|
| 741 | #define IS_RTC_OUTPUT_TYPE(TYPE) (((TYPE) == RTC_OUTPUT_TYPE_OPENDRAIN) || \
|
---|
| 742 | ((TYPE) == RTC_OUTPUT_TYPE_PUSHPULL))
|
---|
| 743 | #define IS_RTC_HOUR12(HOUR) (((HOUR) > (uint32_t)0) && ((HOUR) <= (uint32_t)12))
|
---|
| 744 | #define IS_RTC_HOUR24(HOUR) ((HOUR) <= (uint32_t)23)
|
---|
| 745 | #define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= (uint32_t)0x7F)
|
---|
| 746 | #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= (uint32_t)0x7FFF)
|
---|
| 747 | #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= (uint32_t)59)
|
---|
| 748 | #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= (uint32_t)59)
|
---|
| 749 |
|
---|
| 750 | #define IS_RTC_HOURFORMAT12(PM) (((PM) == RTC_HOURFORMAT12_AM) || ((PM) == RTC_HOURFORMAT12_PM))
|
---|
| 751 | #define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DAYLIGHTSAVING_SUB1H) || \
|
---|
| 752 | ((SAVE) == RTC_DAYLIGHTSAVING_ADD1H) || \
|
---|
| 753 | ((SAVE) == RTC_DAYLIGHTSAVING_NONE))
|
---|
| 754 | #define IS_RTC_STORE_OPERATION(OPERATION) (((OPERATION) == RTC_STOREOPERATION_RESET) || \
|
---|
| 755 | ((OPERATION) == RTC_STOREOPERATION_SET))
|
---|
| 756 | #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD))
|
---|
| 757 | #define IS_RTC_YEAR(YEAR) ((YEAR) <= (uint32_t)99)
|
---|
| 758 | #define IS_RTC_MONTH(MONTH) (((MONTH) >= (uint32_t)1) && ((MONTH) <= (uint32_t)12))
|
---|
| 759 | #define IS_RTC_DATE(DATE) (((DATE) >= (uint32_t)1) && ((DATE) <= (uint32_t)31))
|
---|
| 760 | #define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \
|
---|
| 761 | ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \
|
---|
| 762 | ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \
|
---|
| 763 | ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \
|
---|
| 764 | ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \
|
---|
| 765 | ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \
|
---|
| 766 | ((WEEKDAY) == RTC_WEEKDAY_SUNDAY))
|
---|
| 767 | #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) >(uint32_t) 0) && ((DATE) <= (uint32_t)31))
|
---|
| 768 | #define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \
|
---|
| 769 | ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \
|
---|
| 770 | ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \
|
---|
| 771 | ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \
|
---|
| 772 | ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \
|
---|
| 773 | ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \
|
---|
| 774 | ((WEEKDAY) == RTC_WEEKDAY_SUNDAY))
|
---|
| 775 | #define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL) (((SEL) == RTC_ALARMDATEWEEKDAYSEL_DATE) || \
|
---|
| 776 | ((SEL) == RTC_ALARMDATEWEEKDAYSEL_WEEKDAY))
|
---|
| 777 | #define IS_RTC_ALARM_MASK(MASK) (((MASK) & 0x7F7F7F7F) == (uint32_t)RESET)
|
---|
| 778 | #define IS_RTC_ALARM(ALARM) (((ALARM) == RTC_ALARM_A) || ((ALARM) == RTC_ALARM_B))
|
---|
| 779 | #define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= (uint32_t)0x00007FFF)
|
---|
| 780 |
|
---|
| 781 | #define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_ALARMSUBSECONDMASK_ALL) || \
|
---|
| 782 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_1) || \
|
---|
| 783 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_2) || \
|
---|
| 784 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_3) || \
|
---|
| 785 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_4) || \
|
---|
| 786 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_5) || \
|
---|
| 787 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_6) || \
|
---|
| 788 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_7) || \
|
---|
| 789 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_8) || \
|
---|
| 790 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_9) || \
|
---|
| 791 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_10) || \
|
---|
| 792 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_11) || \
|
---|
| 793 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_12) || \
|
---|
| 794 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_13) || \
|
---|
| 795 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14) || \
|
---|
| 796 | ((MASK) == RTC_ALARMSUBSECONDMASK_NONE))
|
---|
| 797 | /**
|
---|
| 798 | * @}
|
---|
| 799 | */
|
---|
| 800 |
|
---|
| 801 | /**
|
---|
| 802 | * @}
|
---|
| 803 | */
|
---|
| 804 |
|
---|
| 805 | /* Private functions ---------------------------------------------------------*/
|
---|
| 806 | /** @defgroup RTC_Private_Functions RTC Private Functions
|
---|
| 807 | * @{
|
---|
| 808 | */
|
---|
| 809 | HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef* hrtc);
|
---|
| 810 | uint8_t RTC_ByteToBcd2(uint8_t Value);
|
---|
| 811 | uint8_t RTC_Bcd2ToByte(uint8_t Value);
|
---|
| 812 | /**
|
---|
| 813 | * @}
|
---|
| 814 | */
|
---|
| 815 |
|
---|
| 816 | /**
|
---|
| 817 | * @}
|
---|
| 818 | */
|
---|
| 819 |
|
---|
| 820 | /**
|
---|
| 821 | * @}
|
---|
| 822 | */
|
---|
| 823 |
|
---|
| 824 | #ifdef __cplusplus
|
---|
| 825 | }
|
---|
| 826 | #endif
|
---|
| 827 |
|
---|
| 828 | #endif /* __STM32F4xx_HAL_RTC_H */
|
---|
| 829 |
|
---|
| 830 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
---|