mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Tue Jun 24 14:45:08 2014 +0100
Revision:
237:f3da66175598
Child:
375:3d36234a1087
Synchronized with git revision 8ef659bca81f12dfc896b5a7af7c2abbd1a1b8b7

Full URL: https://github.com/mbedmicro/mbed/commit/8ef659bca81f12dfc896b5a7af7c2abbd1a1b8b7/

[NUCLEO_F334R8] Add platform files

Who changed what in which revision?

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