mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Wed Jul 01 09:45:11 2015 +0100
Revision:
579:53297373a894
Parent:
394:83f921546702
Synchronized with git revision d5b4d2ab9c47edb4dc5776e7177b0c2263459081

Full URL: https://github.com/mbedmicro/mbed/commit/d5b4d2ab9c47edb4dc5776e7177b0c2263459081/

Initial version of drivers for SAMR21

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 354:e67efb2aab0e 1 /**
mbed_official 354:e67efb2aab0e 2 ******************************************************************************
mbed_official 354:e67efb2aab0e 3 * @file stm32l1xx_hal_rtc_ex.h
mbed_official 354:e67efb2aab0e 4 * @author MCD Application Team
mbed_official 354:e67efb2aab0e 5 * @version V1.0.0
mbed_official 354:e67efb2aab0e 6 * @date 5-September-2014
mbed_official 354:e67efb2aab0e 7 * @brief Header file of RTC HAL Extension module.
mbed_official 354:e67efb2aab0e 8 ******************************************************************************
mbed_official 354:e67efb2aab0e 9 * @attention
mbed_official 354:e67efb2aab0e 10 *
mbed_official 354:e67efb2aab0e 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 354:e67efb2aab0e 12 *
mbed_official 354:e67efb2aab0e 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 354:e67efb2aab0e 14 * are permitted provided that the following conditions are met:
mbed_official 354:e67efb2aab0e 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 354:e67efb2aab0e 16 * this list of conditions and the following disclaimer.
mbed_official 354:e67efb2aab0e 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 354:e67efb2aab0e 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 354:e67efb2aab0e 19 * and/or other materials provided with the distribution.
mbed_official 354:e67efb2aab0e 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 354:e67efb2aab0e 21 * may be used to endorse or promote products derived from this software
mbed_official 354:e67efb2aab0e 22 * without specific prior written permission.
mbed_official 354:e67efb2aab0e 23 *
mbed_official 354:e67efb2aab0e 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 354:e67efb2aab0e 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 354:e67efb2aab0e 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 354:e67efb2aab0e 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 354:e67efb2aab0e 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 354:e67efb2aab0e 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 354:e67efb2aab0e 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 354:e67efb2aab0e 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 354:e67efb2aab0e 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 354:e67efb2aab0e 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 354:e67efb2aab0e 34 *
mbed_official 354:e67efb2aab0e 35 ******************************************************************************
mbed_official 354:e67efb2aab0e 36 */
mbed_official 354:e67efb2aab0e 37
mbed_official 354:e67efb2aab0e 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 354:e67efb2aab0e 39 #ifndef __STM32L1xx_HAL_RTC_EX_H
mbed_official 354:e67efb2aab0e 40 #define __STM32L1xx_HAL_RTC_EX_H
mbed_official 354:e67efb2aab0e 41
mbed_official 354:e67efb2aab0e 42 #ifdef __cplusplus
mbed_official 354:e67efb2aab0e 43 extern "C" {
mbed_official 354:e67efb2aab0e 44 #endif
mbed_official 354:e67efb2aab0e 45
mbed_official 354:e67efb2aab0e 46 /* Includes ------------------------------------------------------------------*/
mbed_official 354:e67efb2aab0e 47 #include "stm32l1xx_hal_def.h"
mbed_official 354:e67efb2aab0e 48
mbed_official 354:e67efb2aab0e 49 /** @addtogroup STM32L1xx_HAL_Driver
mbed_official 354:e67efb2aab0e 50 * @{
mbed_official 354:e67efb2aab0e 51 */
mbed_official 354:e67efb2aab0e 52
mbed_official 354:e67efb2aab0e 53 /** @addtogroup RTCEx
mbed_official 354:e67efb2aab0e 54 * @{
mbed_official 354:e67efb2aab0e 55 */
mbed_official 354:e67efb2aab0e 56
mbed_official 354:e67efb2aab0e 57 /* Exported types ------------------------------------------------------------*/
mbed_official 354:e67efb2aab0e 58 /** @defgroup RTCEx_Exported_Types RTCEx Exported Types
mbed_official 354:e67efb2aab0e 59 * @{
mbed_official 354:e67efb2aab0e 60 */
mbed_official 354:e67efb2aab0e 61
mbed_official 354:e67efb2aab0e 62 /**
mbed_official 354:e67efb2aab0e 63 * @brief RTC Tamper structure definition
mbed_official 354:e67efb2aab0e 64 */
mbed_official 354:e67efb2aab0e 65 typedef struct
mbed_official 354:e67efb2aab0e 66 {
mbed_official 354:e67efb2aab0e 67 uint32_t Tamper; /*!< Specifies the Tamper Pin.
mbed_official 354:e67efb2aab0e 68 This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */
mbed_official 354:e67efb2aab0e 69
mbed_official 354:e67efb2aab0e 70 uint32_t Trigger; /*!< Specifies the Tamper Trigger.
mbed_official 354:e67efb2aab0e 71 This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */
mbed_official 354:e67efb2aab0e 72
mbed_official 354:e67efb2aab0e 73 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 74 uint32_t Filter; /*!< Specifies the RTC Filter Tamper.
mbed_official 354:e67efb2aab0e 75 This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */
mbed_official 354:e67efb2aab0e 76
mbed_official 354:e67efb2aab0e 77 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency.
mbed_official 354:e67efb2aab0e 78 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */
mbed_official 354:e67efb2aab0e 79
mbed_official 354:e67efb2aab0e 80 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration .
mbed_official 354:e67efb2aab0e 81 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */
mbed_official 354:e67efb2aab0e 82
mbed_official 354:e67efb2aab0e 83 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp .
mbed_official 354:e67efb2aab0e 84 This parameter can be a value of @ref RTCEx_Tamper_Pull_Up_Definitions */
mbed_official 354:e67efb2aab0e 85
mbed_official 354:e67efb2aab0e 86 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection.
mbed_official 354:e67efb2aab0e 87 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */
mbed_official 354:e67efb2aab0e 88 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 89 }RTC_TamperTypeDef;
mbed_official 354:e67efb2aab0e 90
mbed_official 354:e67efb2aab0e 91 /**
mbed_official 354:e67efb2aab0e 92 * @brief RTC Time structure definition
mbed_official 354:e67efb2aab0e 93 */
mbed_official 354:e67efb2aab0e 94 typedef struct
mbed_official 354:e67efb2aab0e 95 {
mbed_official 354:e67efb2aab0e 96 uint8_t Hours; /*!< Specifies the RTC Time Hour.
mbed_official 354:e67efb2aab0e 97 This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the RTC_HourFormat_12 is selected
mbed_official 354:e67efb2aab0e 98 This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the RTC_HourFormat_24 is selected */
mbed_official 354:e67efb2aab0e 99
mbed_official 354:e67efb2aab0e 100 uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
mbed_official 354:e67efb2aab0e 101 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
mbed_official 354:e67efb2aab0e 102
mbed_official 354:e67efb2aab0e 103 uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
mbed_official 354:e67efb2aab0e 104 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
mbed_official 354:e67efb2aab0e 105
mbed_official 354:e67efb2aab0e 106 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 107 uint32_t SubSeconds; /*!< Specifies the RTC Time SubSeconds.
mbed_official 354:e67efb2aab0e 108 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
mbed_official 354:e67efb2aab0e 109 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 110
mbed_official 354:e67efb2aab0e 111 uint8_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
mbed_official 354:e67efb2aab0e 112 This parameter can be a value of @ref RTC_AM_PM_Definitions */
mbed_official 354:e67efb2aab0e 113
mbed_official 354:e67efb2aab0e 114 uint32_t DayLightSaving; /*!< Specifies RTC_DayLightSaveOperation: the value of hour adjustment.
mbed_official 354:e67efb2aab0e 115 This parameter can be a value of @ref RTC_DayLightSaving_Definitions */
mbed_official 354:e67efb2aab0e 116
mbed_official 354:e67efb2aab0e 117 uint32_t StoreOperation; /*!< Specifies RTC_StoreOperation value to be written in the BCK bit
mbed_official 354:e67efb2aab0e 118 in CR register to store the operation.
mbed_official 354:e67efb2aab0e 119 This parameter can be a value of @ref RTC_StoreOperation_Definitions */
mbed_official 354:e67efb2aab0e 120 }RTC_TimeTypeDef;
mbed_official 354:e67efb2aab0e 121
mbed_official 354:e67efb2aab0e 122 /**
mbed_official 354:e67efb2aab0e 123 * @brief RTC Alarm structure definition
mbed_official 354:e67efb2aab0e 124 */
mbed_official 354:e67efb2aab0e 125 typedef struct
mbed_official 354:e67efb2aab0e 126 {
mbed_official 354:e67efb2aab0e 127 RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */
mbed_official 354:e67efb2aab0e 128
mbed_official 354:e67efb2aab0e 129 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks.
mbed_official 354:e67efb2aab0e 130 This parameter can be a value of @ref RTC_AlarmMask_Definitions */
mbed_official 354:e67efb2aab0e 131
mbed_official 354:e67efb2aab0e 132 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 133 uint32_t AlarmSubSecondMask; /*!< Specifies the RTC Alarm SubSeconds Masks.
mbed_official 354:e67efb2aab0e 134 This parameter can be a value of @ref RTC_Alarm_Sub_Seconds_Masks_Definitions */
mbed_official 354:e67efb2aab0e 135 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 136
mbed_official 354:e67efb2aab0e 137 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on Date or WeekDay.
mbed_official 354:e67efb2aab0e 138 This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */
mbed_official 354:e67efb2aab0e 139
mbed_official 354:e67efb2aab0e 140 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Date/WeekDay.
mbed_official 354:e67efb2aab0e 141 If the Alarm Date is selected, this parameter must be set to a value in the 1-31 range.
mbed_official 354:e67efb2aab0e 142 If the Alarm WeekDay is selected, this parameter can be a value of @ref RTC_WeekDay_Definitions */
mbed_official 354:e67efb2aab0e 143
mbed_official 354:e67efb2aab0e 144 uint32_t Alarm; /*!< Specifies the alarm .
mbed_official 354:e67efb2aab0e 145 This parameter can be a value of @ref RTC_Alarms_Definitions */
mbed_official 354:e67efb2aab0e 146 }RTC_AlarmTypeDef;
mbed_official 354:e67efb2aab0e 147 /**
mbed_official 354:e67efb2aab0e 148 * @}
mbed_official 354:e67efb2aab0e 149 */
mbed_official 354:e67efb2aab0e 150
mbed_official 354:e67efb2aab0e 151 /* Exported constants --------------------------------------------------------*/
mbed_official 354:e67efb2aab0e 152 /** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants
mbed_official 354:e67efb2aab0e 153 * @{
mbed_official 354:e67efb2aab0e 154 */
mbed_official 354:e67efb2aab0e 155
mbed_official 354:e67efb2aab0e 156 /** @defgroup RTC_Masks_Definitions Masks Definitions
mbed_official 354:e67efb2aab0e 157 * @{
mbed_official 354:e67efb2aab0e 158 */
mbed_official 354:e67efb2aab0e 159 #define RTC_TR_RESERVED_MASK ((uint32_t)0x007F7F7F)
mbed_official 354:e67efb2aab0e 160 #define RTC_DR_RESERVED_MASK ((uint32_t)0x00FFFF3F)
mbed_official 354:e67efb2aab0e 161 #define RTC_INIT_MASK ((uint32_t)0xFFFFFFFF)
mbed_official 354:e67efb2aab0e 162 #define RTC_RSF_MASK ((uint32_t)0xFFFFFF5F)
mbed_official 354:e67efb2aab0e 163
mbed_official 354:e67efb2aab0e 164 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 165 #define RTC_FLAGS_MASK ((uint32_t)(RTC_FLAG_ALRAWF | RTC_FLAG_ALRBWF | RTC_FLAG_WUTWF | \
mbed_official 354:e67efb2aab0e 166 RTC_FLAG_SHPF | RTC_FLAG_INITS | RTC_FLAG_RSF | \
mbed_official 354:e67efb2aab0e 167 RTC_FLAG_INITF | RTC_FLAG_ALRAF | RTC_FLAG_ALRBF | \
mbed_official 354:e67efb2aab0e 168 RTC_FLAG_WUTF | RTC_FLAG_TSF | RTC_FLAG_TSOVF | \
mbed_official 354:e67efb2aab0e 169 RTC_FLAG_TAMP1F | RTC_FLAG_TAMP2F | RTC_FLAG_TAMP3F | \
mbed_official 354:e67efb2aab0e 170 RTC_FLAG_RECALPF))
mbed_official 354:e67efb2aab0e 171 #else
mbed_official 354:e67efb2aab0e 172 #define RTC_FLAGS_MASK ((uint32_t)(RTC_FLAG_ALRAWF | RTC_FLAG_ALRBWF | RTC_FLAG_WUTWF | \
mbed_official 354:e67efb2aab0e 173 RTC_FLAG_SHPF | RTC_FLAG_INITS | RTC_FLAG_RSF | \
mbed_official 354:e67efb2aab0e 174 RTC_FLAG_INITF | RTC_FLAG_ALRAF | RTC_FLAG_ALRBF | \
mbed_official 354:e67efb2aab0e 175 RTC_FLAG_WUTF | RTC_FLAG_TSF | RTC_FLAG_TSOVF | \
mbed_official 354:e67efb2aab0e 176 RTC_FLAG_TAMP1F | \
mbed_official 354:e67efb2aab0e 177 RTC_FLAG_RECALPF))
mbed_official 354:e67efb2aab0e 178
mbed_official 354:e67efb2aab0e 179 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 180 /**
mbed_official 354:e67efb2aab0e 181 * @}
mbed_official 354:e67efb2aab0e 182 */
mbed_official 354:e67efb2aab0e 183
mbed_official 354:e67efb2aab0e 184 /** @defgroup RTC_Synchronous_Predivider Synchronous Predivider
mbed_official 354:e67efb2aab0e 185 * @{
mbed_official 354:e67efb2aab0e 186 */
mbed_official 354:e67efb2aab0e 187 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 188 #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= (uint32_t)0x7FFF)
mbed_official 354:e67efb2aab0e 189 #elif defined(STM32L100xB) || defined (STM32L151xB) || defined (STM32L152xB)
mbed_official 354:e67efb2aab0e 190 #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= (uint32_t)0x1FFF)
mbed_official 354:e67efb2aab0e 191 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 192 /**
mbed_official 354:e67efb2aab0e 193 * @}
mbed_official 354:e67efb2aab0e 194 */
mbed_official 354:e67efb2aab0e 195
mbed_official 354:e67efb2aab0e 196 /** @defgroup RTC_Interrupts_Definitions Interrupts Definitions
mbed_official 354:e67efb2aab0e 197 * @{
mbed_official 354:e67efb2aab0e 198 */
mbed_official 354:e67efb2aab0e 199 #define RTC_IT_TS ((uint32_t)0x00008000)
mbed_official 354:e67efb2aab0e 200 #define RTC_IT_WUT ((uint32_t)0x00004000)
mbed_official 354:e67efb2aab0e 201 #define RTC_IT_ALRB ((uint32_t)0x00002000)
mbed_official 354:e67efb2aab0e 202 #define RTC_IT_ALRA ((uint32_t)0x00001000)
mbed_official 354:e67efb2aab0e 203 #define RTC_IT_TAMP1 ((uint32_t)0x00020000)
mbed_official 354:e67efb2aab0e 204 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 205 #define RTC_IT_TAMP2 ((uint32_t)0x00040000)
mbed_official 354:e67efb2aab0e 206 #define RTC_IT_TAMP3 ((uint32_t)0x00080000)
mbed_official 354:e67efb2aab0e 207 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 208 /**
mbed_official 354:e67efb2aab0e 209 * @}
mbed_official 354:e67efb2aab0e 210 */
mbed_official 354:e67efb2aab0e 211
mbed_official 354:e67efb2aab0e 212 /** @defgroup RTC_Flags_Definitions Flags Definitions
mbed_official 354:e67efb2aab0e 213 * @{
mbed_official 354:e67efb2aab0e 214 */
mbed_official 354:e67efb2aab0e 215 #define RTC_FLAG_RECALPF ((uint32_t)0x00010000)
mbed_official 354:e67efb2aab0e 216 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 217 #define RTC_FLAG_TAMP3F ((uint32_t)0x00008000)
mbed_official 354:e67efb2aab0e 218 #define RTC_FLAG_TAMP2F ((uint32_t)0x00004000)
mbed_official 354:e67efb2aab0e 219 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 220 #define RTC_FLAG_TAMP1F ((uint32_t)0x00002000)
mbed_official 354:e67efb2aab0e 221 #define RTC_FLAG_TSOVF ((uint32_t)0x00001000)
mbed_official 354:e67efb2aab0e 222 #define RTC_FLAG_TSF ((uint32_t)0x00000800)
mbed_official 354:e67efb2aab0e 223 #define RTC_FLAG_WUTF ((uint32_t)0x00000400)
mbed_official 354:e67efb2aab0e 224 #define RTC_FLAG_ALRBF ((uint32_t)0x00000200)
mbed_official 354:e67efb2aab0e 225 #define RTC_FLAG_ALRAF ((uint32_t)0x00000100)
mbed_official 354:e67efb2aab0e 226 #define RTC_FLAG_INITF ((uint32_t)0x00000040)
mbed_official 354:e67efb2aab0e 227 #define RTC_FLAG_RSF ((uint32_t)0x00000020)
mbed_official 354:e67efb2aab0e 228 #define RTC_FLAG_INITS ((uint32_t)0x00000010)
mbed_official 354:e67efb2aab0e 229 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 230 #define RTC_FLAG_SHPF ((uint32_t)0x00000008)
mbed_official 354:e67efb2aab0e 231 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 232 #define RTC_FLAG_WUTWF ((uint32_t)0x00000004)
mbed_official 354:e67efb2aab0e 233 #define RTC_FLAG_ALRBWF ((uint32_t)0x00000002)
mbed_official 354:e67efb2aab0e 234 #define RTC_FLAG_ALRAWF ((uint32_t)0x00000001)
mbed_official 354:e67efb2aab0e 235 /**
mbed_official 354:e67efb2aab0e 236 * @}
mbed_official 354:e67efb2aab0e 237 */
mbed_official 354:e67efb2aab0e 238
mbed_official 354:e67efb2aab0e 239 /** @defgroup RTCEx_Output_selection_Definitions Output selection Definitions
mbed_official 354:e67efb2aab0e 240 * @{
mbed_official 354:e67efb2aab0e 241 */
mbed_official 354:e67efb2aab0e 242 #define RTC_OUTPUT_DISABLE ((uint32_t)0x00000000)
mbed_official 354:e67efb2aab0e 243 #define RTC_OUTPUT_ALARMA ((uint32_t)0x00200000)
mbed_official 354:e67efb2aab0e 244 #define RTC_OUTPUT_ALARMB ((uint32_t)0x00400000)
mbed_official 354:e67efb2aab0e 245 #define RTC_OUTPUT_WAKEUP ((uint32_t)0x00600000)
mbed_official 354:e67efb2aab0e 246
mbed_official 354:e67efb2aab0e 247 #define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_OUTPUT_DISABLE) || \
mbed_official 354:e67efb2aab0e 248 ((OUTPUT) == RTC_OUTPUT_ALARMA) || \
mbed_official 354:e67efb2aab0e 249 ((OUTPUT) == RTC_OUTPUT_ALARMB) || \
mbed_official 354:e67efb2aab0e 250 ((OUTPUT) == RTC_OUTPUT_WAKEUP))
mbed_official 354:e67efb2aab0e 251 /**
mbed_official 354:e67efb2aab0e 252 * @}
mbed_official 354:e67efb2aab0e 253 */
mbed_official 354:e67efb2aab0e 254
mbed_official 354:e67efb2aab0e 255 /** @defgroup RTCEx_Backup_Registers_Definitions Backup Registers Definitions
mbed_official 354:e67efb2aab0e 256 * @{
mbed_official 354:e67efb2aab0e 257 */
mbed_official 354:e67efb2aab0e 258 #if RTC_BKP_NUMBER > 0
mbed_official 354:e67efb2aab0e 259 #define RTC_BKP_DR0 ((uint32_t)0x00000000)
mbed_official 354:e67efb2aab0e 260 #define RTC_BKP_DR1 ((uint32_t)0x00000001)
mbed_official 354:e67efb2aab0e 261 #define RTC_BKP_DR2 ((uint32_t)0x00000002)
mbed_official 354:e67efb2aab0e 262 #define RTC_BKP_DR3 ((uint32_t)0x00000003)
mbed_official 354:e67efb2aab0e 263 #define RTC_BKP_DR4 ((uint32_t)0x00000004)
mbed_official 354:e67efb2aab0e 264 #endif /* RTC_BKP_NUMBER > 0 */
mbed_official 354:e67efb2aab0e 265
mbed_official 354:e67efb2aab0e 266 #if RTC_BKP_NUMBER > 5
mbed_official 354:e67efb2aab0e 267 #define RTC_BKP_DR5 ((uint32_t)0x00000005)
mbed_official 354:e67efb2aab0e 268 #define RTC_BKP_DR6 ((uint32_t)0x00000006)
mbed_official 354:e67efb2aab0e 269 #define RTC_BKP_DR7 ((uint32_t)0x00000007)
mbed_official 354:e67efb2aab0e 270 #define RTC_BKP_DR8 ((uint32_t)0x00000008)
mbed_official 354:e67efb2aab0e 271 #define RTC_BKP_DR9 ((uint32_t)0x00000009)
mbed_official 354:e67efb2aab0e 272 #define RTC_BKP_DR10 ((uint32_t)0x0000000A)
mbed_official 354:e67efb2aab0e 273 #define RTC_BKP_DR11 ((uint32_t)0x0000000B)
mbed_official 354:e67efb2aab0e 274 #define RTC_BKP_DR12 ((uint32_t)0x0000000C)
mbed_official 354:e67efb2aab0e 275 #define RTC_BKP_DR13 ((uint32_t)0x0000000D)
mbed_official 354:e67efb2aab0e 276 #define RTC_BKP_DR14 ((uint32_t)0x0000000E)
mbed_official 354:e67efb2aab0e 277 #define RTC_BKP_DR15 ((uint32_t)0x0000000F)
mbed_official 354:e67efb2aab0e 278 #define RTC_BKP_DR16 ((uint32_t)0x00000010)
mbed_official 354:e67efb2aab0e 279 #define RTC_BKP_DR17 ((uint32_t)0x00000011)
mbed_official 354:e67efb2aab0e 280 #define RTC_BKP_DR18 ((uint32_t)0x00000012)
mbed_official 354:e67efb2aab0e 281 #define RTC_BKP_DR19 ((uint32_t)0x00000013)
mbed_official 354:e67efb2aab0e 282 #endif /* RTC_BKP_NUMBER > 5 */
mbed_official 354:e67efb2aab0e 283
mbed_official 354:e67efb2aab0e 284 #if RTC_BKP_NUMBER > 20
mbed_official 354:e67efb2aab0e 285 #define RTC_BKP_DR20 ((uint32_t)0x00000014)
mbed_official 354:e67efb2aab0e 286 #define RTC_BKP_DR21 ((uint32_t)0x00000015)
mbed_official 354:e67efb2aab0e 287 #define RTC_BKP_DR22 ((uint32_t)0x00000016)
mbed_official 354:e67efb2aab0e 288 #define RTC_BKP_DR23 ((uint32_t)0x00000017)
mbed_official 354:e67efb2aab0e 289 #define RTC_BKP_DR24 ((uint32_t)0x00000018)
mbed_official 354:e67efb2aab0e 290 #define RTC_BKP_DR25 ((uint32_t)0x00000019)
mbed_official 354:e67efb2aab0e 291 #define RTC_BKP_DR26 ((uint32_t)0x0000001A)
mbed_official 354:e67efb2aab0e 292 #define RTC_BKP_DR27 ((uint32_t)0x0000001B)
mbed_official 354:e67efb2aab0e 293 #define RTC_BKP_DR28 ((uint32_t)0x0000001C)
mbed_official 354:e67efb2aab0e 294 #define RTC_BKP_DR29 ((uint32_t)0x0000001D)
mbed_official 354:e67efb2aab0e 295 #define RTC_BKP_DR30 ((uint32_t)0x0000001E)
mbed_official 354:e67efb2aab0e 296 #define RTC_BKP_DR31 ((uint32_t)0x0000001F)
mbed_official 354:e67efb2aab0e 297 #endif /* RTC_BKP_NUMBER > 20 */
mbed_official 354:e67efb2aab0e 298
mbed_official 354:e67efb2aab0e 299 #define IS_RTC_BKP(BKP) ((BKP) < (uint32_t) RTC_BKP_NUMBER)
mbed_official 354:e67efb2aab0e 300 /**
mbed_official 354:e67efb2aab0e 301 * @}
mbed_official 354:e67efb2aab0e 302 */
mbed_official 354:e67efb2aab0e 303
mbed_official 354:e67efb2aab0e 304 /** @defgroup RTCEx_Time_Stamp_Edges_Definitions Time Stamp Edges Definitions
mbed_official 354:e67efb2aab0e 305 * @{
mbed_official 354:e67efb2aab0e 306 */
mbed_official 354:e67efb2aab0e 307 #define RTC_TIMESTAMPEDGE_RISING ((uint32_t)0x00000000)
mbed_official 354:e67efb2aab0e 308 #define RTC_TIMESTAMPEDGE_FALLING ((uint32_t)0x00000008)
mbed_official 354:e67efb2aab0e 309
mbed_official 354:e67efb2aab0e 310 #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \
mbed_official 354:e67efb2aab0e 311 ((EDGE) == RTC_TIMESTAMPEDGE_FALLING))
mbed_official 354:e67efb2aab0e 312 /**
mbed_official 354:e67efb2aab0e 313 * @}
mbed_official 354:e67efb2aab0e 314 */
mbed_official 354:e67efb2aab0e 315
mbed_official 354:e67efb2aab0e 316 /** @defgroup RTCEx_Tamper_Pins_Definitions Tamper Pins Definitions
mbed_official 354:e67efb2aab0e 317 * @{
mbed_official 354:e67efb2aab0e 318 */
mbed_official 354:e67efb2aab0e 319 #define RTC_TAMPER_1 RTC_TAFCR_TAMP1E
mbed_official 354:e67efb2aab0e 320 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 321 #define RTC_TAMPER_2 RTC_TAFCR_TAMP2E
mbed_official 354:e67efb2aab0e 322 #define RTC_TAMPER_3 RTC_TAFCR_TAMP3E
mbed_official 354:e67efb2aab0e 323 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 324
mbed_official 354:e67efb2aab0e 325 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 326 #define IS_TAMPER(TAMPER) (((~(RTC_TAMPER_1|RTC_TAMPER_2|RTC_TAMPER_3) & (TAMPER)) == (uint32_t)RESET) && ((TAMPER) != (uint32_t)RESET))
mbed_official 354:e67efb2aab0e 327 #else
mbed_official 354:e67efb2aab0e 328 #define IS_TAMPER(TAMPER) ((TAMPER) == RTC_TAMPER_1)
mbed_official 354:e67efb2aab0e 329 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 330 /**
mbed_official 354:e67efb2aab0e 331 * @}
mbed_official 354:e67efb2aab0e 332 */
mbed_official 354:e67efb2aab0e 333
mbed_official 354:e67efb2aab0e 334 /** @defgroup RTCEx_Tamper_Trigger_Definitions Tamper Trigger Definitions
mbed_official 354:e67efb2aab0e 335 * @{
mbed_official 354:e67efb2aab0e 336 */
mbed_official 354:e67efb2aab0e 337 #define RTC_TAMPERTRIGGER_RISINGEDGE ((uint32_t)0x00000000)
mbed_official 354:e67efb2aab0e 338 #define RTC_TAMPERTRIGGER_FALLINGEDGE ((uint32_t)0x00000002)
mbed_official 354:e67efb2aab0e 339 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 340 #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE
mbed_official 354:e67efb2aab0e 341 #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE
mbed_official 354:e67efb2aab0e 342 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 343
mbed_official 354:e67efb2aab0e 344 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 345 #define IS_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) || \
mbed_official 354:e67efb2aab0e 346 ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \
mbed_official 354:e67efb2aab0e 347 ((TRIGGER) == RTC_TAMPERTRIGGER_LOWLEVEL) || \
mbed_official 354:e67efb2aab0e 348 ((TRIGGER) == RTC_TAMPERTRIGGER_HIGHLEVEL))
mbed_official 354:e67efb2aab0e 349 #elif defined(STM32L100xB) || defined (STM32L151xB) || defined (STM32L152xB)
mbed_official 354:e67efb2aab0e 350 #define IS_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) || \
mbed_official 354:e67efb2aab0e 351 ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE))
mbed_official 354:e67efb2aab0e 352 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 353 /**
mbed_official 354:e67efb2aab0e 354 * @}
mbed_official 354:e67efb2aab0e 355 */
mbed_official 354:e67efb2aab0e 356
mbed_official 354:e67efb2aab0e 357 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 358 /** @defgroup RTCEx_Tamper_Filter_Definitions Tamper Filter Definitions
mbed_official 354:e67efb2aab0e 359 * @{
mbed_official 354:e67efb2aab0e 360 */
mbed_official 354:e67efb2aab0e 361 #define RTC_TAMPERFILTER_DISABLE ((uint32_t)0x00000000) /*!< Tamper filter is disabled */
mbed_official 354:e67efb2aab0e 362
mbed_official 354:e67efb2aab0e 363 #define RTC_TAMPERFILTER_2SAMPLE ((uint32_t)0x00000800) /*!< Tamper is activated after 2
mbed_official 354:e67efb2aab0e 364 consecutive samples at the active level */
mbed_official 354:e67efb2aab0e 365 #define RTC_TAMPERFILTER_4SAMPLE ((uint32_t)0x00001000) /*!< Tamper is activated after 4
mbed_official 354:e67efb2aab0e 366 consecutive samples at the active level */
mbed_official 354:e67efb2aab0e 367 #define RTC_TAMPERFILTER_8SAMPLE ((uint32_t)0x00001800) /*!< Tamper is activated after 8
mbed_official 354:e67efb2aab0e 368 consecutive samples at the active level. */
mbed_official 354:e67efb2aab0e 369
mbed_official 354:e67efb2aab0e 370 #define IS_TAMPER_FILTER(FILTER) (((FILTER) == RTC_TAMPERFILTER_DISABLE) || \
mbed_official 354:e67efb2aab0e 371 ((FILTER) == RTC_TAMPERFILTER_2SAMPLE) || \
mbed_official 354:e67efb2aab0e 372 ((FILTER) == RTC_TAMPERFILTER_4SAMPLE) || \
mbed_official 354:e67efb2aab0e 373 ((FILTER) == RTC_TAMPERFILTER_8SAMPLE))
mbed_official 354:e67efb2aab0e 374 /**
mbed_official 354:e67efb2aab0e 375 * @}
mbed_official 354:e67efb2aab0e 376 */
mbed_official 354:e67efb2aab0e 377
mbed_official 354:e67efb2aab0e 378 /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions Tamper Sampling Frequencies
mbed_official 354:e67efb2aab0e 379 * @{
mbed_official 354:e67efb2aab0e 380 */
mbed_official 354:e67efb2aab0e 381 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 ((uint32_t)0x00000000) /*!< Each of the tamper inputs are sampled
mbed_official 354:e67efb2aab0e 382 with a frequency = RTCCLK / 32768 */
mbed_official 354:e67efb2aab0e 383 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 ((uint32_t)0x00000100) /*!< Each of the tamper inputs are sampled
mbed_official 354:e67efb2aab0e 384 with a frequency = RTCCLK / 16384 */
mbed_official 354:e67efb2aab0e 385 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 ((uint32_t)0x00000200) /*!< Each of the tamper inputs are sampled
mbed_official 354:e67efb2aab0e 386 with a frequency = RTCCLK / 8192 */
mbed_official 354:e67efb2aab0e 387 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 ((uint32_t)0x00000300) /*!< Each of the tamper inputs are sampled
mbed_official 354:e67efb2aab0e 388 with a frequency = RTCCLK / 4096 */
mbed_official 354:e67efb2aab0e 389 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 ((uint32_t)0x00000400) /*!< Each of the tamper inputs are sampled
mbed_official 354:e67efb2aab0e 390 with a frequency = RTCCLK / 2048 */
mbed_official 354:e67efb2aab0e 391 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 ((uint32_t)0x00000500) /*!< Each of the tamper inputs are sampled
mbed_official 354:e67efb2aab0e 392 with a frequency = RTCCLK / 1024 */
mbed_official 354:e67efb2aab0e 393 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 ((uint32_t)0x00000600) /*!< Each of the tamper inputs are sampled
mbed_official 354:e67efb2aab0e 394 with a frequency = RTCCLK / 512 */
mbed_official 354:e67efb2aab0e 395 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 ((uint32_t)0x00000700) /*!< Each of the tamper inputs are sampled
mbed_official 354:e67efb2aab0e 396 with a frequency = RTCCLK / 256 */
mbed_official 354:e67efb2aab0e 397
mbed_official 354:e67efb2aab0e 398 #define IS_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \
mbed_official 354:e67efb2aab0e 399 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \
mbed_official 354:e67efb2aab0e 400 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \
mbed_official 354:e67efb2aab0e 401 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \
mbed_official 354:e67efb2aab0e 402 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \
mbed_official 354:e67efb2aab0e 403 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \
mbed_official 354:e67efb2aab0e 404 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \
mbed_official 354:e67efb2aab0e 405 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256))
mbed_official 354:e67efb2aab0e 406 /**
mbed_official 354:e67efb2aab0e 407 * @}
mbed_official 354:e67efb2aab0e 408 */
mbed_official 354:e67efb2aab0e 409
mbed_official 354:e67efb2aab0e 410 /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions Tamper Pin Precharge Duration
mbed_official 354:e67efb2aab0e 411 * @{
mbed_official 354:e67efb2aab0e 412 */
mbed_official 354:e67efb2aab0e 413 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before
mbed_official 354:e67efb2aab0e 414 sampling during 1 RTCCLK cycle */
mbed_official 354:e67efb2aab0e 415 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK ((uint32_t)0x00002000) /*!< Tamper pins are pre-charged before
mbed_official 354:e67efb2aab0e 416 sampling during 2 RTCCLK cycles */
mbed_official 354:e67efb2aab0e 417 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK ((uint32_t)0x00004000) /*!< Tamper pins are pre-charged before
mbed_official 354:e67efb2aab0e 418 sampling during 4 RTCCLK cycles */
mbed_official 354:e67efb2aab0e 419 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK ((uint32_t)0x00006000) /*!< Tamper pins are pre-charged before
mbed_official 354:e67efb2aab0e 420 sampling during 8 RTCCLK cycles */
mbed_official 354:e67efb2aab0e 421
mbed_official 354:e67efb2aab0e 422 #define IS_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \
mbed_official 354:e67efb2aab0e 423 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \
mbed_official 354:e67efb2aab0e 424 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \
mbed_official 354:e67efb2aab0e 425 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK))
mbed_official 354:e67efb2aab0e 426 /**
mbed_official 354:e67efb2aab0e 427 * @}
mbed_official 354:e67efb2aab0e 428 */
mbed_official 354:e67efb2aab0e 429
mbed_official 354:e67efb2aab0e 430 /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions TimeStampOnTamperDetection Definitions
mbed_official 354:e67efb2aab0e 431 * @{
mbed_official 354:e67efb2aab0e 432 */
mbed_official 354:e67efb2aab0e 433 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE ((uint32_t)RTC_TAFCR_TAMPTS) /*!< TimeStamp on Tamper Detection event saved */
mbed_official 354:e67efb2aab0e 434 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE ((uint32_t)0x00000000) /*!< TimeStamp on Tamper Detection event is not saved */
mbed_official 354:e67efb2aab0e 435
mbed_official 354:e67efb2aab0e 436 #define IS_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \
mbed_official 354:e67efb2aab0e 437 ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE))
mbed_official 354:e67efb2aab0e 438 /**
mbed_official 354:e67efb2aab0e 439 * @}
mbed_official 354:e67efb2aab0e 440 */
mbed_official 354:e67efb2aab0e 441
mbed_official 354:e67efb2aab0e 442 /** @defgroup RTCEx_Tamper_Pull_Up_Definitions Tamper Pull-Up Definitions
mbed_official 354:e67efb2aab0e 443 * @{
mbed_official 354:e67efb2aab0e 444 */
mbed_official 354:e67efb2aab0e 445 #define RTC_TAMPER_PULLUP_ENABLE ((uint32_t)0x00000000) /*!< TimeStamp on Tamper Detection event saved */
mbed_official 354:e67efb2aab0e 446 #define RTC_TAMPER_PULLUP_DISABLE ((uint32_t)RTC_TAFCR_TAMPPUDIS) /*!< TimeStamp on Tamper Detection event is not saved */
mbed_official 354:e67efb2aab0e 447
mbed_official 354:e67efb2aab0e 448 #define IS_TAMPER_PULLUP_STATE(STATE) (((STATE) == RTC_TAMPER_PULLUP_ENABLE) || \
mbed_official 354:e67efb2aab0e 449 ((STATE) == RTC_TAMPER_PULLUP_DISABLE))
mbed_official 354:e67efb2aab0e 450 /**
mbed_official 354:e67efb2aab0e 451 * @}
mbed_official 354:e67efb2aab0e 452 */
mbed_official 354:e67efb2aab0e 453 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 454
mbed_official 354:e67efb2aab0e 455 /** @defgroup RTCEx_Wakeup_Timer_Definitions Wakeup Timer Definitions
mbed_official 354:e67efb2aab0e 456 * @{
mbed_official 354:e67efb2aab0e 457 */
mbed_official 354:e67efb2aab0e 458 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 ((uint32_t)0x00000000)
mbed_official 354:e67efb2aab0e 459 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 ((uint32_t)0x00000001)
mbed_official 354:e67efb2aab0e 460 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 ((uint32_t)0x00000002)
mbed_official 354:e67efb2aab0e 461 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 ((uint32_t)0x00000003)
mbed_official 354:e67efb2aab0e 462 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS ((uint32_t)0x00000004)
mbed_official 354:e67efb2aab0e 463 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS ((uint32_t)0x00000006)
mbed_official 354:e67efb2aab0e 464
mbed_official 354:e67efb2aab0e 465 #define IS_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \
mbed_official 354:e67efb2aab0e 466 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \
mbed_official 354:e67efb2aab0e 467 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \
mbed_official 354:e67efb2aab0e 468 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \
mbed_official 354:e67efb2aab0e 469 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \
mbed_official 354:e67efb2aab0e 470 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS))
mbed_official 354:e67efb2aab0e 471
mbed_official 354:e67efb2aab0e 472 #define IS_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFF)
mbed_official 354:e67efb2aab0e 473 /**
mbed_official 354:e67efb2aab0e 474 * @}
mbed_official 354:e67efb2aab0e 475 */
mbed_official 354:e67efb2aab0e 476
mbed_official 354:e67efb2aab0e 477 /** @defgroup RTCEx_Digital_Calibration_Definitions Digital Calibration Definitions
mbed_official 354:e67efb2aab0e 478 * @{
mbed_official 354:e67efb2aab0e 479 */
mbed_official 354:e67efb2aab0e 480 #define RTC_CALIBSIGN_POSITIVE ((uint32_t)0x00000000)
mbed_official 354:e67efb2aab0e 481 #define RTC_CALIBSIGN_NEGATIVE ((uint32_t)0x00000080)
mbed_official 354:e67efb2aab0e 482
mbed_official 354:e67efb2aab0e 483 #define IS_RTC_CALIB_SIGN(SIGN) (((SIGN) == RTC_CALIBSIGN_POSITIVE) || \
mbed_official 354:e67efb2aab0e 484 ((SIGN) == RTC_CALIBSIGN_NEGATIVE))
mbed_official 354:e67efb2aab0e 485
mbed_official 354:e67efb2aab0e 486 #define IS_RTC_CALIB_VALUE(VALUE) ((VALUE) < 0x20)
mbed_official 354:e67efb2aab0e 487 /**
mbed_official 354:e67efb2aab0e 488 * @}
mbed_official 354:e67efb2aab0e 489 */
mbed_official 354:e67efb2aab0e 490
mbed_official 354:e67efb2aab0e 491 /** @defgroup RTCEx_Smooth_Calib_Period_Definitions Smooth Calib Period Definitions
mbed_official 354:e67efb2aab0e 492 * @{
mbed_official 354:e67efb2aab0e 493 */
mbed_official 354:e67efb2aab0e 494 #define RTC_SMOOTHCALIB_PERIOD_32SEC ((uint32_t)0x00000000) /*!< If RTCCLK = 32768 Hz, Smooth calibation
mbed_official 354:e67efb2aab0e 495 period is 32s, else 2exp20 RTCCLK seconds */
mbed_official 354:e67efb2aab0e 496 #define RTC_SMOOTHCALIB_PERIOD_16SEC ((uint32_t)0x00002000) /*!< If RTCCLK = 32768 Hz, Smooth calibation
mbed_official 354:e67efb2aab0e 497 period is 16s, else 2exp19 RTCCLK seconds */
mbed_official 354:e67efb2aab0e 498 #define RTC_SMOOTHCALIB_PERIOD_8SEC ((uint32_t)0x00004000) /*!< If RTCCLK = 32768 Hz, Smooth calibation
mbed_official 354:e67efb2aab0e 499 period is 8s, else 2exp18 RTCCLK seconds */
mbed_official 354:e67efb2aab0e 500
mbed_official 354:e67efb2aab0e 501 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \
mbed_official 354:e67efb2aab0e 502 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \
mbed_official 354:e67efb2aab0e 503 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC))
mbed_official 354:e67efb2aab0e 504 /**
mbed_official 354:e67efb2aab0e 505 * @}
mbed_official 354:e67efb2aab0e 506 */
mbed_official 354:e67efb2aab0e 507
mbed_official 354:e67efb2aab0e 508 /** @defgroup RTCEx_Smooth_Calib_Plus_Pulses_Definitions Smooth Calib Plus Pulses Definitions
mbed_official 354:e67efb2aab0e 509 * @{
mbed_official 354:e67efb2aab0e 510 */
mbed_official 354:e67efb2aab0e 511 #define RTC_SMOOTHCALIB_PLUSPULSES_SET ((uint32_t)0x00008000) /*!< The number of RTCCLK pulses added
mbed_official 354:e67efb2aab0e 512 during a X -second window = Y - CALM[8:0]
mbed_official 354:e67efb2aab0e 513 with Y = 512, 256, 128 when X = 32, 16, 8 */
mbed_official 354:e67efb2aab0e 514 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET ((uint32_t)0x00000000) /*!< The number of RTCCLK pulses subbstited
mbed_official 354:e67efb2aab0e 515 during a 32-second window = CALM[8:0] */
mbed_official 354:e67efb2aab0e 516
mbed_official 354:e67efb2aab0e 517 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \
mbed_official 354:e67efb2aab0e 518 ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET))
mbed_official 354:e67efb2aab0e 519 /**
mbed_official 354:e67efb2aab0e 520 * @}
mbed_official 354:e67efb2aab0e 521 */
mbed_official 354:e67efb2aab0e 522
mbed_official 354:e67efb2aab0e 523 /** @defgroup RTCEx_Smooth_Calib_Minus_Pulses_Definitions Smooth Calib Minus Pulses Definitions
mbed_official 354:e67efb2aab0e 524 * @{
mbed_official 354:e67efb2aab0e 525 */
mbed_official 354:e67efb2aab0e 526 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x000001FF)
mbed_official 354:e67efb2aab0e 527 /**
mbed_official 354:e67efb2aab0e 528 * @}
mbed_official 354:e67efb2aab0e 529 */
mbed_official 354:e67efb2aab0e 530
mbed_official 354:e67efb2aab0e 531 /** @defgroup RTCEx_Add_1_Second_Parameter_Definitions Add 1 Second Parameter Definitions
mbed_official 354:e67efb2aab0e 532 * @{
mbed_official 354:e67efb2aab0e 533 */
mbed_official 354:e67efb2aab0e 534 #define RTC_SHIFTADD1S_RESET ((uint32_t)0x00000000)
mbed_official 354:e67efb2aab0e 535 #define RTC_SHIFTADD1S_SET ((uint32_t)0x80000000)
mbed_official 354:e67efb2aab0e 536
mbed_official 354:e67efb2aab0e 537 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \
mbed_official 354:e67efb2aab0e 538 ((SEL) == RTC_SHIFTADD1S_SET))
mbed_official 354:e67efb2aab0e 539 /**
mbed_official 354:e67efb2aab0e 540 * @}
mbed_official 354:e67efb2aab0e 541 */
mbed_official 354:e67efb2aab0e 542
mbed_official 354:e67efb2aab0e 543 /** @defgroup RTCEx_Substract_Fraction_Of_Second_Value Substract Fraction Of Second Value
mbed_official 354:e67efb2aab0e 544 * @{
mbed_official 354:e67efb2aab0e 545 */
mbed_official 354:e67efb2aab0e 546 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFF)
mbed_official 354:e67efb2aab0e 547 /**
mbed_official 354:e67efb2aab0e 548 * @}
mbed_official 354:e67efb2aab0e 549 */
mbed_official 354:e67efb2aab0e 550
mbed_official 354:e67efb2aab0e 551 /** @defgroup RTCEx_Calib_Output_Selection_Definitions Calib Output Selection Definitions
mbed_official 354:e67efb2aab0e 552 * @{
mbed_official 354:e67efb2aab0e 553 */
mbed_official 354:e67efb2aab0e 554 #define RTC_CALIBOUTPUT_512HZ ((uint32_t)0x00000000)
mbed_official 354:e67efb2aab0e 555 #define RTC_CALIBOUTPUT_1HZ ((uint32_t)0x00080000)
mbed_official 354:e67efb2aab0e 556
mbed_official 354:e67efb2aab0e 557 #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \
mbed_official 354:e67efb2aab0e 558 ((OUTPUT) == RTC_CALIBOUTPUT_1HZ))
mbed_official 354:e67efb2aab0e 559 /**
mbed_official 354:e67efb2aab0e 560 * @}
mbed_official 354:e67efb2aab0e 561 */
mbed_official 354:e67efb2aab0e 562
mbed_official 354:e67efb2aab0e 563 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 564 /** @defgroup RTC_Alarm_Sub_Seconds_Value Alarm Sub Seconds Value
mbed_official 354:e67efb2aab0e 565 * @{
mbed_official 354:e67efb2aab0e 566 */
mbed_official 354:e67efb2aab0e 567 #define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= (uint32_t)0x00007FFF)
mbed_official 354:e67efb2aab0e 568 /**
mbed_official 354:e67efb2aab0e 569 * @}
mbed_official 354:e67efb2aab0e 570 */
mbed_official 354:e67efb2aab0e 571
mbed_official 354:e67efb2aab0e 572 /** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions Alarm Sub Seconds Masks Definitions
mbed_official 354:e67efb2aab0e 573 * @{
mbed_official 354:e67efb2aab0e 574 */
mbed_official 354:e67efb2aab0e 575 #define RTC_ALARMSUBSECONDMASK_ALL ((uint32_t)0x00000000) /*!< All Alarm SS fields are masked.
mbed_official 354:e67efb2aab0e 576 There is no comparison on sub seconds
mbed_official 354:e67efb2aab0e 577 for Alarm */
mbed_official 354:e67efb2aab0e 578 #define RTC_ALARMSUBSECONDMASK_SS14_1 ((uint32_t)0x01000000) /*!< SS[14:1] are don't care in Alarm
mbed_official 354:e67efb2aab0e 579 comparison. Only SS[0] is compared. */
mbed_official 354:e67efb2aab0e 580 #define RTC_ALARMSUBSECONDMASK_SS14_2 ((uint32_t)0x02000000) /*!< SS[14:2] are don't care in Alarm
mbed_official 354:e67efb2aab0e 581 comparison. Only SS[1:0] are compared */
mbed_official 354:e67efb2aab0e 582 #define RTC_ALARMSUBSECONDMASK_SS14_3 ((uint32_t)0x03000000) /*!< SS[14:3] are don't care in Alarm
mbed_official 354:e67efb2aab0e 583 comparison. Only SS[2:0] are compared */
mbed_official 354:e67efb2aab0e 584 #define RTC_ALARMSUBSECONDMASK_SS14_4 ((uint32_t)0x04000000) /*!< SS[14:4] are don't care in Alarm
mbed_official 354:e67efb2aab0e 585 comparison. Only SS[3:0] are compared */
mbed_official 354:e67efb2aab0e 586 #define RTC_ALARMSUBSECONDMASK_SS14_5 ((uint32_t)0x05000000) /*!< SS[14:5] are don't care in Alarm
mbed_official 354:e67efb2aab0e 587 comparison. Only SS[4:0] are compared */
mbed_official 354:e67efb2aab0e 588 #define RTC_ALARMSUBSECONDMASK_SS14_6 ((uint32_t)0x06000000) /*!< SS[14:6] are don't care in Alarm
mbed_official 354:e67efb2aab0e 589 comparison. Only SS[5:0] are compared */
mbed_official 354:e67efb2aab0e 590 #define RTC_ALARMSUBSECONDMASK_SS14_7 ((uint32_t)0x07000000) /*!< SS[14:7] are don't care in Alarm
mbed_official 354:e67efb2aab0e 591 comparison. Only SS[6:0] are compared */
mbed_official 354:e67efb2aab0e 592 #define RTC_ALARMSUBSECONDMASK_SS14_8 ((uint32_t)0x08000000) /*!< SS[14:8] are don't care in Alarm
mbed_official 354:e67efb2aab0e 593 comparison. Only SS[7:0] are compared */
mbed_official 354:e67efb2aab0e 594 #define RTC_ALARMSUBSECONDMASK_SS14_9 ((uint32_t)0x09000000) /*!< SS[14:9] are don't care in Alarm
mbed_official 354:e67efb2aab0e 595 comparison. Only SS[8:0] are compared */
mbed_official 354:e67efb2aab0e 596 #define RTC_ALARMSUBSECONDMASK_SS14_10 ((uint32_t)0x0A000000) /*!< SS[14:10] are don't care in Alarm
mbed_official 354:e67efb2aab0e 597 comparison. Only SS[9:0] are compared */
mbed_official 354:e67efb2aab0e 598 #define RTC_ALARMSUBSECONDMASK_SS14_11 ((uint32_t)0x0B000000) /*!< SS[14:11] are don't care in Alarm
mbed_official 354:e67efb2aab0e 599 comparison. Only SS[10:0] are compared */
mbed_official 354:e67efb2aab0e 600 #define RTC_ALARMSUBSECONDMASK_SS14_12 ((uint32_t)0x0C000000) /*!< SS[14:12] are don't care in Alarm
mbed_official 354:e67efb2aab0e 601 comparison.Only SS[11:0] are compared */
mbed_official 354:e67efb2aab0e 602 #define RTC_ALARMSUBSECONDMASK_SS14_13 ((uint32_t)0x0D000000) /*!< SS[14:13] are don't care in Alarm
mbed_official 354:e67efb2aab0e 603 comparison. Only SS[12:0] are compared */
mbed_official 354:e67efb2aab0e 604 #define RTC_ALARMSUBSECONDMASK_SS14 ((uint32_t)0x0E000000) /*!< SS[14] is don't care in Alarm
mbed_official 354:e67efb2aab0e 605 comparison.Only SS[13:0] are compared */
mbed_official 354:e67efb2aab0e 606 #define RTC_ALARMSUBSECONDMASK_NONE ((uint32_t)0x0F000000) /*!< SS[14:0] are compared and must match
mbed_official 354:e67efb2aab0e 607 to activate alarm. */
mbed_official 354:e67efb2aab0e 608
mbed_official 354:e67efb2aab0e 609 #define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_ALARMSUBSECONDMASK_ALL) || \
mbed_official 354:e67efb2aab0e 610 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_1) || \
mbed_official 354:e67efb2aab0e 611 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_2) || \
mbed_official 354:e67efb2aab0e 612 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_3) || \
mbed_official 354:e67efb2aab0e 613 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_4) || \
mbed_official 354:e67efb2aab0e 614 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_5) || \
mbed_official 354:e67efb2aab0e 615 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_6) || \
mbed_official 354:e67efb2aab0e 616 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_7) || \
mbed_official 354:e67efb2aab0e 617 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_8) || \
mbed_official 354:e67efb2aab0e 618 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_9) || \
mbed_official 354:e67efb2aab0e 619 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_10) || \
mbed_official 354:e67efb2aab0e 620 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_11) || \
mbed_official 354:e67efb2aab0e 621 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_12) || \
mbed_official 354:e67efb2aab0e 622 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_13) || \
mbed_official 354:e67efb2aab0e 623 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14) || \
mbed_official 354:e67efb2aab0e 624 ((MASK) == RTC_ALARMSUBSECONDMASK_NONE))
mbed_official 354:e67efb2aab0e 625 /**
mbed_official 354:e67efb2aab0e 626 * @}
mbed_official 354:e67efb2aab0e 627 */
mbed_official 354:e67efb2aab0e 628 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 629
mbed_official 354:e67efb2aab0e 630 /**
mbed_official 354:e67efb2aab0e 631 * @}
mbed_official 354:e67efb2aab0e 632 */
mbed_official 354:e67efb2aab0e 633
mbed_official 354:e67efb2aab0e 634 /* Exported macro ------------------------------------------------------------*/
mbed_official 354:e67efb2aab0e 635 /** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros
mbed_official 354:e67efb2aab0e 636 * @{
mbed_official 354:e67efb2aab0e 637 */
mbed_official 354:e67efb2aab0e 638
mbed_official 354:e67efb2aab0e 639 /**
mbed_official 354:e67efb2aab0e 640 * @brief Enable the RTC WakeUp Timer peripheral.
mbed_official 354:e67efb2aab0e 641 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 642 * @retval None
mbed_official 354:e67efb2aab0e 643 */
mbed_official 354:e67efb2aab0e 644 #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE))
mbed_official 354:e67efb2aab0e 645
mbed_official 354:e67efb2aab0e 646 /**
mbed_official 354:e67efb2aab0e 647 * @brief Enable the RTC TimeStamp peripheral.
mbed_official 354:e67efb2aab0e 648 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 649 * @retval None
mbed_official 354:e67efb2aab0e 650 */
mbed_official 354:e67efb2aab0e 651 #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE))
mbed_official 354:e67efb2aab0e 652
mbed_official 354:e67efb2aab0e 653 /**
mbed_official 354:e67efb2aab0e 654 * @brief Disable the RTC WakeUp Timer peripheral.
mbed_official 354:e67efb2aab0e 655 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 656 * @retval None
mbed_official 354:e67efb2aab0e 657 */
mbed_official 354:e67efb2aab0e 658 #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE))
mbed_official 354:e67efb2aab0e 659
mbed_official 354:e67efb2aab0e 660 /**
mbed_official 354:e67efb2aab0e 661 * @brief Disable the RTC TimeStamp peripheral.
mbed_official 354:e67efb2aab0e 662 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 663 * @retval None
mbed_official 354:e67efb2aab0e 664 */
mbed_official 354:e67efb2aab0e 665 #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE))
mbed_official 354:e67efb2aab0e 666
mbed_official 354:e67efb2aab0e 667 /**
mbed_official 354:e67efb2aab0e 668 * @brief Enable the Coarse calibration process.
mbed_official 354:e67efb2aab0e 669 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 670 * @retval None
mbed_official 354:e67efb2aab0e 671 */
mbed_official 354:e67efb2aab0e 672 #define __HAL_RTC_COARSE_CALIB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_DCE))
mbed_official 354:e67efb2aab0e 673
mbed_official 354:e67efb2aab0e 674 /**
mbed_official 354:e67efb2aab0e 675 * @brief Disable the Coarse calibration process.
mbed_official 354:e67efb2aab0e 676 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 677 * @retval None
mbed_official 354:e67efb2aab0e 678 */
mbed_official 354:e67efb2aab0e 679 #define __HAL_RTC_COARSE_CALIB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_DCE))
mbed_official 354:e67efb2aab0e 680
mbed_official 354:e67efb2aab0e 681 /**
mbed_official 354:e67efb2aab0e 682 * @brief Enable the RTC calibration output.
mbed_official 354:e67efb2aab0e 683 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 684 * @retval None
mbed_official 354:e67efb2aab0e 685 */
mbed_official 354:e67efb2aab0e 686 #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE))
mbed_official 354:e67efb2aab0e 687
mbed_official 354:e67efb2aab0e 688 /**
mbed_official 354:e67efb2aab0e 689 * @brief Disable the calibration output.
mbed_official 354:e67efb2aab0e 690 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 691 * @retval None
mbed_official 354:e67efb2aab0e 692 */
mbed_official 354:e67efb2aab0e 693 #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE))
mbed_official 354:e67efb2aab0e 694
mbed_official 354:e67efb2aab0e 695 /**
mbed_official 354:e67efb2aab0e 696 * @brief Enable the clock reference detection.
mbed_official 354:e67efb2aab0e 697 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 698 * @retval None
mbed_official 354:e67efb2aab0e 699 */
mbed_official 354:e67efb2aab0e 700 #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON))
mbed_official 354:e67efb2aab0e 701
mbed_official 354:e67efb2aab0e 702 /**
mbed_official 354:e67efb2aab0e 703 * @brief Disable the clock reference detection.
mbed_official 354:e67efb2aab0e 704 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 705 * @retval None
mbed_official 354:e67efb2aab0e 706 */
mbed_official 354:e67efb2aab0e 707 #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON))
mbed_official 354:e67efb2aab0e 708
mbed_official 354:e67efb2aab0e 709 /**
mbed_official 354:e67efb2aab0e 710 * @brief Enable the RTC TimeStamp interrupt.
mbed_official 354:e67efb2aab0e 711 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 712 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
mbed_official 354:e67efb2aab0e 713 * This parameter can be:
mbed_official 354:e67efb2aab0e 714 * @arg RTC_IT_TS: TimeStamp interrupt
mbed_official 354:e67efb2aab0e 715 * @retval None
mbed_official 354:e67efb2aab0e 716 */
mbed_official 354:e67efb2aab0e 717 #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
mbed_official 354:e67efb2aab0e 718
mbed_official 354:e67efb2aab0e 719 /**
mbed_official 354:e67efb2aab0e 720 * @brief Enable the RTC WakeUpTimer interrupt.
mbed_official 354:e67efb2aab0e 721 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 722 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
mbed_official 354:e67efb2aab0e 723 * This parameter can be:
mbed_official 354:e67efb2aab0e 724 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
mbed_official 354:e67efb2aab0e 725 * @retval None
mbed_official 354:e67efb2aab0e 726 */
mbed_official 354:e67efb2aab0e 727 #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
mbed_official 354:e67efb2aab0e 728
mbed_official 354:e67efb2aab0e 729 /**
mbed_official 354:e67efb2aab0e 730 * @brief Disable the RTC TimeStamp interrupt.
mbed_official 354:e67efb2aab0e 731 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 732 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
mbed_official 354:e67efb2aab0e 733 * This parameter can be:
mbed_official 354:e67efb2aab0e 734 * @arg RTC_IT_TS: TimeStamp interrupt
mbed_official 354:e67efb2aab0e 735 * @retval None
mbed_official 354:e67efb2aab0e 736 */
mbed_official 354:e67efb2aab0e 737 #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
mbed_official 354:e67efb2aab0e 738
mbed_official 354:e67efb2aab0e 739 /**
mbed_official 354:e67efb2aab0e 740 * @brief Disable the RTC WakeUpTimer interrupt.
mbed_official 354:e67efb2aab0e 741 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 742 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
mbed_official 354:e67efb2aab0e 743 * This parameter can be:
mbed_official 354:e67efb2aab0e 744 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
mbed_official 354:e67efb2aab0e 745 * @retval None
mbed_official 354:e67efb2aab0e 746 */
mbed_official 354:e67efb2aab0e 747 #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
mbed_official 354:e67efb2aab0e 748
mbed_official 354:e67efb2aab0e 749 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 750 /**
mbed_official 354:e67efb2aab0e 751 * @brief Check whether the specified RTC Tamper interrupt has occurred or not.
mbed_official 354:e67efb2aab0e 752 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 753 * @param __FLAG__: specifies the RTC Tamper interrupt sources to be enabled or disabled.
mbed_official 354:e67efb2aab0e 754 * This parameter can be:
mbed_official 354:e67efb2aab0e 755 * @arg RTC_IT_TAMP1
mbed_official 354:e67efb2aab0e 756 * @arg RTC_IT_TAMP2
mbed_official 354:e67efb2aab0e 757 * @arg RTC_IT_TAMP3
mbed_official 354:e67efb2aab0e 758 * @retval None
mbed_official 354:e67efb2aab0e 759 */
mbed_official 354:e67efb2aab0e 760 #else
mbed_official 354:e67efb2aab0e 761 /**
mbed_official 354:e67efb2aab0e 762 * @brief Check whether the specified RTC Tamper interrupt has occurred or not.
mbed_official 354:e67efb2aab0e 763 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 764 * @param __FLAG__: specifies the RTC Tamper interrupt sources to be enabled or disabled.
mbed_official 354:e67efb2aab0e 765 * This parameter can be:
mbed_official 354:e67efb2aab0e 766 * @arg RTC_IT_TAMP1
mbed_official 354:e67efb2aab0e 767 * @retval None
mbed_official 354:e67efb2aab0e 768 */
mbed_official 354:e67efb2aab0e 769 #endif
mbed_official 354:e67efb2aab0e 770 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
mbed_official 354:e67efb2aab0e 771
mbed_official 354:e67efb2aab0e 772 /**
mbed_official 354:e67efb2aab0e 773 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
mbed_official 354:e67efb2aab0e 774 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 775 * @param __FLAG__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
mbed_official 354:e67efb2aab0e 776 * This parameter can be:
mbed_official 354:e67efb2aab0e 777 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
mbed_official 354:e67efb2aab0e 778 * @retval None
mbed_official 354:e67efb2aab0e 779 */
mbed_official 354:e67efb2aab0e 780 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
mbed_official 354:e67efb2aab0e 781
mbed_official 354:e67efb2aab0e 782 /**
mbed_official 354:e67efb2aab0e 783 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not.
mbed_official 354:e67efb2aab0e 784 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 785 * @param __FLAG__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
mbed_official 354:e67efb2aab0e 786 * This parameter can be:
mbed_official 354:e67efb2aab0e 787 * @arg RTC_IT_TS: TimeStamp interrupt
mbed_official 354:e67efb2aab0e 788 * @retval None
mbed_official 354:e67efb2aab0e 789 */
mbed_official 354:e67efb2aab0e 790 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
mbed_official 354:e67efb2aab0e 791
mbed_official 354:e67efb2aab0e 792 /**
mbed_official 354:e67efb2aab0e 793 * @brief Get the selected RTC TimeStamp's flag status.
mbed_official 354:e67efb2aab0e 794 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 795 * @param __FLAG__: specifies the RTC TimeStamp Flag sources to be enabled or disabled.
mbed_official 354:e67efb2aab0e 796 * This parameter can be:
mbed_official 354:e67efb2aab0e 797 * @arg RTC_FLAG_TSF
mbed_official 354:e67efb2aab0e 798 * @arg RTC_FLAG_TSOVF
mbed_official 354:e67efb2aab0e 799 * @retval None
mbed_official 354:e67efb2aab0e 800 */
mbed_official 354:e67efb2aab0e 801 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
mbed_official 354:e67efb2aab0e 802
mbed_official 354:e67efb2aab0e 803 /**
mbed_official 354:e67efb2aab0e 804 * @brief Get the selected RTC WakeUpTimer's flag status.
mbed_official 354:e67efb2aab0e 805 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 806 * @param __FLAG__: specifies the RTC WakeUpTimer Flag sources to be enabled or disabled.
mbed_official 354:e67efb2aab0e 807 * This parameter can be:
mbed_official 354:e67efb2aab0e 808 * @arg RTC_FLAG_WUTF
mbed_official 354:e67efb2aab0e 809 * @arg RTC_FLAG_WUTWF
mbed_official 354:e67efb2aab0e 810 * @retval None
mbed_official 354:e67efb2aab0e 811 */
mbed_official 354:e67efb2aab0e 812 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
mbed_official 354:e67efb2aab0e 813
mbed_official 354:e67efb2aab0e 814 /**
mbed_official 354:e67efb2aab0e 815 * @brief Get the selected RTC Tamper's flag status.
mbed_official 354:e67efb2aab0e 816 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 817 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
mbed_official 354:e67efb2aab0e 818 * This parameter can be:
mbed_official 354:e67efb2aab0e 819 * @arg RTC_FLAG_TAMP1F
mbed_official 354:e67efb2aab0e 820 * @retval None
mbed_official 354:e67efb2aab0e 821 */
mbed_official 354:e67efb2aab0e 822 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
mbed_official 354:e67efb2aab0e 823
mbed_official 354:e67efb2aab0e 824 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 825 /**
mbed_official 354:e67efb2aab0e 826 * @brief Get the selected RTC shift operation's flag status.
mbed_official 354:e67efb2aab0e 827 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 828 * @param __FLAG__: specifies the RTC shift operation Flag is pending or not.
mbed_official 354:e67efb2aab0e 829 * This parameter can be:
mbed_official 354:e67efb2aab0e 830 * @arg RTC_FLAG_SHPF
mbed_official 354:e67efb2aab0e 831 * @retval None
mbed_official 354:e67efb2aab0e 832 */
mbed_official 354:e67efb2aab0e 833 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
mbed_official 354:e67efb2aab0e 834 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 835
mbed_official 354:e67efb2aab0e 836 /**
mbed_official 354:e67efb2aab0e 837 * @brief Clear the RTC Time Stamp's pending flags.
mbed_official 354:e67efb2aab0e 838 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 839 * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
mbed_official 354:e67efb2aab0e 840 * This parameter can be:
mbed_official 354:e67efb2aab0e 841 * @arg RTC_FLAG_TSF
mbed_official 354:e67efb2aab0e 842 * @retval None
mbed_official 354:e67efb2aab0e 843 */
mbed_official 354:e67efb2aab0e 844 #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
mbed_official 354:e67efb2aab0e 845
mbed_official 354:e67efb2aab0e 846 /**
mbed_official 354:e67efb2aab0e 847 * @brief Clear the RTC Tamper's pending flags.
mbed_official 354:e67efb2aab0e 848 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 849 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
mbed_official 354:e67efb2aab0e 850 * This parameter can be:
mbed_official 354:e67efb2aab0e 851 * @arg RTC_FLAG_TAMP1F
mbed_official 354:e67efb2aab0e 852 * @retval None
mbed_official 354:e67efb2aab0e 853 */
mbed_official 354:e67efb2aab0e 854 #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
mbed_official 354:e67efb2aab0e 855
mbed_official 354:e67efb2aab0e 856 /**
mbed_official 354:e67efb2aab0e 857 * @brief Clear the RTC Wake Up timer's pending flags.
mbed_official 354:e67efb2aab0e 858 * @param __HANDLE__: specifies the RTC handle.
mbed_official 354:e67efb2aab0e 859 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
mbed_official 354:e67efb2aab0e 860 * This parameter can be:
mbed_official 354:e67efb2aab0e 861 * @arg RTC_FLAG_WUTF
mbed_official 354:e67efb2aab0e 862 * @retval None
mbed_official 354:e67efb2aab0e 863 */
mbed_official 354:e67efb2aab0e 864 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
mbed_official 354:e67efb2aab0e 865
mbed_official 354:e67efb2aab0e 866 /**
mbed_official 354:e67efb2aab0e 867 * @}
mbed_official 354:e67efb2aab0e 868 */
mbed_official 354:e67efb2aab0e 869
mbed_official 354:e67efb2aab0e 870 /* Exported functions --------------------------------------------------------*/
mbed_official 354:e67efb2aab0e 871 /** @addtogroup RTCEx_Exported_Functions
mbed_official 354:e67efb2aab0e 872 * @{
mbed_official 354:e67efb2aab0e 873 */
mbed_official 354:e67efb2aab0e 874
mbed_official 354:e67efb2aab0e 875 /* RTC TimeStamp and Tamper functions *****************************************/
mbed_official 354:e67efb2aab0e 876 /** @addtogroup RTCEx_Exported_Functions_Group4
mbed_official 354:e67efb2aab0e 877 * @{
mbed_official 354:e67efb2aab0e 878 */
mbed_official 354:e67efb2aab0e 879 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge);
mbed_official 354:e67efb2aab0e 880 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge);
mbed_official 354:e67efb2aab0e 881 HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 882 HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format);
mbed_official 354:e67efb2aab0e 883
mbed_official 354:e67efb2aab0e 884 HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
mbed_official 354:e67efb2aab0e 885 HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
mbed_official 354:e67efb2aab0e 886 HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper);
mbed_official 354:e67efb2aab0e 887 void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 888
mbed_official 354:e67efb2aab0e 889 void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 890 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 891 void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 892 void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 893 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 894 void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 895 HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
mbed_official 354:e67efb2aab0e 896 HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
mbed_official 354:e67efb2aab0e 897 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 898 HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
mbed_official 354:e67efb2aab0e 899 HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
mbed_official 354:e67efb2aab0e 900 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 901 /**
mbed_official 354:e67efb2aab0e 902 * @}
mbed_official 354:e67efb2aab0e 903 */
mbed_official 354:e67efb2aab0e 904
mbed_official 354:e67efb2aab0e 905 /* RTC Wake-up functions ******************************************************/
mbed_official 354:e67efb2aab0e 906 /** @addtogroup RTCEx_Exported_Functions_Group5
mbed_official 354:e67efb2aab0e 907 * @{
mbed_official 354:e67efb2aab0e 908 */
mbed_official 354:e67efb2aab0e 909 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
mbed_official 354:e67efb2aab0e 910 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
mbed_official 354:e67efb2aab0e 911 uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 912 uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 913 void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 914 void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 915 HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
mbed_official 354:e67efb2aab0e 916 /**
mbed_official 354:e67efb2aab0e 917 * @}
mbed_official 354:e67efb2aab0e 918 */
mbed_official 354:e67efb2aab0e 919
mbed_official 354:e67efb2aab0e 920 /* Extension Control functions ************************************************/
mbed_official 354:e67efb2aab0e 921 /** @addtogroup RTCEx_Exported_Functions_Group7
mbed_official 354:e67efb2aab0e 922 * @{
mbed_official 354:e67efb2aab0e 923 */
mbed_official 354:e67efb2aab0e 924 void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data);
mbed_official 354:e67efb2aab0e 925 uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
mbed_official 354:e67efb2aab0e 926
mbed_official 354:e67efb2aab0e 927 HAL_StatusTypeDef HAL_RTCEx_SetCoarseCalib(RTC_HandleTypeDef *hrtc, uint32_t CalibSign, uint32_t Value);
mbed_official 354:e67efb2aab0e 928 HAL_StatusTypeDef HAL_RTCEx_DeactivateCoarseCalib(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 929 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 930 HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue);
mbed_official 354:e67efb2aab0e 931 HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS);
mbed_official 354:e67efb2aab0e 932 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput);
mbed_official 354:e67efb2aab0e 933 #else
mbed_official 354:e67efb2aab0e 934 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 935 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 936 HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 937 HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 938 HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 939 HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 940 HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 941 /**
mbed_official 354:e67efb2aab0e 942 * @}
mbed_official 354:e67efb2aab0e 943 */
mbed_official 354:e67efb2aab0e 944
mbed_official 354:e67efb2aab0e 945 /* Extension RTC features functions *******************************************/
mbed_official 354:e67efb2aab0e 946 /** @addtogroup RTCEx_Exported_Functions_Group8
mbed_official 354:e67efb2aab0e 947 * @{
mbed_official 354:e67efb2aab0e 948 */
mbed_official 354:e67efb2aab0e 949 void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc);
mbed_official 354:e67efb2aab0e 950 HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
mbed_official 354:e67efb2aab0e 951 /**
mbed_official 354:e67efb2aab0e 952 * @}
mbed_official 354:e67efb2aab0e 953 */
mbed_official 354:e67efb2aab0e 954
mbed_official 354:e67efb2aab0e 955 /**
mbed_official 354:e67efb2aab0e 956 * @}
mbed_official 354:e67efb2aab0e 957 */
mbed_official 354:e67efb2aab0e 958
mbed_official 354:e67efb2aab0e 959 /**
mbed_official 354:e67efb2aab0e 960 * @}
mbed_official 354:e67efb2aab0e 961 */
mbed_official 354:e67efb2aab0e 962
mbed_official 354:e67efb2aab0e 963 /**
mbed_official 354:e67efb2aab0e 964 * @}
mbed_official 354:e67efb2aab0e 965 */
mbed_official 354:e67efb2aab0e 966
mbed_official 354:e67efb2aab0e 967 #ifdef __cplusplus
mbed_official 354:e67efb2aab0e 968 }
mbed_official 354:e67efb2aab0e 969 #endif
mbed_official 354:e67efb2aab0e 970
mbed_official 354:e67efb2aab0e 971 #endif /* __STM32L1xx_HAL_RTC_EX_H */
mbed_official 354:e67efb2aab0e 972
mbed_official 354:e67efb2aab0e 973 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/