meh

Fork of mbed by mbed official

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

Who changed what in which revision?

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