DHT11

Committer:
jhon309
Date:
Thu Aug 13 00:21:57 2015 +0000
Revision:
0:c52df770855b
DHT11

Who changed what in which revision?

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