mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
shaoziyang
Date:
Sat Sep 13 14:25:46 2014 +0000
Revision:
323:9e901b0a5aa1
Parent:
296:ec1b66a3d094
test with CLOCK_SETUP = 0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 133:d4dda5c437f0 1 /**
mbed_official 133:d4dda5c437f0 2 ******************************************************************************
mbed_official 133:d4dda5c437f0 3 * @file stm32f4xx_hal_rtc_ex.h
mbed_official 133:d4dda5c437f0 4 * @author MCD Application Team
mbed_official 242:7074e42da0b2 5 * @version V1.1.0RC2
mbed_official 242:7074e42da0b2 6 * @date 14-May-2014
mbed_official 133:d4dda5c437f0 7 * @brief Header file of RTC HAL Extension module.
mbed_official 133:d4dda5c437f0 8 ******************************************************************************
mbed_official 133:d4dda5c437f0 9 * @attention
mbed_official 133:d4dda5c437f0 10 *
mbed_official 133:d4dda5c437f0 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 133:d4dda5c437f0 12 *
mbed_official 133:d4dda5c437f0 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 133:d4dda5c437f0 14 * are permitted provided that the following conditions are met:
mbed_official 133:d4dda5c437f0 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 133:d4dda5c437f0 16 * this list of conditions and the following disclaimer.
mbed_official 133:d4dda5c437f0 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 133:d4dda5c437f0 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 133:d4dda5c437f0 19 * and/or other materials provided with the distribution.
mbed_official 133:d4dda5c437f0 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 133:d4dda5c437f0 21 * may be used to endorse or promote products derived from this software
mbed_official 133:d4dda5c437f0 22 * without specific prior written permission.
mbed_official 133:d4dda5c437f0 23 *
mbed_official 133:d4dda5c437f0 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 133:d4dda5c437f0 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 133:d4dda5c437f0 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 133:d4dda5c437f0 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 133:d4dda5c437f0 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 133:d4dda5c437f0 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 133:d4dda5c437f0 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 133:d4dda5c437f0 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 133:d4dda5c437f0 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 133:d4dda5c437f0 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 133:d4dda5c437f0 34 *
mbed_official 133:d4dda5c437f0 35 ******************************************************************************
mbed_official 133:d4dda5c437f0 36 */
mbed_official 133:d4dda5c437f0 37
mbed_official 133:d4dda5c437f0 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 133:d4dda5c437f0 39 #ifndef __STM32F4xx_HAL_RTC_EX_H
mbed_official 133:d4dda5c437f0 40 #define __STM32F4xx_HAL_RTC_EX_H
mbed_official 133:d4dda5c437f0 41
mbed_official 133:d4dda5c437f0 42 #ifdef __cplusplus
mbed_official 133:d4dda5c437f0 43 extern "C" {
mbed_official 133:d4dda5c437f0 44 #endif
mbed_official 133:d4dda5c437f0 45
mbed_official 133:d4dda5c437f0 46 /* Includes ------------------------------------------------------------------*/
mbed_official 133:d4dda5c437f0 47 #include "stm32f4xx_hal_def.h"
mbed_official 133:d4dda5c437f0 48
mbed_official 133:d4dda5c437f0 49 /** @addtogroup STM32F4xx_HAL_Driver
mbed_official 133:d4dda5c437f0 50 * @{
mbed_official 133:d4dda5c437f0 51 */
mbed_official 133:d4dda5c437f0 52
mbed_official 133:d4dda5c437f0 53 /** @addtogroup RTCEx
mbed_official 133:d4dda5c437f0 54 * @{
mbed_official 133:d4dda5c437f0 55 */
mbed_official 133:d4dda5c437f0 56
mbed_official 133:d4dda5c437f0 57 /* Exported types ------------------------------------------------------------*/
mbed_official 133:d4dda5c437f0 58
mbed_official 133:d4dda5c437f0 59 /**
mbed_official 133:d4dda5c437f0 60 * @brief RTC Tamper structure definition
mbed_official 133:d4dda5c437f0 61 */
mbed_official 133:d4dda5c437f0 62 typedef struct
mbed_official 133:d4dda5c437f0 63 {
mbed_official 133:d4dda5c437f0 64 uint32_t Tamper; /*!< Specifies the Tamper Pin.
mbed_official 133:d4dda5c437f0 65 This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */
mbed_official 133:d4dda5c437f0 66
mbed_official 133:d4dda5c437f0 67 uint32_t PinSelection; /*!< Specifies the Tamper Pin.
mbed_official 133:d4dda5c437f0 68 This parameter can be a value of @ref RTCEx_Tamper_Pins_Selection */
mbed_official 133:d4dda5c437f0 69
mbed_official 133:d4dda5c437f0 70 uint32_t Trigger; /*!< Specifies the Tamper Trigger.
mbed_official 133:d4dda5c437f0 71 This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */
mbed_official 133:d4dda5c437f0 72
mbed_official 133:d4dda5c437f0 73 uint32_t Filter; /*!< Specifies the RTC Filter Tamper.
mbed_official 133:d4dda5c437f0 74 This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */
mbed_official 133:d4dda5c437f0 75
mbed_official 133:d4dda5c437f0 76 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency.
mbed_official 133:d4dda5c437f0 77 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */
mbed_official 133:d4dda5c437f0 78
mbed_official 133:d4dda5c437f0 79 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration .
mbed_official 133:d4dda5c437f0 80 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */
mbed_official 133:d4dda5c437f0 81
mbed_official 133:d4dda5c437f0 82 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp .
mbed_official 133:d4dda5c437f0 83 This parameter can be a value of @ref RTCEx_Tamper_Pull_UP_Definitions */
mbed_official 133:d4dda5c437f0 84
mbed_official 133:d4dda5c437f0 85 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection.
mbed_official 133:d4dda5c437f0 86 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */
mbed_official 133:d4dda5c437f0 87 }RTC_TamperTypeDef;
mbed_official 133:d4dda5c437f0 88
mbed_official 133:d4dda5c437f0 89 /* Exported constants --------------------------------------------------------*/
mbed_official 133:d4dda5c437f0 90 /** @defgroup RTCEx_Exported_Constants
mbed_official 133:d4dda5c437f0 91 * @{
mbed_official 133:d4dda5c437f0 92 */
mbed_official 133:d4dda5c437f0 93
mbed_official 133:d4dda5c437f0 94 /** @defgroup RTCEx_Backup_Registers_Definitions
mbed_official 133:d4dda5c437f0 95 * @{
mbed_official 133:d4dda5c437f0 96 */
mbed_official 133:d4dda5c437f0 97 #define RTC_BKP_DR0 ((uint32_t)0x00000000)
mbed_official 133:d4dda5c437f0 98 #define RTC_BKP_DR1 ((uint32_t)0x00000001)
mbed_official 133:d4dda5c437f0 99 #define RTC_BKP_DR2 ((uint32_t)0x00000002)
mbed_official 133:d4dda5c437f0 100 #define RTC_BKP_DR3 ((uint32_t)0x00000003)
mbed_official 133:d4dda5c437f0 101 #define RTC_BKP_DR4 ((uint32_t)0x00000004)
mbed_official 133:d4dda5c437f0 102 #define RTC_BKP_DR5 ((uint32_t)0x00000005)
mbed_official 133:d4dda5c437f0 103 #define RTC_BKP_DR6 ((uint32_t)0x00000006)
mbed_official 133:d4dda5c437f0 104 #define RTC_BKP_DR7 ((uint32_t)0x00000007)
mbed_official 133:d4dda5c437f0 105 #define RTC_BKP_DR8 ((uint32_t)0x00000008)
mbed_official 133:d4dda5c437f0 106 #define RTC_BKP_DR9 ((uint32_t)0x00000009)
mbed_official 133:d4dda5c437f0 107 #define RTC_BKP_DR10 ((uint32_t)0x0000000A)
mbed_official 133:d4dda5c437f0 108 #define RTC_BKP_DR11 ((uint32_t)0x0000000B)
mbed_official 133:d4dda5c437f0 109 #define RTC_BKP_DR12 ((uint32_t)0x0000000C)
mbed_official 133:d4dda5c437f0 110 #define RTC_BKP_DR13 ((uint32_t)0x0000000D)
mbed_official 133:d4dda5c437f0 111 #define RTC_BKP_DR14 ((uint32_t)0x0000000E)
mbed_official 133:d4dda5c437f0 112 #define RTC_BKP_DR15 ((uint32_t)0x0000000F)
mbed_official 133:d4dda5c437f0 113 #define RTC_BKP_DR16 ((uint32_t)0x00000010)
mbed_official 133:d4dda5c437f0 114 #define RTC_BKP_DR17 ((uint32_t)0x00000011)
mbed_official 133:d4dda5c437f0 115 #define RTC_BKP_DR18 ((uint32_t)0x00000012)
mbed_official 133:d4dda5c437f0 116 #define RTC_BKP_DR19 ((uint32_t)0x00000013)
mbed_official 133:d4dda5c437f0 117
mbed_official 133:d4dda5c437f0 118 #define IS_RTC_BKP(BKP) (((BKP) == RTC_BKP_DR0) || \
mbed_official 133:d4dda5c437f0 119 ((BKP) == RTC_BKP_DR1) || \
mbed_official 133:d4dda5c437f0 120 ((BKP) == RTC_BKP_DR2) || \
mbed_official 133:d4dda5c437f0 121 ((BKP) == RTC_BKP_DR3) || \
mbed_official 133:d4dda5c437f0 122 ((BKP) == RTC_BKP_DR4) || \
mbed_official 133:d4dda5c437f0 123 ((BKP) == RTC_BKP_DR5) || \
mbed_official 133:d4dda5c437f0 124 ((BKP) == RTC_BKP_DR6) || \
mbed_official 133:d4dda5c437f0 125 ((BKP) == RTC_BKP_DR7) || \
mbed_official 133:d4dda5c437f0 126 ((BKP) == RTC_BKP_DR8) || \
mbed_official 133:d4dda5c437f0 127 ((BKP) == RTC_BKP_DR9) || \
mbed_official 133:d4dda5c437f0 128 ((BKP) == RTC_BKP_DR10) || \
mbed_official 133:d4dda5c437f0 129 ((BKP) == RTC_BKP_DR11) || \
mbed_official 133:d4dda5c437f0 130 ((BKP) == RTC_BKP_DR12) || \
mbed_official 133:d4dda5c437f0 131 ((BKP) == RTC_BKP_DR13) || \
mbed_official 133:d4dda5c437f0 132 ((BKP) == RTC_BKP_DR14) || \
mbed_official 133:d4dda5c437f0 133 ((BKP) == RTC_BKP_DR15) || \
mbed_official 133:d4dda5c437f0 134 ((BKP) == RTC_BKP_DR16) || \
mbed_official 133:d4dda5c437f0 135 ((BKP) == RTC_BKP_DR17) || \
mbed_official 133:d4dda5c437f0 136 ((BKP) == RTC_BKP_DR18) || \
mbed_official 133:d4dda5c437f0 137 ((BKP) == RTC_BKP_DR19))
mbed_official 133:d4dda5c437f0 138 /**
mbed_official 133:d4dda5c437f0 139 * @}
mbed_official 133:d4dda5c437f0 140 */
mbed_official 133:d4dda5c437f0 141
mbed_official 133:d4dda5c437f0 142 /** @defgroup RTCEx_Time_Stamp_Edges_definitions
mbed_official 133:d4dda5c437f0 143 * @{
mbed_official 133:d4dda5c437f0 144 */
mbed_official 133:d4dda5c437f0 145 #define RTC_TIMESTAMPEDGE_RISING ((uint32_t)0x00000000)
mbed_official 133:d4dda5c437f0 146 #define RTC_TIMESTAMPEDGE_FALLING ((uint32_t)0x00000008)
mbed_official 133:d4dda5c437f0 147
mbed_official 133:d4dda5c437f0 148 #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \
mbed_official 133:d4dda5c437f0 149 ((EDGE) == RTC_TIMESTAMPEDGE_FALLING))
mbed_official 133:d4dda5c437f0 150 /**
mbed_official 133:d4dda5c437f0 151 * @}
mbed_official 133:d4dda5c437f0 152 */
mbed_official 133:d4dda5c437f0 153
mbed_official 133:d4dda5c437f0 154 /** @defgroup RTCEx_Tamper_Pins_Definitions
mbed_official 133:d4dda5c437f0 155 * @{
mbed_official 133:d4dda5c437f0 156 */
mbed_official 133:d4dda5c437f0 157 #define RTC_TAMPER_1 RTC_TAFCR_TAMP1E
mbed_official 133:d4dda5c437f0 158 #define RTC_TAMPER_2 RTC_TAFCR_TAMP2E
mbed_official 133:d4dda5c437f0 159
mbed_official 133:d4dda5c437f0 160 #define IS_TAMPER(TAMPER) ((((TAMPER) & (uint32_t)0xFFFFFFF6) == 0x00) && ((TAMPER) != (uint32_t)RESET))
mbed_official 133:d4dda5c437f0 161 /**
mbed_official 133:d4dda5c437f0 162 * @}
mbed_official 133:d4dda5c437f0 163 */
mbed_official 133:d4dda5c437f0 164
mbed_official 133:d4dda5c437f0 165 /** @defgroup RTCEx_Tamper_Pins_Selection
mbed_official 133:d4dda5c437f0 166 * @{
mbed_official 133:d4dda5c437f0 167 */
mbed_official 133:d4dda5c437f0 168 #define RTC_TAMPERPIN_PC13 ((uint32_t)0x00000000)
mbed_official 133:d4dda5c437f0 169 #define RTC_TAMPERPIN_PI8 ((uint32_t)0x00010000)
mbed_official 133:d4dda5c437f0 170
mbed_official 133:d4dda5c437f0 171 #define IS_RTC_TAMPER_PIN(PIN) (((PIN) == RTC_TAMPERPIN_PC13) || \
mbed_official 133:d4dda5c437f0 172 ((PIN) == RTC_TAMPERPIN_PI8))
mbed_official 133:d4dda5c437f0 173 /**
mbed_official 133:d4dda5c437f0 174 * @}
mbed_official 133:d4dda5c437f0 175 */
mbed_official 133:d4dda5c437f0 176
mbed_official 133:d4dda5c437f0 177 /** @defgroup RTCEx_TimeStamp_Pin_Selection
mbed_official 133:d4dda5c437f0 178 * @{
mbed_official 133:d4dda5c437f0 179 */
mbed_official 133:d4dda5c437f0 180 #define RTC_TIMESTAMPPIN_PC13 ((uint32_t)0x00000000)
mbed_official 133:d4dda5c437f0 181 #define RTC_TIMESTAMPPIN_PI8 ((uint32_t)0x00020000)
mbed_official 133:d4dda5c437f0 182
mbed_official 133:d4dda5c437f0 183 #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_PC13) || \
mbed_official 133:d4dda5c437f0 184 ((PIN) == RTC_TIMESTAMPPIN_PI8))
mbed_official 133:d4dda5c437f0 185 /**
mbed_official 133:d4dda5c437f0 186 * @}
mbed_official 133:d4dda5c437f0 187 */
mbed_official 133:d4dda5c437f0 188
mbed_official 133:d4dda5c437f0 189 /** @defgroup RTCEx_Tamper_Trigger_Definitions
mbed_official 133:d4dda5c437f0 190 * @{
mbed_official 133:d4dda5c437f0 191 */
mbed_official 133:d4dda5c437f0 192 #define RTC_TAMPERTRIGGER_RISINGEDGE ((uint32_t)0x00000000)
mbed_official 133:d4dda5c437f0 193 #define RTC_TAMPERTRIGGER_FALLINGEDGE ((uint32_t)0x00000002)
mbed_official 133:d4dda5c437f0 194 #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE
mbed_official 133:d4dda5c437f0 195 #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE
mbed_official 133:d4dda5c437f0 196
mbed_official 133:d4dda5c437f0 197 #define IS_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) || \
mbed_official 133:d4dda5c437f0 198 ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \
mbed_official 133:d4dda5c437f0 199 ((TRIGGER) == RTC_TAMPERTRIGGER_LOWLEVEL) || \
mbed_official 133:d4dda5c437f0 200 ((TRIGGER) == RTC_TAMPERTRIGGER_HIGHLEVEL))
mbed_official 133:d4dda5c437f0 201
mbed_official 133:d4dda5c437f0 202 /**
mbed_official 133:d4dda5c437f0 203 * @}
mbed_official 133:d4dda5c437f0 204 */
mbed_official 133:d4dda5c437f0 205
mbed_official 133:d4dda5c437f0 206 /** @defgroup RTCEx_Tamper_Filter_Definitions
mbed_official 133:d4dda5c437f0 207 * @{
mbed_official 133:d4dda5c437f0 208 */
mbed_official 133:d4dda5c437f0 209 #define RTC_TAMPERFILTER_DISABLE ((uint32_t)0x00000000) /*!< Tamper filter is disabled */
mbed_official 133:d4dda5c437f0 210
mbed_official 133:d4dda5c437f0 211 #define RTC_TAMPERFILTER_2SAMPLE ((uint32_t)0x00000800) /*!< Tamper is activated after 2
mbed_official 133:d4dda5c437f0 212 consecutive samples at the active level */
mbed_official 133:d4dda5c437f0 213 #define RTC_TAMPERFILTER_4SAMPLE ((uint32_t)0x00001000) /*!< Tamper is activated after 4
mbed_official 133:d4dda5c437f0 214 consecutive samples at the active level */
mbed_official 133:d4dda5c437f0 215 #define RTC_TAMPERFILTER_8SAMPLE ((uint32_t)0x00001800) /*!< Tamper is activated after 8
mbed_official 133:d4dda5c437f0 216 consecutive samples at the active leve. */
mbed_official 133:d4dda5c437f0 217
mbed_official 133:d4dda5c437f0 218 #define IS_TAMPER_FILTER(FILTER) (((FILTER) == RTC_TAMPERFILTER_DISABLE) || \
mbed_official 133:d4dda5c437f0 219 ((FILTER) == RTC_TAMPERFILTER_2SAMPLE) || \
mbed_official 133:d4dda5c437f0 220 ((FILTER) == RTC_TAMPERFILTER_4SAMPLE) || \
mbed_official 133:d4dda5c437f0 221 ((FILTER) == RTC_TAMPERFILTER_8SAMPLE))
mbed_official 133:d4dda5c437f0 222 /**
mbed_official 133:d4dda5c437f0 223 * @}
mbed_official 133:d4dda5c437f0 224 */
mbed_official 133:d4dda5c437f0 225
mbed_official 133:d4dda5c437f0 226 /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions
mbed_official 133:d4dda5c437f0 227 * @{
mbed_official 133:d4dda5c437f0 228 */
mbed_official 133:d4dda5c437f0 229 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 ((uint32_t)0x00000000) /*!< Each of the tamper inputs are sampled
mbed_official 133:d4dda5c437f0 230 with a frequency = RTCCLK / 32768 */
mbed_official 133:d4dda5c437f0 231 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 ((uint32_t)0x00000100) /*!< Each of the tamper inputs are sampled
mbed_official 133:d4dda5c437f0 232 with a frequency = RTCCLK / 16384 */
mbed_official 133:d4dda5c437f0 233 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 ((uint32_t)0x00000200) /*!< Each of the tamper inputs are sampled
mbed_official 133:d4dda5c437f0 234 with a frequency = RTCCLK / 8192 */
mbed_official 133:d4dda5c437f0 235 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 ((uint32_t)0x00000300) /*!< Each of the tamper inputs are sampled
mbed_official 133:d4dda5c437f0 236 with a frequency = RTCCLK / 4096 */
mbed_official 133:d4dda5c437f0 237 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 ((uint32_t)0x00000400) /*!< Each of the tamper inputs are sampled
mbed_official 133:d4dda5c437f0 238 with a frequency = RTCCLK / 2048 */
mbed_official 133:d4dda5c437f0 239 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 ((uint32_t)0x00000500) /*!< Each of the tamper inputs are sampled
mbed_official 133:d4dda5c437f0 240 with a frequency = RTCCLK / 1024 */
mbed_official 133:d4dda5c437f0 241 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 ((uint32_t)0x00000600) /*!< Each of the tamper inputs are sampled
mbed_official 133:d4dda5c437f0 242 with a frequency = RTCCLK / 512 */
mbed_official 133:d4dda5c437f0 243 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 ((uint32_t)0x00000700) /*!< Each of the tamper inputs are sampled
mbed_official 133:d4dda5c437f0 244 with a frequency = RTCCLK / 256 */
mbed_official 133:d4dda5c437f0 245
mbed_official 133:d4dda5c437f0 246 #define IS_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \
mbed_official 133:d4dda5c437f0 247 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \
mbed_official 133:d4dda5c437f0 248 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \
mbed_official 133:d4dda5c437f0 249 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \
mbed_official 133:d4dda5c437f0 250 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \
mbed_official 133:d4dda5c437f0 251 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \
mbed_official 133:d4dda5c437f0 252 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \
mbed_official 133:d4dda5c437f0 253 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256))
mbed_official 133:d4dda5c437f0 254 /**
mbed_official 133:d4dda5c437f0 255 * @}
mbed_official 133:d4dda5c437f0 256 */
mbed_official 133:d4dda5c437f0 257
mbed_official 133:d4dda5c437f0 258 /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions
mbed_official 133:d4dda5c437f0 259 * @{
mbed_official 133:d4dda5c437f0 260 */
mbed_official 133:d4dda5c437f0 261 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before
mbed_official 133:d4dda5c437f0 262 sampling during 1 RTCCLK cycle */
mbed_official 133:d4dda5c437f0 263 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK ((uint32_t)0x00002000) /*!< Tamper pins are pre-charged before
mbed_official 133:d4dda5c437f0 264 sampling during 2 RTCCLK cycles */
mbed_official 133:d4dda5c437f0 265 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK ((uint32_t)0x00004000) /*!< Tamper pins are pre-charged before
mbed_official 133:d4dda5c437f0 266 sampling during 4 RTCCLK cycles */
mbed_official 133:d4dda5c437f0 267 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK ((uint32_t)0x00006000) /*!< Tamper pins are pre-charged before
mbed_official 133:d4dda5c437f0 268 sampling during 8 RTCCLK cycles */
mbed_official 133:d4dda5c437f0 269
mbed_official 133:d4dda5c437f0 270 #define IS_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \
mbed_official 133:d4dda5c437f0 271 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \
mbed_official 133:d4dda5c437f0 272 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \
mbed_official 133:d4dda5c437f0 273 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK))
mbed_official 133:d4dda5c437f0 274 /**
mbed_official 133:d4dda5c437f0 275 * @}
mbed_official 133:d4dda5c437f0 276 */
mbed_official 133:d4dda5c437f0 277
mbed_official 133:d4dda5c437f0 278 /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions
mbed_official 133:d4dda5c437f0 279 * @{
mbed_official 133:d4dda5c437f0 280 */
mbed_official 133:d4dda5c437f0 281 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE ((uint32_t)RTC_TAFCR_TAMPTS) /*!< TimeStamp on Tamper Detection event saved */
mbed_official 133:d4dda5c437f0 282 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE ((uint32_t)0x00000000) /*!< TimeStamp on Tamper Detection event is not saved */
mbed_official 133:d4dda5c437f0 283
mbed_official 133:d4dda5c437f0 284 #define IS_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \
mbed_official 133:d4dda5c437f0 285 ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE))
mbed_official 133:d4dda5c437f0 286 /**
mbed_official 133:d4dda5c437f0 287 * @}
mbed_official 133:d4dda5c437f0 288 */
mbed_official 133:d4dda5c437f0 289
mbed_official 133:d4dda5c437f0 290 /** @defgroup RTCEx_Tamper_Pull_UP_Definitions
mbed_official 133:d4dda5c437f0 291 * @{
mbed_official 133:d4dda5c437f0 292 */
mbed_official 133:d4dda5c437f0 293 #define RTC_TAMPER_PULLUP_ENABLE ((uint32_t)0x00000000) /*!< TimeStamp on Tamper Detection event saved */
mbed_official 133:d4dda5c437f0 294 #define RTC_TAMPER_PULLUP_DISABLE ((uint32_t)RTC_TAFCR_TAMPPUDIS) /*!< TimeStamp on Tamper Detection event is not saved */
mbed_official 133:d4dda5c437f0 295
mbed_official 133:d4dda5c437f0 296 #define IS_TAMPER_PULLUP_STATE(STATE) (((STATE) == RTC_TAMPER_PULLUP_ENABLE) || \
mbed_official 133:d4dda5c437f0 297 ((STATE) == RTC_TAMPER_PULLUP_DISABLE))
mbed_official 133:d4dda5c437f0 298 /**
mbed_official 133:d4dda5c437f0 299 * @}
mbed_official 133:d4dda5c437f0 300 */
mbed_official 133:d4dda5c437f0 301
mbed_official 133:d4dda5c437f0 302 /** @defgroup RTCEx_Wakeup_Timer_Definitions
mbed_official 133:d4dda5c437f0 303 * @{
mbed_official 133:d4dda5c437f0 304 */
mbed_official 133:d4dda5c437f0 305 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 ((uint32_t)0x00000000)
mbed_official 133:d4dda5c437f0 306 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 ((uint32_t)0x00000001)
mbed_official 133:d4dda5c437f0 307 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 ((uint32_t)0x00000002)
mbed_official 133:d4dda5c437f0 308 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 ((uint32_t)0x00000003)
mbed_official 133:d4dda5c437f0 309 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS ((uint32_t)0x00000004)
mbed_official 133:d4dda5c437f0 310 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS ((uint32_t)0x00000006)
mbed_official 133:d4dda5c437f0 311
mbed_official 133:d4dda5c437f0 312 #define IS_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \
mbed_official 133:d4dda5c437f0 313 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \
mbed_official 133:d4dda5c437f0 314 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \
mbed_official 133:d4dda5c437f0 315 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \
mbed_official 133:d4dda5c437f0 316 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \
mbed_official 133:d4dda5c437f0 317 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS))
mbed_official 133:d4dda5c437f0 318
mbed_official 133:d4dda5c437f0 319 #define IS_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFF)
mbed_official 133:d4dda5c437f0 320 /**
mbed_official 133:d4dda5c437f0 321 * @}
mbed_official 133:d4dda5c437f0 322 */
mbed_official 133:d4dda5c437f0 323
mbed_official 133:d4dda5c437f0 324 /** @defgroup RTCEx_Digital_Calibration_Definitions
mbed_official 133:d4dda5c437f0 325 * @{
mbed_official 133:d4dda5c437f0 326 */
mbed_official 133:d4dda5c437f0 327 #define RTC_CALIBSIGN_POSITIVE ((uint32_t)0x00000000)
mbed_official 133:d4dda5c437f0 328 #define RTC_CALIBSIGN_NEGATIVE ((uint32_t)0x00000080)
mbed_official 133:d4dda5c437f0 329
mbed_official 133:d4dda5c437f0 330 #define IS_RTC_CALIB_SIGN(SIGN) (((SIGN) == RTC_CALIBSIGN_POSITIVE) || \
mbed_official 133:d4dda5c437f0 331 ((SIGN) == RTC_CALIBSIGN_NEGATIVE))
mbed_official 133:d4dda5c437f0 332
mbed_official 133:d4dda5c437f0 333 #define IS_RTC_CALIB_VALUE(VALUE) ((VALUE) < 0x20)
mbed_official 133:d4dda5c437f0 334 /**
mbed_official 133:d4dda5c437f0 335 * @}
mbed_official 133:d4dda5c437f0 336 */
mbed_official 133:d4dda5c437f0 337
mbed_official 242:7074e42da0b2 338 /** @defgroup RTCEx_Smooth_calib_period_Definitions
mbed_official 133:d4dda5c437f0 339 * @{
mbed_official 133:d4dda5c437f0 340 */
mbed_official 133:d4dda5c437f0 341 #define RTC_SMOOTHCALIB_PERIOD_32SEC ((uint32_t)0x00000000) /*!< If RTCCLK = 32768 Hz, Smooth calibation
mbed_official 133:d4dda5c437f0 342 period is 32s, else 2exp20 RTCCLK seconds */
mbed_official 133:d4dda5c437f0 343 #define RTC_SMOOTHCALIB_PERIOD_16SEC ((uint32_t)0x00002000) /*!< If RTCCLK = 32768 Hz, Smooth calibation
mbed_official 133:d4dda5c437f0 344 period is 16s, else 2exp19 RTCCLK seconds */
mbed_official 133:d4dda5c437f0 345 #define RTC_SMOOTHCALIB_PERIOD_8SEC ((uint32_t)0x00004000) /*!< If RTCCLK = 32768 Hz, Smooth calibation
mbed_official 133:d4dda5c437f0 346 period is 8s, else 2exp18 RTCCLK seconds */
mbed_official 133:d4dda5c437f0 347
mbed_official 133:d4dda5c437f0 348 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \
mbed_official 133:d4dda5c437f0 349 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \
mbed_official 133:d4dda5c437f0 350 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC))
mbed_official 133:d4dda5c437f0 351 /**
mbed_official 133:d4dda5c437f0 352 * @}
mbed_official 133:d4dda5c437f0 353 */
mbed_official 133:d4dda5c437f0 354
mbed_official 133:d4dda5c437f0 355 /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions
mbed_official 133:d4dda5c437f0 356 * @{
mbed_official 133:d4dda5c437f0 357 */
mbed_official 133:d4dda5c437f0 358 #define RTC_SMOOTHCALIB_PLUSPULSES_SET ((uint32_t)0x00008000) /*!< The number of RTCCLK pulses added
mbed_official 133:d4dda5c437f0 359 during a X -second window = Y - CALM[8:0]
mbed_official 133:d4dda5c437f0 360 with Y = 512, 256, 128 when X = 32, 16, 8 */
mbed_official 133:d4dda5c437f0 361 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET ((uint32_t)0x00000000) /*!< The number of RTCCLK pulses subbstited
mbed_official 133:d4dda5c437f0 362 during a 32-second window = CALM[8:0] */
mbed_official 133:d4dda5c437f0 363
mbed_official 133:d4dda5c437f0 364 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \
mbed_official 133:d4dda5c437f0 365 ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET))
mbed_official 133:d4dda5c437f0 366 /**
mbed_official 133:d4dda5c437f0 367 * @}
mbed_official 133:d4dda5c437f0 368 */
mbed_official 133:d4dda5c437f0 369
mbed_official 133:d4dda5c437f0 370 /** @defgroup RTCEx_Smooth_calib_Minus_pulses_Definitions
mbed_official 133:d4dda5c437f0 371 * @{
mbed_official 133:d4dda5c437f0 372 */
mbed_official 133:d4dda5c437f0 373 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x000001FF)
mbed_official 133:d4dda5c437f0 374 /**
mbed_official 133:d4dda5c437f0 375 * @}
mbed_official 133:d4dda5c437f0 376 */
mbed_official 133:d4dda5c437f0 377
mbed_official 133:d4dda5c437f0 378 /** @defgroup RTCEx_Add_1_Second_Parameter_Definitions
mbed_official 133:d4dda5c437f0 379 * @{
mbed_official 133:d4dda5c437f0 380 */
mbed_official 133:d4dda5c437f0 381 #define RTC_SHIFTADD1S_RESET ((uint32_t)0x00000000)
mbed_official 133:d4dda5c437f0 382 #define RTC_SHIFTADD1S_SET ((uint32_t)0x80000000)
mbed_official 133:d4dda5c437f0 383
mbed_official 133:d4dda5c437f0 384 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \
mbed_official 133:d4dda5c437f0 385 ((SEL) == RTC_SHIFTADD1S_SET))
mbed_official 133:d4dda5c437f0 386 /**
mbed_official 133:d4dda5c437f0 387 * @}
mbed_official 133:d4dda5c437f0 388 */
mbed_official 133:d4dda5c437f0 389
mbed_official 133:d4dda5c437f0 390 /** @defgroup RTCEx_Substract_Fraction_Of_Second_Value
mbed_official 133:d4dda5c437f0 391 * @{
mbed_official 133:d4dda5c437f0 392 */
mbed_official 133:d4dda5c437f0 393 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFF)
mbed_official 133:d4dda5c437f0 394 /**
mbed_official 133:d4dda5c437f0 395 * @}
mbed_official 133:d4dda5c437f0 396 */
mbed_official 133:d4dda5c437f0 397
mbed_official 133:d4dda5c437f0 398 /** @defgroup RTCEx_Calib_Output_selection_Definitions
mbed_official 133:d4dda5c437f0 399 * @{
mbed_official 133:d4dda5c437f0 400 */
mbed_official 133:d4dda5c437f0 401 #define RTC_CALIBOUTPUT_512HZ ((uint32_t)0x00000000)
mbed_official 133:d4dda5c437f0 402 #define RTC_CALIBOUTPUT_1HZ ((uint32_t)0x00080000)
mbed_official 133:d4dda5c437f0 403
mbed_official 133:d4dda5c437f0 404 #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \
mbed_official 133:d4dda5c437f0 405 ((OUTPUT) == RTC_CALIBOUTPUT_1HZ))
mbed_official 133:d4dda5c437f0 406 /**
mbed_official 133:d4dda5c437f0 407 * @}
mbed_official 133:d4dda5c437f0 408 */
mbed_official 133:d4dda5c437f0 409
mbed_official 133:d4dda5c437f0 410 /**
mbed_official 133:d4dda5c437f0 411 * @}
mbed_official 133:d4dda5c437f0 412 */
mbed_official 133:d4dda5c437f0 413
mbed_official 133:d4dda5c437f0 414 /* Exported macro ------------------------------------------------------------*/
mbed_official 133:d4dda5c437f0 415
mbed_official 133:d4dda5c437f0 416 /**
mbed_official 133:d4dda5c437f0 417 * @brief Enable the RTC WakeUp Timer peripheral.
mbed_official 133:d4dda5c437f0 418 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 419 * @retval None
mbed_official 133:d4dda5c437f0 420 */
mbed_official 133:d4dda5c437f0 421 #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE))
mbed_official 133:d4dda5c437f0 422
mbed_official 133:d4dda5c437f0 423 /**
mbed_official 133:d4dda5c437f0 424 * @brief Enable the RTC TimeStamp peripheral.
mbed_official 133:d4dda5c437f0 425 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 426 * @retval None
mbed_official 133:d4dda5c437f0 427 */
mbed_official 133:d4dda5c437f0 428 #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE))
mbed_official 133:d4dda5c437f0 429
mbed_official 133:d4dda5c437f0 430 /**
mbed_official 133:d4dda5c437f0 431 * @brief Disable the RTC WakeUp Timer peripheral.
mbed_official 133:d4dda5c437f0 432 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 433 * @retval None
mbed_official 133:d4dda5c437f0 434 */
mbed_official 133:d4dda5c437f0 435 #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE))
mbed_official 133:d4dda5c437f0 436
mbed_official 133:d4dda5c437f0 437 /**
mbed_official 133:d4dda5c437f0 438 * @brief Disable the RTC TimeStamp peripheral.
mbed_official 133:d4dda5c437f0 439 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 440 * @retval None
mbed_official 133:d4dda5c437f0 441 */
mbed_official 133:d4dda5c437f0 442 #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE))
mbed_official 133:d4dda5c437f0 443
mbed_official 133:d4dda5c437f0 444 /**
mbed_official 133:d4dda5c437f0 445 * @brief Enable the Coarse calibration process.
mbed_official 133:d4dda5c437f0 446 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 447 * @retval None
mbed_official 133:d4dda5c437f0 448 */
mbed_official 133:d4dda5c437f0 449 #define __HAL_RTC_COARSE_CALIB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_DCE))
mbed_official 133:d4dda5c437f0 450
mbed_official 133:d4dda5c437f0 451 /**
mbed_official 133:d4dda5c437f0 452 * @brief Disable the Coarse calibration process.
mbed_official 133:d4dda5c437f0 453 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 454 * @retval None
mbed_official 133:d4dda5c437f0 455 */
mbed_official 133:d4dda5c437f0 456 #define __HAL_RTC_COARSE_CALIB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_DCE))
mbed_official 133:d4dda5c437f0 457
mbed_official 133:d4dda5c437f0 458 /**
mbed_official 133:d4dda5c437f0 459 * @brief Enable the RTC calibration output.
mbed_official 133:d4dda5c437f0 460 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 461 * @retval None
mbed_official 133:d4dda5c437f0 462 */
mbed_official 133:d4dda5c437f0 463 #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE))
mbed_official 133:d4dda5c437f0 464
mbed_official 133:d4dda5c437f0 465 /**
mbed_official 133:d4dda5c437f0 466 * @brief Disable the calibration output.
mbed_official 133:d4dda5c437f0 467 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 468 * @retval None
mbed_official 133:d4dda5c437f0 469 */
mbed_official 133:d4dda5c437f0 470 #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE))
mbed_official 133:d4dda5c437f0 471
mbed_official 133:d4dda5c437f0 472 /**
mbed_official 133:d4dda5c437f0 473 * @brief Enable the clock reference detection.
mbed_official 133:d4dda5c437f0 474 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 475 * @retval None
mbed_official 133:d4dda5c437f0 476 */
mbed_official 133:d4dda5c437f0 477 #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON))
mbed_official 133:d4dda5c437f0 478
mbed_official 133:d4dda5c437f0 479 /**
mbed_official 133:d4dda5c437f0 480 * @brief Disable the clock reference detection.
mbed_official 133:d4dda5c437f0 481 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 482 * @retval None
mbed_official 133:d4dda5c437f0 483 */
mbed_official 133:d4dda5c437f0 484 #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON))
mbed_official 133:d4dda5c437f0 485
mbed_official 133:d4dda5c437f0 486 /**
mbed_official 133:d4dda5c437f0 487 * @brief Enable the RTC TimeStamp interrupt.
mbed_official 133:d4dda5c437f0 488 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 489 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
mbed_official 133:d4dda5c437f0 490 * This parameter can be:
mbed_official 133:d4dda5c437f0 491 * @arg RTC_IT_TS: TimeStamp interrupt
mbed_official 133:d4dda5c437f0 492 * @retval None
mbed_official 133:d4dda5c437f0 493 */
mbed_official 133:d4dda5c437f0 494 #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
mbed_official 133:d4dda5c437f0 495
mbed_official 133:d4dda5c437f0 496 /**
mbed_official 133:d4dda5c437f0 497 * @brief Enable the RTC WakeUpTimer interrupt.
mbed_official 133:d4dda5c437f0 498 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 499 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
mbed_official 133:d4dda5c437f0 500 * This parameter can be:
mbed_official 133:d4dda5c437f0 501 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
mbed_official 133:d4dda5c437f0 502 * @retval None
mbed_official 133:d4dda5c437f0 503 */
mbed_official 133:d4dda5c437f0 504 #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
mbed_official 133:d4dda5c437f0 505
mbed_official 133:d4dda5c437f0 506 /**
mbed_official 133:d4dda5c437f0 507 * @brief Disable the RTC TimeStamp interrupt.
mbed_official 133:d4dda5c437f0 508 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 509 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
mbed_official 133:d4dda5c437f0 510 * This parameter can be:
mbed_official 133:d4dda5c437f0 511 * @arg RTC_IT_TS: TimeStamp interrupt
mbed_official 133:d4dda5c437f0 512 * @retval None
mbed_official 133:d4dda5c437f0 513 */
mbed_official 133:d4dda5c437f0 514 #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
mbed_official 133:d4dda5c437f0 515
mbed_official 133:d4dda5c437f0 516 /**
mbed_official 133:d4dda5c437f0 517 * @brief Disable the RTC WakeUpTimer interrupt.
mbed_official 133:d4dda5c437f0 518 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 519 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
mbed_official 133:d4dda5c437f0 520 * This parameter can be:
mbed_official 133:d4dda5c437f0 521 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
mbed_official 133:d4dda5c437f0 522 * @retval None
mbed_official 133:d4dda5c437f0 523 */
mbed_official 133:d4dda5c437f0 524 #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
mbed_official 133:d4dda5c437f0 525
mbed_official 133:d4dda5c437f0 526 /**
mbed_official 133:d4dda5c437f0 527 * @brief Check whether the specified RTC Tamper interrupt has occurred or not.
mbed_official 133:d4dda5c437f0 528 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 529 * @param __FLAG__: specifies the RTC Tamper interrupt sources to be enabled or disabled.
mbed_official 133:d4dda5c437f0 530 * This parameter can be:
mbed_official 133:d4dda5c437f0 531 * @arg RTC_IT_TAMP1
mbed_official 133:d4dda5c437f0 532 * @retval None
mbed_official 133:d4dda5c437f0 533 */
mbed_official 133:d4dda5c437f0 534 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
mbed_official 133:d4dda5c437f0 535
mbed_official 133:d4dda5c437f0 536 /**
mbed_official 133:d4dda5c437f0 537 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
mbed_official 133:d4dda5c437f0 538 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 539 * @param __FLAG__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
mbed_official 133:d4dda5c437f0 540 * This parameter can be:
mbed_official 133:d4dda5c437f0 541 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
mbed_official 133:d4dda5c437f0 542 * @retval None
mbed_official 133:d4dda5c437f0 543 */
mbed_official 133:d4dda5c437f0 544 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
mbed_official 133:d4dda5c437f0 545
mbed_official 133:d4dda5c437f0 546 /**
mbed_official 133:d4dda5c437f0 547 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not.
mbed_official 133:d4dda5c437f0 548 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 549 * @param __FLAG__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
mbed_official 133:d4dda5c437f0 550 * This parameter can be:
mbed_official 133:d4dda5c437f0 551 * @arg RTC_IT_TS: TimeStamp interrupt
mbed_official 133:d4dda5c437f0 552 * @retval None
mbed_official 133:d4dda5c437f0 553 */
mbed_official 133:d4dda5c437f0 554 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
mbed_official 133:d4dda5c437f0 555
mbed_official 133:d4dda5c437f0 556 /**
mbed_official 133:d4dda5c437f0 557 * @brief Get the selected RTC TimeStamp's flag status.
mbed_official 133:d4dda5c437f0 558 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 559 * @param __FLAG__: specifies the RTC TimeStamp Flag sources to be enabled or disabled.
mbed_official 133:d4dda5c437f0 560 * This parameter can be:
mbed_official 133:d4dda5c437f0 561 * @arg RTC_FLAG_TSF
mbed_official 133:d4dda5c437f0 562 * @arg RTC_FLAG_TSOVF
mbed_official 133:d4dda5c437f0 563 * @retval None
mbed_official 133:d4dda5c437f0 564 */
mbed_official 133:d4dda5c437f0 565 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
mbed_official 133:d4dda5c437f0 566
mbed_official 133:d4dda5c437f0 567 /**
mbed_official 133:d4dda5c437f0 568 * @brief Get the selected RTC WakeUpTimer's flag status.
mbed_official 133:d4dda5c437f0 569 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 570 * @param __FLAG__: specifies the RTC WakeUpTimer Flag sources to be enabled or disabled.
mbed_official 133:d4dda5c437f0 571 * This parameter can be:
mbed_official 133:d4dda5c437f0 572 * @arg RTC_FLAG_WUTF
mbed_official 133:d4dda5c437f0 573 * @arg RTC_FLAG_WUTWF
mbed_official 133:d4dda5c437f0 574 * @retval None
mbed_official 133:d4dda5c437f0 575 */
mbed_official 133:d4dda5c437f0 576 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
mbed_official 133:d4dda5c437f0 577
mbed_official 133:d4dda5c437f0 578 /**
mbed_official 133:d4dda5c437f0 579 * @brief Get the selected RTC Tamper's flag status.
mbed_official 133:d4dda5c437f0 580 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 581 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
mbed_official 133:d4dda5c437f0 582 * This parameter can be:
mbed_official 133:d4dda5c437f0 583 * @arg RTC_FLAG_TAMP1F
mbed_official 133:d4dda5c437f0 584 * @retval None
mbed_official 133:d4dda5c437f0 585 */
mbed_official 133:d4dda5c437f0 586 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
mbed_official 133:d4dda5c437f0 587
mbed_official 133:d4dda5c437f0 588 /**
mbed_official 133:d4dda5c437f0 589 * @brief Get the selected RTC shift operation's flag status.
mbed_official 133:d4dda5c437f0 590 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 591 * @param __FLAG__: specifies the RTC shift operation Flag is pending or not.
mbed_official 133:d4dda5c437f0 592 * This parameter can be:
mbed_official 133:d4dda5c437f0 593 * @arg RTC_FLAG_SHPF
mbed_official 133:d4dda5c437f0 594 * @retval None
mbed_official 133:d4dda5c437f0 595 */
mbed_official 133:d4dda5c437f0 596 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
mbed_official 133:d4dda5c437f0 597
mbed_official 133:d4dda5c437f0 598 /**
mbed_official 133:d4dda5c437f0 599 * @brief Clear the RTC Time Stamp's pending flags.
mbed_official 133:d4dda5c437f0 600 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 601 * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
mbed_official 133:d4dda5c437f0 602 * This parameter can be:
mbed_official 133:d4dda5c437f0 603 * @arg RTC_FLAG_TSF
mbed_official 133:d4dda5c437f0 604 * @retval None
mbed_official 133:d4dda5c437f0 605 */
mbed_official 133:d4dda5c437f0 606 #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
mbed_official 133:d4dda5c437f0 607
mbed_official 133:d4dda5c437f0 608 /**
mbed_official 133:d4dda5c437f0 609 * @brief Clear the RTC Tamper's pending flags.
mbed_official 133:d4dda5c437f0 610 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 611 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
mbed_official 133:d4dda5c437f0 612 * This parameter can be:
mbed_official 133:d4dda5c437f0 613 * @arg RTC_FLAG_TAMP1F
mbed_official 133:d4dda5c437f0 614 * @retval None
mbed_official 133:d4dda5c437f0 615 */
mbed_official 133:d4dda5c437f0 616 #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
mbed_official 133:d4dda5c437f0 617
mbed_official 133:d4dda5c437f0 618 /**
mbed_official 133:d4dda5c437f0 619 * @brief Clear the RTC Wake Up timer's pending flags.
mbed_official 133:d4dda5c437f0 620 * @param __HANDLE__: specifies the RTC handle.
mbed_official 133:d4dda5c437f0 621 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
mbed_official 133:d4dda5c437f0 622 * This parameter can be:
mbed_official 133:d4dda5c437f0 623 * @arg RTC_FLAG_WUTF
mbed_official 133:d4dda5c437f0 624 * @retval None
mbed_official 133:d4dda5c437f0 625 */
mbed_official 133:d4dda5c437f0 626 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
mbed_official 133:d4dda5c437f0 627
mbed_official 133:d4dda5c437f0 628 /* Exported functions --------------------------------------------------------*/
mbed_official 133:d4dda5c437f0 629
mbed_official 133:d4dda5c437f0 630 /* RTC TimeStamp and Tamper functions *****************************************/
mbed_official 133:d4dda5c437f0 631 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
mbed_official 133:d4dda5c437f0 632 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
mbed_official 133:d4dda5c437f0 633 HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 634 HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format);
mbed_official 133:d4dda5c437f0 635
mbed_official 133:d4dda5c437f0 636 HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
mbed_official 133:d4dda5c437f0 637 HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
mbed_official 133:d4dda5c437f0 638 HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper);
mbed_official 133:d4dda5c437f0 639 void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 640
mbed_official 133:d4dda5c437f0 641 void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 642 void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 643 void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 644 HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
mbed_official 133:d4dda5c437f0 645 HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
mbed_official 133:d4dda5c437f0 646 HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
mbed_official 133:d4dda5c437f0 647
mbed_official 133:d4dda5c437f0 648 /* RTC Wake-up functions ******************************************************/
mbed_official 133:d4dda5c437f0 649 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
mbed_official 133:d4dda5c437f0 650 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
mbed_official 133:d4dda5c437f0 651 uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 652 uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 653 void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 654 void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 655 HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
mbed_official 133:d4dda5c437f0 656
mbed_official 133:d4dda5c437f0 657 /* Extension Control functions ************************************************/
mbed_official 133:d4dda5c437f0 658 void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data);
mbed_official 133:d4dda5c437f0 659 uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
mbed_official 133:d4dda5c437f0 660
mbed_official 133:d4dda5c437f0 661 HAL_StatusTypeDef HAL_RTCEx_SetCoarseCalib(RTC_HandleTypeDef *hrtc, uint32_t CalibSign, uint32_t Value);
mbed_official 133:d4dda5c437f0 662 HAL_StatusTypeDef HAL_RTCEx_DeactivateCoarseCalib(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 663 HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue);
mbed_official 133:d4dda5c437f0 664 HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS);
mbed_official 133:d4dda5c437f0 665 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput);
mbed_official 133:d4dda5c437f0 666 HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 667 HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 668 HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 669 HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 670 HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 671
mbed_official 133:d4dda5c437f0 672 /* Extension RTC features functions *******************************************/
mbed_official 133:d4dda5c437f0 673 void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc);
mbed_official 133:d4dda5c437f0 674 HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
mbed_official 133:d4dda5c437f0 675
mbed_official 133:d4dda5c437f0 676
mbed_official 133:d4dda5c437f0 677 /**
mbed_official 133:d4dda5c437f0 678 * @}
mbed_official 133:d4dda5c437f0 679 */
mbed_official 133:d4dda5c437f0 680
mbed_official 133:d4dda5c437f0 681 /**
mbed_official 133:d4dda5c437f0 682 * @}
mbed_official 133:d4dda5c437f0 683 */
mbed_official 133:d4dda5c437f0 684
mbed_official 133:d4dda5c437f0 685 #ifdef __cplusplus
mbed_official 133:d4dda5c437f0 686 }
mbed_official 133:d4dda5c437f0 687 #endif
mbed_official 133:d4dda5c437f0 688
mbed_official 133:d4dda5c437f0 689 #endif /* __STM32F4xx_HAL_RTC_EX_H */
mbed_official 133:d4dda5c437f0 690
mbed_official 133:d4dda5c437f0 691 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/