mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

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

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

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

Import librarymbed

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

Committer:
mbed_official
Date:
Thu Jul 02 16:30:08 2015 +0100
Revision:
581:39197bcd20f2
Parent:
489:119543c9f674
Synchronized with git revision ae2d3cdffe70184eb8736d94f76c45c93f4b7724

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

Make it possible to build the core mbed library with yotta

Who changed what in which revision?

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