mbed w/ spi bug fig

Dependents:   display-puck

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Fri Jun 27 07:30:09 2014 +0100
Revision:
242:7074e42da0b2
Parent:
133:d4dda5c437f0
Synchronized with git revision 124ef5e3add9e74a3221347a3fbeea7c8b3cf353

Full URL: https://github.com/mbedmicro/mbed/commit/124ef5e3add9e74a3221347a3fbeea7c8b3cf353/

[DISCO_F407VG] HAL update.

Who changed what in which revision?

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