/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h substitute line 894 extern } by }

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Jun 11 15:14:05 2014 +0100
Revision:
85:024bf7f99721
Parent:
81:7d30d6019079
Child:
90:cb3d968589d8
Release 85 of the mbed library

Main changes:

- K64F Ethernet fixes
- Updated tests
- Fixes for various mbed targets
- Code cleanup: fixed warnings, more consistent code style
- GCC support for K64F

There is a known issue with the I2C interface on some ST targets. If you
find the I2C interface problematic on your ST board, please log a bug
against this on mbed.org.

Who changed what in which revision?

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