meh

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Jun 11 15:14:05 2014 +0100
Revision:
85:024bf7f99721
Child:
92:4fc01daae5a5
Release 85 of the mbed library

Main changes:

- K64F Ethernet fixes
- Updated tests
- Fixes for various mbed targets
- Code cleanup: fixed warnings, more consistent code style
- GCC support for K64F

There is a known issue with the I2C interface on some ST targets. If you
find the I2C interface problematic on your ST board, please log a bug
against this on mbed.org.

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 85:024bf7f99721 5 * @version V1.0.0
bogdanm 85:024bf7f99721 6 * @date 28-May-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 85:024bf7f99721 59 /**
bogdanm 85:024bf7f99721 60 * @brief RTC Tamper structure definition
bogdanm 85:024bf7f99721 61 */
bogdanm 85:024bf7f99721 62 typedef struct
bogdanm 85:024bf7f99721 63 {
bogdanm 85:024bf7f99721 64 uint32_t Tamper; /*!< Specifies the Tamper Pin.
bogdanm 85:024bf7f99721 65 This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */
bogdanm 85:024bf7f99721 66
bogdanm 85:024bf7f99721 67 uint32_t Trigger; /*!< Specifies the Tamper Trigger.
bogdanm 85:024bf7f99721 68 This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */
bogdanm 85:024bf7f99721 69
bogdanm 85:024bf7f99721 70 uint32_t Filter; /*!< Specifies the RTC Filter Tamper.
bogdanm 85:024bf7f99721 71 This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */
bogdanm 85:024bf7f99721 72
bogdanm 85:024bf7f99721 73 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency.
bogdanm 85:024bf7f99721 74 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */
bogdanm 85:024bf7f99721 75
bogdanm 85:024bf7f99721 76 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration .
bogdanm 85:024bf7f99721 77 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */
bogdanm 85:024bf7f99721 78
bogdanm 85:024bf7f99721 79 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp .
bogdanm 85:024bf7f99721 80 This parameter can be a value of @ref RTCEx_Tamper_Pull_UP_Definitions */
bogdanm 85:024bf7f99721 81
bogdanm 85:024bf7f99721 82 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection.
bogdanm 85:024bf7f99721 83 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */
bogdanm 85:024bf7f99721 84 }RTC_TamperTypeDef;
bogdanm 85:024bf7f99721 85
bogdanm 85:024bf7f99721 86 /* Exported constants --------------------------------------------------------*/
bogdanm 85:024bf7f99721 87 /** @defgroup RTCEx_Exported_Constants
bogdanm 85:024bf7f99721 88 * @{
bogdanm 85:024bf7f99721 89 */
bogdanm 85:024bf7f99721 90
bogdanm 85:024bf7f99721 91 /** @defgroup RTCEx_Output_selection_Definitions
bogdanm 85:024bf7f99721 92 * @{
bogdanm 85:024bf7f99721 93 */
bogdanm 85:024bf7f99721 94 #define RTC_OUTPUT_DISABLE ((uint32_t)0x00000000)
bogdanm 85:024bf7f99721 95 #define RTC_OUTPUT_ALARMA ((uint32_t)0x00200000)
bogdanm 85:024bf7f99721 96 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 97 #define RTC_OUTPUT_WAKEUP ((uint32_t)0x00600000)
bogdanm 85:024bf7f99721 98 #endif
bogdanm 85:024bf7f99721 99
bogdanm 85:024bf7f99721 100 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 101 #define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_OUTPUT_DISABLE) || \
bogdanm 85:024bf7f99721 102 ((OUTPUT) == RTC_OUTPUT_ALARMA) || \
bogdanm 85:024bf7f99721 103 ((OUTPUT) == RTC_OUTPUT_WAKEUP))
bogdanm 85:024bf7f99721 104 #else
bogdanm 85:024bf7f99721 105 #define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_OUTPUT_DISABLE) || \
bogdanm 85:024bf7f99721 106 ((OUTPUT) == RTC_OUTPUT_ALARMA))
bogdanm 85:024bf7f99721 107 #endif
bogdanm 85:024bf7f99721 108 /**
bogdanm 85:024bf7f99721 109 * @}
bogdanm 85:024bf7f99721 110 */
bogdanm 85:024bf7f99721 111
bogdanm 85:024bf7f99721 112 #if !defined(STM32F030x6) && !defined(STM32F030x8)
bogdanm 85:024bf7f99721 113 /** @defgroup RTCEx_Backup_Registers_Definitions
bogdanm 85:024bf7f99721 114 * @{
bogdanm 85:024bf7f99721 115 */
bogdanm 85:024bf7f99721 116 #define RTC_BKP_DR0 ((uint32_t)0x00000000)
bogdanm 85:024bf7f99721 117 #define RTC_BKP_DR1 ((uint32_t)0x00000001)
bogdanm 85:024bf7f99721 118 #define RTC_BKP_DR2 ((uint32_t)0x00000002)
bogdanm 85:024bf7f99721 119 #define RTC_BKP_DR3 ((uint32_t)0x00000003)
bogdanm 85:024bf7f99721 120 #define RTC_BKP_DR4 ((uint32_t)0x00000004)
bogdanm 85:024bf7f99721 121
bogdanm 85:024bf7f99721 122 #define IS_RTC_BKP(BKP) ((BKP) < (uint32_t) RTC_BKP_NUMBER)
bogdanm 85:024bf7f99721 123 /**
bogdanm 85:024bf7f99721 124 * @}
bogdanm 85:024bf7f99721 125 */
bogdanm 85:024bf7f99721 126 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
bogdanm 85:024bf7f99721 127
bogdanm 85:024bf7f99721 128 /** @defgroup RTCEx_Time_Stamp_Edges_definitions
bogdanm 85:024bf7f99721 129 * @{
bogdanm 85:024bf7f99721 130 */
bogdanm 85:024bf7f99721 131 #define RTC_TIMESTAMPEDGE_RISING ((uint32_t)0x00000000)
bogdanm 85:024bf7f99721 132 #define RTC_TIMESTAMPEDGE_FALLING ((uint32_t)0x00000008)
bogdanm 85:024bf7f99721 133
bogdanm 85:024bf7f99721 134 #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \
bogdanm 85:024bf7f99721 135 ((EDGE) == RTC_TIMESTAMPEDGE_FALLING))
bogdanm 85:024bf7f99721 136 /**
bogdanm 85:024bf7f99721 137 * @}
bogdanm 85:024bf7f99721 138 */
bogdanm 85:024bf7f99721 139
bogdanm 85:024bf7f99721 140 /** @defgroup RTCEx_Tamper_Pins_Definitions
bogdanm 85:024bf7f99721 141 * @{
bogdanm 85:024bf7f99721 142 */
bogdanm 85:024bf7f99721 143 #define RTC_TAMPER_1 RTC_TAFCR_TAMP1E
bogdanm 85:024bf7f99721 144 #define RTC_TAMPER_2 RTC_TAFCR_TAMP2E
bogdanm 85:024bf7f99721 145 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 146 #define RTC_TAMPER_3 RTC_TAFCR_TAMP3E
bogdanm 85:024bf7f99721 147 #endif
bogdanm 85:024bf7f99721 148
bogdanm 85:024bf7f99721 149 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 150 #define IS_TAMPER(TAMPER) (((TAMPER) == RTC_TAMPER_1) || \
bogdanm 85:024bf7f99721 151 ((TAMPER) == RTC_TAMPER_2) || \
bogdanm 85:024bf7f99721 152 ((TAMPER) == RTC_TAMPER_3))
bogdanm 85:024bf7f99721 153 #else
bogdanm 85:024bf7f99721 154 #define IS_TAMPER(TAMPER) (((TAMPER) == RTC_TAMPER_1) || \
bogdanm 85:024bf7f99721 155 ((TAMPER) == RTC_TAMPER_2))
bogdanm 85:024bf7f99721 156 #endif
bogdanm 85:024bf7f99721 157 /**
bogdanm 85:024bf7f99721 158 * @}
bogdanm 85:024bf7f99721 159 */
bogdanm 85:024bf7f99721 160
bogdanm 85:024bf7f99721 161 /** @defgroup RTCEx_TimeStamp_Pin_Selection
bogdanm 85:024bf7f99721 162 * @{
bogdanm 85:024bf7f99721 163 */
bogdanm 85:024bf7f99721 164 #define RTC_TIMESTAMPPIN_PC13 ((uint32_t)0x00000000)
bogdanm 85:024bf7f99721 165
bogdanm 85:024bf7f99721 166 #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_PC13))
bogdanm 85:024bf7f99721 167 /**
bogdanm 85:024bf7f99721 168 * @}
bogdanm 85:024bf7f99721 169 */
bogdanm 85:024bf7f99721 170
bogdanm 85:024bf7f99721 171 /** @defgroup RTCEx_Tamper_Trigger_Definitions
bogdanm 85:024bf7f99721 172 * @{
bogdanm 85:024bf7f99721 173 */
bogdanm 85:024bf7f99721 174 #define RTC_TAMPERTRIGGER_RISINGEDGE ((uint32_t)0x00000000)
bogdanm 85:024bf7f99721 175 #define RTC_TAMPERTRIGGER_FALLINGEDGE ((uint32_t)0x00000002)
bogdanm 85:024bf7f99721 176 #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE
bogdanm 85:024bf7f99721 177 #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE
bogdanm 85:024bf7f99721 178
bogdanm 85:024bf7f99721 179 #define IS_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) || \
bogdanm 85:024bf7f99721 180 ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \
bogdanm 85:024bf7f99721 181 ((TRIGGER) == RTC_TAMPERTRIGGER_LOWLEVEL) || \
bogdanm 85:024bf7f99721 182 ((TRIGGER) == RTC_TAMPERTRIGGER_HIGHLEVEL))
bogdanm 85:024bf7f99721 183
bogdanm 85:024bf7f99721 184 /**
bogdanm 85:024bf7f99721 185 * @}
bogdanm 85:024bf7f99721 186 */
bogdanm 85:024bf7f99721 187
bogdanm 85:024bf7f99721 188 /** @defgroup RTCEx_Tamper_Filter_Definitions
bogdanm 85:024bf7f99721 189 * @{
bogdanm 85:024bf7f99721 190 */
bogdanm 85:024bf7f99721 191 #define RTC_TAMPERFILTER_DISABLE ((uint32_t)0x00000000) /*!< Tamper filter is disabled */
bogdanm 85:024bf7f99721 192
bogdanm 85:024bf7f99721 193 #define RTC_TAMPERFILTER_2SAMPLE ((uint32_t)0x00000800) /*!< Tamper is activated after 2
bogdanm 85:024bf7f99721 194 consecutive samples at the active level */
bogdanm 85:024bf7f99721 195 #define RTC_TAMPERFILTER_4SAMPLE ((uint32_t)0x00001000) /*!< Tamper is activated after 4
bogdanm 85:024bf7f99721 196 consecutive samples at the active level */
bogdanm 85:024bf7f99721 197 #define RTC_TAMPERFILTER_8SAMPLE ((uint32_t)0x00001800) /*!< Tamper is activated after 8
bogdanm 85:024bf7f99721 198 consecutive samples at the active level. */
bogdanm 85:024bf7f99721 199
bogdanm 85:024bf7f99721 200 #define IS_TAMPER_FILTER(FILTER) (((FILTER) == RTC_TAMPERFILTER_DISABLE) || \
bogdanm 85:024bf7f99721 201 ((FILTER) == RTC_TAMPERFILTER_2SAMPLE) || \
bogdanm 85:024bf7f99721 202 ((FILTER) == RTC_TAMPERFILTER_4SAMPLE) || \
bogdanm 85:024bf7f99721 203 ((FILTER) == RTC_TAMPERFILTER_8SAMPLE))
bogdanm 85:024bf7f99721 204 /**
bogdanm 85:024bf7f99721 205 * @}
bogdanm 85:024bf7f99721 206 */
bogdanm 85:024bf7f99721 207
bogdanm 85:024bf7f99721 208 /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions
bogdanm 85:024bf7f99721 209 * @{
bogdanm 85:024bf7f99721 210 */
bogdanm 85:024bf7f99721 211 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 ((uint32_t)0x00000000) /*!< Each of the tamper inputs are sampled
bogdanm 85:024bf7f99721 212 with a frequency = RTCCLK / 32768 */
bogdanm 85:024bf7f99721 213 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 ((uint32_t)0x00000100) /*!< Each of the tamper inputs are sampled
bogdanm 85:024bf7f99721 214 with a frequency = RTCCLK / 16384 */
bogdanm 85:024bf7f99721 215 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 ((uint32_t)0x00000200) /*!< Each of the tamper inputs are sampled
bogdanm 85:024bf7f99721 216 with a frequency = RTCCLK / 8192 */
bogdanm 85:024bf7f99721 217 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 ((uint32_t)0x00000300) /*!< Each of the tamper inputs are sampled
bogdanm 85:024bf7f99721 218 with a frequency = RTCCLK / 4096 */
bogdanm 85:024bf7f99721 219 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 ((uint32_t)0x00000400) /*!< Each of the tamper inputs are sampled
bogdanm 85:024bf7f99721 220 with a frequency = RTCCLK / 2048 */
bogdanm 85:024bf7f99721 221 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 ((uint32_t)0x00000500) /*!< Each of the tamper inputs are sampled
bogdanm 85:024bf7f99721 222 with a frequency = RTCCLK / 1024 */
bogdanm 85:024bf7f99721 223 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 ((uint32_t)0x00000600) /*!< Each of the tamper inputs are sampled
bogdanm 85:024bf7f99721 224 with a frequency = RTCCLK / 512 */
bogdanm 85:024bf7f99721 225 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 ((uint32_t)0x00000700) /*!< Each of the tamper inputs are sampled
bogdanm 85:024bf7f99721 226 with a frequency = RTCCLK / 256 */
bogdanm 85:024bf7f99721 227
bogdanm 85:024bf7f99721 228 #define IS_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \
bogdanm 85:024bf7f99721 229 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \
bogdanm 85:024bf7f99721 230 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \
bogdanm 85:024bf7f99721 231 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \
bogdanm 85:024bf7f99721 232 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \
bogdanm 85:024bf7f99721 233 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \
bogdanm 85:024bf7f99721 234 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \
bogdanm 85:024bf7f99721 235 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256))
bogdanm 85:024bf7f99721 236 /**
bogdanm 85:024bf7f99721 237 * @}
bogdanm 85:024bf7f99721 238 */
bogdanm 85:024bf7f99721 239
bogdanm 85:024bf7f99721 240 /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions
bogdanm 85:024bf7f99721 241 * @{
bogdanm 85:024bf7f99721 242 */
bogdanm 85:024bf7f99721 243 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before
bogdanm 85:024bf7f99721 244 sampling during 1 RTCCLK cycle */
bogdanm 85:024bf7f99721 245 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK ((uint32_t)0x00002000) /*!< Tamper pins are pre-charged before
bogdanm 85:024bf7f99721 246 sampling during 2 RTCCLK cycles */
bogdanm 85:024bf7f99721 247 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK ((uint32_t)0x00004000) /*!< Tamper pins are pre-charged before
bogdanm 85:024bf7f99721 248 sampling during 4 RTCCLK cycles */
bogdanm 85:024bf7f99721 249 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK ((uint32_t)0x00006000) /*!< Tamper pins are pre-charged before
bogdanm 85:024bf7f99721 250 sampling during 8 RTCCLK cycles */
bogdanm 85:024bf7f99721 251
bogdanm 85:024bf7f99721 252 #define IS_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \
bogdanm 85:024bf7f99721 253 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \
bogdanm 85:024bf7f99721 254 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \
bogdanm 85:024bf7f99721 255 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK))
bogdanm 85:024bf7f99721 256 /**
bogdanm 85:024bf7f99721 257 * @}
bogdanm 85:024bf7f99721 258 */
bogdanm 85:024bf7f99721 259
bogdanm 85:024bf7f99721 260 /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions
bogdanm 85:024bf7f99721 261 * @{
bogdanm 85:024bf7f99721 262 */
bogdanm 85:024bf7f99721 263 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE ((uint32_t)RTC_TAFCR_TAMPTS) /*!< TimeStamp on Tamper Detection event saved */
bogdanm 85:024bf7f99721 264 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE ((uint32_t)0x00000000) /*!< TimeStamp on Tamper Detection event is not saved */
bogdanm 85:024bf7f99721 265
bogdanm 85:024bf7f99721 266 #define IS_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \
bogdanm 85:024bf7f99721 267 ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE))
bogdanm 85:024bf7f99721 268 /**
bogdanm 85:024bf7f99721 269 * @}
bogdanm 85:024bf7f99721 270 */
bogdanm 85:024bf7f99721 271
bogdanm 85:024bf7f99721 272 /** @defgroup RTCEx_Tamper_Pull_UP_Definitions
bogdanm 85:024bf7f99721 273 * @{
bogdanm 85:024bf7f99721 274 */
bogdanm 85:024bf7f99721 275 #define RTC_TAMPER_PULLUP_ENABLE ((uint32_t)0x00000000) /*!< TimeStamp on Tamper Detection event saved */
bogdanm 85:024bf7f99721 276 #define RTC_TAMPER_PULLUP_DISABLE ((uint32_t)RTC_TAFCR_TAMPPUDIS) /*!< TimeStamp on Tamper Detection event is not saved */
bogdanm 85:024bf7f99721 277
bogdanm 85:024bf7f99721 278 #define IS_TAMPER_PULLUP_STATE(STATE) (((STATE) == RTC_TAMPER_PULLUP_ENABLE) || \
bogdanm 85:024bf7f99721 279 ((STATE) == RTC_TAMPER_PULLUP_DISABLE))
bogdanm 85:024bf7f99721 280 /**
bogdanm 85:024bf7f99721 281 * @}
bogdanm 85:024bf7f99721 282 */
bogdanm 85:024bf7f99721 283
bogdanm 85:024bf7f99721 284 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 285 /** @defgroup RTCEx_Wakeup_Timer_Definitions
bogdanm 85:024bf7f99721 286 * @{
bogdanm 85:024bf7f99721 287 */
bogdanm 85:024bf7f99721 288 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 ((uint32_t)0x00000000)
bogdanm 85:024bf7f99721 289 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 ((uint32_t)0x00000001)
bogdanm 85:024bf7f99721 290 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 ((uint32_t)0x00000002)
bogdanm 85:024bf7f99721 291 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 ((uint32_t)0x00000003)
bogdanm 85:024bf7f99721 292 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS ((uint32_t)0x00000004)
bogdanm 85:024bf7f99721 293 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS ((uint32_t)0x00000006)
bogdanm 85:024bf7f99721 294
bogdanm 85:024bf7f99721 295 #define IS_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \
bogdanm 85:024bf7f99721 296 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \
bogdanm 85:024bf7f99721 297 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \
bogdanm 85:024bf7f99721 298 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \
bogdanm 85:024bf7f99721 299 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \
bogdanm 85:024bf7f99721 300 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS))
bogdanm 85:024bf7f99721 301
bogdanm 85:024bf7f99721 302 #define IS_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFF)
bogdanm 85:024bf7f99721 303 /**
bogdanm 85:024bf7f99721 304 * @}
bogdanm 85:024bf7f99721 305 */
bogdanm 85:024bf7f99721 306 #endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) */
bogdanm 85:024bf7f99721 307
bogdanm 85:024bf7f99721 308 /** @defgroup RTCEx_Smooth_calib_period_Definitions
bogdanm 85:024bf7f99721 309 * @{
bogdanm 85:024bf7f99721 310 */
bogdanm 85:024bf7f99721 311 #define RTC_SMOOTHCALIB_PERIOD_32SEC ((uint32_t)0x00000000) /*!< If RTCCLK = 32768 Hz, Smooth calibation
bogdanm 85:024bf7f99721 312 period is 32s, else 2exp20 RTCCLK seconds */
bogdanm 85:024bf7f99721 313 #define RTC_SMOOTHCALIB_PERIOD_16SEC ((uint32_t)0x00002000) /*!< If RTCCLK = 32768 Hz, Smooth calibation
bogdanm 85:024bf7f99721 314 period is 16s, else 2exp19 RTCCLK seconds */
bogdanm 85:024bf7f99721 315 #define RTC_SMOOTHCALIB_PERIOD_8SEC ((uint32_t)0x00004000) /*!< If RTCCLK = 32768 Hz, Smooth calibation
bogdanm 85:024bf7f99721 316 period is 8s, else 2exp18 RTCCLK seconds */
bogdanm 85:024bf7f99721 317
bogdanm 85:024bf7f99721 318 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \
bogdanm 85:024bf7f99721 319 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \
bogdanm 85:024bf7f99721 320 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC))
bogdanm 85:024bf7f99721 321 /**
bogdanm 85:024bf7f99721 322 * @}
bogdanm 85:024bf7f99721 323 */
bogdanm 85:024bf7f99721 324
bogdanm 85:024bf7f99721 325 /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions
bogdanm 85:024bf7f99721 326 * @{
bogdanm 85:024bf7f99721 327 */
bogdanm 85:024bf7f99721 328 #define RTC_SMOOTHCALIB_PLUSPULSES_SET ((uint32_t)0x00008000) /*!< The number of RTCCLK pulses added
bogdanm 85:024bf7f99721 329 during a X -second window = Y - CALM[8:0]
bogdanm 85:024bf7f99721 330 with Y = 512, 256, 128 when X = 32, 16, 8 */
bogdanm 85:024bf7f99721 331 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET ((uint32_t)0x00000000) /*!< The number of RTCCLK pulses subbstited
bogdanm 85:024bf7f99721 332 during a 32-second window = CALM[8:0] */
bogdanm 85:024bf7f99721 333
bogdanm 85:024bf7f99721 334 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \
bogdanm 85:024bf7f99721 335 ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET))
bogdanm 85:024bf7f99721 336 /**
bogdanm 85:024bf7f99721 337 * @}
bogdanm 85:024bf7f99721 338 */
bogdanm 85:024bf7f99721 339
bogdanm 85:024bf7f99721 340 /** @defgroup RTCEx_Smooth_calib_Minus_pulses_Definitions
bogdanm 85:024bf7f99721 341 * @{
bogdanm 85:024bf7f99721 342 */
bogdanm 85:024bf7f99721 343 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x000001FF)
bogdanm 85:024bf7f99721 344 /**
bogdanm 85:024bf7f99721 345 * @}
bogdanm 85:024bf7f99721 346 */
bogdanm 85:024bf7f99721 347
bogdanm 85:024bf7f99721 348 /** @defgroup RTCEx_Add_1_Second_Parameter_Definitions
bogdanm 85:024bf7f99721 349 * @{
bogdanm 85:024bf7f99721 350 */
bogdanm 85:024bf7f99721 351 #define RTC_SHIFTADD1S_RESET ((uint32_t)0x00000000)
bogdanm 85:024bf7f99721 352 #define RTC_SHIFTADD1S_SET ((uint32_t)0x80000000)
bogdanm 85:024bf7f99721 353
bogdanm 85:024bf7f99721 354 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \
bogdanm 85:024bf7f99721 355 ((SEL) == RTC_SHIFTADD1S_SET))
bogdanm 85:024bf7f99721 356 /**
bogdanm 85:024bf7f99721 357 * @}
bogdanm 85:024bf7f99721 358 */
bogdanm 85:024bf7f99721 359
bogdanm 85:024bf7f99721 360 /** @defgroup RTCEx_Substract_Fraction_Of_Second_Value
bogdanm 85:024bf7f99721 361 * @{
bogdanm 85:024bf7f99721 362 */
bogdanm 85:024bf7f99721 363 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFF)
bogdanm 85:024bf7f99721 364 /**
bogdanm 85:024bf7f99721 365 * @}
bogdanm 85:024bf7f99721 366 */
bogdanm 85:024bf7f99721 367
bogdanm 85:024bf7f99721 368 /** @defgroup RTCEx_Calib_Output_selection_Definitions
bogdanm 85:024bf7f99721 369 * @{
bogdanm 85:024bf7f99721 370 */
bogdanm 85:024bf7f99721 371 #define RTC_CALIBOUTPUT_512HZ ((uint32_t)0x00000000)
bogdanm 85:024bf7f99721 372 #define RTC_CALIBOUTPUT_1HZ ((uint32_t)0x00080000)
bogdanm 85:024bf7f99721 373
bogdanm 85:024bf7f99721 374 #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \
bogdanm 85:024bf7f99721 375 ((OUTPUT) == RTC_CALIBOUTPUT_1HZ))
bogdanm 85:024bf7f99721 376 /**
bogdanm 85:024bf7f99721 377 * @}
bogdanm 85:024bf7f99721 378 */
bogdanm 85:024bf7f99721 379
bogdanm 85:024bf7f99721 380 /**
bogdanm 85:024bf7f99721 381 * @}
bogdanm 85:024bf7f99721 382 */
bogdanm 85:024bf7f99721 383
bogdanm 85:024bf7f99721 384 /* Exported macro ------------------------------------------------------------*/
bogdanm 85:024bf7f99721 385
bogdanm 85:024bf7f99721 386 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 387 /**
bogdanm 85:024bf7f99721 388 * @brief Enable the RTC WakeUp Timer peripheral.
bogdanm 85:024bf7f99721 389 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 390 * @retval None
bogdanm 85:024bf7f99721 391 */
bogdanm 85:024bf7f99721 392 #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE))
bogdanm 85:024bf7f99721 393 #endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) */
bogdanm 85:024bf7f99721 394
bogdanm 85:024bf7f99721 395 /**
bogdanm 85:024bf7f99721 396 * @brief Enable the RTC TimeStamp peripheral.
bogdanm 85:024bf7f99721 397 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 398 * @retval None
bogdanm 85:024bf7f99721 399 */
bogdanm 85:024bf7f99721 400 #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE))
bogdanm 85:024bf7f99721 401
bogdanm 85:024bf7f99721 402 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 403 /**
bogdanm 85:024bf7f99721 404 * @brief Disable the RTC WakeUp Timer peripheral.
bogdanm 85:024bf7f99721 405 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 406 * @retval None
bogdanm 85:024bf7f99721 407 */
bogdanm 85:024bf7f99721 408 #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE))
bogdanm 85:024bf7f99721 409 #endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) */
bogdanm 85:024bf7f99721 410
bogdanm 85:024bf7f99721 411 /**
bogdanm 85:024bf7f99721 412 * @brief Disable the RTC TimeStamp peripheral.
bogdanm 85:024bf7f99721 413 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 414 * @retval None
bogdanm 85:024bf7f99721 415 */
bogdanm 85:024bf7f99721 416 #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE))
bogdanm 85:024bf7f99721 417
bogdanm 85:024bf7f99721 418 /**
bogdanm 85:024bf7f99721 419 * @brief Enable the RTC calibration output.
bogdanm 85:024bf7f99721 420 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 421 * @retval None
bogdanm 85:024bf7f99721 422 */
bogdanm 85:024bf7f99721 423 #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE))
bogdanm 85:024bf7f99721 424
bogdanm 85:024bf7f99721 425 /**
bogdanm 85:024bf7f99721 426 * @brief Disable the calibration output.
bogdanm 85:024bf7f99721 427 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 428 * @retval None
bogdanm 85:024bf7f99721 429 */
bogdanm 85:024bf7f99721 430 #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE))
bogdanm 85:024bf7f99721 431
bogdanm 85:024bf7f99721 432 /**
bogdanm 85:024bf7f99721 433 * @brief Enable the clock reference detection.
bogdanm 85:024bf7f99721 434 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 435 * @retval None
bogdanm 85:024bf7f99721 436 */
bogdanm 85:024bf7f99721 437 #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON))
bogdanm 85:024bf7f99721 438
bogdanm 85:024bf7f99721 439 /**
bogdanm 85:024bf7f99721 440 * @brief Disable the clock reference detection.
bogdanm 85:024bf7f99721 441 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 442 * @retval None
bogdanm 85:024bf7f99721 443 */
bogdanm 85:024bf7f99721 444 #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON))
bogdanm 85:024bf7f99721 445
bogdanm 85:024bf7f99721 446 /**
bogdanm 85:024bf7f99721 447 * @brief Enable the RTC TimeStamp interrupt.
bogdanm 85:024bf7f99721 448 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 449 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
bogdanm 85:024bf7f99721 450 * This parameter can be:
bogdanm 85:024bf7f99721 451 * @arg RTC_IT_TS: TimeStamp interrupt
bogdanm 85:024bf7f99721 452 * @retval None
bogdanm 85:024bf7f99721 453 */
bogdanm 85:024bf7f99721 454 #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
bogdanm 85:024bf7f99721 455
bogdanm 85:024bf7f99721 456 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 457 /**
bogdanm 85:024bf7f99721 458 * @brief Enable the RTC WakeUpTimer interrupt.
bogdanm 85:024bf7f99721 459 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 460 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
bogdanm 85:024bf7f99721 461 * This parameter can be:
bogdanm 85:024bf7f99721 462 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
bogdanm 85:024bf7f99721 463 * @retval None
bogdanm 85:024bf7f99721 464 */
bogdanm 85:024bf7f99721 465 #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
bogdanm 85:024bf7f99721 466 #endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) */
bogdanm 85:024bf7f99721 467
bogdanm 85:024bf7f99721 468 /**
bogdanm 85:024bf7f99721 469 * @brief Disable the RTC TimeStamp interrupt.
bogdanm 85:024bf7f99721 470 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 471 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
bogdanm 85:024bf7f99721 472 * This parameter can be:
bogdanm 85:024bf7f99721 473 * @arg RTC_IT_TS: TimeStamp interrupt
bogdanm 85:024bf7f99721 474 * @retval None
bogdanm 85:024bf7f99721 475 */
bogdanm 85:024bf7f99721 476 #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
bogdanm 85:024bf7f99721 477
bogdanm 85:024bf7f99721 478 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 479 /**
bogdanm 85:024bf7f99721 480 * @brief Disable the RTC WakeUpTimer interrupt.
bogdanm 85:024bf7f99721 481 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 482 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
bogdanm 85:024bf7f99721 483 * This parameter can be:
bogdanm 85:024bf7f99721 484 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
bogdanm 85:024bf7f99721 485 * @retval None
bogdanm 85:024bf7f99721 486 */
bogdanm 85:024bf7f99721 487 #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
bogdanm 85:024bf7f99721 488 #endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) */
bogdanm 85:024bf7f99721 489
bogdanm 85:024bf7f99721 490 /**
bogdanm 85:024bf7f99721 491 * @brief Check whether the specified RTC Tamper interrupt has occurred or not.
bogdanm 85:024bf7f99721 492 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 493 * @param __FLAG__: specifies the RTC Tamper interrupt sources to be enabled or disabled.
bogdanm 85:024bf7f99721 494 * This parameter can be:
bogdanm 85:024bf7f99721 495 * @arg RTC_IT_TAMP1
bogdanm 85:024bf7f99721 496 * @retval None
bogdanm 85:024bf7f99721 497 */
bogdanm 85:024bf7f99721 498 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
bogdanm 85:024bf7f99721 499
bogdanm 85:024bf7f99721 500 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 501 /**
bogdanm 85:024bf7f99721 502 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
bogdanm 85:024bf7f99721 503 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 504 * @param __FLAG__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
bogdanm 85:024bf7f99721 505 * This parameter can be:
bogdanm 85:024bf7f99721 506 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
bogdanm 85:024bf7f99721 507 * @retval None
bogdanm 85:024bf7f99721 508 */
bogdanm 85:024bf7f99721 509 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
bogdanm 85:024bf7f99721 510 #endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) */
bogdanm 85:024bf7f99721 511
bogdanm 85:024bf7f99721 512 /**
bogdanm 85:024bf7f99721 513 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not.
bogdanm 85:024bf7f99721 514 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 515 * @param __FLAG__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
bogdanm 85:024bf7f99721 516 * This parameter can be:
bogdanm 85:024bf7f99721 517 * @arg RTC_IT_TS: TimeStamp interrupt
bogdanm 85:024bf7f99721 518 * @retval None
bogdanm 85:024bf7f99721 519 */
bogdanm 85:024bf7f99721 520 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
bogdanm 85:024bf7f99721 521
bogdanm 85:024bf7f99721 522 /**
bogdanm 85:024bf7f99721 523 * @brief Get the selected RTC TimeStamp's flag status.
bogdanm 85:024bf7f99721 524 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 525 * @param __FLAG__: specifies the RTC TimeStamp Flag sources to be enabled or disabled.
bogdanm 85:024bf7f99721 526 * This parameter can be:
bogdanm 85:024bf7f99721 527 * @arg RTC_FLAG_TSF
bogdanm 85:024bf7f99721 528 * @arg RTC_FLAG_TSOVF
bogdanm 85:024bf7f99721 529 * @retval None
bogdanm 85:024bf7f99721 530 */
bogdanm 85:024bf7f99721 531 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
bogdanm 85:024bf7f99721 532
bogdanm 85:024bf7f99721 533 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 534 /**
bogdanm 85:024bf7f99721 535 * @brief Get the selected RTC WakeUpTimer's flag status.
bogdanm 85:024bf7f99721 536 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 537 * @param __FLAG__: specifies the RTC WakeUpTimer Flag sources to be enabled or disabled.
bogdanm 85:024bf7f99721 538 * This parameter can be:
bogdanm 85:024bf7f99721 539 * @arg RTC_FLAG_WUTF
bogdanm 85:024bf7f99721 540 * @arg RTC_FLAG_WUTWF
bogdanm 85:024bf7f99721 541 * @retval None
bogdanm 85:024bf7f99721 542 */
bogdanm 85:024bf7f99721 543 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
bogdanm 85:024bf7f99721 544 #endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) */
bogdanm 85:024bf7f99721 545
bogdanm 85:024bf7f99721 546 /**
bogdanm 85:024bf7f99721 547 * @brief Get the selected RTC Tamper's flag status.
bogdanm 85:024bf7f99721 548 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 549 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
bogdanm 85:024bf7f99721 550 * This parameter can be:
bogdanm 85:024bf7f99721 551 * @arg RTC_FLAG_TAMP1F
bogdanm 85:024bf7f99721 552 * @retval None
bogdanm 85:024bf7f99721 553 */
bogdanm 85:024bf7f99721 554 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
bogdanm 85:024bf7f99721 555
bogdanm 85:024bf7f99721 556 /**
bogdanm 85:024bf7f99721 557 * @brief Get the selected RTC shift operation's flag status.
bogdanm 85:024bf7f99721 558 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 559 * @param __FLAG__: specifies the RTC shift operation Flag is pending or not.
bogdanm 85:024bf7f99721 560 * This parameter can be:
bogdanm 85:024bf7f99721 561 * @arg RTC_FLAG_SHPF
bogdanm 85:024bf7f99721 562 * @retval None
bogdanm 85:024bf7f99721 563 */
bogdanm 85:024bf7f99721 564 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
bogdanm 85:024bf7f99721 565
bogdanm 85:024bf7f99721 566 /**
bogdanm 85:024bf7f99721 567 * @brief Clear the RTC Time Stamp's pending flags.
bogdanm 85:024bf7f99721 568 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 569 * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
bogdanm 85:024bf7f99721 570 * This parameter can be:
bogdanm 85:024bf7f99721 571 * @arg RTC_FLAG_TSF
bogdanm 85:024bf7f99721 572 * @retval None
bogdanm 85:024bf7f99721 573 */
bogdanm 85:024bf7f99721 574 #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 575
bogdanm 85:024bf7f99721 576 /**
bogdanm 85:024bf7f99721 577 * @brief Clear the RTC Tamper's pending flags.
bogdanm 85:024bf7f99721 578 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 579 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
bogdanm 85:024bf7f99721 580 * This parameter can be:
bogdanm 85:024bf7f99721 581 * @arg RTC_FLAG_TAMP1F
bogdanm 85:024bf7f99721 582 * @retval None
bogdanm 85:024bf7f99721 583 */
bogdanm 85:024bf7f99721 584 #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 585
bogdanm 85:024bf7f99721 586 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 587 /**
bogdanm 85:024bf7f99721 588 * @brief Clear the RTC Wake Up timer's pending flags.
bogdanm 85:024bf7f99721 589 * @param __HANDLE__: specifies the RTC handle.
bogdanm 85:024bf7f99721 590 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
bogdanm 85:024bf7f99721 591 * This parameter can be:
bogdanm 85:024bf7f99721 592 * @arg RTC_FLAG_WUTF
bogdanm 85:024bf7f99721 593 * @retval None
bogdanm 85:024bf7f99721 594 */
bogdanm 85:024bf7f99721 595 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
bogdanm 85:024bf7f99721 596 #endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) */
bogdanm 85:024bf7f99721 597
bogdanm 85:024bf7f99721 598 /* Exported functions --------------------------------------------------------*/
bogdanm 85:024bf7f99721 599
bogdanm 85:024bf7f99721 600 /* RTC TimeStamp and Tamper functions *****************************************/
bogdanm 85:024bf7f99721 601 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
bogdanm 85:024bf7f99721 602 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
bogdanm 85:024bf7f99721 603 HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 604 HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format);
bogdanm 85:024bf7f99721 605
bogdanm 85:024bf7f99721 606 HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
bogdanm 85:024bf7f99721 607 HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
bogdanm 85:024bf7f99721 608 HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper);
bogdanm 85:024bf7f99721 609 void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 610
bogdanm 85:024bf7f99721 611 void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 612 void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 613 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 614 void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 615 #endif
bogdanm 85:024bf7f99721 616 void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 617 HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
bogdanm 85:024bf7f99721 618 HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
bogdanm 85:024bf7f99721 619 HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
bogdanm 85:024bf7f99721 620 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 621 HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
bogdanm 85:024bf7f99721 622 #endif
bogdanm 85:024bf7f99721 623
bogdanm 85:024bf7f99721 624 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
bogdanm 85:024bf7f99721 625 /* RTC Wake-up functions ******************************************************/
bogdanm 85:024bf7f99721 626 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
bogdanm 85:024bf7f99721 627 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
bogdanm 85:024bf7f99721 628 uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 629 uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 630 void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 631 void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 632 HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
bogdanm 85:024bf7f99721 633 #endif
bogdanm 85:024bf7f99721 634
bogdanm 85:024bf7f99721 635 /* Extension Control functions ************************************************/
bogdanm 85:024bf7f99721 636 #if !defined(STM32F030x6) && !defined(STM32F030x8)
bogdanm 85:024bf7f99721 637 void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data);
bogdanm 85:024bf7f99721 638 uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
bogdanm 85:024bf7f99721 639 #endif
bogdanm 85:024bf7f99721 640
bogdanm 85:024bf7f99721 641 HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue);
bogdanm 85:024bf7f99721 642 HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS);
bogdanm 85:024bf7f99721 643 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput);
bogdanm 85:024bf7f99721 644 HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 645 HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 646 HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 647 HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 648 HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc);
bogdanm 85:024bf7f99721 649
bogdanm 85:024bf7f99721 650 /* Extension RTC features functions *******************************************/
bogdanm 85:024bf7f99721 651
bogdanm 85:024bf7f99721 652
bogdanm 85:024bf7f99721 653 /**
bogdanm 85:024bf7f99721 654 * @}
bogdanm 85:024bf7f99721 655 */
bogdanm 85:024bf7f99721 656
bogdanm 85:024bf7f99721 657 /**
bogdanm 85:024bf7f99721 658 * @}
bogdanm 85:024bf7f99721 659 */
bogdanm 85:024bf7f99721 660
bogdanm 85:024bf7f99721 661 #ifdef __cplusplus
bogdanm 85:024bf7f99721 662 }
bogdanm 85:024bf7f99721 663 #endif
bogdanm 85:024bf7f99721 664
bogdanm 85:024bf7f99721 665 #endif /* __STM32F0xx_HAL_RTC_EX_H */
bogdanm 85:024bf7f99721 666
bogdanm 85:024bf7f99721 667 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/