my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
filartrix
Date:
Wed Apr 08 14:12:53 2015 +0000
Revision:
97:4298809c7c9e
Parent:
90:cb3d968589d8
First reale BlueNRG module for nucleo 401 board

Who changed what in which revision?

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