Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lypinator 0:bb348c97df44 1 /**
lypinator 0:bb348c97df44 2 ******************************************************************************
lypinator 0:bb348c97df44 3 * @file stm32f4xx_hal_rtc_ex.h
lypinator 0:bb348c97df44 4 * @author MCD Application Team
lypinator 0:bb348c97df44 5 * @brief Header file of RTC HAL Extension module.
lypinator 0:bb348c97df44 6 ******************************************************************************
lypinator 0:bb348c97df44 7 * @attention
lypinator 0:bb348c97df44 8 *
lypinator 0:bb348c97df44 9 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
lypinator 0:bb348c97df44 10 *
lypinator 0:bb348c97df44 11 * Redistribution and use in source and binary forms, with or without modification,
lypinator 0:bb348c97df44 12 * are permitted provided that the following conditions are met:
lypinator 0:bb348c97df44 13 * 1. Redistributions of source code must retain the above copyright notice,
lypinator 0:bb348c97df44 14 * this list of conditions and the following disclaimer.
lypinator 0:bb348c97df44 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
lypinator 0:bb348c97df44 16 * this list of conditions and the following disclaimer in the documentation
lypinator 0:bb348c97df44 17 * and/or other materials provided with the distribution.
lypinator 0:bb348c97df44 18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
lypinator 0:bb348c97df44 19 * may be used to endorse or promote products derived from this software
lypinator 0:bb348c97df44 20 * without specific prior written permission.
lypinator 0:bb348c97df44 21 *
lypinator 0:bb348c97df44 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
lypinator 0:bb348c97df44 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
lypinator 0:bb348c97df44 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
lypinator 0:bb348c97df44 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
lypinator 0:bb348c97df44 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
lypinator 0:bb348c97df44 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
lypinator 0:bb348c97df44 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
lypinator 0:bb348c97df44 29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
lypinator 0:bb348c97df44 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
lypinator 0:bb348c97df44 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
lypinator 0:bb348c97df44 32 *
lypinator 0:bb348c97df44 33 ******************************************************************************
lypinator 0:bb348c97df44 34 */
lypinator 0:bb348c97df44 35
lypinator 0:bb348c97df44 36 /* Define to prevent recursive inclusion -------------------------------------*/
lypinator 0:bb348c97df44 37 #ifndef __STM32F4xx_HAL_RTC_EX_H
lypinator 0:bb348c97df44 38 #define __STM32F4xx_HAL_RTC_EX_H
lypinator 0:bb348c97df44 39
lypinator 0:bb348c97df44 40 #ifdef __cplusplus
lypinator 0:bb348c97df44 41 extern "C" {
lypinator 0:bb348c97df44 42 #endif
lypinator 0:bb348c97df44 43
lypinator 0:bb348c97df44 44 /* Includes ------------------------------------------------------------------*/
lypinator 0:bb348c97df44 45 #include "stm32f4xx_hal_def.h"
lypinator 0:bb348c97df44 46
lypinator 0:bb348c97df44 47 /** @addtogroup STM32F4xx_HAL_Driver
lypinator 0:bb348c97df44 48 * @{
lypinator 0:bb348c97df44 49 */
lypinator 0:bb348c97df44 50
lypinator 0:bb348c97df44 51 /** @addtogroup RTCEx
lypinator 0:bb348c97df44 52 * @{
lypinator 0:bb348c97df44 53 */
lypinator 0:bb348c97df44 54
lypinator 0:bb348c97df44 55 /* Exported types ------------------------------------------------------------*/
lypinator 0:bb348c97df44 56 /** @defgroup RTCEx_Exported_Types RTCEx Exported Types
lypinator 0:bb348c97df44 57 * @{
lypinator 0:bb348c97df44 58 */
lypinator 0:bb348c97df44 59
lypinator 0:bb348c97df44 60 /**
lypinator 0:bb348c97df44 61 * @brief RTC Tamper structure definition
lypinator 0:bb348c97df44 62 */
lypinator 0:bb348c97df44 63 typedef struct
lypinator 0:bb348c97df44 64 {
lypinator 0:bb348c97df44 65 uint32_t Tamper; /*!< Specifies the Tamper Pin.
lypinator 0:bb348c97df44 66 This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */
lypinator 0:bb348c97df44 67
lypinator 0:bb348c97df44 68 uint32_t PinSelection; /*!< Specifies the Tamper Pin.
lypinator 0:bb348c97df44 69 This parameter can be a value of @ref RTCEx_Tamper_Pins_Selection */
lypinator 0:bb348c97df44 70
lypinator 0:bb348c97df44 71 uint32_t Trigger; /*!< Specifies the Tamper Trigger.
lypinator 0:bb348c97df44 72 This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */
lypinator 0:bb348c97df44 73
lypinator 0:bb348c97df44 74 uint32_t Filter; /*!< Specifies the RTC Filter Tamper.
lypinator 0:bb348c97df44 75 This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */
lypinator 0:bb348c97df44 76
lypinator 0:bb348c97df44 77 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency.
lypinator 0:bb348c97df44 78 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */
lypinator 0:bb348c97df44 79
lypinator 0:bb348c97df44 80 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration .
lypinator 0:bb348c97df44 81 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */
lypinator 0:bb348c97df44 82
lypinator 0:bb348c97df44 83 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp .
lypinator 0:bb348c97df44 84 This parameter can be a value of @ref RTCEx_Tamper_Pull_UP_Definitions */
lypinator 0:bb348c97df44 85
lypinator 0:bb348c97df44 86 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection.
lypinator 0:bb348c97df44 87 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */
lypinator 0:bb348c97df44 88 }RTC_TamperTypeDef;
lypinator 0:bb348c97df44 89 /**
lypinator 0:bb348c97df44 90 * @}
lypinator 0:bb348c97df44 91 */
lypinator 0:bb348c97df44 92
lypinator 0:bb348c97df44 93 /* Exported constants --------------------------------------------------------*/
lypinator 0:bb348c97df44 94 /** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants
lypinator 0:bb348c97df44 95 * @{
lypinator 0:bb348c97df44 96 */
lypinator 0:bb348c97df44 97
lypinator 0:bb348c97df44 98 /** @defgroup RTCEx_Backup_Registers_Definitions RTC Backup Registers Definitions
lypinator 0:bb348c97df44 99 * @{
lypinator 0:bb348c97df44 100 */
lypinator 0:bb348c97df44 101 #define RTC_BKP_DR0 0x00000000U
lypinator 0:bb348c97df44 102 #define RTC_BKP_DR1 0x00000001U
lypinator 0:bb348c97df44 103 #define RTC_BKP_DR2 0x00000002U
lypinator 0:bb348c97df44 104 #define RTC_BKP_DR3 0x00000003U
lypinator 0:bb348c97df44 105 #define RTC_BKP_DR4 0x00000004U
lypinator 0:bb348c97df44 106 #define RTC_BKP_DR5 0x00000005U
lypinator 0:bb348c97df44 107 #define RTC_BKP_DR6 0x00000006U
lypinator 0:bb348c97df44 108 #define RTC_BKP_DR7 0x00000007U
lypinator 0:bb348c97df44 109 #define RTC_BKP_DR8 0x00000008U
lypinator 0:bb348c97df44 110 #define RTC_BKP_DR9 0x00000009U
lypinator 0:bb348c97df44 111 #define RTC_BKP_DR10 0x0000000AU
lypinator 0:bb348c97df44 112 #define RTC_BKP_DR11 0x0000000BU
lypinator 0:bb348c97df44 113 #define RTC_BKP_DR12 0x0000000CU
lypinator 0:bb348c97df44 114 #define RTC_BKP_DR13 0x0000000DU
lypinator 0:bb348c97df44 115 #define RTC_BKP_DR14 0x0000000EU
lypinator 0:bb348c97df44 116 #define RTC_BKP_DR15 0x0000000FU
lypinator 0:bb348c97df44 117 #define RTC_BKP_DR16 0x00000010U
lypinator 0:bb348c97df44 118 #define RTC_BKP_DR17 0x00000011U
lypinator 0:bb348c97df44 119 #define RTC_BKP_DR18 0x00000012U
lypinator 0:bb348c97df44 120 #define RTC_BKP_DR19 0x00000013U
lypinator 0:bb348c97df44 121 /**
lypinator 0:bb348c97df44 122 * @}
lypinator 0:bb348c97df44 123 */
lypinator 0:bb348c97df44 124
lypinator 0:bb348c97df44 125 /** @defgroup RTCEx_Time_Stamp_Edges_definitions RTC TimeStamp Edges Definitions
lypinator 0:bb348c97df44 126 * @{
lypinator 0:bb348c97df44 127 */
lypinator 0:bb348c97df44 128 #define RTC_TIMESTAMPEDGE_RISING 0x00000000U
lypinator 0:bb348c97df44 129 #define RTC_TIMESTAMPEDGE_FALLING 0x00000008U
lypinator 0:bb348c97df44 130 /**
lypinator 0:bb348c97df44 131 * @}
lypinator 0:bb348c97df44 132 */
lypinator 0:bb348c97df44 133
lypinator 0:bb348c97df44 134 /** @defgroup RTCEx_Tamper_Pins_Definitions RTC Tamper Pins Definitions
lypinator 0:bb348c97df44 135 * @{
lypinator 0:bb348c97df44 136 */
lypinator 0:bb348c97df44 137 #define RTC_TAMPER_1 RTC_TAFCR_TAMP1E
lypinator 0:bb348c97df44 138
lypinator 0:bb348c97df44 139 #if !defined(STM32F412Zx) && !defined(STM32F412Vx) && !defined(STM32F412Rx) && !defined(STM32F412Cx) && !defined(STM32F413xx) && !defined(STM32F423xx)
lypinator 0:bb348c97df44 140 #define RTC_TAMPER_2 RTC_TAFCR_TAMP2E
lypinator 0:bb348c97df44 141 #endif
lypinator 0:bb348c97df44 142 /**
lypinator 0:bb348c97df44 143 * @}
lypinator 0:bb348c97df44 144 */
lypinator 0:bb348c97df44 145
lypinator 0:bb348c97df44 146 /** @defgroup RTCEx_Tamper_Pins_Selection RTC tamper Pins Selection
lypinator 0:bb348c97df44 147 * @{
lypinator 0:bb348c97df44 148 */
lypinator 0:bb348c97df44 149
lypinator 0:bb348c97df44 150 #define RTC_TAMPERPIN_DEFAULT 0x00000000U
lypinator 0:bb348c97df44 151
lypinator 0:bb348c97df44 152 #if !defined(STM32F412Zx) && !defined(STM32F412Vx) && !defined(STM32F412Rx) && !defined(STM32F412Cx) && !defined(STM32F413xx) && !defined(STM32F423xx)
lypinator 0:bb348c97df44 153 #define RTC_TAMPERPIN_POS1 0x00010000U
lypinator 0:bb348c97df44 154 #endif
lypinator 0:bb348c97df44 155 /**
lypinator 0:bb348c97df44 156 * @}
lypinator 0:bb348c97df44 157 */
lypinator 0:bb348c97df44 158
lypinator 0:bb348c97df44 159 /** @defgroup RTCEx_TimeStamp_Pin_Selection RTC TimeStamp Pins Selection
lypinator 0:bb348c97df44 160 * @{
lypinator 0:bb348c97df44 161 */
lypinator 0:bb348c97df44 162 #define RTC_TIMESTAMPPIN_DEFAULT 0x00000000U
lypinator 0:bb348c97df44 163
lypinator 0:bb348c97df44 164 #if !defined(STM32F412Zx) && !defined(STM32F412Vx) && !defined(STM32F412Rx) && !defined(STM32F412Cx) && !defined(STM32F413xx) && !defined(STM32F423xx)
lypinator 0:bb348c97df44 165 #define RTC_TIMESTAMPPIN_POS1 0x00020000U
lypinator 0:bb348c97df44 166 #endif
lypinator 0:bb348c97df44 167 /**
lypinator 0:bb348c97df44 168 * @}
lypinator 0:bb348c97df44 169 */
lypinator 0:bb348c97df44 170
lypinator 0:bb348c97df44 171 /** @defgroup RTCEx_Tamper_Trigger_Definitions RTC Tamper Triggers Definitions
lypinator 0:bb348c97df44 172 * @{
lypinator 0:bb348c97df44 173 */
lypinator 0:bb348c97df44 174 #define RTC_TAMPERTRIGGER_RISINGEDGE 0x00000000U
lypinator 0:bb348c97df44 175 #define RTC_TAMPERTRIGGER_FALLINGEDGE 0x00000002U
lypinator 0:bb348c97df44 176 #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE
lypinator 0:bb348c97df44 177 #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE
lypinator 0:bb348c97df44 178 /**
lypinator 0:bb348c97df44 179 * @}
lypinator 0:bb348c97df44 180 */
lypinator 0:bb348c97df44 181
lypinator 0:bb348c97df44 182 /** @defgroup RTCEx_Tamper_Filter_Definitions RTC Tamper Filter Definitions
lypinator 0:bb348c97df44 183 * @{
lypinator 0:bb348c97df44 184 */
lypinator 0:bb348c97df44 185 #define RTC_TAMPERFILTER_DISABLE 0x00000000U /*!< Tamper filter is disabled */
lypinator 0:bb348c97df44 186
lypinator 0:bb348c97df44 187 #define RTC_TAMPERFILTER_2SAMPLE 0x00000800U /*!< Tamper is activated after 2
lypinator 0:bb348c97df44 188 consecutive samples at the active level */
lypinator 0:bb348c97df44 189 #define RTC_TAMPERFILTER_4SAMPLE 0x00001000U /*!< Tamper is activated after 4
lypinator 0:bb348c97df44 190 consecutive samples at the active level */
lypinator 0:bb348c97df44 191 #define RTC_TAMPERFILTER_8SAMPLE 0x00001800U /*!< Tamper is activated after 8
lypinator 0:bb348c97df44 192 consecutive samples at the active level. */
lypinator 0:bb348c97df44 193 /**
lypinator 0:bb348c97df44 194 * @}
lypinator 0:bb348c97df44 195 */
lypinator 0:bb348c97df44 196
lypinator 0:bb348c97df44 197 /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTC Tamper Sampling Frequencies Definitions
lypinator 0:bb348c97df44 198 * @{
lypinator 0:bb348c97df44 199 */
lypinator 0:bb348c97df44 200 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 0x00000000U /*!< Each of the tamper inputs are sampled
lypinator 0:bb348c97df44 201 with a frequency = RTCCLK / 32768 */
lypinator 0:bb348c97df44 202 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 0x00000100U /*!< Each of the tamper inputs are sampled
lypinator 0:bb348c97df44 203 with a frequency = RTCCLK / 16384 */
lypinator 0:bb348c97df44 204 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 0x00000200U /*!< Each of the tamper inputs are sampled
lypinator 0:bb348c97df44 205 with a frequency = RTCCLK / 8192 */
lypinator 0:bb348c97df44 206 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 0x00000300U /*!< Each of the tamper inputs are sampled
lypinator 0:bb348c97df44 207 with a frequency = RTCCLK / 4096 */
lypinator 0:bb348c97df44 208 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 0x00000400U /*!< Each of the tamper inputs are sampled
lypinator 0:bb348c97df44 209 with a frequency = RTCCLK / 2048 */
lypinator 0:bb348c97df44 210 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 0x00000500U /*!< Each of the tamper inputs are sampled
lypinator 0:bb348c97df44 211 with a frequency = RTCCLK / 1024 */
lypinator 0:bb348c97df44 212 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 0x00000600U /*!< Each of the tamper inputs are sampled
lypinator 0:bb348c97df44 213 with a frequency = RTCCLK / 512 */
lypinator 0:bb348c97df44 214 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 0x00000700U /*!< Each of the tamper inputs are sampled
lypinator 0:bb348c97df44 215 with a frequency = RTCCLK / 256 */
lypinator 0:bb348c97df44 216 /**
lypinator 0:bb348c97df44 217 * @}
lypinator 0:bb348c97df44 218 */
lypinator 0:bb348c97df44 219
lypinator 0:bb348c97df44 220 /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTC Tamper Pin Precharge Duration Definitions
lypinator 0:bb348c97df44 221 * @{
lypinator 0:bb348c97df44 222 */
lypinator 0:bb348c97df44 223 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK 0x00000000U /*!< Tamper pins are pre-charged before
lypinator 0:bb348c97df44 224 sampling during 1 RTCCLK cycle */
lypinator 0:bb348c97df44 225 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK 0x00002000U /*!< Tamper pins are pre-charged before
lypinator 0:bb348c97df44 226 sampling during 2 RTCCLK cycles */
lypinator 0:bb348c97df44 227 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK 0x00004000U /*!< Tamper pins are pre-charged before
lypinator 0:bb348c97df44 228 sampling during 4 RTCCLK cycles */
lypinator 0:bb348c97df44 229 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK 0x00006000U /*!< Tamper pins are pre-charged before
lypinator 0:bb348c97df44 230 sampling during 8 RTCCLK cycles */
lypinator 0:bb348c97df44 231 /**
lypinator 0:bb348c97df44 232 * @}
lypinator 0:bb348c97df44 233 */
lypinator 0:bb348c97df44 234
lypinator 0:bb348c97df44 235 /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions RTC Tamper TimeStamp On Tamper Detection Definitions
lypinator 0:bb348c97df44 236 * @{
lypinator 0:bb348c97df44 237 */
lypinator 0:bb348c97df44 238 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE ((uint32_t)RTC_TAFCR_TAMPTS) /*!< TimeStamp on Tamper Detection event saved */
lypinator 0:bb348c97df44 239 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE 0x00000000U /*!< TimeStamp on Tamper Detection event is not saved */
lypinator 0:bb348c97df44 240 /**
lypinator 0:bb348c97df44 241 * @}
lypinator 0:bb348c97df44 242 */
lypinator 0:bb348c97df44 243
lypinator 0:bb348c97df44 244 /** @defgroup RTCEx_Tamper_Pull_UP_Definitions RTC Tamper Pull Up Definitions
lypinator 0:bb348c97df44 245 * @{
lypinator 0:bb348c97df44 246 */
lypinator 0:bb348c97df44 247 #define RTC_TAMPER_PULLUP_ENABLE 0x00000000U /*!< TimeStamp on Tamper Detection event saved */
lypinator 0:bb348c97df44 248 #define RTC_TAMPER_PULLUP_DISABLE ((uint32_t)RTC_TAFCR_TAMPPUDIS) /*!< TimeStamp on Tamper Detection event is not saved */
lypinator 0:bb348c97df44 249 /**
lypinator 0:bb348c97df44 250 * @}
lypinator 0:bb348c97df44 251 */
lypinator 0:bb348c97df44 252
lypinator 0:bb348c97df44 253 /** @defgroup RTCEx_Wakeup_Timer_Definitions RTC Wake-up Timer Definitions
lypinator 0:bb348c97df44 254 * @{
lypinator 0:bb348c97df44 255 */
lypinator 0:bb348c97df44 256 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 0x00000000U
lypinator 0:bb348c97df44 257 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 0x00000001U
lypinator 0:bb348c97df44 258 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 0x00000002U
lypinator 0:bb348c97df44 259 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 0x00000003U
lypinator 0:bb348c97df44 260 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS 0x00000004U
lypinator 0:bb348c97df44 261 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS 0x00000006U
lypinator 0:bb348c97df44 262 /**
lypinator 0:bb348c97df44 263 * @}
lypinator 0:bb348c97df44 264 */
lypinator 0:bb348c97df44 265
lypinator 0:bb348c97df44 266 /** @defgroup RTCEx_Digital_Calibration_Definitions RTC Digital Calib Definitions
lypinator 0:bb348c97df44 267 * @{
lypinator 0:bb348c97df44 268 */
lypinator 0:bb348c97df44 269 #define RTC_CALIBSIGN_POSITIVE 0x00000000U
lypinator 0:bb348c97df44 270 #define RTC_CALIBSIGN_NEGATIVE 0x00000080U
lypinator 0:bb348c97df44 271 /**
lypinator 0:bb348c97df44 272 * @}
lypinator 0:bb348c97df44 273 */
lypinator 0:bb348c97df44 274
lypinator 0:bb348c97df44 275 /** @defgroup RTCEx_Smooth_calib_period_Definitions RTC Smooth Calib Period Definitions
lypinator 0:bb348c97df44 276 * @{
lypinator 0:bb348c97df44 277 */
lypinator 0:bb348c97df44 278 #define RTC_SMOOTHCALIB_PERIOD_32SEC 0x00000000U /*!< If RTCCLK = 32768 Hz, Smooth calibration
lypinator 0:bb348c97df44 279 period is 32s, else 2exp20 RTCCLK seconds */
lypinator 0:bb348c97df44 280 #define RTC_SMOOTHCALIB_PERIOD_16SEC 0x00002000U /*!< If RTCCLK = 32768 Hz, Smooth calibration
lypinator 0:bb348c97df44 281 period is 16s, else 2exp19 RTCCLK seconds */
lypinator 0:bb348c97df44 282 #define RTC_SMOOTHCALIB_PERIOD_8SEC 0x00004000U /*!< If RTCCLK = 32768 Hz, Smooth calibration
lypinator 0:bb348c97df44 283 period is 8s, else 2exp18 RTCCLK seconds */
lypinator 0:bb348c97df44 284 /**
lypinator 0:bb348c97df44 285 * @}
lypinator 0:bb348c97df44 286 */
lypinator 0:bb348c97df44 287
lypinator 0:bb348c97df44 288 /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTC Smooth Calib Plus Pulses Definitions
lypinator 0:bb348c97df44 289 * @{
lypinator 0:bb348c97df44 290 */
lypinator 0:bb348c97df44 291 #define RTC_SMOOTHCALIB_PLUSPULSES_SET 0x00008000U /*!< The number of RTCCLK pulses added
lypinator 0:bb348c97df44 292 during a X -second window = Y - CALM[8:0]
lypinator 0:bb348c97df44 293 with Y = 512, 256, 128 when X = 32, 16, 8 */
lypinator 0:bb348c97df44 294 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET 0x00000000U /*!< The number of RTCCLK pulses subbstited
lypinator 0:bb348c97df44 295 during a 32-second window = CALM[8:0] */
lypinator 0:bb348c97df44 296 /**
lypinator 0:bb348c97df44 297 * @}
lypinator 0:bb348c97df44 298 */
lypinator 0:bb348c97df44 299
lypinator 0:bb348c97df44 300 /** @defgroup RTCEx_Add_1_Second_Parameter_Definitions RTC Add 1 Second Parameter Definitions
lypinator 0:bb348c97df44 301 * @{
lypinator 0:bb348c97df44 302 */
lypinator 0:bb348c97df44 303 #define RTC_SHIFTADD1S_RESET 0x00000000U
lypinator 0:bb348c97df44 304 #define RTC_SHIFTADD1S_SET 0x80000000U
lypinator 0:bb348c97df44 305 /**
lypinator 0:bb348c97df44 306 * @}
lypinator 0:bb348c97df44 307 */
lypinator 0:bb348c97df44 308
lypinator 0:bb348c97df44 309
lypinator 0:bb348c97df44 310 /** @defgroup RTCEx_Calib_Output_selection_Definitions RTC Calib Output Selection Definitions
lypinator 0:bb348c97df44 311 * @{
lypinator 0:bb348c97df44 312 */
lypinator 0:bb348c97df44 313 #define RTC_CALIBOUTPUT_512HZ 0x00000000U
lypinator 0:bb348c97df44 314 #define RTC_CALIBOUTPUT_1HZ 0x00080000U
lypinator 0:bb348c97df44 315 /**
lypinator 0:bb348c97df44 316 * @}
lypinator 0:bb348c97df44 317 */
lypinator 0:bb348c97df44 318
lypinator 0:bb348c97df44 319 /**
lypinator 0:bb348c97df44 320 * @}
lypinator 0:bb348c97df44 321 */
lypinator 0:bb348c97df44 322
lypinator 0:bb348c97df44 323 /* Exported macro ------------------------------------------------------------*/
lypinator 0:bb348c97df44 324 /** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros
lypinator 0:bb348c97df44 325 * @{
lypinator 0:bb348c97df44 326 */
lypinator 0:bb348c97df44 327
lypinator 0:bb348c97df44 328 /* ---------------------------------WAKEUPTIMER---------------------------------*/
lypinator 0:bb348c97df44 329 /** @defgroup RTCEx_WakeUp_Timer RTC WakeUp Timer
lypinator 0:bb348c97df44 330 * @{
lypinator 0:bb348c97df44 331 */
lypinator 0:bb348c97df44 332
lypinator 0:bb348c97df44 333 /**
lypinator 0:bb348c97df44 334 * @brief Enable the RTC WakeUp Timer peripheral.
lypinator 0:bb348c97df44 335 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 336 * @retval None
lypinator 0:bb348c97df44 337 */
lypinator 0:bb348c97df44 338 #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE))
lypinator 0:bb348c97df44 339
lypinator 0:bb348c97df44 340 /**
lypinator 0:bb348c97df44 341 * @brief Disable the RTC Wake-up Timer peripheral.
lypinator 0:bb348c97df44 342 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 343 * @retval None
lypinator 0:bb348c97df44 344 */
lypinator 0:bb348c97df44 345 #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE))
lypinator 0:bb348c97df44 346
lypinator 0:bb348c97df44 347 /**
lypinator 0:bb348c97df44 348 * @brief Enable the RTC WakeUpTimer interrupt.
lypinator 0:bb348c97df44 349 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 350 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
lypinator 0:bb348c97df44 351 * This parameter can be:
lypinator 0:bb348c97df44 352 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
lypinator 0:bb348c97df44 353 * @retval None
lypinator 0:bb348c97df44 354 */
lypinator 0:bb348c97df44 355 #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
lypinator 0:bb348c97df44 356
lypinator 0:bb348c97df44 357 /**
lypinator 0:bb348c97df44 358 * @brief Disable the RTC WakeUpTimer interrupt.
lypinator 0:bb348c97df44 359 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 360 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
lypinator 0:bb348c97df44 361 * This parameter can be:
lypinator 0:bb348c97df44 362 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
lypinator 0:bb348c97df44 363 * @retval None
lypinator 0:bb348c97df44 364 */
lypinator 0:bb348c97df44 365 #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
lypinator 0:bb348c97df44 366
lypinator 0:bb348c97df44 367 /**
lypinator 0:bb348c97df44 368 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
lypinator 0:bb348c97df44 369 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 370 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt to check.
lypinator 0:bb348c97df44 371 * This parameter can be:
lypinator 0:bb348c97df44 372 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
lypinator 0:bb348c97df44 373 * @retval None
lypinator 0:bb348c97df44 374 */
lypinator 0:bb348c97df44 375 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4U)) != RESET)? SET : RESET)
lypinator 0:bb348c97df44 376
lypinator 0:bb348c97df44 377 /**
lypinator 0:bb348c97df44 378 * @brief Check whether the specified RTC Wake Up timer interrupt has been enabled or not.
lypinator 0:bb348c97df44 379 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 380 * @param __INTERRUPT__ specifies the RTC Wake Up timer interrupt sources to check.
lypinator 0:bb348c97df44 381 * This parameter can be:
lypinator 0:bb348c97df44 382 * @arg RTC_IT_WUT: WakeUpTimer interrupt
lypinator 0:bb348c97df44 383 * @retval None
lypinator 0:bb348c97df44 384 */
lypinator 0:bb348c97df44 385 #define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
lypinator 0:bb348c97df44 386
lypinator 0:bb348c97df44 387 /**
lypinator 0:bb348c97df44 388 * @brief Get the selected RTC WakeUpTimer's flag status.
lypinator 0:bb348c97df44 389 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 390 * @param __FLAG__ specifies the RTC WakeUpTimer Flag to check.
lypinator 0:bb348c97df44 391 * This parameter can be:
lypinator 0:bb348c97df44 392 * @arg RTC_FLAG_WUTF
lypinator 0:bb348c97df44 393 * @arg RTC_FLAG_WUTWF
lypinator 0:bb348c97df44 394 * @retval None
lypinator 0:bb348c97df44 395 */
lypinator 0:bb348c97df44 396 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
lypinator 0:bb348c97df44 397
lypinator 0:bb348c97df44 398 /**
lypinator 0:bb348c97df44 399 * @brief Clear the RTC Wake Up timer's pending flags.
lypinator 0:bb348c97df44 400 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 401 * @param __FLAG__ specifies the RTC Tamper Flag sources to be enabled or disabled.
lypinator 0:bb348c97df44 402 * This parameter can be:
lypinator 0:bb348c97df44 403 * @arg RTC_FLAG_WUTF
lypinator 0:bb348c97df44 404 * @retval None
lypinator 0:bb348c97df44 405 */
lypinator 0:bb348c97df44 406 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
lypinator 0:bb348c97df44 407
lypinator 0:bb348c97df44 408 /**
lypinator 0:bb348c97df44 409 * @brief Enable interrupt on the RTC Wake-up Timer associated Exti line.
lypinator 0:bb348c97df44 410 * @retval None
lypinator 0:bb348c97df44 411 */
lypinator 0:bb348c97df44 412 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
lypinator 0:bb348c97df44 413
lypinator 0:bb348c97df44 414 /**
lypinator 0:bb348c97df44 415 * @brief Disable interrupt on the RTC Wake-up Timer associated Exti line.
lypinator 0:bb348c97df44 416 * @retval None
lypinator 0:bb348c97df44 417 */
lypinator 0:bb348c97df44 418 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
lypinator 0:bb348c97df44 419
lypinator 0:bb348c97df44 420 /**
lypinator 0:bb348c97df44 421 * @brief Enable event on the RTC Wake-up Timer associated Exti line.
lypinator 0:bb348c97df44 422 * @retval None.
lypinator 0:bb348c97df44 423 */
lypinator 0:bb348c97df44 424 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
lypinator 0:bb348c97df44 425
lypinator 0:bb348c97df44 426 /**
lypinator 0:bb348c97df44 427 * @brief Disable event on the RTC Wake-up Timer associated Exti line.
lypinator 0:bb348c97df44 428 * @retval None.
lypinator 0:bb348c97df44 429 */
lypinator 0:bb348c97df44 430 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
lypinator 0:bb348c97df44 431
lypinator 0:bb348c97df44 432 /**
lypinator 0:bb348c97df44 433 * @brief Enable falling edge trigger on the RTC Wake-up Timer associated Exti line.
lypinator 0:bb348c97df44 434 * @retval None.
lypinator 0:bb348c97df44 435 */
lypinator 0:bb348c97df44 436 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
lypinator 0:bb348c97df44 437
lypinator 0:bb348c97df44 438 /**
lypinator 0:bb348c97df44 439 * @brief Disable falling edge trigger on the RTC Wake-up Timer associated Exti line.
lypinator 0:bb348c97df44 440 * @retval None.
lypinator 0:bb348c97df44 441 */
lypinator 0:bb348c97df44 442 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
lypinator 0:bb348c97df44 443
lypinator 0:bb348c97df44 444 /**
lypinator 0:bb348c97df44 445 * @brief Enable rising edge trigger on the RTC Wake-up Timer associated Exti line.
lypinator 0:bb348c97df44 446 * @retval None.
lypinator 0:bb348c97df44 447 */
lypinator 0:bb348c97df44 448 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
lypinator 0:bb348c97df44 449
lypinator 0:bb348c97df44 450 /**
lypinator 0:bb348c97df44 451 * @brief Disable rising edge trigger on the RTC Wake-up Timer associated Exti line.
lypinator 0:bb348c97df44 452 * @retval None.
lypinator 0:bb348c97df44 453 */
lypinator 0:bb348c97df44 454 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
lypinator 0:bb348c97df44 455
lypinator 0:bb348c97df44 456 /**
lypinator 0:bb348c97df44 457 * @brief Enable rising & falling edge trigger on the RTC Wake-up Timer associated Exti line.
lypinator 0:bb348c97df44 458 * @retval None.
lypinator 0:bb348c97df44 459 */
lypinator 0:bb348c97df44 460 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() do { __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();\
lypinator 0:bb348c97df44 461 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE();\
lypinator 0:bb348c97df44 462 } while(0U)
lypinator 0:bb348c97df44 463
lypinator 0:bb348c97df44 464 /**
lypinator 0:bb348c97df44 465 * @brief Disable rising & falling edge trigger on the RTC Wake-up Timer associated Exti line.
lypinator 0:bb348c97df44 466 * This parameter can be:
lypinator 0:bb348c97df44 467 * @retval None.
lypinator 0:bb348c97df44 468 */
lypinator 0:bb348c97df44 469 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() do { __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();\
lypinator 0:bb348c97df44 470 __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE();\
lypinator 0:bb348c97df44 471 } while(0U)
lypinator 0:bb348c97df44 472
lypinator 0:bb348c97df44 473 /**
lypinator 0:bb348c97df44 474 * @brief Check whether the RTC Wake-up Timer associated Exti line interrupt flag is set or not.
lypinator 0:bb348c97df44 475 * @retval Line Status.
lypinator 0:bb348c97df44 476 */
lypinator 0:bb348c97df44 477 #define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
lypinator 0:bb348c97df44 478
lypinator 0:bb348c97df44 479 /**
lypinator 0:bb348c97df44 480 * @brief Clear the RTC Wake-up Timer associated Exti line flag.
lypinator 0:bb348c97df44 481 * @retval None.
lypinator 0:bb348c97df44 482 */
lypinator 0:bb348c97df44 483 #define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
lypinator 0:bb348c97df44 484
lypinator 0:bb348c97df44 485 /**
lypinator 0:bb348c97df44 486 * @brief Generate a Software interrupt on the RTC Wake-up Timer associated Exti line.
lypinator 0:bb348c97df44 487 * @retval None.
lypinator 0:bb348c97df44 488 */
lypinator 0:bb348c97df44 489 #define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
lypinator 0:bb348c97df44 490
lypinator 0:bb348c97df44 491 /**
lypinator 0:bb348c97df44 492 * @}
lypinator 0:bb348c97df44 493 */
lypinator 0:bb348c97df44 494
lypinator 0:bb348c97df44 495 /* ---------------------------------TIMESTAMP---------------------------------*/
lypinator 0:bb348c97df44 496 /** @defgroup RTCEx_Timestamp RTC Timestamp
lypinator 0:bb348c97df44 497 * @{
lypinator 0:bb348c97df44 498 */
lypinator 0:bb348c97df44 499
lypinator 0:bb348c97df44 500 /**
lypinator 0:bb348c97df44 501 * @brief Enable the RTC TimeStamp peripheral.
lypinator 0:bb348c97df44 502 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 503 * @retval None
lypinator 0:bb348c97df44 504 */
lypinator 0:bb348c97df44 505 #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE))
lypinator 0:bb348c97df44 506
lypinator 0:bb348c97df44 507 /**
lypinator 0:bb348c97df44 508 * @brief Disable the RTC TimeStamp peripheral.
lypinator 0:bb348c97df44 509 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 510 * @retval None
lypinator 0:bb348c97df44 511 */
lypinator 0:bb348c97df44 512 #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE))
lypinator 0:bb348c97df44 513
lypinator 0:bb348c97df44 514 /**
lypinator 0:bb348c97df44 515 * @brief Enable the RTC TimeStamp interrupt.
lypinator 0:bb348c97df44 516 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 517 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
lypinator 0:bb348c97df44 518 * This parameter can be:
lypinator 0:bb348c97df44 519 * @arg RTC_IT_TS: TimeStamp interrupt
lypinator 0:bb348c97df44 520 * @retval None
lypinator 0:bb348c97df44 521 */
lypinator 0:bb348c97df44 522 #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
lypinator 0:bb348c97df44 523
lypinator 0:bb348c97df44 524 /**
lypinator 0:bb348c97df44 525 * @brief Disable the RTC TimeStamp interrupt.
lypinator 0:bb348c97df44 526 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 527 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
lypinator 0:bb348c97df44 528 * This parameter can be:
lypinator 0:bb348c97df44 529 * @arg RTC_IT_TS: TimeStamp interrupt
lypinator 0:bb348c97df44 530 * @retval None
lypinator 0:bb348c97df44 531 */
lypinator 0:bb348c97df44 532 #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
lypinator 0:bb348c97df44 533
lypinator 0:bb348c97df44 534 /**
lypinator 0:bb348c97df44 535 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not.
lypinator 0:bb348c97df44 536 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 537 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt to check.
lypinator 0:bb348c97df44 538 * This parameter can be:
lypinator 0:bb348c97df44 539 * @arg RTC_IT_TS: TimeStamp interrupt
lypinator 0:bb348c97df44 540 * @retval None
lypinator 0:bb348c97df44 541 */
lypinator 0:bb348c97df44 542 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4U)) != RESET)? SET : RESET)
lypinator 0:bb348c97df44 543
lypinator 0:bb348c97df44 544 /**
lypinator 0:bb348c97df44 545 * @brief Check whether the specified RTC Time Stamp interrupt has been enabled or not.
lypinator 0:bb348c97df44 546 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 547 * @param __INTERRUPT__ specifies the RTC Time Stamp interrupt source to check.
lypinator 0:bb348c97df44 548 * This parameter can be:
lypinator 0:bb348c97df44 549 * @arg RTC_IT_TS: TimeStamp interrupt
lypinator 0:bb348c97df44 550 * @retval None
lypinator 0:bb348c97df44 551 */
lypinator 0:bb348c97df44 552 #define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
lypinator 0:bb348c97df44 553
lypinator 0:bb348c97df44 554 /**
lypinator 0:bb348c97df44 555 * @brief Get the selected RTC TimeStamp's flag status.
lypinator 0:bb348c97df44 556 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 557 * @param __FLAG__ specifies the RTC TimeStamp flag to check.
lypinator 0:bb348c97df44 558 * This parameter can be:
lypinator 0:bb348c97df44 559 * @arg RTC_FLAG_TSF
lypinator 0:bb348c97df44 560 * @arg RTC_FLAG_TSOVF
lypinator 0:bb348c97df44 561 * @retval None
lypinator 0:bb348c97df44 562 */
lypinator 0:bb348c97df44 563 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
lypinator 0:bb348c97df44 564
lypinator 0:bb348c97df44 565 /**
lypinator 0:bb348c97df44 566 * @brief Clear the RTC Time Stamp's pending flags.
lypinator 0:bb348c97df44 567 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 568 * @param __FLAG__ specifies the RTC Alarm Flag sources to be enabled or disabled.
lypinator 0:bb348c97df44 569 * This parameter can be:
lypinator 0:bb348c97df44 570 * @arg RTC_FLAG_TSF
lypinator 0:bb348c97df44 571 * @retval None
lypinator 0:bb348c97df44 572 */
lypinator 0:bb348c97df44 573 #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
lypinator 0:bb348c97df44 574
lypinator 0:bb348c97df44 575 /**
lypinator 0:bb348c97df44 576 * @}
lypinator 0:bb348c97df44 577 */
lypinator 0:bb348c97df44 578
lypinator 0:bb348c97df44 579 /* ---------------------------------TAMPER------------------------------------*/
lypinator 0:bb348c97df44 580 /** @defgroup RTCEx_Tamper RTC Tamper
lypinator 0:bb348c97df44 581 * @{
lypinator 0:bb348c97df44 582 */
lypinator 0:bb348c97df44 583
lypinator 0:bb348c97df44 584 /**
lypinator 0:bb348c97df44 585 * @brief Enable the RTC Tamper1 input detection.
lypinator 0:bb348c97df44 586 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 587 * @retval None
lypinator 0:bb348c97df44 588 */
lypinator 0:bb348c97df44 589 #define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR |= (RTC_TAFCR_TAMP1E))
lypinator 0:bb348c97df44 590
lypinator 0:bb348c97df44 591 /**
lypinator 0:bb348c97df44 592 * @brief Disable the RTC Tamper1 input detection.
lypinator 0:bb348c97df44 593 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 594 * @retval None
lypinator 0:bb348c97df44 595 */
lypinator 0:bb348c97df44 596 #define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR &= ~(RTC_TAFCR_TAMP1E))
lypinator 0:bb348c97df44 597
lypinator 0:bb348c97df44 598 #if !defined(STM32F412Zx) && !defined(STM32F412Vx) && !defined(STM32F412Rx) && !defined(STM32F412Cx) && !defined(STM32F413xx) && !defined(STM32F423xx)
lypinator 0:bb348c97df44 599 /**
lypinator 0:bb348c97df44 600 * @brief Enable the RTC Tamper2 input detection.
lypinator 0:bb348c97df44 601 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 602 * @retval None
lypinator 0:bb348c97df44 603 */
lypinator 0:bb348c97df44 604 #define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR |= (RTC_TAFCR_TAMP2E))
lypinator 0:bb348c97df44 605
lypinator 0:bb348c97df44 606 /**
lypinator 0:bb348c97df44 607 * @brief Disable the RTC Tamper2 input detection.
lypinator 0:bb348c97df44 608 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 609 * @retval None
lypinator 0:bb348c97df44 610 */
lypinator 0:bb348c97df44 611 #define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR &= ~(RTC_TAFCR_TAMP2E))
lypinator 0:bb348c97df44 612 #endif
lypinator 0:bb348c97df44 613
lypinator 0:bb348c97df44 614 /**
lypinator 0:bb348c97df44 615 * @brief Check whether the specified RTC Tamper interrupt has occurred or not.
lypinator 0:bb348c97df44 616 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 617 * @param __INTERRUPT__ specifies the RTC Tamper interrupt to check.
lypinator 0:bb348c97df44 618 * This parameter can be:
lypinator 0:bb348c97df44 619 * @arg RTC_IT_TAMP1
lypinator 0:bb348c97df44 620 * @arg RTC_IT_TAMP2
lypinator 0:bb348c97df44 621 * @retval None
lypinator 0:bb348c97df44 622 */
lypinator 0:bb348c97df44 623 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4U)) != RESET)? SET : RESET)
lypinator 0:bb348c97df44 624
lypinator 0:bb348c97df44 625 /**
lypinator 0:bb348c97df44 626 * @brief Check whether the specified RTC Tamper interrupt has been enabled or not.
lypinator 0:bb348c97df44 627 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 628 * @param __INTERRUPT__ specifies the RTC Tamper interrupt source to check.
lypinator 0:bb348c97df44 629 * This parameter can be:
lypinator 0:bb348c97df44 630 * @arg RTC_IT_TAMP: Tamper interrupt
lypinator 0:bb348c97df44 631 * @retval None
lypinator 0:bb348c97df44 632 */
lypinator 0:bb348c97df44 633 #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->TAFCR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
lypinator 0:bb348c97df44 634
lypinator 0:bb348c97df44 635 /**
lypinator 0:bb348c97df44 636 * @brief Get the selected RTC Tamper's flag status.
lypinator 0:bb348c97df44 637 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 638 * @param __FLAG__ specifies the RTC Tamper Flag sources to be enabled or disabled.
lypinator 0:bb348c97df44 639 * This parameter can be:
lypinator 0:bb348c97df44 640 * @arg RTC_FLAG_TAMP1F
lypinator 0:bb348c97df44 641 * @arg RTC_FLAG_TAMP2F
lypinator 0:bb348c97df44 642 * @retval None
lypinator 0:bb348c97df44 643 */
lypinator 0:bb348c97df44 644 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
lypinator 0:bb348c97df44 645
lypinator 0:bb348c97df44 646 /**
lypinator 0:bb348c97df44 647 * @brief Clear the RTC Tamper's pending flags.
lypinator 0:bb348c97df44 648 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 649 * @param __FLAG__ specifies the RTC Tamper Flag to clear.
lypinator 0:bb348c97df44 650 * This parameter can be:
lypinator 0:bb348c97df44 651 * @arg RTC_FLAG_TAMP1F
lypinator 0:bb348c97df44 652 * @arg RTC_FLAG_TAMP2F
lypinator 0:bb348c97df44 653 * @retval None
lypinator 0:bb348c97df44 654 */
lypinator 0:bb348c97df44 655 #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
lypinator 0:bb348c97df44 656 /**
lypinator 0:bb348c97df44 657 * @}
lypinator 0:bb348c97df44 658 */
lypinator 0:bb348c97df44 659
lypinator 0:bb348c97df44 660 /* --------------------------TAMPER/TIMESTAMP---------------------------------*/
lypinator 0:bb348c97df44 661 /** @defgroup RTCEx_Tamper_Timestamp EXTI RTC Tamper Timestamp EXTI
lypinator 0:bb348c97df44 662 * @{
lypinator 0:bb348c97df44 663 */
lypinator 0:bb348c97df44 664
lypinator 0:bb348c97df44 665 /**
lypinator 0:bb348c97df44 666 * @brief Enable interrupt on the RTC Tamper and Timestamp associated Exti line.
lypinator 0:bb348c97df44 667 * @retval None
lypinator 0:bb348c97df44 668 */
lypinator 0:bb348c97df44 669 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
lypinator 0:bb348c97df44 670
lypinator 0:bb348c97df44 671 /**
lypinator 0:bb348c97df44 672 * @brief Disable interrupt on the RTC Tamper and Timestamp associated Exti line.
lypinator 0:bb348c97df44 673 * @retval None
lypinator 0:bb348c97df44 674 */
lypinator 0:bb348c97df44 675 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
lypinator 0:bb348c97df44 676
lypinator 0:bb348c97df44 677 /**
lypinator 0:bb348c97df44 678 * @brief Enable event on the RTC Tamper and Timestamp associated Exti line.
lypinator 0:bb348c97df44 679 * @retval None.
lypinator 0:bb348c97df44 680 */
lypinator 0:bb348c97df44 681 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
lypinator 0:bb348c97df44 682
lypinator 0:bb348c97df44 683 /**
lypinator 0:bb348c97df44 684 * @brief Disable event on the RTC Tamper and Timestamp associated Exti line.
lypinator 0:bb348c97df44 685 * @retval None.
lypinator 0:bb348c97df44 686 */
lypinator 0:bb348c97df44 687 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
lypinator 0:bb348c97df44 688
lypinator 0:bb348c97df44 689 /**
lypinator 0:bb348c97df44 690 * @brief Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
lypinator 0:bb348c97df44 691 * @retval None.
lypinator 0:bb348c97df44 692 */
lypinator 0:bb348c97df44 693 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
lypinator 0:bb348c97df44 694
lypinator 0:bb348c97df44 695 /**
lypinator 0:bb348c97df44 696 * @brief Disable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
lypinator 0:bb348c97df44 697 * @retval None.
lypinator 0:bb348c97df44 698 */
lypinator 0:bb348c97df44 699 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
lypinator 0:bb348c97df44 700
lypinator 0:bb348c97df44 701 /**
lypinator 0:bb348c97df44 702 * @brief Enable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
lypinator 0:bb348c97df44 703 * @retval None.
lypinator 0:bb348c97df44 704 */
lypinator 0:bb348c97df44 705 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
lypinator 0:bb348c97df44 706
lypinator 0:bb348c97df44 707 /**
lypinator 0:bb348c97df44 708 * @brief Disable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
lypinator 0:bb348c97df44 709 * @retval None.
lypinator 0:bb348c97df44 710 */
lypinator 0:bb348c97df44 711 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
lypinator 0:bb348c97df44 712
lypinator 0:bb348c97df44 713 /**
lypinator 0:bb348c97df44 714 * @brief Enable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
lypinator 0:bb348c97df44 715 * @retval None.
lypinator 0:bb348c97df44 716 */
lypinator 0:bb348c97df44 717 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_FALLING_EDGE() do { __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE();\
lypinator 0:bb348c97df44 718 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE(); \
lypinator 0:bb348c97df44 719 } while(0U)
lypinator 0:bb348c97df44 720
lypinator 0:bb348c97df44 721 /**
lypinator 0:bb348c97df44 722 * @brief Disable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
lypinator 0:bb348c97df44 723 * This parameter can be:
lypinator 0:bb348c97df44 724 * @retval None.
lypinator 0:bb348c97df44 725 */
lypinator 0:bb348c97df44 726 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_FALLING_EDGE() do { __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE();\
lypinator 0:bb348c97df44 727 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE();\
lypinator 0:bb348c97df44 728 } while(0U)
lypinator 0:bb348c97df44 729
lypinator 0:bb348c97df44 730 /**
lypinator 0:bb348c97df44 731 * @brief Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not.
lypinator 0:bb348c97df44 732 * @retval Line Status.
lypinator 0:bb348c97df44 733 */
lypinator 0:bb348c97df44 734 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
lypinator 0:bb348c97df44 735
lypinator 0:bb348c97df44 736 /**
lypinator 0:bb348c97df44 737 * @brief Clear the RTC Tamper and Timestamp associated Exti line flag.
lypinator 0:bb348c97df44 738 * @retval None.
lypinator 0:bb348c97df44 739 */
lypinator 0:bb348c97df44 740 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
lypinator 0:bb348c97df44 741
lypinator 0:bb348c97df44 742 /**
lypinator 0:bb348c97df44 743 * @brief Generate a Software interrupt on the RTC Tamper and Timestamp associated Exti line
lypinator 0:bb348c97df44 744 * @retval None.
lypinator 0:bb348c97df44 745 */
lypinator 0:bb348c97df44 746 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
lypinator 0:bb348c97df44 747 /**
lypinator 0:bb348c97df44 748 * @}
lypinator 0:bb348c97df44 749 */
lypinator 0:bb348c97df44 750
lypinator 0:bb348c97df44 751 /* ------------------------------Calibration----------------------------------*/
lypinator 0:bb348c97df44 752 /** @defgroup RTCEx_Calibration RTC Calibration
lypinator 0:bb348c97df44 753 * @{
lypinator 0:bb348c97df44 754 */
lypinator 0:bb348c97df44 755
lypinator 0:bb348c97df44 756 /**
lypinator 0:bb348c97df44 757 * @brief Enable the Coarse calibration process.
lypinator 0:bb348c97df44 758 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 759 * @retval None
lypinator 0:bb348c97df44 760 */
lypinator 0:bb348c97df44 761 #define __HAL_RTC_COARSE_CALIB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_DCE))
lypinator 0:bb348c97df44 762
lypinator 0:bb348c97df44 763 /**
lypinator 0:bb348c97df44 764 * @brief Disable the Coarse calibration process.
lypinator 0:bb348c97df44 765 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 766 * @retval None
lypinator 0:bb348c97df44 767 */
lypinator 0:bb348c97df44 768 #define __HAL_RTC_COARSE_CALIB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_DCE))
lypinator 0:bb348c97df44 769
lypinator 0:bb348c97df44 770 /**
lypinator 0:bb348c97df44 771 * @brief Enable the RTC calibration output.
lypinator 0:bb348c97df44 772 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 773 * @retval None
lypinator 0:bb348c97df44 774 */
lypinator 0:bb348c97df44 775 #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE))
lypinator 0:bb348c97df44 776
lypinator 0:bb348c97df44 777 /**
lypinator 0:bb348c97df44 778 * @brief Disable the calibration output.
lypinator 0:bb348c97df44 779 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 780 * @retval None
lypinator 0:bb348c97df44 781 */
lypinator 0:bb348c97df44 782 #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE))
lypinator 0:bb348c97df44 783
lypinator 0:bb348c97df44 784 /**
lypinator 0:bb348c97df44 785 * @brief Enable the clock reference detection.
lypinator 0:bb348c97df44 786 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 787 * @retval None
lypinator 0:bb348c97df44 788 */
lypinator 0:bb348c97df44 789 #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON))
lypinator 0:bb348c97df44 790
lypinator 0:bb348c97df44 791 /**
lypinator 0:bb348c97df44 792 * @brief Disable the clock reference detection.
lypinator 0:bb348c97df44 793 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 794 * @retval None
lypinator 0:bb348c97df44 795 */
lypinator 0:bb348c97df44 796 #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON))
lypinator 0:bb348c97df44 797
lypinator 0:bb348c97df44 798 /**
lypinator 0:bb348c97df44 799 * @brief Get the selected RTC shift operation's flag status.
lypinator 0:bb348c97df44 800 * @param __HANDLE__ specifies the RTC handle.
lypinator 0:bb348c97df44 801 * @param __FLAG__ specifies the RTC shift operation Flag is pending or not.
lypinator 0:bb348c97df44 802 * This parameter can be:
lypinator 0:bb348c97df44 803 * @arg RTC_FLAG_SHPF
lypinator 0:bb348c97df44 804 * @retval None
lypinator 0:bb348c97df44 805 */
lypinator 0:bb348c97df44 806 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
lypinator 0:bb348c97df44 807 /**
lypinator 0:bb348c97df44 808 * @}
lypinator 0:bb348c97df44 809 */
lypinator 0:bb348c97df44 810
lypinator 0:bb348c97df44 811 /**
lypinator 0:bb348c97df44 812 * @}
lypinator 0:bb348c97df44 813 */
lypinator 0:bb348c97df44 814
lypinator 0:bb348c97df44 815 /* Exported functions --------------------------------------------------------*/
lypinator 0:bb348c97df44 816 /** @defgroup RTCEx_Exported_Functions RTCEx Exported Functions
lypinator 0:bb348c97df44 817 * @{
lypinator 0:bb348c97df44 818 */
lypinator 0:bb348c97df44 819
lypinator 0:bb348c97df44 820 /** @addtogroup RTCEx_Exported_Functions_Group1
lypinator 0:bb348c97df44 821 * @{
lypinator 0:bb348c97df44 822 */
lypinator 0:bb348c97df44 823 /* RTC TimeStamp and Tamper functions *****************************************/
lypinator 0:bb348c97df44 824 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
lypinator 0:bb348c97df44 825 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
lypinator 0:bb348c97df44 826 HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 827 HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format);
lypinator 0:bb348c97df44 828
lypinator 0:bb348c97df44 829 HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
lypinator 0:bb348c97df44 830 HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
lypinator 0:bb348c97df44 831 HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper);
lypinator 0:bb348c97df44 832 void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 833
lypinator 0:bb348c97df44 834 void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 835 void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 836 void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 837 HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
lypinator 0:bb348c97df44 838 HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
lypinator 0:bb348c97df44 839 HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
lypinator 0:bb348c97df44 840 /**
lypinator 0:bb348c97df44 841 * @}
lypinator 0:bb348c97df44 842 */
lypinator 0:bb348c97df44 843
lypinator 0:bb348c97df44 844 /** @addtogroup RTCEx_Exported_Functions_Group2
lypinator 0:bb348c97df44 845 * @{
lypinator 0:bb348c97df44 846 */
lypinator 0:bb348c97df44 847 /* RTC Wake-up functions ******************************************************/
lypinator 0:bb348c97df44 848 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
lypinator 0:bb348c97df44 849 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
lypinator 0:bb348c97df44 850 uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 851 uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 852 void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 853 void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 854 HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
lypinator 0:bb348c97df44 855 /**
lypinator 0:bb348c97df44 856 * @}
lypinator 0:bb348c97df44 857 */
lypinator 0:bb348c97df44 858
lypinator 0:bb348c97df44 859 /** @addtogroup RTCEx_Exported_Functions_Group3
lypinator 0:bb348c97df44 860 * @{
lypinator 0:bb348c97df44 861 */
lypinator 0:bb348c97df44 862 /* Extension Control functions ************************************************/
lypinator 0:bb348c97df44 863 void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data);
lypinator 0:bb348c97df44 864 uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
lypinator 0:bb348c97df44 865
lypinator 0:bb348c97df44 866 HAL_StatusTypeDef HAL_RTCEx_SetCoarseCalib(RTC_HandleTypeDef *hrtc, uint32_t CalibSign, uint32_t Value);
lypinator 0:bb348c97df44 867 HAL_StatusTypeDef HAL_RTCEx_DeactivateCoarseCalib(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 868 HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue);
lypinator 0:bb348c97df44 869 HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS);
lypinator 0:bb348c97df44 870 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput);
lypinator 0:bb348c97df44 871 HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 872 HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 873 HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 874 HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 875 HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 876 /**
lypinator 0:bb348c97df44 877 * @}
lypinator 0:bb348c97df44 878 */
lypinator 0:bb348c97df44 879
lypinator 0:bb348c97df44 880 /** @addtogroup RTCEx_Exported_Functions_Group4
lypinator 0:bb348c97df44 881 * @{
lypinator 0:bb348c97df44 882 */
lypinator 0:bb348c97df44 883 /* Extension RTC features functions *******************************************/
lypinator 0:bb348c97df44 884 void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc);
lypinator 0:bb348c97df44 885 HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
lypinator 0:bb348c97df44 886 /**
lypinator 0:bb348c97df44 887 * @}
lypinator 0:bb348c97df44 888 */
lypinator 0:bb348c97df44 889
lypinator 0:bb348c97df44 890 /**
lypinator 0:bb348c97df44 891 * @}
lypinator 0:bb348c97df44 892 */
lypinator 0:bb348c97df44 893
lypinator 0:bb348c97df44 894 /* Private types -------------------------------------------------------------*/
lypinator 0:bb348c97df44 895 /* Private variables ---------------------------------------------------------*/
lypinator 0:bb348c97df44 896 /* Private constants ---------------------------------------------------------*/
lypinator 0:bb348c97df44 897 /** @defgroup RTCEx_Private_Constants RTCEx Private Constants
lypinator 0:bb348c97df44 898 * @{
lypinator 0:bb348c97df44 899 */
lypinator 0:bb348c97df44 900 #define RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT ((uint32_t)EXTI_IMR_MR21) /*!< External interrupt line 21 Connected to the RTC Tamper and Time Stamp events */
lypinator 0:bb348c97df44 901 #define RTC_EXTI_LINE_WAKEUPTIMER_EVENT ((uint32_t)EXTI_IMR_MR22) /*!< External interrupt line 22 Connected to the RTC Wake-up event */
lypinator 0:bb348c97df44 902 /**
lypinator 0:bb348c97df44 903 * @}
lypinator 0:bb348c97df44 904 */
lypinator 0:bb348c97df44 905
lypinator 0:bb348c97df44 906 /* Private macros ------------------------------------------------------------*/
lypinator 0:bb348c97df44 907 /** @defgroup RTCEx_Private_Macros RTCEx Private Macros
lypinator 0:bb348c97df44 908 * @{
lypinator 0:bb348c97df44 909 */
lypinator 0:bb348c97df44 910
lypinator 0:bb348c97df44 911 /** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters
lypinator 0:bb348c97df44 912 * @{
lypinator 0:bb348c97df44 913 */
lypinator 0:bb348c97df44 914 #define IS_RTC_BKP(BKP) (((BKP) == RTC_BKP_DR0) || \
lypinator 0:bb348c97df44 915 ((BKP) == RTC_BKP_DR1) || \
lypinator 0:bb348c97df44 916 ((BKP) == RTC_BKP_DR2) || \
lypinator 0:bb348c97df44 917 ((BKP) == RTC_BKP_DR3) || \
lypinator 0:bb348c97df44 918 ((BKP) == RTC_BKP_DR4) || \
lypinator 0:bb348c97df44 919 ((BKP) == RTC_BKP_DR5) || \
lypinator 0:bb348c97df44 920 ((BKP) == RTC_BKP_DR6) || \
lypinator 0:bb348c97df44 921 ((BKP) == RTC_BKP_DR7) || \
lypinator 0:bb348c97df44 922 ((BKP) == RTC_BKP_DR8) || \
lypinator 0:bb348c97df44 923 ((BKP) == RTC_BKP_DR9) || \
lypinator 0:bb348c97df44 924 ((BKP) == RTC_BKP_DR10) || \
lypinator 0:bb348c97df44 925 ((BKP) == RTC_BKP_DR11) || \
lypinator 0:bb348c97df44 926 ((BKP) == RTC_BKP_DR12) || \
lypinator 0:bb348c97df44 927 ((BKP) == RTC_BKP_DR13) || \
lypinator 0:bb348c97df44 928 ((BKP) == RTC_BKP_DR14) || \
lypinator 0:bb348c97df44 929 ((BKP) == RTC_BKP_DR15) || \
lypinator 0:bb348c97df44 930 ((BKP) == RTC_BKP_DR16) || \
lypinator 0:bb348c97df44 931 ((BKP) == RTC_BKP_DR17) || \
lypinator 0:bb348c97df44 932 ((BKP) == RTC_BKP_DR18) || \
lypinator 0:bb348c97df44 933 ((BKP) == RTC_BKP_DR19))
lypinator 0:bb348c97df44 934 #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \
lypinator 0:bb348c97df44 935 ((EDGE) == RTC_TIMESTAMPEDGE_FALLING))
lypinator 0:bb348c97df44 936
lypinator 0:bb348c97df44 937 #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
lypinator 0:bb348c97df44 938 #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & ((uint32_t)!(RTC_TAFCR_TAMP1E ))) == 0x00U) && ((TAMPER) != (uint32_t)RESET))
lypinator 0:bb348c97df44 939 #else
lypinator 0:bb348c97df44 940 #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & ((uint32_t)!(RTC_TAFCR_TAMP1E | RTC_TAFCR_TAMP2E))) == 0x00U) && ((TAMPER) != (uint32_t)RESET))
lypinator 0:bb348c97df44 941 #endif
lypinator 0:bb348c97df44 942
lypinator 0:bb348c97df44 943 #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
lypinator 0:bb348c97df44 944 #define IS_RTC_TAMPER_PIN(PIN) ((PIN) == RTC_TAMPERPIN_DEFAULT)
lypinator 0:bb348c97df44 945 #else
lypinator 0:bb348c97df44 946 #define IS_RTC_TAMPER_PIN(PIN) (((PIN) == RTC_TAMPERPIN_DEFAULT) || \
lypinator 0:bb348c97df44 947 ((PIN) == RTC_TAMPERPIN_POS1))
lypinator 0:bb348c97df44 948 #endif
lypinator 0:bb348c97df44 949
lypinator 0:bb348c97df44 950 #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
lypinator 0:bb348c97df44 951 #define IS_RTC_TIMESTAMP_PIN(PIN) ((PIN) == RTC_TIMESTAMPPIN_DEFAULT)
lypinator 0:bb348c97df44 952 #else
lypinator 0:bb348c97df44 953 #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_DEFAULT) || \
lypinator 0:bb348c97df44 954 ((PIN) == RTC_TIMESTAMPPIN_POS1))
lypinator 0:bb348c97df44 955 #endif
lypinator 0:bb348c97df44 956 #define IS_RTC_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) || \
lypinator 0:bb348c97df44 957 ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \
lypinator 0:bb348c97df44 958 ((TRIGGER) == RTC_TAMPERTRIGGER_LOWLEVEL) || \
lypinator 0:bb348c97df44 959 ((TRIGGER) == RTC_TAMPERTRIGGER_HIGHLEVEL))
lypinator 0:bb348c97df44 960 #define IS_RTC_TAMPER_FILTER(FILTER) (((FILTER) == RTC_TAMPERFILTER_DISABLE) || \
lypinator 0:bb348c97df44 961 ((FILTER) == RTC_TAMPERFILTER_2SAMPLE) || \
lypinator 0:bb348c97df44 962 ((FILTER) == RTC_TAMPERFILTER_4SAMPLE) || \
lypinator 0:bb348c97df44 963 ((FILTER) == RTC_TAMPERFILTER_8SAMPLE))
lypinator 0:bb348c97df44 964 #define IS_RTC_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \
lypinator 0:bb348c97df44 965 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \
lypinator 0:bb348c97df44 966 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \
lypinator 0:bb348c97df44 967 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \
lypinator 0:bb348c97df44 968 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \
lypinator 0:bb348c97df44 969 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \
lypinator 0:bb348c97df44 970 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \
lypinator 0:bb348c97df44 971 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256))
lypinator 0:bb348c97df44 972 #define IS_RTC_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \
lypinator 0:bb348c97df44 973 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \
lypinator 0:bb348c97df44 974 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \
lypinator 0:bb348c97df44 975 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK))
lypinator 0:bb348c97df44 976 #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \
lypinator 0:bb348c97df44 977 ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE))
lypinator 0:bb348c97df44 978 #define IS_RTC_TAMPER_PULLUP_STATE(STATE) (((STATE) == RTC_TAMPER_PULLUP_ENABLE) || \
lypinator 0:bb348c97df44 979 ((STATE) == RTC_TAMPER_PULLUP_DISABLE))
lypinator 0:bb348c97df44 980 #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \
lypinator 0:bb348c97df44 981 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \
lypinator 0:bb348c97df44 982 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \
lypinator 0:bb348c97df44 983 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \
lypinator 0:bb348c97df44 984 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \
lypinator 0:bb348c97df44 985 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS))
lypinator 0:bb348c97df44 986
lypinator 0:bb348c97df44 987 #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFFU)
lypinator 0:bb348c97df44 988 #define IS_RTC_CALIB_SIGN(SIGN) (((SIGN) == RTC_CALIBSIGN_POSITIVE) || \
lypinator 0:bb348c97df44 989 ((SIGN) == RTC_CALIBSIGN_NEGATIVE))
lypinator 0:bb348c97df44 990
lypinator 0:bb348c97df44 991 #define IS_RTC_CALIB_VALUE(VALUE) ((VALUE) < 0x20U)
lypinator 0:bb348c97df44 992
lypinator 0:bb348c97df44 993 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \
lypinator 0:bb348c97df44 994 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \
lypinator 0:bb348c97df44 995 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC))
lypinator 0:bb348c97df44 996 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \
lypinator 0:bb348c97df44 997 ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET))
lypinator 0:bb348c97df44 998
lypinator 0:bb348c97df44 999 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x000001FFU)
lypinator 0:bb348c97df44 1000 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \
lypinator 0:bb348c97df44 1001 ((SEL) == RTC_SHIFTADD1S_SET))
lypinator 0:bb348c97df44 1002 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFFU)
lypinator 0:bb348c97df44 1003 #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \
lypinator 0:bb348c97df44 1004 ((OUTPUT) == RTC_CALIBOUTPUT_1HZ))
lypinator 0:bb348c97df44 1005 /**
lypinator 0:bb348c97df44 1006 * @}
lypinator 0:bb348c97df44 1007 */
lypinator 0:bb348c97df44 1008
lypinator 0:bb348c97df44 1009 /**
lypinator 0:bb348c97df44 1010 * @}
lypinator 0:bb348c97df44 1011 */
lypinator 0:bb348c97df44 1012
lypinator 0:bb348c97df44 1013 /**
lypinator 0:bb348c97df44 1014 * @}
lypinator 0:bb348c97df44 1015 */
lypinator 0:bb348c97df44 1016
lypinator 0:bb348c97df44 1017 /**
lypinator 0:bb348c97df44 1018 * @}
lypinator 0:bb348c97df44 1019 */
lypinator 0:bb348c97df44 1020
lypinator 0:bb348c97df44 1021 #ifdef __cplusplus
lypinator 0:bb348c97df44 1022 }
lypinator 0:bb348c97df44 1023 #endif
lypinator 0:bb348c97df44 1024
lypinator 0:bb348c97df44 1025 #endif /* __STM32F4xx_HAL_RTC_EX_H */
lypinator 0:bb348c97df44 1026
lypinator 0:bb348c97df44 1027 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/