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

Fork of mbed by mbed official

Committer:
Mikchel
Date:
Sun May 03 16:04:42 2015 +0000
Revision:
99:7f6c6de930c0
Parent:
92:4fc01daae5a5
12

Who changed what in which revision?

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