my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Thu Nov 27 13:33:22 2014 +0000
Revision:
92:4fc01daae5a5
Parent:
85:024bf7f99721
Child:
93:e188a91d3eaa
Release 92 of the mbed libray

Main changes:

- nRF51822: fixed pin assignment issues
- ST targets moving to the STM32Cube driver
- LPC1439: fixed serial interrupt issue
- first Cortex-A platform supported in mbed (RZ_A1H)

Who changed what in which revision?

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