Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | mjames | 1 | /** |
| 2 | ****************************************************************************** |
||
| 3 | * @file stm32f1xx_hal_rtc.h |
||
| 4 | * @author MCD Application Team |
||
| 5 | * @brief Header file of RTC HAL module. |
||
| 6 | ****************************************************************************** |
||
| 7 | * @attention |
||
| 8 | * |
||
| 9 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
||
| 10 | * |
||
| 11 | * Redistribution and use in source and binary forms, with or without modification, |
||
| 12 | * are permitted provided that the following conditions are met: |
||
| 13 | * 1. Redistributions of source code must retain the above copyright notice, |
||
| 14 | * this list of conditions and the following disclaimer. |
||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
||
| 16 | * this list of conditions and the following disclaimer in the documentation |
||
| 17 | * and/or other materials provided with the distribution. |
||
| 18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
||
| 19 | * may be used to endorse or promote products derived from this software |
||
| 20 | * without specific prior written permission. |
||
| 21 | * |
||
| 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
| 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
| 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
| 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
||
| 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||
| 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
||
| 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
||
| 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
||
| 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||
| 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
| 32 | * |
||
| 33 | ****************************************************************************** |
||
| 34 | */ |
||
| 35 | |||
| 36 | /* Define to prevent recursive inclusion -------------------------------------*/ |
||
| 37 | #ifndef __STM32F1xx_HAL_RTC_H |
||
| 38 | #define __STM32F1xx_HAL_RTC_H |
||
| 39 | |||
| 40 | #ifdef __cplusplus |
||
| 41 | extern "C" { |
||
| 42 | #endif |
||
| 43 | |||
| 44 | /* Includes ------------------------------------------------------------------*/ |
||
| 45 | #include "stm32f1xx_hal_def.h" |
||
| 46 | |||
| 47 | /** @addtogroup STM32F1xx_HAL_Driver |
||
| 48 | * @{ |
||
| 49 | */ |
||
| 50 | |||
| 51 | /** @addtogroup RTC |
||
| 52 | * @{ |
||
| 53 | */ |
||
| 54 | |||
| 55 | /** @addtogroup RTC_Private_Macros |
||
| 56 | * @{ |
||
| 57 | */ |
||
| 58 | |||
| 59 | #define IS_RTC_ASYNCH_PREDIV(PREDIV) (((PREDIV) <= 0xFFFFFU) || ((PREDIV) == RTC_AUTO_1_SECOND)) |
||
| 60 | #define IS_RTC_HOUR24(HOUR) ((HOUR) <= 23U) |
||
| 61 | #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= 59U) |
||
| 62 | #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= 59U) |
||
| 63 | #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD)) |
||
| 64 | #define IS_RTC_YEAR(YEAR) ((YEAR) <= 99U) |
||
| 65 | #define IS_RTC_MONTH(MONTH) (((MONTH) >= 1U) && ((MONTH) <= 12U)) |
||
| 66 | #define IS_RTC_DATE(DATE) (((DATE) >= 1U) && ((DATE) <= 31U)) |
||
| 67 | #define IS_RTC_ALARM(ALARM) ((ALARM) == RTC_ALARM_A) |
||
| 68 | #define IS_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == RTC_OUTPUTSOURCE_NONE) || \ |
||
| 69 | ((__OUTPUT__) == RTC_OUTPUTSOURCE_CALIBCLOCK) || \ |
||
| 70 | ((__OUTPUT__) == RTC_OUTPUTSOURCE_ALARM) || \ |
||
| 71 | ((__OUTPUT__) == RTC_OUTPUTSOURCE_SECOND)) |
||
| 72 | |||
| 73 | |||
| 74 | /** |
||
| 75 | * @} |
||
| 76 | */ |
||
| 77 | |||
| 78 | /** @addtogroup RTC_Private_Constants |
||
| 79 | * @{ |
||
| 80 | */ |
||
| 81 | /** @defgroup RTC_Timeout_Value Default Timeout Value |
||
| 82 | * @{ |
||
| 83 | */ |
||
| 84 | #define RTC_TIMEOUT_VALUE 1000U |
||
| 85 | /** |
||
| 86 | * @} |
||
| 87 | */ |
||
| 88 | |||
| 89 | /** @defgroup RTC_EXTI_Line_Event RTC EXTI Line event |
||
| 90 | * @{ |
||
| 91 | */ |
||
| 92 | #define RTC_EXTI_LINE_ALARM_EVENT ((uint32_t)EXTI_IMR_MR17) /*!< External interrupt line 17 Connected to the RTC Alarm event */ |
||
| 93 | /** |
||
| 94 | * @} |
||
| 95 | */ |
||
| 96 | |||
| 97 | |||
| 98 | /** |
||
| 99 | * @} |
||
| 100 | */ |
||
| 101 | |||
| 102 | /* Exported types ------------------------------------------------------------*/ |
||
| 103 | /** @defgroup RTC_Exported_Types RTC Exported Types |
||
| 104 | * @{ |
||
| 105 | */ |
||
| 106 | /** |
||
| 107 | * @brief RTC Time structure definition |
||
| 108 | */ |
||
| 109 | typedef struct |
||
| 110 | { |
||
| 111 | uint8_t Hours; /*!< Specifies the RTC Time Hour. |
||
| 112 | This parameter must be a number between Min_Data = 0 and Max_Data = 23 */ |
||
| 113 | |||
| 114 | uint8_t Minutes; /*!< Specifies the RTC Time Minutes. |
||
| 115 | This parameter must be a number between Min_Data = 0 and Max_Data = 59 */ |
||
| 116 | |||
| 117 | uint8_t Seconds; /*!< Specifies the RTC Time Seconds. |
||
| 118 | This parameter must be a number between Min_Data = 0 and Max_Data = 59 */ |
||
| 119 | |||
| 120 | }RTC_TimeTypeDef; |
||
| 121 | |||
| 122 | /** |
||
| 123 | * @brief RTC Alarm structure definition |
||
| 124 | */ |
||
| 125 | typedef struct |
||
| 126 | { |
||
| 127 | RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */ |
||
| 128 | |||
| 129 | uint32_t Alarm; /*!< Specifies the alarm ID (only 1 alarm ID for STM32F1). |
||
| 130 | This parameter can be a value of @ref RTC_Alarms_Definitions */ |
||
| 131 | }RTC_AlarmTypeDef; |
||
| 132 | |||
| 133 | /** |
||
| 134 | * @brief HAL State structures definition |
||
| 135 | */ |
||
| 136 | typedef enum |
||
| 137 | { |
||
| 138 | HAL_RTC_STATE_RESET = 0x00U, /*!< RTC not yet initialized or disabled */ |
||
| 139 | HAL_RTC_STATE_READY = 0x01U, /*!< RTC initialized and ready for use */ |
||
| 140 | HAL_RTC_STATE_BUSY = 0x02U, /*!< RTC process is ongoing */ |
||
| 141 | HAL_RTC_STATE_TIMEOUT = 0x03U, /*!< RTC timeout state */ |
||
| 142 | HAL_RTC_STATE_ERROR = 0x04U /*!< RTC error state */ |
||
| 143 | |||
| 144 | }HAL_RTCStateTypeDef; |
||
| 145 | |||
| 146 | /** |
||
| 147 | * @brief RTC Configuration Structure definition |
||
| 148 | */ |
||
| 149 | typedef struct |
||
| 150 | { |
||
| 151 | uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value. |
||
| 152 | This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFFF or RTC_AUTO_1_SECOND |
||
| 153 | If RTC_AUTO_1_SECOND is selected, AsynchPrediv will be set automatically to get 1sec timebase */ |
||
| 154 | |||
| 155 | uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC Tamper pin. |
||
| 156 | This parameter can be a value of @ref RTC_output_source_to_output_on_the_Tamper_pin */ |
||
| 157 | |||
| 158 | }RTC_InitTypeDef; |
||
| 159 | |||
| 160 | /** |
||
| 161 | * @brief RTC Date structure definition |
||
| 162 | */ |
||
| 163 | typedef struct |
||
| 164 | { |
||
| 165 | uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay (not necessary for HAL_RTC_SetDate). |
||
| 166 | This parameter can be a value of @ref RTC_WeekDay_Definitions */ |
||
| 167 | |||
| 168 | uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format). |
||
| 169 | This parameter can be a value of @ref RTC_Month_Date_Definitions */ |
||
| 170 | |||
| 171 | uint8_t Date; /*!< Specifies the RTC Date. |
||
| 172 | This parameter must be a number between Min_Data = 1 and Max_Data = 31 */ |
||
| 173 | |||
| 174 | uint8_t Year; /*!< Specifies the RTC Date Year. |
||
| 175 | This parameter must be a number between Min_Data = 0 and Max_Data = 99 */ |
||
| 176 | |||
| 177 | }RTC_DateTypeDef; |
||
| 178 | |||
| 179 | /** |
||
| 180 | * @brief Time Handle Structure definition |
||
| 181 | */ |
||
| 182 | typedef struct |
||
| 183 | { |
||
| 184 | RTC_TypeDef *Instance; /*!< Register base address */ |
||
| 185 | |||
| 186 | RTC_InitTypeDef Init; /*!< RTC required parameters */ |
||
| 187 | |||
| 188 | RTC_DateTypeDef DateToUpdate; /*!< Current date set by user and updated automatically */ |
||
| 189 | |||
| 190 | HAL_LockTypeDef Lock; /*!< RTC locking object */ |
||
| 191 | |||
| 192 | __IO HAL_RTCStateTypeDef State; /*!< Time communication state */ |
||
| 193 | |||
| 194 | }RTC_HandleTypeDef; |
||
| 195 | |||
| 196 | /** |
||
| 197 | * @} |
||
| 198 | */ |
||
| 199 | |||
| 200 | /* Exported constants --------------------------------------------------------*/ |
||
| 201 | /** @defgroup RTC_Exported_Constants RTC Exported Constants |
||
| 202 | * @{ |
||
| 203 | */ |
||
| 204 | |||
| 205 | /** @defgroup RTC_Automatic_Prediv_1_Second Automatic calculation of prediv for 1sec timebase |
||
| 206 | * @{ |
||
| 207 | */ |
||
| 208 | #define RTC_AUTO_1_SECOND 0xFFFFFFFFU |
||
| 209 | |||
| 210 | /** |
||
| 211 | * @} |
||
| 212 | */ |
||
| 213 | |||
| 214 | /** @defgroup RTC_Input_parameter_format_definitions Input Parameter Format |
||
| 215 | * @{ |
||
| 216 | */ |
||
| 217 | #define RTC_FORMAT_BIN 0x000000000U |
||
| 218 | #define RTC_FORMAT_BCD 0x000000001U |
||
| 219 | |||
| 220 | /** |
||
| 221 | * @} |
||
| 222 | */ |
||
| 223 | |||
| 224 | /** @defgroup RTC_Month_Date_Definitions Month Definitions |
||
| 225 | * @{ |
||
| 226 | */ |
||
| 227 | |||
| 228 | /* Coded in BCD format */ |
||
| 229 | #define RTC_MONTH_JANUARY ((uint8_t)0x01) |
||
| 230 | #define RTC_MONTH_FEBRUARY ((uint8_t)0x02) |
||
| 231 | #define RTC_MONTH_MARCH ((uint8_t)0x03) |
||
| 232 | #define RTC_MONTH_APRIL ((uint8_t)0x04) |
||
| 233 | #define RTC_MONTH_MAY ((uint8_t)0x05) |
||
| 234 | #define RTC_MONTH_JUNE ((uint8_t)0x06) |
||
| 235 | #define RTC_MONTH_JULY ((uint8_t)0x07) |
||
| 236 | #define RTC_MONTH_AUGUST ((uint8_t)0x08) |
||
| 237 | #define RTC_MONTH_SEPTEMBER ((uint8_t)0x09) |
||
| 238 | #define RTC_MONTH_OCTOBER ((uint8_t)0x10) |
||
| 239 | #define RTC_MONTH_NOVEMBER ((uint8_t)0x11) |
||
| 240 | #define RTC_MONTH_DECEMBER ((uint8_t)0x12) |
||
| 241 | |||
| 242 | /** |
||
| 243 | * @} |
||
| 244 | */ |
||
| 245 | |||
| 246 | /** @defgroup RTC_WeekDay_Definitions WeekDay Definitions |
||
| 247 | * @{ |
||
| 248 | */ |
||
| 249 | #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01) |
||
| 250 | #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02) |
||
| 251 | #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03) |
||
| 252 | #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04) |
||
| 253 | #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05) |
||
| 254 | #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06) |
||
| 255 | #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x00) |
||
| 256 | |||
| 257 | /** |
||
| 258 | * @} |
||
| 259 | */ |
||
| 260 | |||
| 261 | /** @defgroup RTC_Alarms_Definitions Alarms Definitions |
||
| 262 | * @{ |
||
| 263 | */ |
||
| 264 | #define RTC_ALARM_A 0U /*!< Specify alarm ID (mainly for legacy purposes) */ |
||
| 265 | |||
| 266 | /** |
||
| 267 | * @} |
||
| 268 | */ |
||
| 269 | |||
| 270 | |||
| 271 | /** @defgroup RTC_output_source_to_output_on_the_Tamper_pin Output source to output on the Tamper pin |
||
| 272 | * @{ |
||
| 273 | */ |
||
| 274 | |||
| 275 | #define RTC_OUTPUTSOURCE_NONE 0x00000000U /*!< No output on the TAMPER pin */ |
||
| 276 | #define RTC_OUTPUTSOURCE_CALIBCLOCK BKP_RTCCR_CCO /*!< RTC clock with a frequency divided by 64 on the TAMPER pin */ |
||
| 277 | #define RTC_OUTPUTSOURCE_ALARM BKP_RTCCR_ASOE /*!< Alarm pulse signal on the TAMPER pin */ |
||
| 278 | #define RTC_OUTPUTSOURCE_SECOND (BKP_RTCCR_ASOS | BKP_RTCCR_ASOE) /*!< Second pulse signal on the TAMPER pin */ |
||
| 279 | |||
| 280 | /** |
||
| 281 | * @} |
||
| 282 | */ |
||
| 283 | |||
| 284 | /** @defgroup RTC_Interrupts_Definitions Interrupts Definitions |
||
| 285 | * @{ |
||
| 286 | */ |
||
| 287 | #define RTC_IT_OW RTC_CRH_OWIE /*!< Overflow interrupt */ |
||
| 288 | #define RTC_IT_ALRA RTC_CRH_ALRIE /*!< Alarm interrupt */ |
||
| 289 | #define RTC_IT_SEC RTC_CRH_SECIE /*!< Second interrupt */ |
||
| 290 | #define RTC_IT_TAMP1 BKP_CSR_TPIE /*!< TAMPER Pin interrupt enable */ |
||
| 291 | /** |
||
| 292 | * @} |
||
| 293 | */ |
||
| 294 | |||
| 295 | /** @defgroup RTC_Flags_Definitions Flags Definitions |
||
| 296 | * @{ |
||
| 297 | */ |
||
| 298 | #define RTC_FLAG_RTOFF RTC_CRL_RTOFF /*!< RTC Operation OFF flag */ |
||
| 299 | #define RTC_FLAG_RSF RTC_CRL_RSF /*!< Registers Synchronized flag */ |
||
| 300 | #define RTC_FLAG_OW RTC_CRL_OWF /*!< Overflow flag */ |
||
| 301 | #define RTC_FLAG_ALRAF RTC_CRL_ALRF /*!< Alarm flag */ |
||
| 302 | #define RTC_FLAG_SEC RTC_CRL_SECF /*!< Second flag */ |
||
| 303 | #define RTC_FLAG_TAMP1F BKP_CSR_TEF /*!< Tamper Interrupt Flag */ |
||
| 304 | |||
| 305 | /** |
||
| 306 | * @} |
||
| 307 | */ |
||
| 308 | |||
| 309 | /** |
||
| 310 | * @} |
||
| 311 | */ |
||
| 312 | |||
| 313 | /* Exported macro ------------------------------------------------------------*/ |
||
| 314 | /** @defgroup RTC_Exported_macros RTC Exported Macros |
||
| 315 | * @{ |
||
| 316 | */ |
||
| 317 | |||
| 318 | /** @brief Reset RTC handle state |
||
| 319 | * @param __HANDLE__: RTC handle. |
||
| 320 | * @retval None |
||
| 321 | */ |
||
| 322 | #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET) |
||
| 323 | |||
| 324 | /** |
||
| 325 | * @brief Disable the write protection for RTC registers. |
||
| 326 | * @param __HANDLE__: specifies the RTC handle. |
||
| 327 | * @retval None |
||
| 328 | */ |
||
| 329 | #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CRL, RTC_CRL_CNF) |
||
| 330 | |||
| 331 | /** |
||
| 332 | * @brief Enable the write protection for RTC registers. |
||
| 333 | * @param __HANDLE__: specifies the RTC handle. |
||
| 334 | * @retval None |
||
| 335 | */ |
||
| 336 | #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CRL, RTC_CRL_CNF) |
||
| 337 | |||
| 338 | /** |
||
| 339 | * @brief Enable the RTC Alarm interrupt. |
||
| 340 | * @param __HANDLE__: specifies the RTC handle. |
||
| 341 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled. |
||
| 342 | * This parameter can be any combination of the following values: |
||
| 343 | * @arg RTC_IT_ALRA: Alarm A interrupt |
||
| 344 | * @retval None |
||
| 345 | */ |
||
| 346 | #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__)) |
||
| 347 | |||
| 348 | /** |
||
| 349 | * @brief Disable the RTC Alarm interrupt. |
||
| 350 | * @param __HANDLE__: specifies the RTC handle. |
||
| 351 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled. |
||
| 352 | * This parameter can be any combination of the following values: |
||
| 353 | * @arg RTC_IT_ALRA: Alarm A interrupt |
||
| 354 | * @retval None |
||
| 355 | */ |
||
| 356 | #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__)) |
||
| 357 | |||
| 358 | /** |
||
| 359 | * @brief Check whether the specified RTC Alarm interrupt has been enabled or not. |
||
| 360 | * @param __HANDLE__: specifies the RTC handle. |
||
| 361 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be checked |
||
| 362 | * This parameter can be: |
||
| 363 | * @arg RTC_IT_ALRA: Alarm A interrupt |
||
| 364 | * @retval None |
||
| 365 | */ |
||
| 366 | #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((__HANDLE__)->Instance->CRH)& ((__INTERRUPT__)))) != RESET)? SET : RESET) |
||
| 367 | |||
| 368 | /** |
||
| 369 | * @brief Get the selected RTC Alarm's flag status. |
||
| 370 | * @param __HANDLE__: specifies the RTC handle. |
||
| 371 | * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled. |
||
| 372 | * This parameter can be: |
||
| 373 | * @arg RTC_FLAG_ALRAF |
||
| 374 | * @retval None |
||
| 375 | */ |
||
| 376 | #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->CRL) & (__FLAG__)) != RESET)? SET : RESET) |
||
| 377 | |||
| 378 | /** |
||
| 379 | * @brief Check whether the specified RTC Alarm interrupt has occurred or not. |
||
| 380 | * @param __HANDLE__: specifies the RTC handle. |
||
| 381 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check. |
||
| 382 | * This parameter can be: |
||
| 383 | * @arg RTC_IT_ALRA: Alarm A interrupt |
||
| 384 | * @retval None |
||
| 385 | */ |
||
| 386 | #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CRL) & (__INTERRUPT__)) != RESET)? SET : RESET) |
||
| 387 | |||
| 388 | /** |
||
| 389 | * @brief Clear the RTC Alarm's pending flags. |
||
| 390 | * @param __HANDLE__: specifies the RTC handle. |
||
| 391 | * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled. |
||
| 392 | * This parameter can be: |
||
| 393 | * @arg RTC_FLAG_ALRAF |
||
| 394 | * @retval None |
||
| 395 | */ |
||
| 396 | #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CRL) = ~(__FLAG__) |
||
| 397 | |||
| 398 | /** |
||
| 399 | * @brief Enable interrupt on ALARM Exti Line 17. |
||
| 400 | * @retval None. |
||
| 401 | */ |
||
| 402 | #define __HAL_RTC_ALARM_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR, RTC_EXTI_LINE_ALARM_EVENT) |
||
| 403 | |||
| 404 | /** |
||
| 405 | * @brief Disable interrupt on ALARM Exti Line 17. |
||
| 406 | * @retval None. |
||
| 407 | */ |
||
| 408 | #define __HAL_RTC_ALARM_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR, RTC_EXTI_LINE_ALARM_EVENT) |
||
| 409 | |||
| 410 | /** |
||
| 411 | * @brief Enable event on ALARM Exti Line 17. |
||
| 412 | * @retval None. |
||
| 413 | */ |
||
| 414 | #define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR, RTC_EXTI_LINE_ALARM_EVENT) |
||
| 415 | |||
| 416 | /** |
||
| 417 | * @brief Disable event on ALARM Exti Line 17. |
||
| 418 | * @retval None. |
||
| 419 | */ |
||
| 420 | #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR, RTC_EXTI_LINE_ALARM_EVENT) |
||
| 421 | |||
| 422 | |||
| 423 | /** |
||
| 424 | * @brief ALARM EXTI line configuration: set falling edge trigger. |
||
| 425 | * @retval None. |
||
| 426 | */ |
||
| 427 | #define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR, RTC_EXTI_LINE_ALARM_EVENT) |
||
| 428 | |||
| 429 | |||
| 430 | /** |
||
| 431 | * @brief Disable the ALARM Extended Interrupt Falling Trigger. |
||
| 432 | * @retval None. |
||
| 433 | */ |
||
| 434 | #define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR, RTC_EXTI_LINE_ALARM_EVENT) |
||
| 435 | |||
| 436 | |||
| 437 | /** |
||
| 438 | * @brief ALARM EXTI line configuration: set rising edge trigger. |
||
| 439 | * @retval None. |
||
| 440 | */ |
||
| 441 | #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR, RTC_EXTI_LINE_ALARM_EVENT) |
||
| 442 | |||
| 443 | /** |
||
| 444 | * @brief Disable the ALARM Extended Interrupt Rising Trigger. |
||
| 445 | * This parameter can be: |
||
| 446 | * @retval None. |
||
| 447 | */ |
||
| 448 | #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR, RTC_EXTI_LINE_ALARM_EVENT) |
||
| 449 | |||
| 450 | /** |
||
| 451 | * @brief ALARM EXTI line configuration: set rising & falling edge trigger. |
||
| 452 | * @retval None. |
||
| 453 | */ |
||
| 454 | #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() \ |
||
| 455 | do{ \ |
||
| 456 | __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE(); \ |
||
| 457 | __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE(); \ |
||
| 458 | } while(0U) |
||
| 459 | |||
| 460 | /** |
||
| 461 | * @brief Disable the ALARM Extended Interrupt Rising & Falling Trigger. |
||
| 462 | * This parameter can be: |
||
| 463 | * @retval None. |
||
| 464 | */ |
||
| 465 | #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() \ |
||
| 466 | do{ \ |
||
| 467 | __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE(); \ |
||
| 468 | __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE(); \ |
||
| 469 | } while(0U) |
||
| 470 | |||
| 471 | /** |
||
| 472 | * @brief Check whether the specified ALARM EXTI interrupt flag is set or not. |
||
| 473 | * @retval EXTI ALARM Line Status. |
||
| 474 | */ |
||
| 475 | #define __HAL_RTC_ALARM_EXTI_GET_FLAG() (EXTI->PR & (RTC_EXTI_LINE_ALARM_EVENT)) |
||
| 476 | |||
| 477 | /** |
||
| 478 | * @brief Clear the ALARM EXTI flag. |
||
| 479 | * @retval None. |
||
| 480 | */ |
||
| 481 | #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI->PR = (RTC_EXTI_LINE_ALARM_EVENT)) |
||
| 482 | |||
| 483 | /** |
||
| 484 | * @brief Generate a Software interrupt on selected EXTI line. |
||
| 485 | * @retval None. |
||
| 486 | */ |
||
| 487 | #define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER, RTC_EXTI_LINE_ALARM_EVENT) |
||
| 488 | /** |
||
| 489 | * @} |
||
| 490 | */ |
||
| 491 | |||
| 492 | /* Include RTC HAL Extension module */ |
||
| 493 | #include "stm32f1xx_hal_rtc_ex.h" |
||
| 494 | |||
| 495 | /* Exported functions --------------------------------------------------------*/ |
||
| 496 | /** @addtogroup RTC_Exported_Functions |
||
| 497 | * @{ |
||
| 498 | */ |
||
| 499 | |||
| 500 | |||
| 501 | /* Initialization and de-initialization functions ****************************/ |
||
| 502 | /** @addtogroup RTC_Exported_Functions_Group1 |
||
| 503 | * @{ |
||
| 504 | */ |
||
| 505 | HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc); |
||
| 506 | HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc); |
||
| 507 | void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc); |
||
| 508 | void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc); |
||
| 509 | /** |
||
| 510 | * @} |
||
| 511 | */ |
||
| 512 | |||
| 513 | /* RTC Time and Date functions ************************************************/ |
||
| 514 | /** @addtogroup RTC_Exported_Functions_Group2 |
||
| 515 | * @{ |
||
| 516 | */ |
||
| 517 | HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format); |
||
| 518 | HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format); |
||
| 519 | HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format); |
||
| 520 | HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format); |
||
| 521 | /** |
||
| 522 | * @} |
||
| 523 | */ |
||
| 524 | |||
| 525 | /* RTC Alarm functions ********************************************************/ |
||
| 526 | /** @addtogroup RTC_Exported_Functions_Group3 |
||
| 527 | * @{ |
||
| 528 | */ |
||
| 529 | HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format); |
||
| 530 | HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format); |
||
| 531 | HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm); |
||
| 532 | HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format); |
||
| 533 | void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc); |
||
| 534 | HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); |
||
| 535 | void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc); |
||
| 536 | /** |
||
| 537 | * @} |
||
| 538 | */ |
||
| 539 | |||
| 540 | /* Peripheral State functions *************************************************/ |
||
| 541 | /** @addtogroup RTC_Exported_Functions_Group4 |
||
| 542 | * @{ |
||
| 543 | */ |
||
| 544 | HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc); |
||
| 545 | /** |
||
| 546 | * @} |
||
| 547 | */ |
||
| 548 | |||
| 549 | /* Peripheral Control functions ***********************************************/ |
||
| 550 | /** @addtogroup RTC_Exported_Functions_Group5 |
||
| 551 | * @{ |
||
| 552 | */ |
||
| 553 | HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc); |
||
| 554 | /** |
||
| 555 | * @} |
||
| 556 | */ |
||
| 557 | |||
| 558 | /** |
||
| 559 | * @} |
||
| 560 | */ |
||
| 561 | |||
| 562 | /** |
||
| 563 | * @} |
||
| 564 | */ |
||
| 565 | |||
| 566 | /** |
||
| 567 | * @} |
||
| 568 | */ |
||
| 569 | |||
| 570 | #ifdef __cplusplus |
||
| 571 | } |
||
| 572 | #endif |
||
| 573 | |||
| 574 | #endif /* __STM32F1xx_HAL_RTC_H */ |
||
| 575 | |||
| 576 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |