Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
99:dbbf35b96557
.

Who changed what in which revision?

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