mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Thu May 22 20:00:09 2014 +0100
Revision:
205:c41fc65bcfb4
Child:
218:44081b78fdc2
Synchronized with git revision ea4b6f76efab17a3f7d7777b0cc1ef05fec6d1cb

Full URL: https://github.com/mbedmicro/mbed/commit/ea4b6f76efab17a3f7d7777b0cc1ef05fec6d1cb/

[NUCLEO_F072RB] cmsis files

Who changed what in which revision?

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