meh

Fork of mbed by mbed official

Committer:
ricardobtez
Date:
Tue Apr 05 23:51:21 2016 +0000
Revision:
118:16969dd821af
Parent:
92:4fc01daae5a5
Child:
93:e188a91d3eaa
dgdgr

Who changed what in which revision?

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