Ricardo Benitez / mbed

Fork of mbed by mbed official

Committer:
Kojto
Date:
Thu Oct 29 08:40:18 2015 +0000
Revision:
109:9296ab0bfc11
Release 109  of the mbed library

Changes:
- new platforms - NUCLEO_F042K6, WIZNWIKI_W7500ECO
- MTS targets - bootloaders update to 0.1.1
- STM F7 - RTC enable fixes
- STM F4 - i2c pending stop before start fix
- STM all targets - analogout normalization fix

Who changed what in which revision?

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