mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

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

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 96:487b796308b0 1 /**
Kojto 96:487b796308b0 2 ******************************************************************************
Kojto 96:487b796308b0 3 * @file stm32f1xx_hal_rtc.h
Kojto 96:487b796308b0 4 * @author MCD Application Team
Kojto 96:487b796308b0 5 * @version V1.0.0
Kojto 96:487b796308b0 6 * @date 15-December-2014
Kojto 96:487b796308b0 7 * @brief Header file of RTC HAL module.
Kojto 96:487b796308b0 8 ******************************************************************************
Kojto 96:487b796308b0 9 * @attention
Kojto 96:487b796308b0 10 *
Kojto 96:487b796308b0 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Kojto 96:487b796308b0 12 *
Kojto 96:487b796308b0 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 96:487b796308b0 14 * are permitted provided that the following conditions are met:
Kojto 96:487b796308b0 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 96:487b796308b0 16 * this list of conditions and the following disclaimer.
Kojto 96:487b796308b0 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 96:487b796308b0 18 * this list of conditions and the following disclaimer in the documentation
Kojto 96:487b796308b0 19 * and/or other materials provided with the distribution.
Kojto 96:487b796308b0 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 96:487b796308b0 21 * may be used to endorse or promote products derived from this software
Kojto 96:487b796308b0 22 * without specific prior written permission.
Kojto 96:487b796308b0 23 *
Kojto 96:487b796308b0 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 96:487b796308b0 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 96:487b796308b0 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 96:487b796308b0 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 96:487b796308b0 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 96:487b796308b0 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 96:487b796308b0 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 96:487b796308b0 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 96:487b796308b0 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 96:487b796308b0 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 96:487b796308b0 34 *
Kojto 96:487b796308b0 35 ******************************************************************************
Kojto 96:487b796308b0 36 */
Kojto 96:487b796308b0 37
Kojto 96:487b796308b0 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 96:487b796308b0 39 #ifndef __STM32F1xx_HAL_RTC_H
Kojto 96:487b796308b0 40 #define __STM32F1xx_HAL_RTC_H
Kojto 96:487b796308b0 41
Kojto 96:487b796308b0 42 #ifdef __cplusplus
Kojto 96:487b796308b0 43 extern "C" {
Kojto 96:487b796308b0 44 #endif
Kojto 96:487b796308b0 45
Kojto 96:487b796308b0 46 /* Includes ------------------------------------------------------------------*/
Kojto 96:487b796308b0 47 #include "stm32f1xx_hal_def.h"
Kojto 96:487b796308b0 48
Kojto 96:487b796308b0 49 /** @addtogroup STM32F1xx_HAL_Driver
Kojto 96:487b796308b0 50 * @{
Kojto 96:487b796308b0 51 */
Kojto 96:487b796308b0 52
Kojto 96:487b796308b0 53 /** @addtogroup RTC
Kojto 96:487b796308b0 54 * @{
Kojto 96:487b796308b0 55 */
Kojto 96:487b796308b0 56
Kojto 96:487b796308b0 57 /** @addtogroup RTC_Private_Macros
Kojto 96:487b796308b0 58 * @{
Kojto 96:487b796308b0 59 */
Kojto 96:487b796308b0 60
Kojto 96:487b796308b0 61 #define IS_RTC_ASYNCH_PREDIV(PREDIV) (((PREDIV) <= (uint32_t)0xFFFFF) || ((PREDIV) == RTC_AUTO_1_SECOND))
Kojto 96:487b796308b0 62 #define IS_RTC_HOUR24(HOUR) ((HOUR) <= (uint32_t)23)
Kojto 96:487b796308b0 63 #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= (uint32_t)59)
Kojto 96:487b796308b0 64 #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= (uint32_t)59)
Kojto 96:487b796308b0 65 #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD))
Kojto 96:487b796308b0 66 #define IS_RTC_YEAR(YEAR) ((YEAR) <= (uint32_t)99)
Kojto 96:487b796308b0 67 #define IS_RTC_MONTH(MONTH) (((MONTH) >= (uint32_t)1) && ((MONTH) <= (uint32_t)12))
Kojto 96:487b796308b0 68 #define IS_RTC_DATE(DATE) (((DATE) >= (uint32_t)1) && ((DATE) <= (uint32_t)31))
Kojto 96:487b796308b0 69 #define IS_RTC_ALARM(ALARM) ((ALARM) == RTC_ALARM_A)
Kojto 96:487b796308b0 70 #define IS_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == RTC_OUTPUTSOURCE_NONE) || \
Kojto 96:487b796308b0 71 ((__OUTPUT__) == RTC_OUTPUTSOURCE_CALIBCLOCK) || \
Kojto 96:487b796308b0 72 ((__OUTPUT__) == RTC_OUTPUTSOURCE_ALARM) || \
Kojto 96:487b796308b0 73 ((__OUTPUT__) == RTC_OUTPUTSOURCE_SECOND))
Kojto 96:487b796308b0 74
Kojto 96:487b796308b0 75
Kojto 96:487b796308b0 76 /**
Kojto 96:487b796308b0 77 * @}
Kojto 96:487b796308b0 78 */
Kojto 96:487b796308b0 79
Kojto 96:487b796308b0 80 /** @addtogroup RTC_Private_Constants
Kojto 96:487b796308b0 81 * @{
Kojto 96:487b796308b0 82 */
Kojto 96:487b796308b0 83 /** @defgroup RTC_Timeout_Value Default Timeout Value
Kojto 96:487b796308b0 84 * @{
Kojto 96:487b796308b0 85 */
Kojto 96:487b796308b0 86 #define RTC_TIMEOUT_VALUE 1000
Kojto 96:487b796308b0 87 /**
Kojto 96:487b796308b0 88 * @}
Kojto 96:487b796308b0 89 */
Kojto 96:487b796308b0 90
Kojto 96:487b796308b0 91 /** @defgroup RTC_EXTI_Line_Event RTC EXTI Line event
Kojto 96:487b796308b0 92 * @{
Kojto 96:487b796308b0 93 */
Kojto 96:487b796308b0 94 #define RTC_EXTI_LINE_ALARM_EVENT ((uint32_t)0x00020000) /*!< External interrupt line 17 Connected to the RTC Alarm event */
Kojto 96:487b796308b0 95 /**
Kojto 96:487b796308b0 96 * @}
Kojto 96:487b796308b0 97 */
Kojto 96:487b796308b0 98
Kojto 96:487b796308b0 99
Kojto 96:487b796308b0 100 /**
Kojto 96:487b796308b0 101 * @}
Kojto 96:487b796308b0 102 */
Kojto 96:487b796308b0 103
Kojto 96:487b796308b0 104 /* Exported types ------------------------------------------------------------*/
Kojto 96:487b796308b0 105 /** @defgroup RTC_Exported_Types RTC Exported Types
Kojto 96:487b796308b0 106 * @{
Kojto 96:487b796308b0 107 */
Kojto 96:487b796308b0 108 /**
Kojto 96:487b796308b0 109 * @brief RTC Time structure definition
Kojto 96:487b796308b0 110 */
Kojto 96:487b796308b0 111 typedef struct
Kojto 96:487b796308b0 112 {
Kojto 96:487b796308b0 113 uint8_t Hours; /*!< Specifies the RTC Time Hour.
Kojto 96:487b796308b0 114 This parameter must be a number between Min_Data = 0 and Max_Data = 23 */
Kojto 96:487b796308b0 115
Kojto 96:487b796308b0 116 uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
Kojto 96:487b796308b0 117 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
Kojto 96:487b796308b0 118
Kojto 96:487b796308b0 119 uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
Kojto 96:487b796308b0 120 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
Kojto 96:487b796308b0 121
Kojto 96:487b796308b0 122 }RTC_TimeTypeDef;
Kojto 96:487b796308b0 123
Kojto 96:487b796308b0 124 /**
Kojto 96:487b796308b0 125 * @brief RTC Alarm structure definition
Kojto 96:487b796308b0 126 */
Kojto 96:487b796308b0 127 typedef struct
Kojto 96:487b796308b0 128 {
Kojto 96:487b796308b0 129 RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */
Kojto 96:487b796308b0 130
Kojto 96:487b796308b0 131 uint32_t Alarm; /*!< Specifies the alarm ID (only 1 alarm ID for STM32F1).
Kojto 96:487b796308b0 132 This parameter can be a value of @ref RTC_Alarms_Definitions */
Kojto 96:487b796308b0 133 }RTC_AlarmTypeDef;
Kojto 96:487b796308b0 134
Kojto 96:487b796308b0 135 /**
Kojto 96:487b796308b0 136 * @brief HAL State structures definition
Kojto 96:487b796308b0 137 */
Kojto 96:487b796308b0 138 typedef enum
Kojto 96:487b796308b0 139 {
Kojto 96:487b796308b0 140 HAL_RTC_STATE_RESET = 0x00, /*!< RTC not yet initialized or disabled */
Kojto 96:487b796308b0 141 HAL_RTC_STATE_READY = 0x01, /*!< RTC initialized and ready for use */
Kojto 96:487b796308b0 142 HAL_RTC_STATE_BUSY = 0x02, /*!< RTC process is ongoing */
Kojto 96:487b796308b0 143 HAL_RTC_STATE_TIMEOUT = 0x03, /*!< RTC timeout state */
Kojto 96:487b796308b0 144 HAL_RTC_STATE_ERROR = 0x04 /*!< RTC error state */
Kojto 96:487b796308b0 145
Kojto 96:487b796308b0 146 }HAL_RTCStateTypeDef;
Kojto 96:487b796308b0 147
Kojto 96:487b796308b0 148 /**
Kojto 96:487b796308b0 149 * @brief RTC Configuration Structure definition
Kojto 96:487b796308b0 150 */
Kojto 96:487b796308b0 151 typedef struct
Kojto 96:487b796308b0 152 {
Kojto 96:487b796308b0 153 uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value.
Kojto 96:487b796308b0 154 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFFF or RTC_AUTO_1_SECOND
Kojto 96:487b796308b0 155 If RTC_AUTO_1_SECOND is selected, AsynchPrediv will be set automatically to get 1sec timebase */
Kojto 96:487b796308b0 156
Kojto 96:487b796308b0 157 uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC Tamper pin.
Kojto 96:487b796308b0 158 This parameter can be a value of @ref RTC_output_source_to_output_on_the_Tamper_pin */
Kojto 96:487b796308b0 159
Kojto 96:487b796308b0 160 }RTC_InitTypeDef;
Kojto 96:487b796308b0 161
Kojto 96:487b796308b0 162 /**
Kojto 96:487b796308b0 163 * @brief RTC Date structure definition
Kojto 96:487b796308b0 164 */
Kojto 96:487b796308b0 165 typedef struct
Kojto 96:487b796308b0 166 {
Kojto 96:487b796308b0 167 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay (not necessary for HAL_RTC_SetDate).
Kojto 96:487b796308b0 168 This parameter can be a value of @ref RTC_WeekDay_Definitions */
Kojto 96:487b796308b0 169
Kojto 96:487b796308b0 170 uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format).
Kojto 96:487b796308b0 171 This parameter can be a value of @ref RTC_Month_Date_Definitions */
Kojto 96:487b796308b0 172
Kojto 96:487b796308b0 173 uint8_t Date; /*!< Specifies the RTC Date.
Kojto 96:487b796308b0 174 This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
Kojto 96:487b796308b0 175
Kojto 96:487b796308b0 176 uint8_t Year; /*!< Specifies the RTC Date Year.
Kojto 96:487b796308b0 177 This parameter must be a number between Min_Data = 0 and Max_Data = 99 */
Kojto 96:487b796308b0 178
Kojto 96:487b796308b0 179 }RTC_DateTypeDef;
Kojto 96:487b796308b0 180
Kojto 96:487b796308b0 181 /**
Kojto 96:487b796308b0 182 * @brief Time Handle Structure definition
Kojto 96:487b796308b0 183 */
Kojto 96:487b796308b0 184 typedef struct
Kojto 96:487b796308b0 185 {
Kojto 96:487b796308b0 186 RTC_TypeDef *Instance; /*!< Register base address */
Kojto 96:487b796308b0 187
Kojto 96:487b796308b0 188 RTC_InitTypeDef Init; /*!< RTC required parameters */
Kojto 96:487b796308b0 189
Kojto 96:487b796308b0 190 RTC_DateTypeDef DateToUpdate; /*!< Current date set by user and updated automatically */
Kojto 96:487b796308b0 191
Kojto 96:487b796308b0 192 HAL_LockTypeDef Lock; /*!< RTC locking object */
Kojto 96:487b796308b0 193
Kojto 96:487b796308b0 194 __IO HAL_RTCStateTypeDef State; /*!< Time communication state */
Kojto 96:487b796308b0 195
Kojto 96:487b796308b0 196 }RTC_HandleTypeDef;
Kojto 96:487b796308b0 197
Kojto 96:487b796308b0 198 /**
Kojto 96:487b796308b0 199 * @}
Kojto 96:487b796308b0 200 */
Kojto 96:487b796308b0 201
Kojto 96:487b796308b0 202 /* Exported constants --------------------------------------------------------*/
Kojto 96:487b796308b0 203 /** @defgroup RTC_Exported_Constants RTC Exported Constants
Kojto 96:487b796308b0 204 * @{
Kojto 96:487b796308b0 205 */
Kojto 96:487b796308b0 206
Kojto 96:487b796308b0 207 /** @defgroup RTC_Automatic_Prediv_1_Second Automatic calculation of prediv for 1sec timebase
Kojto 96:487b796308b0 208 * @{
Kojto 96:487b796308b0 209 */
Kojto 96:487b796308b0 210 #define RTC_AUTO_1_SECOND ((uint32_t)0xFFFFFFFF)
Kojto 96:487b796308b0 211
Kojto 96:487b796308b0 212 /**
Kojto 96:487b796308b0 213 * @}
Kojto 96:487b796308b0 214 */
Kojto 96:487b796308b0 215
Kojto 96:487b796308b0 216 /** @defgroup RTC_Input_parameter_format_definitions Input Parameter Format
Kojto 96:487b796308b0 217 * @{
Kojto 96:487b796308b0 218 */
Kojto 96:487b796308b0 219 #define RTC_FORMAT_BIN ((uint32_t)0x000000000)
Kojto 96:487b796308b0 220 #define RTC_FORMAT_BCD ((uint32_t)0x000000001)
Kojto 96:487b796308b0 221
Kojto 96:487b796308b0 222 /**
Kojto 96:487b796308b0 223 * @}
Kojto 96:487b796308b0 224 */
Kojto 96:487b796308b0 225
Kojto 96:487b796308b0 226 /** @defgroup RTC_Month_Date_Definitions Month Definitions
Kojto 96:487b796308b0 227 * @{
Kojto 96:487b796308b0 228 */
Kojto 96:487b796308b0 229
Kojto 96:487b796308b0 230 /* Coded in BCD format */
Kojto 96:487b796308b0 231 #define RTC_MONTH_JANUARY ((uint8_t)0x01)
Kojto 96:487b796308b0 232 #define RTC_MONTH_FEBRUARY ((uint8_t)0x02)
Kojto 96:487b796308b0 233 #define RTC_MONTH_MARCH ((uint8_t)0x03)
Kojto 96:487b796308b0 234 #define RTC_MONTH_APRIL ((uint8_t)0x04)
Kojto 96:487b796308b0 235 #define RTC_MONTH_MAY ((uint8_t)0x05)
Kojto 96:487b796308b0 236 #define RTC_MONTH_JUNE ((uint8_t)0x06)
Kojto 96:487b796308b0 237 #define RTC_MONTH_JULY ((uint8_t)0x07)
Kojto 96:487b796308b0 238 #define RTC_MONTH_AUGUST ((uint8_t)0x08)
Kojto 96:487b796308b0 239 #define RTC_MONTH_SEPTEMBER ((uint8_t)0x09)
Kojto 96:487b796308b0 240 #define RTC_MONTH_OCTOBER ((uint8_t)0x10)
Kojto 96:487b796308b0 241 #define RTC_MONTH_NOVEMBER ((uint8_t)0x11)
Kojto 96:487b796308b0 242 #define RTC_MONTH_DECEMBER ((uint8_t)0x12)
Kojto 96:487b796308b0 243
Kojto 96:487b796308b0 244 /**
Kojto 96:487b796308b0 245 * @}
Kojto 96:487b796308b0 246 */
Kojto 96:487b796308b0 247
Kojto 96:487b796308b0 248 /** @defgroup RTC_WeekDay_Definitions WeekDay Definitions
Kojto 96:487b796308b0 249 * @{
Kojto 96:487b796308b0 250 */
Kojto 96:487b796308b0 251 #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01)
Kojto 96:487b796308b0 252 #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02)
Kojto 96:487b796308b0 253 #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03)
Kojto 96:487b796308b0 254 #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04)
Kojto 96:487b796308b0 255 #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05)
Kojto 96:487b796308b0 256 #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06)
Kojto 96:487b796308b0 257 #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x00)
Kojto 96:487b796308b0 258
Kojto 96:487b796308b0 259 /**
Kojto 96:487b796308b0 260 * @}
Kojto 96:487b796308b0 261 */
Kojto 96:487b796308b0 262
Kojto 96:487b796308b0 263 /** @defgroup RTC_Alarms_Definitions Alarms Definitions
Kojto 96:487b796308b0 264 * @{
Kojto 96:487b796308b0 265 */
Kojto 96:487b796308b0 266 #define RTC_ALARM_A 0 /*!< Specify alarm ID (mainly for legacy purposes) */
Kojto 96:487b796308b0 267
Kojto 96:487b796308b0 268 /**
Kojto 96:487b796308b0 269 * @}
Kojto 96:487b796308b0 270 */
Kojto 96:487b796308b0 271
Kojto 96:487b796308b0 272
Kojto 96:487b796308b0 273 /** @defgroup RTC_output_source_to_output_on_the_Tamper_pin Output source to output on the Tamper pin
Kojto 96:487b796308b0 274 * @{
Kojto 96:487b796308b0 275 */
Kojto 96:487b796308b0 276
Kojto 96:487b796308b0 277 #define RTC_OUTPUTSOURCE_NONE ((uint32_t)0x00000000) /*!< No output on the TAMPER pin */
Kojto 96:487b796308b0 278 #define RTC_OUTPUTSOURCE_CALIBCLOCK BKP_RTCCR_CCO /*!< RTC clock with a frequency divided by 64 on the TAMPER pin */
Kojto 96:487b796308b0 279 #define RTC_OUTPUTSOURCE_ALARM BKP_RTCCR_ASOE /*!< Alarm pulse signal on the TAMPER pin */
Kojto 96:487b796308b0 280 #define RTC_OUTPUTSOURCE_SECOND (BKP_RTCCR_ASOS | BKP_RTCCR_ASOE) /*!< Second pulse signal on the TAMPER pin */
Kojto 96:487b796308b0 281
Kojto 96:487b796308b0 282 /**
Kojto 96:487b796308b0 283 * @}
Kojto 96:487b796308b0 284 */
Kojto 96:487b796308b0 285
Kojto 96:487b796308b0 286 /** @defgroup RTC_Interrupts_Definitions Interrupts Definitions
Kojto 96:487b796308b0 287 * @{
Kojto 96:487b796308b0 288 */
Kojto 96:487b796308b0 289 #define RTC_IT_OW RTC_CRH_OWIE /*!< Overflow interrupt */
Kojto 96:487b796308b0 290 #define RTC_IT_ALRA RTC_CRH_ALRIE /*!< Alarm interrupt */
Kojto 96:487b796308b0 291 #define RTC_IT_SEC RTC_CRH_SECIE /*!< Second interrupt */
Kojto 96:487b796308b0 292 #define RTC_IT_TAMP1 BKP_CSR_TPIE /*!< TAMPER Pin interrupt enable */
Kojto 96:487b796308b0 293 /**
Kojto 96:487b796308b0 294 * @}
Kojto 96:487b796308b0 295 */
Kojto 96:487b796308b0 296
Kojto 96:487b796308b0 297 /** @defgroup RTC_Flags_Definitions Flags Definitions
Kojto 96:487b796308b0 298 * @{
Kojto 96:487b796308b0 299 */
Kojto 96:487b796308b0 300 #define RTC_FLAG_RTOFF RTC_CRL_RTOFF /*!< RTC Operation OFF flag */
Kojto 96:487b796308b0 301 #define RTC_FLAG_RSF RTC_CRL_RSF /*!< Registers Synchronized flag */
Kojto 96:487b796308b0 302 #define RTC_FLAG_OW RTC_CRL_OWF /*!< Overflow flag */
Kojto 96:487b796308b0 303 #define RTC_FLAG_ALRAF RTC_CRL_ALRF /*!< Alarm flag */
Kojto 96:487b796308b0 304 #define RTC_FLAG_SEC RTC_CRL_SECF /*!< Second flag */
Kojto 96:487b796308b0 305 #define RTC_FLAG_TAMP1F BKP_CSR_TEF /*!< Tamper Interrupt Flag */
Kojto 96:487b796308b0 306
Kojto 96:487b796308b0 307 /**
Kojto 96:487b796308b0 308 * @}
Kojto 96:487b796308b0 309 */
Kojto 96:487b796308b0 310
Kojto 96:487b796308b0 311 /**
Kojto 96:487b796308b0 312 * @}
Kojto 96:487b796308b0 313 */
Kojto 96:487b796308b0 314
Kojto 96:487b796308b0 315 /* Exported macro ------------------------------------------------------------*/
Kojto 96:487b796308b0 316 /** @defgroup RTC_Exported_macros RTC Exported Macros
Kojto 96:487b796308b0 317 * @{
Kojto 96:487b796308b0 318 */
Kojto 96:487b796308b0 319
Kojto 96:487b796308b0 320 /** @brief Reset RTC handle state
Kojto 96:487b796308b0 321 * @param __HANDLE__: RTC handle.
Kojto 96:487b796308b0 322 * @retval None
Kojto 96:487b796308b0 323 */
Kojto 96:487b796308b0 324 #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET)
Kojto 96:487b796308b0 325
Kojto 96:487b796308b0 326 /**
Kojto 96:487b796308b0 327 * @brief Disable the write protection for RTC registers.
Kojto 96:487b796308b0 328 * @param __HANDLE__: specifies the RTC handle.
Kojto 96:487b796308b0 329 * @retval None
Kojto 96:487b796308b0 330 */
Kojto 96:487b796308b0 331 #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CRL, RTC_CRL_CNF)
Kojto 96:487b796308b0 332
Kojto 96:487b796308b0 333 /**
Kojto 96:487b796308b0 334 * @brief Enable the write protection for RTC registers.
Kojto 96:487b796308b0 335 * @param __HANDLE__: specifies the RTC handle.
Kojto 96:487b796308b0 336 * @retval None
Kojto 96:487b796308b0 337 */
Kojto 96:487b796308b0 338 #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CRL, RTC_CRL_CNF)
Kojto 96:487b796308b0 339
Kojto 96:487b796308b0 340 /**
Kojto 96:487b796308b0 341 * @brief Enable the RTC Alarm interrupt.
Kojto 96:487b796308b0 342 * @param __HANDLE__: specifies the RTC handle.
Kojto 96:487b796308b0 343 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
Kojto 96:487b796308b0 344 * This parameter can be any combination of the following values:
Kojto 96:487b796308b0 345 * @arg RTC_IT_ALRA: Alarm A interrupt
Kojto 96:487b796308b0 346 * @retval None
Kojto 96:487b796308b0 347 */
Kojto 96:487b796308b0 348 #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
Kojto 96:487b796308b0 349
Kojto 96:487b796308b0 350 /**
Kojto 96:487b796308b0 351 * @brief Disable the RTC Alarm interrupt.
Kojto 96:487b796308b0 352 * @param __HANDLE__: specifies the RTC handle.
Kojto 96:487b796308b0 353 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
Kojto 96:487b796308b0 354 * This parameter can be any combination of the following values:
Kojto 96:487b796308b0 355 * @arg RTC_IT_ALRA: Alarm A interrupt
Kojto 96:487b796308b0 356 * @retval None
Kojto 96:487b796308b0 357 */
Kojto 96:487b796308b0 358 #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
Kojto 96:487b796308b0 359
Kojto 96:487b796308b0 360 /**
Kojto 96:487b796308b0 361 * @brief Check whether the specified RTC Alarm interrupt has been enabled or not.
Kojto 96:487b796308b0 362 * @param __HANDLE__: specifies the RTC handle.
Kojto 96:487b796308b0 363 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be checked
Kojto 96:487b796308b0 364 * This parameter can be:
Kojto 96:487b796308b0 365 * @arg RTC_IT_ALRA: Alarm A interrupt
Kojto 96:487b796308b0 366 * @retval None
Kojto 96:487b796308b0 367 */
Kojto 96:487b796308b0 368 #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((__HANDLE__)->Instance->CRH)& ((__INTERRUPT__)))) != RESET)? SET : RESET)
Kojto 96:487b796308b0 369
Kojto 96:487b796308b0 370 /**
Kojto 96:487b796308b0 371 * @brief Get the selected RTC Alarm's flag status.
Kojto 96:487b796308b0 372 * @param __HANDLE__: specifies the RTC handle.
Kojto 96:487b796308b0 373 * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
Kojto 96:487b796308b0 374 * This parameter can be:
Kojto 96:487b796308b0 375 * @arg RTC_FLAG_ALRAF
Kojto 96:487b796308b0 376 * @retval None
Kojto 96:487b796308b0 377 */
Kojto 96:487b796308b0 378 #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->CRL) & (__FLAG__)) != RESET)? SET : RESET)
Kojto 96:487b796308b0 379
Kojto 96:487b796308b0 380 /**
Kojto 96:487b796308b0 381 * @brief Check whether the specified RTC Alarm interrupt has occurred or not.
Kojto 96:487b796308b0 382 * @param __HANDLE__: specifies the RTC handle.
Kojto 96:487b796308b0 383 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check.
Kojto 96:487b796308b0 384 * This parameter can be:
Kojto 96:487b796308b0 385 * @arg RTC_IT_ALRA: Alarm A interrupt
Kojto 96:487b796308b0 386 * @retval None
Kojto 96:487b796308b0 387 */
Kojto 96:487b796308b0 388 #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CRL) & (__INTERRUPT__)) != RESET)? SET : RESET)
Kojto 96:487b796308b0 389
Kojto 96:487b796308b0 390 /**
Kojto 96:487b796308b0 391 * @brief Clear the RTC Alarm's pending flags.
Kojto 96:487b796308b0 392 * @param __HANDLE__: specifies the RTC handle.
Kojto 96:487b796308b0 393 * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
Kojto 96:487b796308b0 394 * This parameter can be:
Kojto 96:487b796308b0 395 * @arg RTC_FLAG_ALRAF
Kojto 96:487b796308b0 396 * @retval None
Kojto 96:487b796308b0 397 */
Kojto 96:487b796308b0 398 #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CRL) = ~(__FLAG__)
Kojto 96:487b796308b0 399
Kojto 96:487b796308b0 400 /**
Kojto 96:487b796308b0 401 * @brief Enable interrupt on ALARM Exti Line 17.
Kojto 96:487b796308b0 402 * @retval None.
Kojto 96:487b796308b0 403 */
Kojto 96:487b796308b0 404 #define __HAL_RTC_ALARM_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR, RTC_EXTI_LINE_ALARM_EVENT)
Kojto 96:487b796308b0 405
Kojto 96:487b796308b0 406 /**
Kojto 96:487b796308b0 407 * @brief Disable interrupt on ALARM Exti Line 17.
Kojto 96:487b796308b0 408 * @retval None.
Kojto 96:487b796308b0 409 */
Kojto 96:487b796308b0 410 #define __HAL_RTC_ALARM_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR, RTC_EXTI_LINE_ALARM_EVENT)
Kojto 96:487b796308b0 411
Kojto 96:487b796308b0 412 /**
Kojto 96:487b796308b0 413 * @brief Enable event on ALARM Exti Line 17.
Kojto 96:487b796308b0 414 * @retval None.
Kojto 96:487b796308b0 415 */
Kojto 96:487b796308b0 416 #define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR, RTC_EXTI_LINE_ALARM_EVENT)
Kojto 96:487b796308b0 417
Kojto 96:487b796308b0 418 /**
Kojto 96:487b796308b0 419 * @brief Disable event on ALARM Exti Line 17.
Kojto 96:487b796308b0 420 * @retval None.
Kojto 96:487b796308b0 421 */
Kojto 96:487b796308b0 422 #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR, RTC_EXTI_LINE_ALARM_EVENT)
Kojto 96:487b796308b0 423
Kojto 96:487b796308b0 424
Kojto 96:487b796308b0 425 /**
Kojto 96:487b796308b0 426 * @brief ALARM EXTI line configuration: set falling edge trigger.
Kojto 96:487b796308b0 427 * @retval None.
Kojto 96:487b796308b0 428 */
Kojto 96:487b796308b0 429 #define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR, RTC_EXTI_LINE_ALARM_EVENT)
Kojto 96:487b796308b0 430
Kojto 96:487b796308b0 431
Kojto 96:487b796308b0 432 /**
Kojto 96:487b796308b0 433 * @brief Disable the ALARM Extended Interrupt Falling Trigger.
Kojto 96:487b796308b0 434 * @retval None.
Kojto 96:487b796308b0 435 */
Kojto 96:487b796308b0 436 #define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR, RTC_EXTI_LINE_ALARM_EVENT)
Kojto 96:487b796308b0 437
Kojto 96:487b796308b0 438
Kojto 96:487b796308b0 439 /**
Kojto 96:487b796308b0 440 * @brief ALARM EXTI line configuration: set rising edge trigger.
Kojto 96:487b796308b0 441 * @retval None.
Kojto 96:487b796308b0 442 */
Kojto 96:487b796308b0 443 #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR, RTC_EXTI_LINE_ALARM_EVENT)
Kojto 96:487b796308b0 444
Kojto 96:487b796308b0 445 /**
Kojto 96:487b796308b0 446 * @brief Disable the ALARM Extended Interrupt Rising Trigger.
Kojto 96:487b796308b0 447 * This parameter can be:
Kojto 96:487b796308b0 448 * @retval None.
Kojto 96:487b796308b0 449 */
Kojto 96:487b796308b0 450 #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR, RTC_EXTI_LINE_ALARM_EVENT)
Kojto 96:487b796308b0 451
Kojto 96:487b796308b0 452 /**
Kojto 96:487b796308b0 453 * @brief ALARM EXTI line configuration: set rising & falling edge trigger.
Kojto 96:487b796308b0 454 * @retval None.
Kojto 96:487b796308b0 455 */
Kojto 96:487b796308b0 456 #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE();
Kojto 96:487b796308b0 457
Kojto 96:487b796308b0 458 /**
Kojto 96:487b796308b0 459 * @brief Disable the ALARM Extended Interrupt Rising & Falling Trigger.
Kojto 96:487b796308b0 460 * This parameter can be:
Kojto 96:487b796308b0 461 * @retval None.
Kojto 96:487b796308b0 462 */
Kojto 96:487b796308b0 463 #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE()();
Kojto 96:487b796308b0 464
Kojto 96:487b796308b0 465 /**
Kojto 96:487b796308b0 466 * @brief Check whether the specified ALARM EXTI interrupt flag is set or not.
Kojto 96:487b796308b0 467 * @retval EXTI ALARM Line Status.
Kojto 96:487b796308b0 468 */
Kojto 96:487b796308b0 469 #define __HAL_RTC_ALARM_EXTI_GET_FLAG() (EXTI->PR & (RTC_EXTI_LINE_ALARM_EVENT))
Kojto 96:487b796308b0 470
Kojto 96:487b796308b0 471 /**
Kojto 96:487b796308b0 472 * @brief Clear the ALARM EXTI flag.
Kojto 96:487b796308b0 473 * @retval None.
Kojto 96:487b796308b0 474 */
Kojto 96:487b796308b0 475 #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI->PR = (RTC_EXTI_LINE_ALARM_EVENT))
Kojto 96:487b796308b0 476
Kojto 96:487b796308b0 477 /**
Kojto 96:487b796308b0 478 * @brief Generate a Software interrupt on selected EXTI line.
Kojto 96:487b796308b0 479 * @retval None.
Kojto 96:487b796308b0 480 */
Kojto 96:487b796308b0 481 #define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER, RTC_EXTI_LINE_ALARM_EVENT)
Kojto 96:487b796308b0 482 /**
Kojto 96:487b796308b0 483 * @}
Kojto 96:487b796308b0 484 */
Kojto 96:487b796308b0 485
Kojto 96:487b796308b0 486 /* Include RTC HAL Extension module */
Kojto 96:487b796308b0 487 #include "stm32f1xx_hal_rtc_ex.h"
Kojto 96:487b796308b0 488
Kojto 96:487b796308b0 489 /* Exported functions --------------------------------------------------------*/
Kojto 96:487b796308b0 490 /** @addtogroup RTC_Exported_Functions
Kojto 96:487b796308b0 491 * @{
Kojto 96:487b796308b0 492 */
Kojto 96:487b796308b0 493
Kojto 96:487b796308b0 494
Kojto 96:487b796308b0 495 /* Initialization and de-initialization functions ****************************/
Kojto 96:487b796308b0 496 /** @addtogroup RTC_Exported_Functions_Group1
Kojto 96:487b796308b0 497 * @{
Kojto 96:487b796308b0 498 */
Kojto 96:487b796308b0 499 HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 500 HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 501 void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 502 void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 503 /**
Kojto 96:487b796308b0 504 * @}
Kojto 96:487b796308b0 505 */
Kojto 96:487b796308b0 506
Kojto 96:487b796308b0 507 /* RTC Time and Date functions ************************************************/
Kojto 96:487b796308b0 508 /** @addtogroup RTC_Exported_Functions_Group2
Kojto 96:487b796308b0 509 * @{
Kojto 96:487b796308b0 510 */
Kojto 96:487b796308b0 511 HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
Kojto 96:487b796308b0 512 HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
Kojto 96:487b796308b0 513 HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
Kojto 96:487b796308b0 514 HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
Kojto 96:487b796308b0 515 /**
Kojto 96:487b796308b0 516 * @}
Kojto 96:487b796308b0 517 */
Kojto 96:487b796308b0 518
Kojto 96:487b796308b0 519 /* RTC Alarm functions ********************************************************/
Kojto 96:487b796308b0 520 /** @addtogroup RTC_Exported_Functions_Group3
Kojto 96:487b796308b0 521 * @{
Kojto 96:487b796308b0 522 */
Kojto 96:487b796308b0 523 HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
Kojto 96:487b796308b0 524 HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
Kojto 96:487b796308b0 525 HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm);
Kojto 96:487b796308b0 526 HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format);
Kojto 96:487b796308b0 527 void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 528 HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
Kojto 96:487b796308b0 529 void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 530 /**
Kojto 96:487b796308b0 531 * @}
Kojto 96:487b796308b0 532 */
Kojto 96:487b796308b0 533
Kojto 96:487b796308b0 534 /* Peripheral State functions *************************************************/
Kojto 96:487b796308b0 535 /** @addtogroup RTC_Exported_Functions_Group4
Kojto 96:487b796308b0 536 * @{
Kojto 96:487b796308b0 537 */
Kojto 96:487b796308b0 538 HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 539 /**
Kojto 96:487b796308b0 540 * @}
Kojto 96:487b796308b0 541 */
Kojto 96:487b796308b0 542
Kojto 96:487b796308b0 543 /* Peripheral Control functions ***********************************************/
Kojto 96:487b796308b0 544 /** @addtogroup RTC_Exported_Functions_Group5
Kojto 96:487b796308b0 545 * @{
Kojto 96:487b796308b0 546 */
Kojto 96:487b796308b0 547 HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc);
Kojto 96:487b796308b0 548 /**
Kojto 96:487b796308b0 549 * @}
Kojto 96:487b796308b0 550 */
Kojto 96:487b796308b0 551
Kojto 96:487b796308b0 552 /**
Kojto 96:487b796308b0 553 * @}
Kojto 96:487b796308b0 554 */
Kojto 96:487b796308b0 555
Kojto 96:487b796308b0 556 /**
Kojto 96:487b796308b0 557 * @}
Kojto 96:487b796308b0 558 */
Kojto 96:487b796308b0 559
Kojto 96:487b796308b0 560 /**
Kojto 96:487b796308b0 561 * @}
Kojto 96:487b796308b0 562 */
Kojto 96:487b796308b0 563
Kojto 96:487b796308b0 564 #ifdef __cplusplus
Kojto 96:487b796308b0 565 }
Kojto 96:487b796308b0 566 #endif
Kojto 96:487b796308b0 567
Kojto 96:487b796308b0 568 #endif /* __STM32F1xx_HAL_RTC_H */
Kojto 96:487b796308b0 569
Kojto 96:487b796308b0 570 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/