mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
yusuke_kyo
Date:
Wed Apr 08 08:04:18 2015 +0000
Revision:
98:01a414ca7d6d
Parent:
93:e188a91d3eaa
remove SerialHalfDuplex.h

Who changed what in which revision?

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