version_2.0

Dependents:   cc3000_ping_demo_try_2

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon May 19 18:14:09 2014 +0100
Revision:
84:0b3ab51c8877
Release 84 of the mbed library

Main changes:

- added LPC11U68 to the official build
- Bug fixes and new features for ST Nucleo boards
- I2C fixes for Freescale targets
- Added nRF51822 exporters

Who changed what in which revision?

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