meh

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Mar 17 14:27:45 2015 +0000
Revision:
96:487b796308b0
Parent:
92:4fc01daae5a5
Release 96 of the mbed library

Changes:
- IAR support for ble boards, lpc, ethernet stack
- RTC - attach function to redirect time functions
- Nucleo F103RB - cube driver
- k20xx - fixes for teensy and k20 platforms in sleep/deepsleep and usb
- STM32L0, Nucleo/Disco L053 - refactoring

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
Kojto 96:487b796308b0 5 * @version V1.2.0
Kojto 96:487b796308b0 6 * @date 06-February-2015
Kojto 96:487b796308b0 7 * @brief Header file of RTC HAL Extended module.
bogdanm 84:0b3ab51c8877 8 ******************************************************************************
bogdanm 84:0b3ab51c8877 9 * @attention
bogdanm 84:0b3ab51c8877 10 *
Kojto 96:487b796308b0 11 * <h2><center>&copy; COPYRIGHT(c) 2015 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
Kojto 96:487b796308b0 53 /** @defgroup RTCEx RTCEx
bogdanm 84:0b3ab51c8877 54 * @{
bogdanm 84:0b3ab51c8877 55 */
bogdanm 84:0b3ab51c8877 56
Kojto 96:487b796308b0 57 /* Exported types ------------------------------------------------------------*/
Kojto 96:487b796308b0 58
Kojto 96:487b796308b0 59 /** @defgroup RTCEx_Exported_Types RTC Extended Exported Types
Kojto 96:487b796308b0 60 * @{
Kojto 96:487b796308b0 61 */
Kojto 96:487b796308b0 62
bogdanm 84:0b3ab51c8877 63 /**
bogdanm 84:0b3ab51c8877 64 * @brief RTC Tamper structure definition
bogdanm 84:0b3ab51c8877 65 */
bogdanm 84:0b3ab51c8877 66 typedef struct
bogdanm 84:0b3ab51c8877 67 {
bogdanm 84:0b3ab51c8877 68 uint32_t Tamper; /*!< Specifies the Tamper Pin.
bogdanm 84:0b3ab51c8877 69 This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */
bogdanm 84:0b3ab51c8877 70
bogdanm 84:0b3ab51c8877 71 uint32_t Interrupt; /*!< Specifies the Tamper Interrupt.
bogdanm 84:0b3ab51c8877 72 This parameter can be a value of @ref RTCEx_Tamper_Interrupt_Definitions */
bogdanm 84:0b3ab51c8877 73
bogdanm 84:0b3ab51c8877 74 uint32_t Trigger; /*!< Specifies the Tamper Trigger.
bogdanm 84:0b3ab51c8877 75 This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */
bogdanm 84:0b3ab51c8877 76
bogdanm 84:0b3ab51c8877 77 uint32_t NoErase; /*!< Specifies the Tamper no erase mode.
bogdanm 84:0b3ab51c8877 78 This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp_Definitions */
bogdanm 84:0b3ab51c8877 79
bogdanm 84:0b3ab51c8877 80 uint32_t MaskFlag; /*!< Specifies the Tamper Flag masking.
bogdanm 84:0b3ab51c8877 81 This parameter can be a value of @ref RTCEx_Tamper_MaskFlag_Definitions */
bogdanm 84:0b3ab51c8877 82
bogdanm 84:0b3ab51c8877 83 uint32_t Filter; /*!< Specifies the RTC Filter Tamper.
bogdanm 84:0b3ab51c8877 84 This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */
bogdanm 84:0b3ab51c8877 85
bogdanm 84:0b3ab51c8877 86 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency.
bogdanm 92:4fc01daae5a5 87 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */
bogdanm 84:0b3ab51c8877 88
bogdanm 84:0b3ab51c8877 89 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration .
bogdanm 92:4fc01daae5a5 90 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */
bogdanm 84:0b3ab51c8877 91
bogdanm 84:0b3ab51c8877 92 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp .
Kojto 96:487b796308b0 93 This parameter can be a value of @ref RTCEx_Tamper_Pull_UP_Definitions */
bogdanm 84:0b3ab51c8877 94
bogdanm 84:0b3ab51c8877 95 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection.
bogdanm 84:0b3ab51c8877 96 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */
bogdanm 84:0b3ab51c8877 97 }RTC_TamperTypeDef;
Kojto 96:487b796308b0 98 /**
Kojto 96:487b796308b0 99 * @}
Kojto 96:487b796308b0 100 */
bogdanm 84:0b3ab51c8877 101
bogdanm 84:0b3ab51c8877 102 /* Exported constants --------------------------------------------------------*/
Kojto 96:487b796308b0 103 /** @defgroup RTCEx_Exported_Constants RTC Extended Exported Constants
bogdanm 84:0b3ab51c8877 104 * @{
bogdanm 84:0b3ab51c8877 105 */
bogdanm 84:0b3ab51c8877 106
Kojto 96:487b796308b0 107
Kojto 96:487b796308b0 108 /** @defgroup RTCEx_Interrupts_Definitions RTC Extended Interrupts Definitions
Kojto 96:487b796308b0 109 * @{
Kojto 96:487b796308b0 110 */
Kojto 96:487b796308b0 111 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
Kojto 96:487b796308b0 112 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
Kojto 96:487b796308b0 113
Kojto 96:487b796308b0 114 #define RTC_IT_TAMP3 RTC_TAMPCR_TAMP3IE
Kojto 96:487b796308b0 115
Kojto 96:487b796308b0 116 #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) ||
Kojto 96:487b796308b0 117 * (STM32L073xx) || (STM32L072xx) || (STM32L071xx)
Kojto 96:487b796308b0 118 */
Kojto 96:487b796308b0 119 /**
Kojto 96:487b796308b0 120 * @}
Kojto 96:487b796308b0 121 */
Kojto 96:487b796308b0 122
Kojto 96:487b796308b0 123
Kojto 96:487b796308b0 124 /** @defgroup RTCEx_Flags_Definitions RTC Extended Flags Definitions
Kojto 96:487b796308b0 125 * @{
Kojto 96:487b796308b0 126 */
Kojto 96:487b796308b0 127 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
Kojto 96:487b796308b0 128 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
Kojto 96:487b796308b0 129
Kojto 96:487b796308b0 130 #define RTC_FLAG_TAMP3F RTC_ISR_TAMP3F
Kojto 96:487b796308b0 131
Kojto 96:487b796308b0 132 #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) ||
Kojto 96:487b796308b0 133 * (STM32L073xx) || (STM32L072xx) || (STM32L071xx)
Kojto 96:487b796308b0 134 */
Kojto 96:487b796308b0 135
Kojto 96:487b796308b0 136 /**
Kojto 96:487b796308b0 137 * @}
Kojto 96:487b796308b0 138 */
Kojto 96:487b796308b0 139
Kojto 96:487b796308b0 140 /** @defgroup RTCEx_Backup_Registers_Definitions RTC Extended Backup Registers Definition
bogdanm 84:0b3ab51c8877 141 * @{
bogdanm 84:0b3ab51c8877 142 */
bogdanm 84:0b3ab51c8877 143 #define RTC_BKP_DR0 ((uint32_t)0x00000000)
bogdanm 84:0b3ab51c8877 144 #define RTC_BKP_DR1 ((uint32_t)0x00000001)
bogdanm 84:0b3ab51c8877 145 #define RTC_BKP_DR2 ((uint32_t)0x00000002)
bogdanm 84:0b3ab51c8877 146 #define RTC_BKP_DR3 ((uint32_t)0x00000003)
bogdanm 84:0b3ab51c8877 147 #define RTC_BKP_DR4 ((uint32_t)0x00000004)
bogdanm 84:0b3ab51c8877 148
Kojto 96:487b796308b0 149 #define IS_RTC_BKP(__BKP__) (((__BKP__) == RTC_BKP_DR0) || \
Kojto 96:487b796308b0 150 ((__BKP__) == RTC_BKP_DR1) || \
Kojto 96:487b796308b0 151 ((__BKP__) == RTC_BKP_DR2) || \
Kojto 96:487b796308b0 152 ((__BKP__) == RTC_BKP_DR3) || \
Kojto 96:487b796308b0 153 ((__BKP__) == RTC_BKP_DR4))
bogdanm 84:0b3ab51c8877 154 /**
bogdanm 84:0b3ab51c8877 155 * @}
bogdanm 84:0b3ab51c8877 156 */
Kojto 96:487b796308b0 157
Kojto 96:487b796308b0 158 /** @defgroup RTC_Mask_Definition RTC Mask Definition
bogdanm 84:0b3ab51c8877 159 * @{
Kojto 96:487b796308b0 160 */
Kojto 96:487b796308b0 161
Kojto 96:487b796308b0 162 /* Masks Definition */
Kojto 96:487b796308b0 163
Kojto 96:487b796308b0 164 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
Kojto 96:487b796308b0 165 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
Kojto 96:487b796308b0 166
Kojto 96:487b796308b0 167 #define RTC_FLAGS_MASK ((uint32_t) (RTC_FLAG_RECALPF | RTC_FLAG_TAMP3F | RTC_FLAG_TAMP2F | \
Kojto 96:487b796308b0 168 RTC_FLAG_TAMP1F| RTC_FLAG_TSOVF | RTC_FLAG_TSF | \
Kojto 96:487b796308b0 169 RTC_FLAG_WUTF | RTC_FLAG_ALRBF | RTC_FLAG_ALRAF | \
Kojto 96:487b796308b0 170 RTC_FLAG_INIT | RTC_FLAG_INITF | RTC_FLAG_RSF | \
Kojto 96:487b796308b0 171 RTC_FLAG_INITS | RTC_FLAG_SHPF | RTC_FLAG_WUTWF | \
Kojto 96:487b796308b0 172 RTC_FLAG_ALRBWF | RTC_FLAG_ALRAWF))
bogdanm 84:0b3ab51c8877 173
Kojto 96:487b796308b0 174 #define RTC_TAMPCR_TAMPXE ((uint32_t) (RTC_TAMPCR_TAMP3E | RTC_TAMPCR_TAMP2E | RTC_TAMPCR_TAMP1E))
Kojto 96:487b796308b0 175
Kojto 96:487b796308b0 176 #else
Kojto 96:487b796308b0 177
Kojto 96:487b796308b0 178 #define RTC_FLAGS_MASK ((uint32_t) (RTC_FLAG_RECALPF | RTC_FLAG_TAMP2F | RTC_FLAG_TAMP1F| \
Kojto 96:487b796308b0 179 RTC_FLAG_TSOVF | RTC_FLAG_TSF | RTC_FLAG_WUTF | \
Kojto 96:487b796308b0 180 RTC_FLAG_ALRBF | RTC_FLAG_ALRAF | RTC_FLAG_INIT | \
Kojto 96:487b796308b0 181 RTC_FLAG_INITF | RTC_FLAG_RSF | RTC_FLAG_INITS | \
Kojto 96:487b796308b0 182 RTC_FLAG_SHPF | RTC_FLAG_WUTWF |RTC_FLAG_ALRBWF | \
Kojto 96:487b796308b0 183 RTC_FLAG_ALRAWF))
Kojto 96:487b796308b0 184
Kojto 96:487b796308b0 185 #define RTC_TAMPCR_TAMPXE ((uint32_t) (RTC_TAMPCR_TAMP2E | RTC_TAMPCR_TAMP1E))
Kojto 96:487b796308b0 186
Kojto 96:487b796308b0 187 #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) ||
Kojto 96:487b796308b0 188 * (STM32L073xx) || (STM32L072xx) || (STM32L071xx)
Kojto 96:487b796308b0 189 */
bogdanm 84:0b3ab51c8877 190 /**
bogdanm 84:0b3ab51c8877 191 * @}
bogdanm 84:0b3ab51c8877 192 */
Kojto 96:487b796308b0 193
Kojto 96:487b796308b0 194 /** @defgroup RTCEx_Time_Stamp_Edges_definitions RTC Extended Time Stamp Edges definition
bogdanm 84:0b3ab51c8877 195 * @{
Kojto 96:487b796308b0 196 */
Kojto 96:487b796308b0 197 #define RTC_TIMESTAMPEDGE_RISING ((uint32_t)0x00000000)
Kojto 96:487b796308b0 198 #define RTC_TIMESTAMPEDGE_FALLING RTC_CR_TSEDGE
bogdanm 84:0b3ab51c8877 199
Kojto 96:487b796308b0 200 #define IS_TIMESTAMP_EDGE(__EDGE__) (((__EDGE__) == RTC_TIMESTAMPEDGE_RISING) || \
Kojto 96:487b796308b0 201 ((__EDGE__) == RTC_TIMESTAMPEDGE_FALLING))
bogdanm 84:0b3ab51c8877 202 /**
bogdanm 84:0b3ab51c8877 203 * @}
bogdanm 84:0b3ab51c8877 204 */
bogdanm 84:0b3ab51c8877 205
Kojto 96:487b796308b0 206 /** @defgroup RTCEx_Tamper_Pins_Definitions RTC Extended Tamper Pins Definition
bogdanm 84:0b3ab51c8877 207 * @{
bogdanm 84:0b3ab51c8877 208 */
Kojto 96:487b796308b0 209
Kojto 96:487b796308b0 210 #define RTC_TAMPER_1 RTC_TAMPCR_TAMP1E
Kojto 96:487b796308b0 211 #define RTC_TAMPER_2 RTC_TAMPCR_TAMP2E
Kojto 96:487b796308b0 212
Kojto 96:487b796308b0 213 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
Kojto 96:487b796308b0 214 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
bogdanm 84:0b3ab51c8877 215
Kojto 96:487b796308b0 216 #define RTC_TAMPER_3 RTC_TAMPCR_TAMP3E
Kojto 96:487b796308b0 217
Kojto 96:487b796308b0 218 #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) ||
Kojto 96:487b796308b0 219 * (STM32L073xx) || (STM32L072xx) || (STM32L071xx)
Kojto 96:487b796308b0 220 */
Kojto 96:487b796308b0 221
Kojto 96:487b796308b0 222 #define IS_RTC_TAMPER(__TAMPER__) ((((__TAMPER__) & ((uint32_t)(0xFFFFFFFF ^ RTC_TAMPCR_TAMPXE))) == 0x00) && ((__TAMPER__) != (uint32_t)RESET))
Kojto 96:487b796308b0 223
bogdanm 84:0b3ab51c8877 224 /**
bogdanm 84:0b3ab51c8877 225 * @}
bogdanm 84:0b3ab51c8877 226 */
bogdanm 84:0b3ab51c8877 227
Kojto 96:487b796308b0 228
Kojto 96:487b796308b0 229 /** @defgroup RTCEx_Tamper_Interrupt_Definitions RTC Extended Tamper Interrupt Definitions
bogdanm 84:0b3ab51c8877 230 * @{
bogdanm 84:0b3ab51c8877 231 */
Kojto 96:487b796308b0 232
Kojto 96:487b796308b0 233 #define RTC_TAMPER1_INTERRUPT RTC_TAMPCR_TAMP1IE
Kojto 96:487b796308b0 234 #define RTC_TAMPER2_INTERRUPT RTC_TAMPCR_TAMP2IE
Kojto 96:487b796308b0 235 #define RTC_ALL_TAMPER_INTERRUPT RTC_TAMPCR_TAMPIE
Kojto 96:487b796308b0 236
Kojto 96:487b796308b0 237 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
Kojto 96:487b796308b0 238 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
bogdanm 84:0b3ab51c8877 239
Kojto 96:487b796308b0 240 #define RTC_TAMPER3_INTERRUPT RTC_TAMPCR_TAMP3IE
Kojto 96:487b796308b0 241 #define IS_RTC_TAMPER_INTERRUPT(__INTERRUPT__) (((__INTERRUPT__) == RTC_TAMPER1_INTERRUPT) || \
Kojto 96:487b796308b0 242 ((__INTERRUPT__) == RTC_TAMPER2_INTERRUPT) || \
Kojto 96:487b796308b0 243 ((__INTERRUPT__) == RTC_TAMPER3_INTERRUPT) || \
Kojto 96:487b796308b0 244 ((__INTERRUPT__) == RTC_ALL_TAMPER_INTERRUPT ))
Kojto 96:487b796308b0 245
Kojto 96:487b796308b0 246 #else
Kojto 96:487b796308b0 247
Kojto 96:487b796308b0 248 #define IS_RTC_TAMPER_INTERRUPT(__INTERRUPT__) (((__INTERRUPT__) == RTC_TAMPER1_INTERRUPT) || \
Kojto 96:487b796308b0 249 ((__INTERRUPT__) == RTC_TAMPER2_INTERRUPT) || \
Kojto 96:487b796308b0 250 ((__INTERRUPT__) == RTC_ALL_TAMPER_INTERRUPT ))
Kojto 96:487b796308b0 251
Kojto 96:487b796308b0 252 #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) ||
Kojto 96:487b796308b0 253 * (STM32L073xx) || (STM32L072xx) || (STM32L071xx)
Kojto 96:487b796308b0 254 */
Kojto 96:487b796308b0 255
bogdanm 84:0b3ab51c8877 256 /**
bogdanm 84:0b3ab51c8877 257 * @}
bogdanm 84:0b3ab51c8877 258 */
bogdanm 84:0b3ab51c8877 259
Kojto 96:487b796308b0 260 /** @defgroup RTCEx_TimeStamp_Pin_Selections RTC Extended TimeStamp Pin Selection
Kojto 96:487b796308b0 261 * @{
Kojto 96:487b796308b0 262 */
Kojto 96:487b796308b0 263 #define RTC_TIMESTAMPPIN_PC13 ((uint32_t)0x00000000)
Kojto 96:487b796308b0 264
Kojto 96:487b796308b0 265 #define IS_RTC_TIMESTAMP_PIN(__PIN__) (((__PIN__) == RTC_TIMESTAMPPIN_PC13))
Kojto 96:487b796308b0 266 /**
Kojto 96:487b796308b0 267 * @}
Kojto 96:487b796308b0 268 */
Kojto 96:487b796308b0 269
Kojto 96:487b796308b0 270 /** @defgroup RTCEx_Tamper_Trigger_Definitions RTC Extended Tamper Trigger Definition
bogdanm 84:0b3ab51c8877 271 * @{
bogdanm 84:0b3ab51c8877 272 */
bogdanm 84:0b3ab51c8877 273 #define RTC_TAMPERTRIGGER_RISINGEDGE ((uint32_t)0x00000000)
Kojto 96:487b796308b0 274 #define RTC_TAMPERTRIGGER_FALLINGEDGE RTC_TAMPCR_TAMP1TRG
bogdanm 84:0b3ab51c8877 275 #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE
bogdanm 84:0b3ab51c8877 276 #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE
bogdanm 84:0b3ab51c8877 277
Kojto 96:487b796308b0 278 #define IS_RTC_TAMPER_TRIGGER(__TRIGGER__) (((__TRIGGER__) == RTC_TAMPERTRIGGER_RISINGEDGE) || \
Kojto 96:487b796308b0 279 ((__TRIGGER__) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \
Kojto 96:487b796308b0 280 ((__TRIGGER__) == RTC_TAMPERTRIGGER_LOWLEVEL) || \
Kojto 96:487b796308b0 281 ((__TRIGGER__) == RTC_TAMPERTRIGGER_HIGHLEVEL))
bogdanm 84:0b3ab51c8877 282
bogdanm 84:0b3ab51c8877 283 /**
bogdanm 84:0b3ab51c8877 284 * @}
bogdanm 84:0b3ab51c8877 285 */
bogdanm 84:0b3ab51c8877 286
Kojto 96:487b796308b0 287 /** @defgroup RTCEx_Tamper_EraseBackUp_Definitions RTC Extended Tamper EraseBackUp Definitions
bogdanm 84:0b3ab51c8877 288 * @{
bogdanm 84:0b3ab51c8877 289 */
Kojto 96:487b796308b0 290 #define RTC_TAMPER_ERASE_BACKUP_ENABLE ((uint32_t)0x00000000)
Kojto 96:487b796308b0 291 #define RTC_TAMPER_ERASE_BACKUP_DISABLE RTC_TAMPCR_TAMP1NOERASE
bogdanm 84:0b3ab51c8877 292
Kojto 96:487b796308b0 293 #define IS_RTC_TAMPER_ERASE_MODE(__MODE__) (((__MODE__) == RTC_TAMPER_ERASE_BACKUP_ENABLE) || \
Kojto 96:487b796308b0 294 ((__MODE__) == RTC_TAMPER_ERASE_BACKUP_DISABLE))
bogdanm 84:0b3ab51c8877 295 /**
bogdanm 84:0b3ab51c8877 296 * @}
bogdanm 84:0b3ab51c8877 297 */
bogdanm 84:0b3ab51c8877 298
Kojto 96:487b796308b0 299 /** @defgroup RTCEx_Tamper_MaskFlag_Definitions RTC Extended Tamper MaskFlag Definitions
bogdanm 84:0b3ab51c8877 300 * @{
bogdanm 84:0b3ab51c8877 301 */
Kojto 96:487b796308b0 302 #define RTC_TAMPERMASK_FLAG_DISABLE ((uint32_t)0x00000000)
Kojto 96:487b796308b0 303 #define RTC_TAMPERMASK_FLAG_ENABLE RTC_TAMPCR_TAMP1MF
bogdanm 84:0b3ab51c8877 304
Kojto 96:487b796308b0 305 #define IS_RTC_TAMPER_MASKFLAG_STATE(__STATE__) (((__STATE__) == RTC_TAMPERMASK_FLAG_ENABLE ) || \
Kojto 96:487b796308b0 306 ((__STATE__) == RTC_TAMPERMASK_FLAG_DISABLE))
bogdanm 84:0b3ab51c8877 307 /**
bogdanm 84:0b3ab51c8877 308 * @}
bogdanm 84:0b3ab51c8877 309 */
bogdanm 84:0b3ab51c8877 310
Kojto 96:487b796308b0 311 /** @defgroup RTCEx_Tamper_Filter_Definitions RTC Extended Tamper Filter Definitions
bogdanm 84:0b3ab51c8877 312 * @{
bogdanm 84:0b3ab51c8877 313 */
bogdanm 84:0b3ab51c8877 314 #define RTC_TAMPERFILTER_DISABLE ((uint32_t)0x00000000) /*!< Tamper filter is disabled */
bogdanm 84:0b3ab51c8877 315
Kojto 96:487b796308b0 316 #define RTC_TAMPERFILTER_2SAMPLE RTC_TAMPCR_TAMPFLT_0 /*!< Tamper is activated after 2
bogdanm 84:0b3ab51c8877 317 consecutive samples at the active level */
Kojto 96:487b796308b0 318 #define RTC_TAMPERFILTER_4SAMPLE RTC_TAMPCR_TAMPFLT_1 /*!< Tamper is activated after 4
bogdanm 84:0b3ab51c8877 319 consecutive samples at the active level */
Kojto 96:487b796308b0 320 #define RTC_TAMPERFILTER_8SAMPLE RTC_TAMPCR_TAMPFLT /*!< Tamper is activated after 8
bogdanm 84:0b3ab51c8877 321 consecutive samples at the active leve. */
bogdanm 84:0b3ab51c8877 322
Kojto 96:487b796308b0 323 #define IS_RTC_TAMPER_FILTER(__FILTER__) (((__FILTER__) == RTC_TAMPERFILTER_DISABLE) || \
Kojto 96:487b796308b0 324 ((__FILTER__) == RTC_TAMPERFILTER_2SAMPLE) || \
Kojto 96:487b796308b0 325 ((__FILTER__) == RTC_TAMPERFILTER_4SAMPLE) || \
Kojto 96:487b796308b0 326 ((__FILTER__) == RTC_TAMPERFILTER_8SAMPLE))
bogdanm 84:0b3ab51c8877 327 /**
bogdanm 84:0b3ab51c8877 328 * @}
bogdanm 84:0b3ab51c8877 329 */
bogdanm 84:0b3ab51c8877 330
Kojto 96:487b796308b0 331 /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTC Extended Tamper Sampling Frequencies Definitions
bogdanm 84:0b3ab51c8877 332 * @{
bogdanm 84:0b3ab51c8877 333 */
Kojto 96:487b796308b0 334 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 ((uint32_t)0x00000000) /*!< Each of the tamper inputs are sampled
Kojto 96:487b796308b0 335 with a frequency = RTCCLK / 32768 */
Kojto 96:487b796308b0 336 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 RTC_TAMPCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled
Kojto 96:487b796308b0 337 with a frequency = RTCCLK / 16384 */
Kojto 96:487b796308b0 338 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 RTC_TAMPCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled
Kojto 96:487b796308b0 339 with a frequency = RTCCLK / 8192 */
Kojto 96:487b796308b0 340 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 ((uint32_t) (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_1)) /*!< Each of the tamper inputs are sampled
Kojto 96:487b796308b0 341 with a frequency = RTCCLK / 4096 */
Kojto 96:487b796308b0 342 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 RTC_TAMPCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled
Kojto 96:487b796308b0 343 with a frequency = RTCCLK / 2048 */
Kojto 96:487b796308b0 344 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 ((uint32_t) (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_2)) /*!< Each of the tamper inputs are sampled
Kojto 96:487b796308b0 345 with a frequency = RTCCLK / 1024 */
Kojto 96:487b796308b0 346 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 ((uint32_t) (RTC_TAMPCR_TAMPFREQ_1 | RTC_TAMPCR_TAMPFREQ_2)) /*!< Each of the tamper inputs are sampled
Kojto 96:487b796308b0 347 with a frequency = RTCCLK / 512 */
Kojto 96:487b796308b0 348 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 ((uint32_t) (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_1 | \
Kojto 96:487b796308b0 349 RTC_TAMPCR_TAMPFREQ_2)) /*!< Each of the tamper inputs are sampled
Kojto 96:487b796308b0 350 with a frequency = RTCCLK / 256 */
bogdanm 84:0b3ab51c8877 351
Kojto 96:487b796308b0 352 #define IS_RTC_TAMPER_SAMPLING_FREQ(__FREQ__) (((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \
Kojto 96:487b796308b0 353 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \
Kojto 96:487b796308b0 354 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \
Kojto 96:487b796308b0 355 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \
Kojto 96:487b796308b0 356 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \
Kojto 96:487b796308b0 357 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \
Kojto 96:487b796308b0 358 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \
Kojto 96:487b796308b0 359 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256))
bogdanm 84:0b3ab51c8877 360 /**
bogdanm 84:0b3ab51c8877 361 * @}
bogdanm 84:0b3ab51c8877 362 */
bogdanm 84:0b3ab51c8877 363
Kojto 96:487b796308b0 364 /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTC Extended Tamper Pin Precharge Duration Definitions
bogdanm 84:0b3ab51c8877 365 * @{
bogdanm 84:0b3ab51c8877 366 */
Kojto 96:487b796308b0 367 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before
Kojto 96:487b796308b0 368 sampling during 1 RTCCLK cycle */
Kojto 96:487b796308b0 369 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK RTC_TAMPCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before
Kojto 96:487b796308b0 370 sampling during 2 RTCCLK cycles */
Kojto 96:487b796308b0 371 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK RTC_TAMPCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before
Kojto 96:487b796308b0 372 sampling during 4 RTCCLK cycles */
Kojto 96:487b796308b0 373 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK ((uint32_t)(RTC_TAMPCR_TAMPPRCH_0 | RTC_TAMPCR_TAMPPRCH_1)) /*!< Tamper pins are pre-charged before
Kojto 96:487b796308b0 374 sampling during 8 RTCCLK cycles */
bogdanm 84:0b3ab51c8877 375
Kojto 96:487b796308b0 376 #define IS_RTC_TAMPER_PRECHARGE_DURATION(__DURATION_) (((__DURATION_) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \
Kojto 96:487b796308b0 377 ((__DURATION_) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \
Kojto 96:487b796308b0 378 ((__DURATION_) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \
Kojto 96:487b796308b0 379 ((__DURATION_) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK))
bogdanm 84:0b3ab51c8877 380 /**
bogdanm 84:0b3ab51c8877 381 * @}
bogdanm 84:0b3ab51c8877 382 */
bogdanm 84:0b3ab51c8877 383
Kojto 96:487b796308b0 384 /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions RTC Extended Tamper TimeStampOnTamperDetection Definitions
bogdanm 84:0b3ab51c8877 385 * @{
bogdanm 84:0b3ab51c8877 386 */
Kojto 96:487b796308b0 387 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE RTC_TAMPCR_TAMPTS /*!< TimeStamp on Tamper Detection event saved */
Kojto 96:487b796308b0 388 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE ((uint32_t)0x00000000) /*!< TimeStamp on Tamper Detection event is not saved */
bogdanm 84:0b3ab51c8877 389
Kojto 96:487b796308b0 390 #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(__DETECTION__) (((__DETECTION__) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \
Kojto 96:487b796308b0 391 ((__DETECTION__) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE))
bogdanm 84:0b3ab51c8877 392 /**
bogdanm 84:0b3ab51c8877 393 * @}
bogdanm 84:0b3ab51c8877 394 */
bogdanm 84:0b3ab51c8877 395
Kojto 96:487b796308b0 396 /** @defgroup RTCEx_Tamper_Pull_UP_Definitions RTC Extended Tamper Pull UP Definitions
bogdanm 84:0b3ab51c8877 397 * @{
bogdanm 84:0b3ab51c8877 398 */
Kojto 96:487b796308b0 399 #define RTC_TAMPER_PULLUP_ENABLE ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before sampling */
Kojto 96:487b796308b0 400 #define RTC_TAMPER_PULLUP_DISABLE RTC_TAMPCR_TAMPPUDIS /*!< Tamper pins pre-charge is disabled */
bogdanm 84:0b3ab51c8877 401
Kojto 96:487b796308b0 402 #define IS_RTC_TAMPER_PULLUP_STATE(__STATE__) (((__STATE__) == RTC_TAMPER_PULLUP_ENABLE) || \
Kojto 96:487b796308b0 403 ((__STATE__) == RTC_TAMPER_PULLUP_DISABLE))
bogdanm 84:0b3ab51c8877 404 /**
bogdanm 84:0b3ab51c8877 405 * @}
bogdanm 84:0b3ab51c8877 406 */
bogdanm 84:0b3ab51c8877 407
Kojto 96:487b796308b0 408 /** @defgroup RTCEx_Wakeup_Timer_Definitions RTC Extended Wakeup Timer Definitions
bogdanm 84:0b3ab51c8877 409 * @{
bogdanm 84:0b3ab51c8877 410 */
bogdanm 84:0b3ab51c8877 411 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 ((uint32_t)0x00000000)
Kojto 96:487b796308b0 412 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 RTC_CR_WUCKSEL_0
Kojto 96:487b796308b0 413 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 RTC_CR_WUCKSEL_1
Kojto 96:487b796308b0 414 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 ((uint32_t) (RTC_CR_WUCKSEL_0 | RTC_CR_WUCKSEL_1))
Kojto 96:487b796308b0 415 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS RTC_CR_WUCKSEL_2
Kojto 96:487b796308b0 416 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS ((uint32_t) (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_2))
bogdanm 84:0b3ab51c8877 417
Kojto 96:487b796308b0 418 #define IS_RTC_WAKEUP_CLOCK(__CLOCK__) (((__CLOCK__) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \
Kojto 96:487b796308b0 419 ((__CLOCK__) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \
Kojto 96:487b796308b0 420 ((__CLOCK__) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \
Kojto 96:487b796308b0 421 ((__CLOCK__) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \
Kojto 96:487b796308b0 422 ((__CLOCK__) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \
Kojto 96:487b796308b0 423 ((__CLOCK__) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS))
bogdanm 84:0b3ab51c8877 424
Kojto 96:487b796308b0 425 #define IS_RTC_WAKEUP_COUNTER(__COUNTER__) ((__COUNTER__) <= RTC_WUTR_WUT)
bogdanm 84:0b3ab51c8877 426 /**
bogdanm 84:0b3ab51c8877 427 * @}
bogdanm 84:0b3ab51c8877 428 */
bogdanm 84:0b3ab51c8877 429
Kojto 96:487b796308b0 430 /** @defgroup RTCEx_Smooth_calib_period_Definitions RTC Extended Smooth calib period Definitions
bogdanm 84:0b3ab51c8877 431 * @{
bogdanm 84:0b3ab51c8877 432 */
Kojto 96:487b796308b0 433 #define RTC_SMOOTHCALIB_PERIOD_32SEC ((uint32_t)0x00000000) /*!< If RTCCLK = 32768 Hz, Smooth calibation
Kojto 96:487b796308b0 434 period is 32s, else 2exp20 RTCCLK pulses */
Kojto 96:487b796308b0 435 #define RTC_SMOOTHCALIB_PERIOD_16SEC RTC_CAL_CALW16 /*!< If RTCCLK = 32768 Hz, Smooth calibation
Kojto 96:487b796308b0 436 period is 16s, else 2exp19 RTCCLK pulses */
Kojto 96:487b796308b0 437 #define RTC_SMOOTHCALIB_PERIOD_8SEC RTC_CAL_CALW8 /*!< If RTCCLK = 32768 Hz, Smooth calibation
Kojto 96:487b796308b0 438 period is 8s, else 2exp18 RTCCLK pulses */
bogdanm 84:0b3ab51c8877 439
Kojto 96:487b796308b0 440 #define IS_RTC_SMOOTH_CALIB_PERIOD(__PERIOD__) (((__PERIOD__) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \
Kojto 96:487b796308b0 441 ((__PERIOD__) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \
Kojto 96:487b796308b0 442 ((__PERIOD__) == RTC_SMOOTHCALIB_PERIOD_8SEC))
bogdanm 84:0b3ab51c8877 443 /**
bogdanm 84:0b3ab51c8877 444 * @}
bogdanm 84:0b3ab51c8877 445 */
bogdanm 84:0b3ab51c8877 446
Kojto 96:487b796308b0 447 /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTC Extended Smooth calib Plus pulses Definitions
bogdanm 84:0b3ab51c8877 448 * @{
bogdanm 84:0b3ab51c8877 449 */
Kojto 96:487b796308b0 450 #define RTC_SMOOTHCALIB_PLUSPULSES_SET RTC_CAL_CALP /*!< The number of RTCCLK pulses added
bogdanm 84:0b3ab51c8877 451 during a X -second window = Y - CALM[8:0]
bogdanm 84:0b3ab51c8877 452 with Y = 512, 256, 128 when X = 32, 16, 8 */
bogdanm 84:0b3ab51c8877 453 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET ((uint32_t)0x00000000) /*!< The number of RTCCLK pulses subbstited
bogdanm 84:0b3ab51c8877 454 during a 32-second window = CALM[8:0] */
bogdanm 84:0b3ab51c8877 455
Kojto 96:487b796308b0 456 #define IS_RTC_SMOOTH_CALIB_PLUS(__PLUS__) (((__PLUS__) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \
Kojto 96:487b796308b0 457 ((__PLUS__) == RTC_SMOOTHCALIB_PLUSPULSES_RESET))
bogdanm 84:0b3ab51c8877 458 /**
bogdanm 84:0b3ab51c8877 459 * @}
bogdanm 84:0b3ab51c8877 460 */
bogdanm 84:0b3ab51c8877 461
Kojto 96:487b796308b0 462 /** @defgroup RTCEx_Smooth_calib_Minus_pulses_Definitions RTC Extended Smooth calib Minus pulses Definitions
bogdanm 84:0b3ab51c8877 463 * @{
bogdanm 84:0b3ab51c8877 464 */
Kojto 96:487b796308b0 465 #define IS_RTC_SMOOTH_CALIB_MINUS(__VALUE__) ((__VALUE__) <= RTC_CAL_CALM)
bogdanm 84:0b3ab51c8877 466 /**
bogdanm 84:0b3ab51c8877 467 * @}
bogdanm 84:0b3ab51c8877 468 */
bogdanm 84:0b3ab51c8877 469
Kojto 96:487b796308b0 470 /** @defgroup RTCEx_Add_1_Second_Parameter_Definition RTC Extended Add 1 Second Parameter Definitions
bogdanm 84:0b3ab51c8877 471 * @{
bogdanm 84:0b3ab51c8877 472 */
bogdanm 84:0b3ab51c8877 473 #define RTC_SHIFTADD1S_RESET ((uint32_t)0x00000000)
Kojto 96:487b796308b0 474 #define RTC_SHIFTADD1S_SET RTC_SHIFTR_ADD1S
bogdanm 84:0b3ab51c8877 475
Kojto 96:487b796308b0 476 #define IS_RTC_SHIFT_ADD1S(__SEL__) (((__SEL__) == RTC_SHIFTADD1S_RESET) || \
Kojto 96:487b796308b0 477 ((__SEL__) == RTC_SHIFTADD1S_SET))
bogdanm 84:0b3ab51c8877 478 /**
bogdanm 84:0b3ab51c8877 479 * @}
bogdanm 84:0b3ab51c8877 480 */
bogdanm 84:0b3ab51c8877 481
Kojto 96:487b796308b0 482 /** @defgroup RTCEx_Substract_Fraction_Of_Second_Value RTC Extended Substract Fraction Of Second Value
bogdanm 84:0b3ab51c8877 483 * @{
bogdanm 84:0b3ab51c8877 484 */
Kojto 96:487b796308b0 485 #define IS_RTC_SHIFT_SUBFS(__FS__) ((__FS__) <= RTC_SHIFTR_SUBFS)
bogdanm 84:0b3ab51c8877 486 /**
bogdanm 84:0b3ab51c8877 487 * @}
bogdanm 84:0b3ab51c8877 488 */
bogdanm 84:0b3ab51c8877 489
Kojto 96:487b796308b0 490 /** @defgroup RTCEx_Calib_Output_selection_Definitions RTC Extended Calib Output selection Definitions
bogdanm 84:0b3ab51c8877 491 * @{
bogdanm 84:0b3ab51c8877 492 */
bogdanm 84:0b3ab51c8877 493 #define RTC_CALIBOUTPUT_512HZ ((uint32_t)0x00000000)
Kojto 96:487b796308b0 494 #define RTC_CALIBOUTPUT_1HZ RTC_CR_COSEL
bogdanm 84:0b3ab51c8877 495
Kojto 96:487b796308b0 496 #define IS_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == RTC_CALIBOUTPUT_512HZ) || \
Kojto 96:487b796308b0 497 ((__OUTPUT__) == RTC_CALIBOUTPUT_1HZ))
bogdanm 84:0b3ab51c8877 498 /**
bogdanm 84:0b3ab51c8877 499 * @}
bogdanm 84:0b3ab51c8877 500 */
bogdanm 84:0b3ab51c8877 501
bogdanm 84:0b3ab51c8877 502 /**
bogdanm 84:0b3ab51c8877 503 * @}
bogdanm 84:0b3ab51c8877 504 */
bogdanm 84:0b3ab51c8877 505
bogdanm 84:0b3ab51c8877 506 /* Exported macro ------------------------------------------------------------*/
Kojto 96:487b796308b0 507 /** @defgroup RTCEx_Exported_Macros RTC Extended Exported Macros
Kojto 96:487b796308b0 508 * @{
Kojto 96:487b796308b0 509 */
bogdanm 84:0b3ab51c8877 510
bogdanm 84:0b3ab51c8877 511 /**
bogdanm 84:0b3ab51c8877 512 * @brief Enable the RTC WakeUp Timer peripheral.
bogdanm 84:0b3ab51c8877 513 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 514 * @retval None
bogdanm 84:0b3ab51c8877 515 */
bogdanm 84:0b3ab51c8877 516 #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE))
bogdanm 84:0b3ab51c8877 517
bogdanm 84:0b3ab51c8877 518 /**
Kojto 96:487b796308b0 519 * @brief Enable the RTC TimeStamp peripheral.
Kojto 96:487b796308b0 520 * @param __HANDLE__: specifies the RTC handle.
Kojto 96:487b796308b0 521 * @retval None
Kojto 96:487b796308b0 522 */
Kojto 96:487b796308b0 523 #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE))
Kojto 96:487b796308b0 524
Kojto 96:487b796308b0 525 /**
bogdanm 84:0b3ab51c8877 526 * @brief Disable the RTC WakeUp Timer peripheral.
bogdanm 84:0b3ab51c8877 527 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 528 * @retval None
bogdanm 84:0b3ab51c8877 529 */
bogdanm 84:0b3ab51c8877 530 #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE))
bogdanm 84:0b3ab51c8877 531
bogdanm 84:0b3ab51c8877 532 /**
bogdanm 84:0b3ab51c8877 533 * @brief Disable the RTC TimeStamp peripheral.
bogdanm 84:0b3ab51c8877 534 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 535 * @retval None
bogdanm 84:0b3ab51c8877 536 */
bogdanm 84:0b3ab51c8877 537 #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE))
bogdanm 84:0b3ab51c8877 538
bogdanm 84:0b3ab51c8877 539 /**
bogdanm 84:0b3ab51c8877 540 * @brief Enable the RTC calibration output.
bogdanm 84:0b3ab51c8877 541 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 542 * @retval None
bogdanm 84:0b3ab51c8877 543 */
Kojto 96:487b796308b0 544 #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE))
bogdanm 84:0b3ab51c8877 545
bogdanm 84:0b3ab51c8877 546 /**
bogdanm 84:0b3ab51c8877 547 * @brief Disable the calibration output.
bogdanm 84:0b3ab51c8877 548 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 549 * @retval None
bogdanm 84:0b3ab51c8877 550 */
Kojto 96:487b796308b0 551 #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE))
bogdanm 84:0b3ab51c8877 552
bogdanm 84:0b3ab51c8877 553 /**
bogdanm 84:0b3ab51c8877 554 * @brief Enable the clock reference detection.
bogdanm 84:0b3ab51c8877 555 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 556 * @retval None
bogdanm 84:0b3ab51c8877 557 */
Kojto 96:487b796308b0 558 #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON))
bogdanm 84:0b3ab51c8877 559
bogdanm 84:0b3ab51c8877 560 /**
bogdanm 84:0b3ab51c8877 561 * @brief Disable the clock reference detection.
bogdanm 84:0b3ab51c8877 562 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 563 * @retval None
bogdanm 84:0b3ab51c8877 564 */
Kojto 96:487b796308b0 565 #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON))
bogdanm 84:0b3ab51c8877 566
bogdanm 84:0b3ab51c8877 567 /**
bogdanm 84:0b3ab51c8877 568 * @brief Enable the RTC TimeStamp interrupt.
bogdanm 84:0b3ab51c8877 569 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 570 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
bogdanm 84:0b3ab51c8877 571 * This parameter can be:
bogdanm 84:0b3ab51c8877 572 * @arg RTC_IT_TS: TimeStamp interrupt
bogdanm 84:0b3ab51c8877 573 * @retval None
bogdanm 84:0b3ab51c8877 574 */
bogdanm 84:0b3ab51c8877 575 #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
bogdanm 84:0b3ab51c8877 576
bogdanm 84:0b3ab51c8877 577 /**
Kojto 96:487b796308b0 578 * @brief Enable the RTC WakeUpTimer interrupt.
Kojto 96:487b796308b0 579 * @param __HANDLE__: specifies the RTC handle.
Kojto 96:487b796308b0 580 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
Kojto 96:487b796308b0 581 * This parameter can be:
Kojto 96:487b796308b0 582 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
Kojto 96:487b796308b0 583 * @retval None
Kojto 96:487b796308b0 584 */
Kojto 96:487b796308b0 585 #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
Kojto 96:487b796308b0 586
Kojto 96:487b796308b0 587 /**
bogdanm 84:0b3ab51c8877 588 * @brief Disable the RTC TimeStamp interrupt.
bogdanm 84:0b3ab51c8877 589 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 590 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
bogdanm 84:0b3ab51c8877 591 * This parameter can be:
bogdanm 84:0b3ab51c8877 592 * @arg RTC_IT_TS: TimeStamp interrupt
bogdanm 84:0b3ab51c8877 593 * @retval None
bogdanm 84:0b3ab51c8877 594 */
bogdanm 84:0b3ab51c8877 595 #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
bogdanm 84:0b3ab51c8877 596
bogdanm 84:0b3ab51c8877 597 /**
bogdanm 84:0b3ab51c8877 598 * @brief Disable the RTC WakeUpTimer interrupt.
bogdanm 84:0b3ab51c8877 599 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 600 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
bogdanm 84:0b3ab51c8877 601 * This parameter can be:
bogdanm 84:0b3ab51c8877 602 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
bogdanm 84:0b3ab51c8877 603 * @retval None
bogdanm 84:0b3ab51c8877 604 */
bogdanm 84:0b3ab51c8877 605 #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
bogdanm 84:0b3ab51c8877 606
bogdanm 84:0b3ab51c8877 607 /**
bogdanm 84:0b3ab51c8877 608 * @brief Check whether the specified RTC Tamper interrupt has occurred or not.
bogdanm 84:0b3ab51c8877 609 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 610 * @param __FLAG__: specifies the RTC Tamper interrupt sources to be enabled or disabled.
bogdanm 84:0b3ab51c8877 611 * This parameter can be:
bogdanm 84:0b3ab51c8877 612 * @arg RTC_IT_TAMP1
bogdanm 84:0b3ab51c8877 613 * @retval None
bogdanm 84:0b3ab51c8877 614 */
bogdanm 84:0b3ab51c8877 615 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
bogdanm 84:0b3ab51c8877 616
bogdanm 84:0b3ab51c8877 617 /**
bogdanm 84:0b3ab51c8877 618 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
bogdanm 84:0b3ab51c8877 619 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 620 * @param __FLAG__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
bogdanm 84:0b3ab51c8877 621 * This parameter can be:
bogdanm 84:0b3ab51c8877 622 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
bogdanm 84:0b3ab51c8877 623 * @retval None
bogdanm 84:0b3ab51c8877 624 */
bogdanm 84:0b3ab51c8877 625 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
bogdanm 84:0b3ab51c8877 626
bogdanm 84:0b3ab51c8877 627 /**
bogdanm 84:0b3ab51c8877 628 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not.
bogdanm 84:0b3ab51c8877 629 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 630 * @param __FLAG__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
bogdanm 84:0b3ab51c8877 631 * This parameter can be:
bogdanm 84:0b3ab51c8877 632 * @arg RTC_IT_TS: TimeStamp interrupt
bogdanm 84:0b3ab51c8877 633 * @retval None
bogdanm 84:0b3ab51c8877 634 */
bogdanm 84:0b3ab51c8877 635 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
bogdanm 84:0b3ab51c8877 636
bogdanm 84:0b3ab51c8877 637 /**
bogdanm 84:0b3ab51c8877 638 * @brief Get the selected RTC TimeStamp's flag status.
bogdanm 84:0b3ab51c8877 639 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 640 * @param __FLAG__: specifies the RTC TimeStamp Flag sources to be enabled or disabled.
bogdanm 84:0b3ab51c8877 641 * This parameter can be:
bogdanm 84:0b3ab51c8877 642 * @arg RTC_FLAG_TSF
bogdanm 84:0b3ab51c8877 643 * @arg RTC_FLAG_TSOVF
bogdanm 84:0b3ab51c8877 644 * @retval None
bogdanm 84:0b3ab51c8877 645 */
bogdanm 84:0b3ab51c8877 646 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
bogdanm 84:0b3ab51c8877 647
bogdanm 84:0b3ab51c8877 648 /**
bogdanm 84:0b3ab51c8877 649 * @brief Get the selected RTC WakeUpTimer's flag status.
bogdanm 84:0b3ab51c8877 650 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 651 * @param __FLAG__: specifies the RTC WakeUpTimer Flag sources to be enabled or disabled.
bogdanm 84:0b3ab51c8877 652 * This parameter can be:
bogdanm 84:0b3ab51c8877 653 * @arg RTC_FLAG_WUTF
bogdanm 84:0b3ab51c8877 654 * @arg RTC_FLAG_WUTWF
bogdanm 84:0b3ab51c8877 655 * @retval None
bogdanm 84:0b3ab51c8877 656 */
bogdanm 84:0b3ab51c8877 657 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
bogdanm 84:0b3ab51c8877 658
bogdanm 84:0b3ab51c8877 659 /**
bogdanm 84:0b3ab51c8877 660 * @brief Get the selected RTC Tamper's flag status.
bogdanm 84:0b3ab51c8877 661 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 662 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
bogdanm 84:0b3ab51c8877 663 * This parameter can be:
bogdanm 84:0b3ab51c8877 664 * @arg RTC_FLAG_TAMP1F
bogdanm 84:0b3ab51c8877 665 * @retval None
bogdanm 84:0b3ab51c8877 666 */
bogdanm 84:0b3ab51c8877 667 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
bogdanm 84:0b3ab51c8877 668
bogdanm 84:0b3ab51c8877 669 /**
bogdanm 84:0b3ab51c8877 670 * @brief Get the selected RTC shift operation's flag status.
bogdanm 84:0b3ab51c8877 671 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 672 * @param __FLAG__: specifies the RTC shift operation Flag is pending or not.
bogdanm 84:0b3ab51c8877 673 * This parameter can be:
bogdanm 84:0b3ab51c8877 674 * @arg RTC_FLAG_SHPF
bogdanm 84:0b3ab51c8877 675 * @retval None
bogdanm 84:0b3ab51c8877 676 */
bogdanm 84:0b3ab51c8877 677 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
bogdanm 84:0b3ab51c8877 678
bogdanm 84:0b3ab51c8877 679 /**
bogdanm 84:0b3ab51c8877 680 * @brief Clear the RTC Time Stamp's pending flags.
bogdanm 84:0b3ab51c8877 681 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 682 * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
bogdanm 84:0b3ab51c8877 683 * This parameter can be:
bogdanm 84:0b3ab51c8877 684 * @arg RTC_FLAG_TSF
bogdanm 84:0b3ab51c8877 685 * @retval None
bogdanm 84:0b3ab51c8877 686 */
Kojto 96:487b796308b0 687 #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& RTC_FLAGS_MASK)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
bogdanm 84:0b3ab51c8877 688
bogdanm 84:0b3ab51c8877 689 /**
bogdanm 84:0b3ab51c8877 690 * @brief Clear the RTC Tamper's pending flags.
bogdanm 84:0b3ab51c8877 691 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 692 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
bogdanm 84:0b3ab51c8877 693 * This parameter can be:
bogdanm 84:0b3ab51c8877 694 * @arg RTC_FLAG_TAMP1F
bogdanm 84:0b3ab51c8877 695 * @retval None
bogdanm 84:0b3ab51c8877 696 */
Kojto 96:487b796308b0 697 #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& RTC_FLAGS_MASK)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
bogdanm 84:0b3ab51c8877 698
bogdanm 84:0b3ab51c8877 699 /**
bogdanm 84:0b3ab51c8877 700 * @brief Clear the RTC Wake Up timer's pending flags.
bogdanm 84:0b3ab51c8877 701 * @param __HANDLE__: specifies the RTC handle.
bogdanm 84:0b3ab51c8877 702 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
bogdanm 84:0b3ab51c8877 703 * This parameter can be:
bogdanm 84:0b3ab51c8877 704 * @arg RTC_FLAG_WUTF
bogdanm 84:0b3ab51c8877 705 * @retval None
bogdanm 84:0b3ab51c8877 706 */
Kojto 96:487b796308b0 707 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& RTC_FLAGS_MASK)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
Kojto 96:487b796308b0 708
Kojto 96:487b796308b0 709 /* WAKE-UP TIMER EXTI */
Kojto 96:487b796308b0 710 /* ------------------ */
Kojto 96:487b796308b0 711 /**
Kojto 96:487b796308b0 712 * @brief Enable interrupt on the RTC WakeUp Timer associated Exti line.
Kojto 96:487b796308b0 713 * @retval None
Kojto 96:487b796308b0 714 */
Kojto 96:487b796308b0 715 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
Kojto 96:487b796308b0 716
Kojto 96:487b796308b0 717 /**
Kojto 96:487b796308b0 718 * @brief Disable interrupt on the RTC WakeUp Timer associated Exti line.
Kojto 96:487b796308b0 719 * @retval None
Kojto 96:487b796308b0 720 */
Kojto 96:487b796308b0 721 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
Kojto 96:487b796308b0 722
Kojto 96:487b796308b0 723 /**
Kojto 96:487b796308b0 724 * @brief Enable event on the RTC WakeUp Timer associated Exti line.
Kojto 96:487b796308b0 725 * @retval None.
Kojto 96:487b796308b0 726 */
Kojto 96:487b796308b0 727 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
Kojto 96:487b796308b0 728
Kojto 96:487b796308b0 729 /**
Kojto 96:487b796308b0 730 * @brief Disable event on the RTC WakeUp Timer associated Exti line.
Kojto 96:487b796308b0 731 * @retval None.
Kojto 96:487b796308b0 732 */
Kojto 96:487b796308b0 733 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
Kojto 96:487b796308b0 734
Kojto 96:487b796308b0 735 /**
Kojto 96:487b796308b0 736 * @brief Enable falling edge trigger on the RTC WakeUp Timer associated Exti line.
Kojto 96:487b796308b0 737 * @retval None.
Kojto 96:487b796308b0 738 */
Kojto 96:487b796308b0 739 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
Kojto 96:487b796308b0 740
Kojto 96:487b796308b0 741 /**
Kojto 96:487b796308b0 742 * @brief Disable falling edge trigger on the RTC WakeUp Timer associated Exti line.
Kojto 96:487b796308b0 743 * @retval None.
Kojto 96:487b796308b0 744 */
Kojto 96:487b796308b0 745 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
Kojto 96:487b796308b0 746
Kojto 96:487b796308b0 747 /**
Kojto 96:487b796308b0 748 * @brief Enable rising edge trigger on the RTC WakeUp Timer associated Exti line.
Kojto 96:487b796308b0 749 * @retval None.
Kojto 96:487b796308b0 750 */
Kojto 96:487b796308b0 751 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
Kojto 96:487b796308b0 752
Kojto 96:487b796308b0 753 /**
Kojto 96:487b796308b0 754 * @brief Disable rising edge trigger on the RTC WakeUp Timer associated Exti line.
Kojto 96:487b796308b0 755 * @retval None.
Kojto 96:487b796308b0 756 */
Kojto 96:487b796308b0 757 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
Kojto 96:487b796308b0 758
Kojto 96:487b796308b0 759 /**
Kojto 96:487b796308b0 760 * @brief Enable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line.
Kojto 96:487b796308b0 761 * @retval None.
Kojto 96:487b796308b0 762 */
Kojto 96:487b796308b0 763 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE();
Kojto 96:487b796308b0 764
Kojto 96:487b796308b0 765 /**
Kojto 96:487b796308b0 766 * @brief Disable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line.
Kojto 96:487b796308b0 767 * This parameter can be:
Kojto 96:487b796308b0 768 * @retval None.
Kojto 96:487b796308b0 769 */
Kojto 96:487b796308b0 770 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE();
Kojto 96:487b796308b0 771
Kojto 96:487b796308b0 772 /**
Kojto 96:487b796308b0 773 * @brief Check whether the RTC WakeUp Timer associated Exti line interrupt flag is set or not.
Kojto 96:487b796308b0 774 * @retval Line Status.
Kojto 96:487b796308b0 775 */
Kojto 96:487b796308b0 776 #define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
Kojto 96:487b796308b0 777
Kojto 96:487b796308b0 778 /**
Kojto 96:487b796308b0 779 * @brief Clear the RTC WakeUp Timer associated Exti line flag.
Kojto 96:487b796308b0 780 * @retval None.
Kojto 96:487b796308b0 781 */
Kojto 96:487b796308b0 782 #define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
Kojto 96:487b796308b0 783
Kojto 96:487b796308b0 784 /**
Kojto 96:487b796308b0 785 * @brief Generate a Software interrupt on the RTC WakeUp Timer associated Exti line.
Kojto 96:487b796308b0 786 * @retval None.
Kojto 96:487b796308b0 787 */
Kojto 96:487b796308b0 788 #define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
Kojto 96:487b796308b0 789
Kojto 96:487b796308b0 790
Kojto 96:487b796308b0 791 /* TAMPER TIMESTAMP EXTI */
Kojto 96:487b796308b0 792 /* --------------------- */
Kojto 96:487b796308b0 793 /**
Kojto 96:487b796308b0 794 * @brief Enable interrupt on the RTC Tamper and Timestamp associated Exti line.
Kojto 96:487b796308b0 795 * @retval None
Kojto 96:487b796308b0 796 */
Kojto 96:487b796308b0 797 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
Kojto 96:487b796308b0 798
Kojto 96:487b796308b0 799 /**
Kojto 96:487b796308b0 800 * @brief Disable interrupt on the RTC Tamper and Timestamp associated Exti line.
Kojto 96:487b796308b0 801 * @retval None
Kojto 96:487b796308b0 802 */
Kojto 96:487b796308b0 803 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
Kojto 96:487b796308b0 804
Kojto 96:487b796308b0 805 /**
Kojto 96:487b796308b0 806 * @brief Enable event on the RTC Tamper and Timestamp associated Exti line.
Kojto 96:487b796308b0 807 * @retval None.
Kojto 96:487b796308b0 808 */
Kojto 96:487b796308b0 809 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
Kojto 96:487b796308b0 810
Kojto 96:487b796308b0 811 /**
Kojto 96:487b796308b0 812 * @brief Disable event on the RTC Tamper and Timestamp associated Exti line.
Kojto 96:487b796308b0 813 * @retval None.
Kojto 96:487b796308b0 814 */
Kojto 96:487b796308b0 815 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
Kojto 96:487b796308b0 816
Kojto 96:487b796308b0 817 /**
Kojto 96:487b796308b0 818 * @brief Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
Kojto 96:487b796308b0 819 * @retval None.
Kojto 96:487b796308b0 820 */
Kojto 96:487b796308b0 821 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
Kojto 96:487b796308b0 822
Kojto 96:487b796308b0 823 /**
Kojto 96:487b796308b0 824 * @brief Disable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
Kojto 96:487b796308b0 825 * @retval None.
Kojto 96:487b796308b0 826 */
Kojto 96:487b796308b0 827 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
Kojto 96:487b796308b0 828
Kojto 96:487b796308b0 829 /**
Kojto 96:487b796308b0 830 * @brief Enable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
Kojto 96:487b796308b0 831 * @retval None.
Kojto 96:487b796308b0 832 */
Kojto 96:487b796308b0 833 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
Kojto 96:487b796308b0 834
Kojto 96:487b796308b0 835 /**
Kojto 96:487b796308b0 836 * @brief Disable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
Kojto 96:487b796308b0 837 * @retval None.
Kojto 96:487b796308b0 838 */
Kojto 96:487b796308b0 839 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
Kojto 96:487b796308b0 840
Kojto 96:487b796308b0 841 /**
Kojto 96:487b796308b0 842 * @brief Enable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
Kojto 96:487b796308b0 843 * @retval None.
Kojto 96:487b796308b0 844 */
Kojto 96:487b796308b0 845 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE();
Kojto 96:487b796308b0 846
Kojto 96:487b796308b0 847 /**
Kojto 96:487b796308b0 848 * @brief Disable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
Kojto 96:487b796308b0 849 * This parameter can be:
Kojto 96:487b796308b0 850 * @retval None.
Kojto 96:487b796308b0 851 */
Kojto 96:487b796308b0 852 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE();
Kojto 96:487b796308b0 853
Kojto 96:487b796308b0 854 /**
Kojto 96:487b796308b0 855 * @brief Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not.
Kojto 96:487b796308b0 856 * @retval Line Status.
Kojto 96:487b796308b0 857 */
Kojto 96:487b796308b0 858 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
Kojto 96:487b796308b0 859
Kojto 96:487b796308b0 860 /**
Kojto 96:487b796308b0 861 * @brief Clear the RTC Tamper and Timestamp associated Exti line flag.
Kojto 96:487b796308b0 862 * @retval None.
Kojto 96:487b796308b0 863 */
Kojto 96:487b796308b0 864 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
Kojto 96:487b796308b0 865
Kojto 96:487b796308b0 866 /**
Kojto 96:487b796308b0 867 * @brief Generate a Software interrupt on the RTC Tamper and Timestamp associated Exti line
Kojto 96:487b796308b0 868 * @retval None.
Kojto 96:487b796308b0 869 */
Kojto 96:487b796308b0 870 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
Kojto 96:487b796308b0 871
bogdanm 84:0b3ab51c8877 872
bogdanm 84:0b3ab51c8877 873 /**
bogdanm 84:0b3ab51c8877 874 * @}
bogdanm 84:0b3ab51c8877 875 */
bogdanm 84:0b3ab51c8877 876
bogdanm 84:0b3ab51c8877 877 /* Exported functions --------------------------------------------------------*/
Kojto 96:487b796308b0 878 /** @defgroup RTCEx_Exported_Functions RTC Extended Exported Functions
Kojto 96:487b796308b0 879 * @{
Kojto 96:487b796308b0 880 */
Kojto 96:487b796308b0 881
Kojto 96:487b796308b0 882 /** @defgroup RTCEx_Exported_Functions_Group1 Extended RTC TimeStamp and Tamper functions
Kojto 96:487b796308b0 883 * @{
Kojto 96:487b796308b0 884 */
bogdanm 84:0b3ab51c8877 885
bogdanm 84:0b3ab51c8877 886 /* RTC TimeStamp and Tamper functions *****************************************/
bogdanm 84:0b3ab51c8877 887 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
bogdanm 84:0b3ab51c8877 888 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
bogdanm 84:0b3ab51c8877 889 HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc);
bogdanm 84:0b3ab51c8877 890 HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format);
bogdanm 84:0b3ab51c8877 891
bogdanm 84:0b3ab51c8877 892 HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
bogdanm 84:0b3ab51c8877 893 HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
bogdanm 84:0b3ab51c8877 894 HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper);
Kojto 96:487b796308b0 895 void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc);
bogdanm 84:0b3ab51c8877 896
Kojto 96:487b796308b0 897 void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 898 void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 899
Kojto 96:487b796308b0 900 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
Kojto 96:487b796308b0 901 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
Kojto 96:487b796308b0 902
Kojto 96:487b796308b0 903 void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 904
Kojto 96:487b796308b0 905 #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) ||
Kojto 96:487b796308b0 906 * (STM32L073xx) || (STM32L072xx) || (STM32L071xx)
Kojto 96:487b796308b0 907 */
Kojto 96:487b796308b0 908
Kojto 96:487b796308b0 909 void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 910 HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
Kojto 96:487b796308b0 911 HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
Kojto 96:487b796308b0 912 HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
Kojto 96:487b796308b0 913
Kojto 96:487b796308b0 914 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
Kojto 96:487b796308b0 915 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
Kojto 96:487b796308b0 916
Kojto 96:487b796308b0 917 HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
Kojto 96:487b796308b0 918
Kojto 96:487b796308b0 919 #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) ||
Kojto 96:487b796308b0 920 * (STM32L073xx) || (STM32L072xx) || (STM32L071xx)
Kojto 96:487b796308b0 921 */
Kojto 96:487b796308b0 922
Kojto 96:487b796308b0 923 /**
Kojto 96:487b796308b0 924 * @}
Kojto 96:487b796308b0 925 */
Kojto 96:487b796308b0 926
Kojto 96:487b796308b0 927 /** @defgroup RTCEx_Exported_Functions_Group2 Extended RTC Wake-up functions
Kojto 96:487b796308b0 928 * @{
Kojto 96:487b796308b0 929 */
Kojto 96:487b796308b0 930
Kojto 96:487b796308b0 931 /* RTC Wake-up functions ******************************************************/
bogdanm 84:0b3ab51c8877 932 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
bogdanm 84:0b3ab51c8877 933 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
bogdanm 84:0b3ab51c8877 934 uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc);
bogdanm 84:0b3ab51c8877 935 uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 936 void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 937 void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 938 HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
Kojto 96:487b796308b0 939 /**
Kojto 96:487b796308b0 940 * @}
Kojto 96:487b796308b0 941 */
bogdanm 84:0b3ab51c8877 942
Kojto 96:487b796308b0 943 /** @defgroup RTCEx_Exported_Functions_Group3 Extended Peripheral Control functions
Kojto 96:487b796308b0 944 * @{
Kojto 96:487b796308b0 945 */
Kojto 96:487b796308b0 946
Kojto 96:487b796308b0 947 /* Extended Control functions ************************************************/
bogdanm 84:0b3ab51c8877 948 void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data);
bogdanm 84:0b3ab51c8877 949 uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
bogdanm 84:0b3ab51c8877 950
bogdanm 84:0b3ab51c8877 951 HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue);
bogdanm 84:0b3ab51c8877 952 HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS);
bogdanm 84:0b3ab51c8877 953 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput);
bogdanm 84:0b3ab51c8877 954 HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc);
bogdanm 84:0b3ab51c8877 955 HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc);
bogdanm 84:0b3ab51c8877 956 HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc);
bogdanm 84:0b3ab51c8877 957 HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc);
bogdanm 84:0b3ab51c8877 958 HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 959 /**
Kojto 96:487b796308b0 960 * @}
Kojto 96:487b796308b0 961 */
bogdanm 84:0b3ab51c8877 962
Kojto 96:487b796308b0 963 /* Extended RTC features functions *******************************************/
Kojto 96:487b796308b0 964 /** @defgroup RTCEx_Exported_Functions_Group4 Extended features functions
Kojto 96:487b796308b0 965 * @{
Kojto 96:487b796308b0 966 */
Kojto 96:487b796308b0 967 void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc);
Kojto 96:487b796308b0 968 HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
bogdanm 84:0b3ab51c8877 969
Kojto 96:487b796308b0 970 /**
Kojto 96:487b796308b0 971 * @}
Kojto 96:487b796308b0 972 */
bogdanm 84:0b3ab51c8877 973
Kojto 96:487b796308b0 974 /**
Kojto 96:487b796308b0 975 * @}
Kojto 96:487b796308b0 976 */
bogdanm 84:0b3ab51c8877 977
bogdanm 84:0b3ab51c8877 978 /**
bogdanm 84:0b3ab51c8877 979 * @}
bogdanm 84:0b3ab51c8877 980 */
bogdanm 84:0b3ab51c8877 981
bogdanm 84:0b3ab51c8877 982 /**
bogdanm 84:0b3ab51c8877 983 * @}
bogdanm 84:0b3ab51c8877 984 */
bogdanm 84:0b3ab51c8877 985
bogdanm 84:0b3ab51c8877 986 #ifdef __cplusplus
bogdanm 84:0b3ab51c8877 987 }
bogdanm 84:0b3ab51c8877 988 #endif
bogdanm 84:0b3ab51c8877 989
Kojto 96:487b796308b0 990 #endif /* __STM32L0xx_HAL_RTC_EX_H */
bogdanm 84:0b3ab51c8877 991
bogdanm 84:0b3ab51c8877 992 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Kojto 96:487b796308b0 993