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:
235:685d5f11838f
test with CLOCK_SETUP = 0

Who changed what in which revision?

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