mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

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

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

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

Import librarymbed

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

Committer:
mbed_official
Date:
Mon Sep 28 14:00:11 2015 +0100
Revision:
632:7687fb9c4f91
Parent:
385:be64abf45658
Child:
634:ac7d6880524d
Synchronized with git revision f7ce4ed029cc611121464252ff28d5e8beb895b0

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

NUCLEO_F303K8 - add support of the STM32F303K8

Who changed what in which revision?

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