TUKS MCU Introductory course / TUKS-COURSE-TIMER
Committer:
elmot
Date:
Fri Feb 24 21:13:56 2017 +0000
Revision:
1:d0dfbce63a89
Ready-to-copy

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elmot 1:d0dfbce63a89 1 /**
elmot 1:d0dfbce63a89 2 ******************************************************************************
elmot 1:d0dfbce63a89 3 * @file stm32l4xx_ll_rtc.h
elmot 1:d0dfbce63a89 4 * @author MCD Application Team
elmot 1:d0dfbce63a89 5 * @version V1.5.1
elmot 1:d0dfbce63a89 6 * @date $DATE$
elmot 1:d0dfbce63a89 7 * @brief Header file of RTC LL module.
elmot 1:d0dfbce63a89 8 ******************************************************************************
elmot 1:d0dfbce63a89 9 * @attention
elmot 1:d0dfbce63a89 10 *
elmot 1:d0dfbce63a89 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
elmot 1:d0dfbce63a89 12 *
elmot 1:d0dfbce63a89 13 * Redistribution and use in source and binary forms, with or without modification,
elmot 1:d0dfbce63a89 14 * are permitted provided that the following conditions are met:
elmot 1:d0dfbce63a89 15 * 1. Redistributions of source code must retain the above copyright notice,
elmot 1:d0dfbce63a89 16 * this list of conditions and the following disclaimer.
elmot 1:d0dfbce63a89 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
elmot 1:d0dfbce63a89 18 * this list of conditions and the following disclaimer in the documentation
elmot 1:d0dfbce63a89 19 * and/or other materials provided with the distribution.
elmot 1:d0dfbce63a89 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
elmot 1:d0dfbce63a89 21 * may be used to endorse or promote products derived from this software
elmot 1:d0dfbce63a89 22 * without specific prior written permission.
elmot 1:d0dfbce63a89 23 *
elmot 1:d0dfbce63a89 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
elmot 1:d0dfbce63a89 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
elmot 1:d0dfbce63a89 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
elmot 1:d0dfbce63a89 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
elmot 1:d0dfbce63a89 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
elmot 1:d0dfbce63a89 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
elmot 1:d0dfbce63a89 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
elmot 1:d0dfbce63a89 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
elmot 1:d0dfbce63a89 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
elmot 1:d0dfbce63a89 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
elmot 1:d0dfbce63a89 34 *
elmot 1:d0dfbce63a89 35 ******************************************************************************
elmot 1:d0dfbce63a89 36 */
elmot 1:d0dfbce63a89 37
elmot 1:d0dfbce63a89 38 /* Define to prevent recursive inclusion -------------------------------------*/
elmot 1:d0dfbce63a89 39 #ifndef __STM32L4xx_LL_RTC_H
elmot 1:d0dfbce63a89 40 #define __STM32L4xx_LL_RTC_H
elmot 1:d0dfbce63a89 41
elmot 1:d0dfbce63a89 42 #ifdef __cplusplus
elmot 1:d0dfbce63a89 43 extern "C" {
elmot 1:d0dfbce63a89 44 #endif
elmot 1:d0dfbce63a89 45
elmot 1:d0dfbce63a89 46 /* Includes ------------------------------------------------------------------*/
elmot 1:d0dfbce63a89 47 #include "stm32l4xx.h"
elmot 1:d0dfbce63a89 48
elmot 1:d0dfbce63a89 49 /** @addtogroup STM32L4xx_LL_Driver
elmot 1:d0dfbce63a89 50 * @{
elmot 1:d0dfbce63a89 51 */
elmot 1:d0dfbce63a89 52
elmot 1:d0dfbce63a89 53 #if defined(RTC)
elmot 1:d0dfbce63a89 54
elmot 1:d0dfbce63a89 55 /** @defgroup RTC_LL RTC
elmot 1:d0dfbce63a89 56 * @{
elmot 1:d0dfbce63a89 57 */
elmot 1:d0dfbce63a89 58
elmot 1:d0dfbce63a89 59 /* Private types -------------------------------------------------------------*/
elmot 1:d0dfbce63a89 60 /* Private variables ---------------------------------------------------------*/
elmot 1:d0dfbce63a89 61 /* Private constants ---------------------------------------------------------*/
elmot 1:d0dfbce63a89 62 /** @defgroup RTC_LL_Private_Constants RTC Private Constants
elmot 1:d0dfbce63a89 63 * @{
elmot 1:d0dfbce63a89 64 */
elmot 1:d0dfbce63a89 65 /* Masks Definition */
elmot 1:d0dfbce63a89 66 #define RTC_INIT_MASK ((uint32_t)0xFFFFFFFFU)
elmot 1:d0dfbce63a89 67 #define RTC_RSF_MASK ((uint32_t)0xFFFFFF5FU)
elmot 1:d0dfbce63a89 68
elmot 1:d0dfbce63a89 69 /* Write protection defines */
elmot 1:d0dfbce63a89 70 #define RTC_WRITE_PROTECTION_DISABLE ((uint8_t)0xFFU)
elmot 1:d0dfbce63a89 71 #define RTC_WRITE_PROTECTION_ENABLE_1 ((uint8_t)0xCAU)
elmot 1:d0dfbce63a89 72 #define RTC_WRITE_PROTECTION_ENABLE_2 ((uint8_t)0x53U)
elmot 1:d0dfbce63a89 73
elmot 1:d0dfbce63a89 74 /* Defines used for the bit position in the register and perform offsets */
elmot 1:d0dfbce63a89 75 #define RTC_POSITION_TR_HT (uint32_t)POSITION_VAL(RTC_TR_HT)
elmot 1:d0dfbce63a89 76 #define RTC_POSITION_TR_HU (uint32_t)POSITION_VAL(RTC_TR_HU)
elmot 1:d0dfbce63a89 77 #define RTC_POSITION_TR_MT (uint32_t)POSITION_VAL(RTC_TR_MNT)
elmot 1:d0dfbce63a89 78 #define RTC_POSITION_TR_MU (uint32_t)POSITION_VAL(RTC_TR_MNU)
elmot 1:d0dfbce63a89 79 #define RTC_POSITION_TR_ST (uint32_t)POSITION_VAL(RTC_TR_ST)
elmot 1:d0dfbce63a89 80 #define RTC_POSITION_TR_SU (uint32_t)POSITION_VAL(RTC_TR_SU)
elmot 1:d0dfbce63a89 81 #define RTC_POSITION_DR_YT (uint32_t)POSITION_VAL(RTC_DR_YT)
elmot 1:d0dfbce63a89 82 #define RTC_POSITION_DR_YU (uint32_t)POSITION_VAL(RTC_DR_YU)
elmot 1:d0dfbce63a89 83 #define RTC_POSITION_DR_MT (uint32_t)POSITION_VAL(RTC_DR_MT)
elmot 1:d0dfbce63a89 84 #define RTC_POSITION_DR_MU (uint32_t)POSITION_VAL(RTC_DR_MU)
elmot 1:d0dfbce63a89 85 #define RTC_POSITION_DR_DT (uint32_t)POSITION_VAL(RTC_DR_DT)
elmot 1:d0dfbce63a89 86 #define RTC_POSITION_DR_DU (uint32_t)POSITION_VAL(RTC_DR_DU)
elmot 1:d0dfbce63a89 87 #define RTC_POSITION_DR_WDU (uint32_t)POSITION_VAL(RTC_DR_WDU)
elmot 1:d0dfbce63a89 88 #define RTC_POSITION_ALMA_DT (uint32_t)POSITION_VAL(RTC_ALRMAR_DT)
elmot 1:d0dfbce63a89 89 #define RTC_POSITION_ALMA_DU (uint32_t)POSITION_VAL(RTC_ALRMAR_DU)
elmot 1:d0dfbce63a89 90 #define RTC_POSITION_ALMA_HT (uint32_t)POSITION_VAL(RTC_ALRMAR_HT)
elmot 1:d0dfbce63a89 91 #define RTC_POSITION_ALMA_HU (uint32_t)POSITION_VAL(RTC_ALRMAR_HU)
elmot 1:d0dfbce63a89 92 #define RTC_POSITION_ALMA_MT (uint32_t)POSITION_VAL(RTC_ALRMAR_MNT)
elmot 1:d0dfbce63a89 93 #define RTC_POSITION_ALMA_MU (uint32_t)POSITION_VAL(RTC_ALRMAR_MNU)
elmot 1:d0dfbce63a89 94 #define RTC_POSITION_ALMA_SU (uint32_t)POSITION_VAL(RTC_ALRMAR_SU)
elmot 1:d0dfbce63a89 95 #define RTC_POSITION_ALMA_ST (uint32_t)POSITION_VAL(RTC_ALRMAR_ST)
elmot 1:d0dfbce63a89 96 #define RTC_POSITION_ALMB_DT (uint32_t)POSITION_VAL(RTC_ALRMBR_DT)
elmot 1:d0dfbce63a89 97 #define RTC_POSITION_ALMB_DU (uint32_t)POSITION_VAL(RTC_ALRMBR_DU)
elmot 1:d0dfbce63a89 98 #define RTC_POSITION_ALMB_HT (uint32_t)POSITION_VAL(RTC_ALRMBR_HT)
elmot 1:d0dfbce63a89 99 #define RTC_POSITION_ALMB_HU (uint32_t)POSITION_VAL(RTC_ALRMBR_HU)
elmot 1:d0dfbce63a89 100 #define RTC_POSITION_ALMB_MT (uint32_t)POSITION_VAL(RTC_ALRMBR_MNT)
elmot 1:d0dfbce63a89 101 #define RTC_POSITION_ALMB_MU (uint32_t)POSITION_VAL(RTC_ALRMBR_MNU)
elmot 1:d0dfbce63a89 102 #define RTC_POSITION_ALMB_SU (uint32_t)POSITION_VAL(RTC_ALRMBR_SU)
elmot 1:d0dfbce63a89 103 #define RTC_POSITION_ALMB_ST (uint32_t)POSITION_VAL(RTC_ALRMBR_ST)
elmot 1:d0dfbce63a89 104 #define RTC_POSITION_PRER_PREDIV_A (uint32_t)POSITION_VAL(RTC_PRER_PREDIV_A)
elmot 1:d0dfbce63a89 105 #define RTC_POSITION_ALMA_MASKSS (uint32_t)POSITION_VAL(RTC_ALRMASSR_MASKSS)
elmot 1:d0dfbce63a89 106 #define RTC_POSITION_ALMB_MASKSS (uint32_t)POSITION_VAL(RTC_ALRMBSSR_MASKSS)
elmot 1:d0dfbce63a89 107 #define RTC_POSITION_TS_HU (uint32_t)POSITION_VAL(RTC_TSTR_HU)
elmot 1:d0dfbce63a89 108 #define RTC_POSITION_TS_MNU (uint32_t)POSITION_VAL(RTC_TSTR_MNU)
elmot 1:d0dfbce63a89 109 #define RTC_POSITION_TS_WDU (uint32_t)POSITION_VAL(RTC_TSDR_WDU)
elmot 1:d0dfbce63a89 110 #define RTC_POSITION_TS_MU (uint32_t)POSITION_VAL(RTC_TSDR_MU)
elmot 1:d0dfbce63a89 111
elmot 1:d0dfbce63a89 112 /* Defines used to combine date & time */
elmot 1:d0dfbce63a89 113 #define RTC_OFFSET_WEEKDAY (uint32_t)24U
elmot 1:d0dfbce63a89 114 #define RTC_OFFSET_DAY (uint32_t)16U
elmot 1:d0dfbce63a89 115 #define RTC_OFFSET_MONTH (uint32_t)8U
elmot 1:d0dfbce63a89 116 #define RTC_OFFSET_HOUR (uint32_t)16U
elmot 1:d0dfbce63a89 117 #define RTC_OFFSET_MINUTE (uint32_t)8U
elmot 1:d0dfbce63a89 118
elmot 1:d0dfbce63a89 119 /**
elmot 1:d0dfbce63a89 120 * @}
elmot 1:d0dfbce63a89 121 */
elmot 1:d0dfbce63a89 122
elmot 1:d0dfbce63a89 123 /* Private macros ------------------------------------------------------------*/
elmot 1:d0dfbce63a89 124 #if defined(USE_FULL_LL_DRIVER)
elmot 1:d0dfbce63a89 125 /** @defgroup RTC_LL_Private_Macros RTC Private Macros
elmot 1:d0dfbce63a89 126 * @{
elmot 1:d0dfbce63a89 127 */
elmot 1:d0dfbce63a89 128 /**
elmot 1:d0dfbce63a89 129 * @}
elmot 1:d0dfbce63a89 130 */
elmot 1:d0dfbce63a89 131 #endif /*USE_FULL_LL_DRIVER*/
elmot 1:d0dfbce63a89 132
elmot 1:d0dfbce63a89 133 /* Exported types ------------------------------------------------------------*/
elmot 1:d0dfbce63a89 134 #if defined(USE_FULL_LL_DRIVER)
elmot 1:d0dfbce63a89 135 /** @defgroup RTC_LL_ES_INIT RTC Exported Init structure
elmot 1:d0dfbce63a89 136 * @{
elmot 1:d0dfbce63a89 137 */
elmot 1:d0dfbce63a89 138
elmot 1:d0dfbce63a89 139 /**
elmot 1:d0dfbce63a89 140 * @brief RTC Init structures definition
elmot 1:d0dfbce63a89 141 */
elmot 1:d0dfbce63a89 142 typedef struct
elmot 1:d0dfbce63a89 143 {
elmot 1:d0dfbce63a89 144 uint32_t HourFormat; /*!< Specifies the RTC Hours Format.
elmot 1:d0dfbce63a89 145 This parameter can be a value of @ref RTC_LL_EC_HOURFORMAT
elmot 1:d0dfbce63a89 146
elmot 1:d0dfbce63a89 147 This feature can be modified afterwards using unitary function
elmot 1:d0dfbce63a89 148 @ref LL_RTC_SetHourFormat(). */
elmot 1:d0dfbce63a89 149
elmot 1:d0dfbce63a89 150 uint32_t AsynchPrescaler; /*!< Specifies the RTC Asynchronous Predivider value.
elmot 1:d0dfbce63a89 151 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F
elmot 1:d0dfbce63a89 152
elmot 1:d0dfbce63a89 153 This feature can be modified afterwards using unitary function
elmot 1:d0dfbce63a89 154 @ref LL_RTC_SetAsynchPrescaler(). */
elmot 1:d0dfbce63a89 155
elmot 1:d0dfbce63a89 156 uint32_t SynchPrescaler; /*!< Specifies the RTC Synchronous Predivider value.
elmot 1:d0dfbce63a89 157 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF
elmot 1:d0dfbce63a89 158
elmot 1:d0dfbce63a89 159 This feature can be modified afterwards using unitary function
elmot 1:d0dfbce63a89 160 @ref LL_RTC_SetSynchPrescaler(). */
elmot 1:d0dfbce63a89 161 } LL_RTC_InitTypeDef;
elmot 1:d0dfbce63a89 162
elmot 1:d0dfbce63a89 163 /**
elmot 1:d0dfbce63a89 164 * @brief RTC Time structure definition
elmot 1:d0dfbce63a89 165 */
elmot 1:d0dfbce63a89 166 typedef struct
elmot 1:d0dfbce63a89 167 {
elmot 1:d0dfbce63a89 168 uint32_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
elmot 1:d0dfbce63a89 169 This parameter can be a value of @ref RTC_LL_EC_TIME_FORMAT
elmot 1:d0dfbce63a89 170
elmot 1:d0dfbce63a89 171 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetFormat(). */
elmot 1:d0dfbce63a89 172
elmot 1:d0dfbce63a89 173 uint8_t Hours; /*!< Specifies the RTC Time Hours.
elmot 1:d0dfbce63a89 174 This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the @ref LL_RTC_TIME_FORMAT_PM is selected.
elmot 1:d0dfbce63a89 175 This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the @ref LL_RTC_TIME_FORMAT_AM_OR_24 is selected.
elmot 1:d0dfbce63a89 176
elmot 1:d0dfbce63a89 177 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetHour(). */
elmot 1:d0dfbce63a89 178
elmot 1:d0dfbce63a89 179 uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
elmot 1:d0dfbce63a89 180 This parameter must be a number between Min_Data = 0 and Max_Data = 59
elmot 1:d0dfbce63a89 181
elmot 1:d0dfbce63a89 182 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetMinute(). */
elmot 1:d0dfbce63a89 183
elmot 1:d0dfbce63a89 184 uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
elmot 1:d0dfbce63a89 185 This parameter must be a number between Min_Data = 0 and Max_Data = 59
elmot 1:d0dfbce63a89 186
elmot 1:d0dfbce63a89 187 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetSecond(). */
elmot 1:d0dfbce63a89 188 } LL_RTC_TimeTypeDef;
elmot 1:d0dfbce63a89 189
elmot 1:d0dfbce63a89 190 /**
elmot 1:d0dfbce63a89 191 * @brief RTC Date structure definition
elmot 1:d0dfbce63a89 192 */
elmot 1:d0dfbce63a89 193 typedef struct
elmot 1:d0dfbce63a89 194 {
elmot 1:d0dfbce63a89 195 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay.
elmot 1:d0dfbce63a89 196 This parameter can be a value of @ref RTC_LL_EC_WEEKDAY
elmot 1:d0dfbce63a89 197
elmot 1:d0dfbce63a89 198 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetWeekDay(). */
elmot 1:d0dfbce63a89 199
elmot 1:d0dfbce63a89 200 uint8_t Month; /*!< Specifies the RTC Date Month.
elmot 1:d0dfbce63a89 201 This parameter can be a value of @ref RTC_LL_EC_MONTH
elmot 1:d0dfbce63a89 202
elmot 1:d0dfbce63a89 203 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetMonth(). */
elmot 1:d0dfbce63a89 204
elmot 1:d0dfbce63a89 205 uint8_t Day; /*!< Specifies the RTC Date Day.
elmot 1:d0dfbce63a89 206 This parameter must be a number between Min_Data = 1 and Max_Data = 31
elmot 1:d0dfbce63a89 207
elmot 1:d0dfbce63a89 208 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetDay(). */
elmot 1:d0dfbce63a89 209
elmot 1:d0dfbce63a89 210 uint8_t Year; /*!< Specifies the RTC Date Year.
elmot 1:d0dfbce63a89 211 This parameter must be a number between Min_Data = 0 and Max_Data = 99
elmot 1:d0dfbce63a89 212
elmot 1:d0dfbce63a89 213 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetYear(). */
elmot 1:d0dfbce63a89 214 } LL_RTC_DateTypeDef;
elmot 1:d0dfbce63a89 215
elmot 1:d0dfbce63a89 216 /**
elmot 1:d0dfbce63a89 217 * @brief RTC Alarm structure definition
elmot 1:d0dfbce63a89 218 */
elmot 1:d0dfbce63a89 219 typedef struct
elmot 1:d0dfbce63a89 220 {
elmot 1:d0dfbce63a89 221 LL_RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members. */
elmot 1:d0dfbce63a89 222
elmot 1:d0dfbce63a89 223 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks.
elmot 1:d0dfbce63a89 224 This parameter can be a value of @ref RTC_LL_EC_ALMA_MASK for ALARM A or @ref RTC_LL_EC_ALMB_MASK for ALARM B.
elmot 1:d0dfbce63a89 225
elmot 1:d0dfbce63a89 226 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetMask() for ALARM A
elmot 1:d0dfbce63a89 227 or @ref LL_RTC_ALMB_SetMask() for ALARM B
elmot 1:d0dfbce63a89 228 */
elmot 1:d0dfbce63a89 229
elmot 1:d0dfbce63a89 230 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on day or WeekDay.
elmot 1:d0dfbce63a89 231 This parameter can be a value of @ref RTC_LL_EC_ALMA_WEEKDAY_SELECTION for ALARM A or @ref RTC_LL_EC_ALMB_WEEKDAY_SELECTION for ALARM B
elmot 1:d0dfbce63a89 232
elmot 1:d0dfbce63a89 233 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_EnableWeekday() or @ref LL_RTC_ALMA_DisableWeekday()
elmot 1:d0dfbce63a89 234 for ALARM A or @ref LL_RTC_ALMB_EnableWeekday() or @ref LL_RTC_ALMB_DisableWeekday() for ALARM B
elmot 1:d0dfbce63a89 235 */
elmot 1:d0dfbce63a89 236
elmot 1:d0dfbce63a89 237 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Day/WeekDay.
elmot 1:d0dfbce63a89 238 If AlarmDateWeekDaySel set to day, this parameter must be a number between Min_Data = 1 and Max_Data = 31.
elmot 1:d0dfbce63a89 239
elmot 1:d0dfbce63a89 240 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetDay()
elmot 1:d0dfbce63a89 241 for ALARM A or @ref LL_RTC_ALMB_SetDay() for ALARM B.
elmot 1:d0dfbce63a89 242
elmot 1:d0dfbce63a89 243 If AlarmDateWeekDaySel set to Weekday, this parameter can be a value of @ref RTC_LL_EC_WEEKDAY.
elmot 1:d0dfbce63a89 244
elmot 1:d0dfbce63a89 245 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetWeekDay()
elmot 1:d0dfbce63a89 246 for ALARM A or @ref LL_RTC_ALMB_SetWeekDay() for ALARM B.
elmot 1:d0dfbce63a89 247 */
elmot 1:d0dfbce63a89 248 } LL_RTC_AlarmTypeDef;
elmot 1:d0dfbce63a89 249
elmot 1:d0dfbce63a89 250 /**
elmot 1:d0dfbce63a89 251 * @}
elmot 1:d0dfbce63a89 252 */
elmot 1:d0dfbce63a89 253 #endif /* USE_FULL_LL_DRIVER */
elmot 1:d0dfbce63a89 254
elmot 1:d0dfbce63a89 255 /* Exported constants --------------------------------------------------------*/
elmot 1:d0dfbce63a89 256 /** @defgroup RTC_LL_Exported_Constants RTC Exported Constants
elmot 1:d0dfbce63a89 257 * @{
elmot 1:d0dfbce63a89 258 */
elmot 1:d0dfbce63a89 259
elmot 1:d0dfbce63a89 260 #if defined(USE_FULL_LL_DRIVER)
elmot 1:d0dfbce63a89 261 /** @defgroup RTC_LL_EC_FORMAT FORMAT
elmot 1:d0dfbce63a89 262 * @{
elmot 1:d0dfbce63a89 263 */
elmot 1:d0dfbce63a89 264 #define LL_RTC_FORMAT_BIN ((uint32_t)0x000000000U) /*!< Binary data format */
elmot 1:d0dfbce63a89 265 #define LL_RTC_FORMAT_BCD ((uint32_t)0x000000001U) /*!< BCD data format */
elmot 1:d0dfbce63a89 266 /**
elmot 1:d0dfbce63a89 267 * @}
elmot 1:d0dfbce63a89 268 */
elmot 1:d0dfbce63a89 269
elmot 1:d0dfbce63a89 270 /** @defgroup RTC_LL_EC_ALMA_WEEKDAY_SELECTION RTC Alarm A Date WeekDay
elmot 1:d0dfbce63a89 271 * @{
elmot 1:d0dfbce63a89 272 */
elmot 1:d0dfbce63a89 273 #define LL_RTC_ALMA_DATEWEEKDAYSEL_DATE ((uint32_t)0x00000000U) /*!< Alarm A Date is selected */
elmot 1:d0dfbce63a89 274 #define LL_RTC_ALMA_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMAR_WDSEL /*!< Alarm A WeekDay is selected */
elmot 1:d0dfbce63a89 275 /**
elmot 1:d0dfbce63a89 276 * @}
elmot 1:d0dfbce63a89 277 */
elmot 1:d0dfbce63a89 278
elmot 1:d0dfbce63a89 279 /** @defgroup RTC_LL_EC_ALMB_WEEKDAY_SELECTION RTC Alarm B Date WeekDay
elmot 1:d0dfbce63a89 280 * @{
elmot 1:d0dfbce63a89 281 */
elmot 1:d0dfbce63a89 282 #define LL_RTC_ALMB_DATEWEEKDAYSEL_DATE ((uint32_t)0x00000000U) /*!< Alarm B Date is selected */
elmot 1:d0dfbce63a89 283 #define LL_RTC_ALMB_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMBR_WDSEL /*!< Alarm B WeekDay is selected */
elmot 1:d0dfbce63a89 284 /**
elmot 1:d0dfbce63a89 285 * @}
elmot 1:d0dfbce63a89 286 */
elmot 1:d0dfbce63a89 287
elmot 1:d0dfbce63a89 288 #endif /* USE_FULL_LL_DRIVER */
elmot 1:d0dfbce63a89 289
elmot 1:d0dfbce63a89 290 /** @defgroup RTC_LL_EC_GET_FLAG Get Flags Defines
elmot 1:d0dfbce63a89 291 * @brief Flags defines which can be used with LL_RTC_ReadReg function
elmot 1:d0dfbce63a89 292 * @{
elmot 1:d0dfbce63a89 293 */
elmot 1:d0dfbce63a89 294 #define LL_RTC_ISR_ITSF RTC_ISR_ITSF
elmot 1:d0dfbce63a89 295 #define LL_RTC_ISR_RECALPF RTC_ISR_RECALPF
elmot 1:d0dfbce63a89 296 #define LL_RTC_ISR_TAMP3F RTC_ISR_TAMP3F
elmot 1:d0dfbce63a89 297 #define LL_RTC_ISR_TAMP2F RTC_ISR_TAMP2F
elmot 1:d0dfbce63a89 298 #define LL_RTC_ISR_TAMP1F RTC_ISR_TAMP1F
elmot 1:d0dfbce63a89 299 #define LL_RTC_ISR_TSOVF RTC_ISR_TSOVF
elmot 1:d0dfbce63a89 300 #define LL_RTC_ISR_TSF RTC_ISR_TSF
elmot 1:d0dfbce63a89 301 #define LL_RTC_ISR_WUTF RTC_ISR_WUTF
elmot 1:d0dfbce63a89 302 #define LL_RTC_ISR_ALRBF RTC_ISR_ALRBF
elmot 1:d0dfbce63a89 303 #define LL_RTC_ISR_ALRAF RTC_ISR_ALRAF
elmot 1:d0dfbce63a89 304 #define LL_RTC_ISR_INITF RTC_ISR_INITF
elmot 1:d0dfbce63a89 305 #define LL_RTC_ISR_RSF RTC_ISR_RSF
elmot 1:d0dfbce63a89 306 #define LL_RTC_ISR_INITS RTC_ISR_INITS
elmot 1:d0dfbce63a89 307 #define LL_RTC_ISR_SHPF RTC_ISR_SHPF
elmot 1:d0dfbce63a89 308 #define LL_RTC_ISR_WUTWF RTC_ISR_WUTWF
elmot 1:d0dfbce63a89 309 #define LL_RTC_ISR_ALRBWF RTC_ISR_ALRBWF
elmot 1:d0dfbce63a89 310 #define LL_RTC_ISR_ALRAWF RTC_ISR_ALRAWF
elmot 1:d0dfbce63a89 311 /**
elmot 1:d0dfbce63a89 312 * @}
elmot 1:d0dfbce63a89 313 */
elmot 1:d0dfbce63a89 314
elmot 1:d0dfbce63a89 315 /** @defgroup RTC_LL_EC_IT IT Defines
elmot 1:d0dfbce63a89 316 * @brief IT defines which can be used with LL_RTC_ReadReg and LL_RTC_WriteReg functions
elmot 1:d0dfbce63a89 317 * @{
elmot 1:d0dfbce63a89 318 */
elmot 1:d0dfbce63a89 319 #define LL_RTC_CR_TSIE RTC_CR_TSIE
elmot 1:d0dfbce63a89 320 #define LL_RTC_CR_WUTIE RTC_CR_WUTIE
elmot 1:d0dfbce63a89 321 #define LL_RTC_CR_ALRBIE RTC_CR_ALRBIE
elmot 1:d0dfbce63a89 322 #define LL_RTC_CR_ALRAIE RTC_CR_ALRAIE
elmot 1:d0dfbce63a89 323 #define LL_RTC_TAMPCR_TAMP3IE RTC_TAMPCR_TAMP3IE
elmot 1:d0dfbce63a89 324 #define LL_RTC_TAMPCR_TAMP2IE RTC_TAMPCR_TAMP2IE
elmot 1:d0dfbce63a89 325 #define LL_RTC_TAMPCR_TAMP1IE RTC_TAMPCR_TAMP1IE
elmot 1:d0dfbce63a89 326 #define LL_RTC_TAMPCR_TAMPIE RTC_TAMPCR_TAMPIE
elmot 1:d0dfbce63a89 327 /**
elmot 1:d0dfbce63a89 328 * @}
elmot 1:d0dfbce63a89 329 */
elmot 1:d0dfbce63a89 330
elmot 1:d0dfbce63a89 331 /** @defgroup RTC_LL_EC_WEEKDAY WEEK DAY
elmot 1:d0dfbce63a89 332 * @{
elmot 1:d0dfbce63a89 333 */
elmot 1:d0dfbce63a89 334 #define LL_RTC_WEEKDAY_MONDAY ((uint8_t)0x01U) /*!< Monday */
elmot 1:d0dfbce63a89 335 #define LL_RTC_WEEKDAY_TUESDAY ((uint8_t)0x02U) /*!< Tuesday */
elmot 1:d0dfbce63a89 336 #define LL_RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03U) /*!< Wednesday */
elmot 1:d0dfbce63a89 337 #define LL_RTC_WEEKDAY_THURSDAY ((uint8_t)0x04U) /*!< Thrusday */
elmot 1:d0dfbce63a89 338 #define LL_RTC_WEEKDAY_FRIDAY ((uint8_t)0x05U) /*!< Friday */
elmot 1:d0dfbce63a89 339 #define LL_RTC_WEEKDAY_SATURDAY ((uint8_t)0x06U) /*!< Saturday */
elmot 1:d0dfbce63a89 340 #define LL_RTC_WEEKDAY_SUNDAY ((uint8_t)0x07U) /*!< Sunday */
elmot 1:d0dfbce63a89 341 /**
elmot 1:d0dfbce63a89 342 * @}
elmot 1:d0dfbce63a89 343 */
elmot 1:d0dfbce63a89 344
elmot 1:d0dfbce63a89 345 /** @defgroup RTC_LL_EC_MONTH MONTH
elmot 1:d0dfbce63a89 346 * @{
elmot 1:d0dfbce63a89 347 */
elmot 1:d0dfbce63a89 348 #define LL_RTC_MONTH_JANUARY ((uint8_t)0x01U) /*!< January */
elmot 1:d0dfbce63a89 349 #define LL_RTC_MONTH_FEBRUARY ((uint8_t)0x02U) /*!< February */
elmot 1:d0dfbce63a89 350 #define LL_RTC_MONTH_MARCH ((uint8_t)0x03U) /*!< March */
elmot 1:d0dfbce63a89 351 #define LL_RTC_MONTH_APRIL ((uint8_t)0x04U) /*!< April */
elmot 1:d0dfbce63a89 352 #define LL_RTC_MONTH_MAY ((uint8_t)0x05U) /*!< May */
elmot 1:d0dfbce63a89 353 #define LL_RTC_MONTH_JUNE ((uint8_t)0x06U) /*!< June */
elmot 1:d0dfbce63a89 354 #define LL_RTC_MONTH_JULY ((uint8_t)0x07U) /*!< July */
elmot 1:d0dfbce63a89 355 #define LL_RTC_MONTH_AUGUST ((uint8_t)0x08U) /*!< August */
elmot 1:d0dfbce63a89 356 #define LL_RTC_MONTH_SEPTEMBER ((uint8_t)0x09U) /*!< September */
elmot 1:d0dfbce63a89 357 #define LL_RTC_MONTH_OCTOBER ((uint8_t)0x10U) /*!< October */
elmot 1:d0dfbce63a89 358 #define LL_RTC_MONTH_NOVEMBER ((uint8_t)0x11U) /*!< November */
elmot 1:d0dfbce63a89 359 #define LL_RTC_MONTH_DECEMBER ((uint8_t)0x12U) /*!< December */
elmot 1:d0dfbce63a89 360 /**
elmot 1:d0dfbce63a89 361 * @}
elmot 1:d0dfbce63a89 362 */
elmot 1:d0dfbce63a89 363
elmot 1:d0dfbce63a89 364 /** @defgroup RTC_LL_EC_HOURFORMAT HOUR FORMAT
elmot 1:d0dfbce63a89 365 * @{
elmot 1:d0dfbce63a89 366 */
elmot 1:d0dfbce63a89 367 #define LL_RTC_HOURFORMAT_24HOUR (uint32_t)0x00000000U /*!< 24 hour/day format */
elmot 1:d0dfbce63a89 368 #define LL_RTC_HOURFORMAT_AMPM RTC_CR_FMT /*!< AM/PM hour format */
elmot 1:d0dfbce63a89 369 /**
elmot 1:d0dfbce63a89 370 * @}
elmot 1:d0dfbce63a89 371 */
elmot 1:d0dfbce63a89 372
elmot 1:d0dfbce63a89 373 /** @defgroup RTC_LL_EC_ALARMOUT ALARM OUTPUT
elmot 1:d0dfbce63a89 374 * @{
elmot 1:d0dfbce63a89 375 */
elmot 1:d0dfbce63a89 376 #define LL_RTC_ALARMOUT_DISABLE ((uint32_t)0x00000000U) /*!< Output disabled */
elmot 1:d0dfbce63a89 377 #define LL_RTC_ALARMOUT_ALMA RTC_CR_OSEL_0 /*!< Alarm A output enabled */
elmot 1:d0dfbce63a89 378 #define LL_RTC_ALARMOUT_ALMB RTC_CR_OSEL_1 /*!< Alarm B output enabled */
elmot 1:d0dfbce63a89 379 #define LL_RTC_ALARMOUT_WAKEUP RTC_CR_OSEL /*!< Wakeup output enabled */
elmot 1:d0dfbce63a89 380 /**
elmot 1:d0dfbce63a89 381 * @}
elmot 1:d0dfbce63a89 382 */
elmot 1:d0dfbce63a89 383
elmot 1:d0dfbce63a89 384 /** @defgroup RTC_LL_EC_ALARM_OUTPUTTYPE ALARM OUTPUT TYPE
elmot 1:d0dfbce63a89 385 * @{
elmot 1:d0dfbce63a89 386 */
elmot 1:d0dfbce63a89 387 #define LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN (uint32_t)0x00000000U /*!< RTC_ALARM, when mapped on PC13, is open-drain output */
elmot 1:d0dfbce63a89 388 #define LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL RTC_OR_ALARMOUTTYPE /*!< RTC_ALARM, when mapped on PC13, is push-pull output */
elmot 1:d0dfbce63a89 389 /**
elmot 1:d0dfbce63a89 390 * @}
elmot 1:d0dfbce63a89 391 */
elmot 1:d0dfbce63a89 392
elmot 1:d0dfbce63a89 393 /** @defgroup RTC_LL_EC_OUTPUTPOLARITY_PIN OUTPUT POLARITY PIN
elmot 1:d0dfbce63a89 394 * @{
elmot 1:d0dfbce63a89 395 */
elmot 1:d0dfbce63a89 396 #define LL_RTC_OUTPUTPOLARITY_PIN_HIGH (uint32_t)0x00000000U /*!< Pin is high when ALRAF/ALRBF/WUTF is asserted (depending on OSEL)*/
elmot 1:d0dfbce63a89 397 #define LL_RTC_OUTPUTPOLARITY_PIN_LOW RTC_CR_POL /*!< Pin is low when ALRAF/ALRBF/WUTF is asserted (depending on OSEL) */
elmot 1:d0dfbce63a89 398 /**
elmot 1:d0dfbce63a89 399 * @}
elmot 1:d0dfbce63a89 400 */
elmot 1:d0dfbce63a89 401
elmot 1:d0dfbce63a89 402 /** @defgroup RTC_LL_EC_TIME_FORMAT TIME FORMAT
elmot 1:d0dfbce63a89 403 * @{
elmot 1:d0dfbce63a89 404 */
elmot 1:d0dfbce63a89 405 #define LL_RTC_TIME_FORMAT_AM_OR_24 (uint32_t)0x00000000U /*!< AM or 24-hour format */
elmot 1:d0dfbce63a89 406 #define LL_RTC_TIME_FORMAT_PM RTC_TR_PM /*!< PM */
elmot 1:d0dfbce63a89 407 /**
elmot 1:d0dfbce63a89 408 * @}
elmot 1:d0dfbce63a89 409 */
elmot 1:d0dfbce63a89 410
elmot 1:d0dfbce63a89 411 /** @defgroup RTC_LL_EC_SHIFT_SECOND SHIFT SECOND
elmot 1:d0dfbce63a89 412 * @{
elmot 1:d0dfbce63a89 413 */
elmot 1:d0dfbce63a89 414 #define LL_RTC_SHIFT_SECOND_DELAY (uint32_t)0x00000000U /* Delay (seconds) = SUBFS / (PREDIV_S + 1) */
elmot 1:d0dfbce63a89 415 #define LL_RTC_SHIFT_SECOND_ADVANCE RTC_SHIFTR_ADD1S /* Advance (seconds) = (1 - (SUBFS / (PREDIV_S + 1))) */
elmot 1:d0dfbce63a89 416 /**
elmot 1:d0dfbce63a89 417 * @}
elmot 1:d0dfbce63a89 418 */
elmot 1:d0dfbce63a89 419
elmot 1:d0dfbce63a89 420 /** @defgroup RTC_LL_EC_ALMA_MASK ALARMA MASK
elmot 1:d0dfbce63a89 421 * @{
elmot 1:d0dfbce63a89 422 */
elmot 1:d0dfbce63a89 423 #define LL_RTC_ALMA_MASK_NONE ((uint32_t)0x00000000U) /*!< No masks applied on Alarm A*/
elmot 1:d0dfbce63a89 424 #define LL_RTC_ALMA_MASK_DATEWEEKDAY RTC_ALRMAR_MSK4 /*!< Date/day do not care in Alarm A comparison */
elmot 1:d0dfbce63a89 425 #define LL_RTC_ALMA_MASK_HOURS RTC_ALRMAR_MSK3 /*!< Hours do not care in Alarm A comparison */
elmot 1:d0dfbce63a89 426 #define LL_RTC_ALMA_MASK_MINUTES RTC_ALRMAR_MSK2 /*!< Minutes do not care in Alarm A comparison */
elmot 1:d0dfbce63a89 427 #define LL_RTC_ALMA_MASK_SECONDS RTC_ALRMAR_MSK1 /*!< Seconds do not care in Alarm A comparison */
elmot 1:d0dfbce63a89 428 #define LL_RTC_ALMA_MASK_ALL (RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1) /*!< Masks all */
elmot 1:d0dfbce63a89 429 /**
elmot 1:d0dfbce63a89 430 * @}
elmot 1:d0dfbce63a89 431 */
elmot 1:d0dfbce63a89 432
elmot 1:d0dfbce63a89 433 /** @defgroup RTC_LL_EC_ALMA_TIME_FORMAT ALARMA TIME FORMAT
elmot 1:d0dfbce63a89 434 * @{
elmot 1:d0dfbce63a89 435 */
elmot 1:d0dfbce63a89 436 #define LL_RTC_ALMA_TIME_FORMAT_AM (uint32_t)0x00000000U /*!< AM or 24-hour format */
elmot 1:d0dfbce63a89 437 #define LL_RTC_ALMA_TIME_FORMAT_PM RTC_ALRMAR_PM /*!< PM */
elmot 1:d0dfbce63a89 438 /**
elmot 1:d0dfbce63a89 439 * @}
elmot 1:d0dfbce63a89 440 */
elmot 1:d0dfbce63a89 441
elmot 1:d0dfbce63a89 442 /** @defgroup RTC_LL_EC_ALMB_MASK ALARMB MASK
elmot 1:d0dfbce63a89 443 * @{
elmot 1:d0dfbce63a89 444 */
elmot 1:d0dfbce63a89 445 #define LL_RTC_ALMB_MASK_NONE ((uint32_t)0x00000000U) /*!< No masks applied on Alarm B*/
elmot 1:d0dfbce63a89 446 #define LL_RTC_ALMB_MASK_DATEWEEKDAY RTC_ALRMBR_MSK4 /*!< Date/day do not care in Alarm B comparison */
elmot 1:d0dfbce63a89 447 #define LL_RTC_ALMB_MASK_HOURS RTC_ALRMBR_MSK3 /*!< Hours do not care in Alarm B comparison */
elmot 1:d0dfbce63a89 448 #define LL_RTC_ALMB_MASK_MINUTES RTC_ALRMBR_MSK2 /*!< Minutes do not care in Alarm B comparison */
elmot 1:d0dfbce63a89 449 #define LL_RTC_ALMB_MASK_SECONDS RTC_ALRMBR_MSK1 /*!< Seconds do not care in Alarm B comparison */
elmot 1:d0dfbce63a89 450 #define LL_RTC_ALMB_MASK_ALL (RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1) /*!< Masks all */
elmot 1:d0dfbce63a89 451 /**
elmot 1:d0dfbce63a89 452 * @}
elmot 1:d0dfbce63a89 453 */
elmot 1:d0dfbce63a89 454
elmot 1:d0dfbce63a89 455 /** @defgroup RTC_LL_EC_ALMB_TIME_FORMAT ALARMB TIME FORMAT
elmot 1:d0dfbce63a89 456 * @{
elmot 1:d0dfbce63a89 457 */
elmot 1:d0dfbce63a89 458 #define LL_RTC_ALMB_TIME_FORMAT_AM (uint32_t)0x00000000U /*!< AM or 24-hour format */
elmot 1:d0dfbce63a89 459 #define LL_RTC_ALMB_TIME_FORMAT_PM RTC_ALRMBR_PM /*!< PM */
elmot 1:d0dfbce63a89 460 /**
elmot 1:d0dfbce63a89 461 * @}
elmot 1:d0dfbce63a89 462 */
elmot 1:d0dfbce63a89 463
elmot 1:d0dfbce63a89 464 /** @defgroup RTC_LL_EC_TIMESTAMP_EDGE TIMESTAMP EDGE
elmot 1:d0dfbce63a89 465 * @{
elmot 1:d0dfbce63a89 466 */
elmot 1:d0dfbce63a89 467 #define LL_RTC_TIMESTAMP_EDGE_RISING (uint32_t)0x00000000U /*!< RTC_TS input rising edge generates a time-stamp event */
elmot 1:d0dfbce63a89 468 #define LL_RTC_TIMESTAMP_EDGE_FALLING RTC_CR_TSEDGE /*!< RTC_TS input falling edge generates a time-stamp even */
elmot 1:d0dfbce63a89 469 /**
elmot 1:d0dfbce63a89 470 * @}
elmot 1:d0dfbce63a89 471 */
elmot 1:d0dfbce63a89 472
elmot 1:d0dfbce63a89 473 /** @defgroup RTC_LL_EC_TS_TIME_FORMAT TIMESTAMP TIME FORMAT
elmot 1:d0dfbce63a89 474 * @{
elmot 1:d0dfbce63a89 475 */
elmot 1:d0dfbce63a89 476 #define LL_RTC_TS_TIME_FORMAT_AM (uint32_t)0x00000000U /*!< AM or 24-hour format */
elmot 1:d0dfbce63a89 477 #define LL_RTC_TS_TIME_FORMAT_PM RTC_TSTR_PM /*!< PM */
elmot 1:d0dfbce63a89 478 /**
elmot 1:d0dfbce63a89 479 * @}
elmot 1:d0dfbce63a89 480 */
elmot 1:d0dfbce63a89 481
elmot 1:d0dfbce63a89 482 /** @defgroup RTC_LL_EC_TAMPER TAMPER
elmot 1:d0dfbce63a89 483 * @{
elmot 1:d0dfbce63a89 484 */
elmot 1:d0dfbce63a89 485 #if defined(RTC_TAMPER1_SUPPORT)
elmot 1:d0dfbce63a89 486 #define LL_RTC_TAMPER_1 RTC_TAMPCR_TAMP1E /*!< RTC_TAMP1 input detection */
elmot 1:d0dfbce63a89 487 #endif /* RTC_TAMPER1_SUPPORT */
elmot 1:d0dfbce63a89 488 #if defined(RTC_TAMPER2_SUPPORT)
elmot 1:d0dfbce63a89 489 #define LL_RTC_TAMPER_2 RTC_TAMPCR_TAMP2E /*!< RTC_TAMP2 input detection */
elmot 1:d0dfbce63a89 490 #endif /* RTC_TAMPER2_SUPPORT */
elmot 1:d0dfbce63a89 491 #if defined(RTC_TAMPER3_SUPPORT)
elmot 1:d0dfbce63a89 492 #define LL_RTC_TAMPER_3 RTC_TAMPCR_TAMP3E /*!< RTC_TAMP3 input detection */
elmot 1:d0dfbce63a89 493 #endif /* RTC_TAMPER3_SUPPORT */
elmot 1:d0dfbce63a89 494 /**
elmot 1:d0dfbce63a89 495 * @}
elmot 1:d0dfbce63a89 496 */
elmot 1:d0dfbce63a89 497
elmot 1:d0dfbce63a89 498 /** @defgroup RTC_LL_EC_TAMPER_MASK TAMPER MASK
elmot 1:d0dfbce63a89 499 * @{
elmot 1:d0dfbce63a89 500 */
elmot 1:d0dfbce63a89 501 #if defined(RTC_TAMPER1_SUPPORT)
elmot 1:d0dfbce63a89 502 #define LL_RTC_TAMPER_MASK_TAMPER1 RTC_TAMPCR_TAMP1MF /*!< Tamper 1 event generates a trigger event. TAMP1F is masked and internally cleared by hardware.The backup registers are not erased */
elmot 1:d0dfbce63a89 503 #endif /* RTC_TAMPER1_SUPPORT */
elmot 1:d0dfbce63a89 504 #if defined(RTC_TAMPER2_SUPPORT)
elmot 1:d0dfbce63a89 505 #define LL_RTC_TAMPER_MASK_TAMPER2 RTC_TAMPCR_TAMP2MF /*!< Tamper 2 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */
elmot 1:d0dfbce63a89 506 #endif /* RTC_TAMPER2_SUPPORT */
elmot 1:d0dfbce63a89 507 #if defined(RTC_TAMPER3_SUPPORT)
elmot 1:d0dfbce63a89 508 #define LL_RTC_TAMPER_MASK_TAMPER3 RTC_TAMPCR_TAMP3MF /*!< Tamper 3 event generates a trigger event. TAMP3F is masked and internally cleared by hardware. The backup registers are not erased */
elmot 1:d0dfbce63a89 509 #endif /* RTC_TAMPER3_SUPPORT */
elmot 1:d0dfbce63a89 510 /**
elmot 1:d0dfbce63a89 511 * @}
elmot 1:d0dfbce63a89 512 */
elmot 1:d0dfbce63a89 513
elmot 1:d0dfbce63a89 514 /** @defgroup RTC_LL_EC_TAMPER_NOERASE TAMPER NO ERASE
elmot 1:d0dfbce63a89 515 * @{
elmot 1:d0dfbce63a89 516 */
elmot 1:d0dfbce63a89 517 #if defined(RTC_TAMPER1_SUPPORT)
elmot 1:d0dfbce63a89 518 #define LL_RTC_TAMPER_NOERASE_TAMPER1 RTC_TAMPCR_TAMP1NOERASE /*!< Tamper 1 event does not erase the backup registers. */
elmot 1:d0dfbce63a89 519 #endif /* RTC_TAMPER1_SUPPORT */
elmot 1:d0dfbce63a89 520 #if defined(RTC_TAMPER2_SUPPORT)
elmot 1:d0dfbce63a89 521 #define LL_RTC_TAMPER_NOERASE_TAMPER2 RTC_TAMPCR_TAMP2NOERASE /*!< Tamper 2 event does not erase the backup registers. */
elmot 1:d0dfbce63a89 522 #endif /* RTC_TAMPER2_SUPPORT */
elmot 1:d0dfbce63a89 523 #if defined(RTC_TAMPER3_SUPPORT)
elmot 1:d0dfbce63a89 524 #define LL_RTC_TAMPER_NOERASE_TAMPER3 RTC_TAMPCR_TAMP3NOERASE /*!< Tamper 3 event does not erase the backup registers. */
elmot 1:d0dfbce63a89 525 #endif /* RTC_TAMPER3_SUPPORT */
elmot 1:d0dfbce63a89 526 /**
elmot 1:d0dfbce63a89 527 * @}
elmot 1:d0dfbce63a89 528 */
elmot 1:d0dfbce63a89 529
elmot 1:d0dfbce63a89 530 #if defined(RTC_TAMPCR_TAMPPRCH)
elmot 1:d0dfbce63a89 531 /** @defgroup RTC_LL_EC_TAMPER_DURATION TAMPER DURATION
elmot 1:d0dfbce63a89 532 * @{
elmot 1:d0dfbce63a89 533 */
elmot 1:d0dfbce63a89 534 #define LL_RTC_TAMPER_DURATION_1RTCCLK ((uint32_t)0x00000000U) /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle */
elmot 1:d0dfbce63a89 535 #define LL_RTC_TAMPER_DURATION_2RTCCLK RTC_TAMPCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */
elmot 1:d0dfbce63a89 536 #define LL_RTC_TAMPER_DURATION_4RTCCLK RTC_TAMPCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */
elmot 1:d0dfbce63a89 537 #define LL_RTC_TAMPER_DURATION_8RTCCLK RTC_TAMPCR_TAMPPRCH /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */
elmot 1:d0dfbce63a89 538 /**
elmot 1:d0dfbce63a89 539 * @}
elmot 1:d0dfbce63a89 540 */
elmot 1:d0dfbce63a89 541 #endif /* RTC_TAMPCR_TAMPPRCH */
elmot 1:d0dfbce63a89 542
elmot 1:d0dfbce63a89 543 #if defined(RTC_TAMPCR_TAMPFLT)
elmot 1:d0dfbce63a89 544 /** @defgroup RTC_LL_EC_TAMPER_FILTER TAMPER FILTER
elmot 1:d0dfbce63a89 545 * @{
elmot 1:d0dfbce63a89 546 */
elmot 1:d0dfbce63a89 547 #define LL_RTC_TAMPER_FILTER_DISABLE ((uint32_t)0x00000000U) /*!< Tamper filter is disabled */
elmot 1:d0dfbce63a89 548 #define LL_RTC_TAMPER_FILTER_2SAMPLE RTC_TAMPCR_TAMPFLT_0 /*!< Tamper is activated after 2 consecutive samples at the active level */
elmot 1:d0dfbce63a89 549 #define LL_RTC_TAMPER_FILTER_4SAMPLE RTC_TAMPCR_TAMPFLT_1 /*!< Tamper is activated after 4 consecutive samples at the active level */
elmot 1:d0dfbce63a89 550 #define LL_RTC_TAMPER_FILTER_8SAMPLE RTC_TAMPCR_TAMPFLT /*!< Tamper is activated after 8 consecutive samples at the active level. */
elmot 1:d0dfbce63a89 551 /**
elmot 1:d0dfbce63a89 552 * @}
elmot 1:d0dfbce63a89 553 */
elmot 1:d0dfbce63a89 554 #endif /* RTC_TAMPCR_TAMPFLT */
elmot 1:d0dfbce63a89 555
elmot 1:d0dfbce63a89 556 #if defined(RTC_TAMPCR_TAMPFREQ)
elmot 1:d0dfbce63a89 557 /** @defgroup RTC_LL_EC_TAMPER_SAMPLFREQDIV TAMPER SAMPLING FREQUENCY DIVIDER
elmot 1:d0dfbce63a89 558 * @{
elmot 1:d0dfbce63a89 559 */
elmot 1:d0dfbce63a89 560 #define LL_RTC_TAMPER_SAMPLFREQDIV_32768 ((uint32_t)0x00000000U) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 32768 */
elmot 1:d0dfbce63a89 561 #define LL_RTC_TAMPER_SAMPLFREQDIV_16384 RTC_TAMPCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 16384 */
elmot 1:d0dfbce63a89 562 #define LL_RTC_TAMPER_SAMPLFREQDIV_8192 RTC_TAMPCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 8192 */
elmot 1:d0dfbce63a89 563 #define LL_RTC_TAMPER_SAMPLFREQDIV_4096 (RTC_TAMPCR_TAMPFREQ_1 | RTC_TAMPCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 4096 */
elmot 1:d0dfbce63a89 564 #define LL_RTC_TAMPER_SAMPLFREQDIV_2048 RTC_TAMPCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 2048 */
elmot 1:d0dfbce63a89 565 #define LL_RTC_TAMPER_SAMPLFREQDIV_1024 (RTC_TAMPCR_TAMPFREQ_2 | RTC_TAMPCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 1024 */
elmot 1:d0dfbce63a89 566 #define LL_RTC_TAMPER_SAMPLFREQDIV_512 (RTC_TAMPCR_TAMPFREQ_2 | RTC_TAMPCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 512 */
elmot 1:d0dfbce63a89 567 #define LL_RTC_TAMPER_SAMPLFREQDIV_256 RTC_TAMPCR_TAMPFREQ /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 256 */
elmot 1:d0dfbce63a89 568 /**
elmot 1:d0dfbce63a89 569 * @}
elmot 1:d0dfbce63a89 570 */
elmot 1:d0dfbce63a89 571 #endif /* RTC_TAMPCR_TAMPFREQ */
elmot 1:d0dfbce63a89 572
elmot 1:d0dfbce63a89 573 /** @defgroup RTC_LL_EC_TAMPER_ACTIVELEVEL TAMPER ACTIVE LEVEL
elmot 1:d0dfbce63a89 574 * @{
elmot 1:d0dfbce63a89 575 */
elmot 1:d0dfbce63a89 576 #if defined(RTC_TAMPER1_SUPPORT)
elmot 1:d0dfbce63a89 577 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 RTC_TAMPCR_TAMP1TRG /*!< RTC_TAMP1 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/
elmot 1:d0dfbce63a89 578 #endif /* RTC_TAMPER1_SUPPORT */
elmot 1:d0dfbce63a89 579 #if defined(RTC_TAMPER2_SUPPORT)
elmot 1:d0dfbce63a89 580 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 RTC_TAMPCR_TAMP2TRG /*!< RTC_TAMP2 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/
elmot 1:d0dfbce63a89 581 #endif /* RTC_TAMPER2_SUPPORT */
elmot 1:d0dfbce63a89 582 #if defined(RTC_TAMPER3_SUPPORT)
elmot 1:d0dfbce63a89 583 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 RTC_TAMPCR_TAMP3TRG /*!< RTC_TAMP3 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/
elmot 1:d0dfbce63a89 584 #endif /* RTC_TAMPER3_SUPPORT */
elmot 1:d0dfbce63a89 585 /**
elmot 1:d0dfbce63a89 586 * @}
elmot 1:d0dfbce63a89 587 */
elmot 1:d0dfbce63a89 588
elmot 1:d0dfbce63a89 589 /** @defgroup RTC_LL_EC_WAKEUPCLOCK_DIV WAKEUP CLOCK DIV
elmot 1:d0dfbce63a89 590 * @{
elmot 1:d0dfbce63a89 591 */
elmot 1:d0dfbce63a89 592 #define LL_RTC_WAKEUPCLOCK_DIV_16 ((uint32_t)0x00000000U) /*!< RTC/16 clock is selected */
elmot 1:d0dfbce63a89 593 #define LL_RTC_WAKEUPCLOCK_DIV_8 (RTC_CR_WUCKSEL_0) /*!< RTC/8 clock is selected */
elmot 1:d0dfbce63a89 594 #define LL_RTC_WAKEUPCLOCK_DIV_4 (RTC_CR_WUCKSEL_1) /*!< RTC/4 clock is selected */
elmot 1:d0dfbce63a89 595 #define LL_RTC_WAKEUPCLOCK_DIV_2 (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_0) /*!< RTC/2 clock is selected */
elmot 1:d0dfbce63a89 596 #define LL_RTC_WAKEUPCLOCK_CKSPRE (RTC_CR_WUCKSEL_2) /*!< ck_spre (usually 1 Hz) clock is selected */
elmot 1:d0dfbce63a89 597 #define LL_RTC_WAKEUPCLOCK_CKSPRE_WUT (RTC_CR_WUCKSEL_2 | RTC_CR_WUCKSEL_1) /*!< ck_spre (usually 1 Hz) clock is selected and 2exp16 is added to the WUT counter value*/
elmot 1:d0dfbce63a89 598 /**
elmot 1:d0dfbce63a89 599 * @}
elmot 1:d0dfbce63a89 600 */
elmot 1:d0dfbce63a89 601
elmot 1:d0dfbce63a89 602 #if defined(RTC_BACKUP_SUPPORT)
elmot 1:d0dfbce63a89 603 /** @defgroup RTC_LL_EC_BKP BACKUP
elmot 1:d0dfbce63a89 604 * @{
elmot 1:d0dfbce63a89 605 */
elmot 1:d0dfbce63a89 606 #define LL_RTC_BKP_DR0 ((uint32_t)0x00000000U)
elmot 1:d0dfbce63a89 607 #define LL_RTC_BKP_DR1 ((uint32_t)0x00000001U)
elmot 1:d0dfbce63a89 608 #define LL_RTC_BKP_DR2 ((uint32_t)0x00000002U)
elmot 1:d0dfbce63a89 609 #define LL_RTC_BKP_DR3 ((uint32_t)0x00000003U)
elmot 1:d0dfbce63a89 610 #define LL_RTC_BKP_DR4 ((uint32_t)0x00000004U)
elmot 1:d0dfbce63a89 611 #if RTC_BKP_NUMBER > 5
elmot 1:d0dfbce63a89 612 #define LL_RTC_BKP_DR5 ((uint32_t)0x00000005U)
elmot 1:d0dfbce63a89 613 #define LL_RTC_BKP_DR6 ((uint32_t)0x00000006U)
elmot 1:d0dfbce63a89 614 #define LL_RTC_BKP_DR7 ((uint32_t)0x00000007U)
elmot 1:d0dfbce63a89 615 #define LL_RTC_BKP_DR8 ((uint32_t)0x00000008U)
elmot 1:d0dfbce63a89 616 #define LL_RTC_BKP_DR9 ((uint32_t)0x00000009U)
elmot 1:d0dfbce63a89 617 #define LL_RTC_BKP_DR10 ((uint32_t)0x0000000AU)
elmot 1:d0dfbce63a89 618 #define LL_RTC_BKP_DR11 ((uint32_t)0x0000000BU)
elmot 1:d0dfbce63a89 619 #define LL_RTC_BKP_DR12 ((uint32_t)0x0000000CU)
elmot 1:d0dfbce63a89 620 #define LL_RTC_BKP_DR13 ((uint32_t)0x0000000DU)
elmot 1:d0dfbce63a89 621 #define LL_RTC_BKP_DR14 ((uint32_t)0x0000000EU)
elmot 1:d0dfbce63a89 622 #define LL_RTC_BKP_DR15 ((uint32_t)0x0000000FU)
elmot 1:d0dfbce63a89 623 #endif /* RTC_BKP_NUMBER > 5 */
elmot 1:d0dfbce63a89 624
elmot 1:d0dfbce63a89 625 #if RTC_BKP_NUMBER > 16
elmot 1:d0dfbce63a89 626 #define LL_RTC_BKP_DR16 ((uint32_t)0x00000010U)
elmot 1:d0dfbce63a89 627 #define LL_RTC_BKP_DR17 ((uint32_t)0x00000011U)
elmot 1:d0dfbce63a89 628 #define LL_RTC_BKP_DR18 ((uint32_t)0x00000012U)
elmot 1:d0dfbce63a89 629 #define LL_RTC_BKP_DR19 ((uint32_t)0x00000013U)
elmot 1:d0dfbce63a89 630 #endif /* RTC_BKP_NUMBER > 16 */
elmot 1:d0dfbce63a89 631
elmot 1:d0dfbce63a89 632 #if RTC_BKP_NUMBER > 20
elmot 1:d0dfbce63a89 633 #define LL_RTC_BKP_DR20 ((uint32_t)0x00000014U)
elmot 1:d0dfbce63a89 634 #define LL_RTC_BKP_DR21 ((uint32_t)0x00000015U)
elmot 1:d0dfbce63a89 635 #define LL_RTC_BKP_DR22 ((uint32_t)0x00000016U)
elmot 1:d0dfbce63a89 636 #define LL_RTC_BKP_DR23 ((uint32_t)0x00000017U)
elmot 1:d0dfbce63a89 637 #define LL_RTC_BKP_DR24 ((uint32_t)0x00000018U)
elmot 1:d0dfbce63a89 638 #define LL_RTC_BKP_DR25 ((uint32_t)0x00000019U)
elmot 1:d0dfbce63a89 639 #define LL_RTC_BKP_DR26 ((uint32_t)0x0000001AU)
elmot 1:d0dfbce63a89 640 #define LL_RTC_BKP_DR27 ((uint32_t)0x0000001BU)
elmot 1:d0dfbce63a89 641 #define LL_RTC_BKP_DR28 ((uint32_t)0x0000001CU)
elmot 1:d0dfbce63a89 642 #define LL_RTC_BKP_DR29 ((uint32_t)0x0000001DU)
elmot 1:d0dfbce63a89 643 #define LL_RTC_BKP_DR30 ((uint32_t)0x0000001EU)
elmot 1:d0dfbce63a89 644 #define LL_RTC_BKP_DR31 ((uint32_t)0x0000001FU)
elmot 1:d0dfbce63a89 645 #endif /* RTC_BKP_NUMBER > 20 */
elmot 1:d0dfbce63a89 646 /**
elmot 1:d0dfbce63a89 647 * @}
elmot 1:d0dfbce63a89 648 */
elmot 1:d0dfbce63a89 649 #endif /* RTC_BACKUP_SUPPORT */
elmot 1:d0dfbce63a89 650
elmot 1:d0dfbce63a89 651 /** @defgroup RTC_LL_EC_CALIB_OUTPUT Calibration output
elmot 1:d0dfbce63a89 652 * @{
elmot 1:d0dfbce63a89 653 */
elmot 1:d0dfbce63a89 654 #define LL_RTC_CALIB_OUTPUT_NONE (uint32_t)0x00000000U /*!< Calibration output disabled */
elmot 1:d0dfbce63a89 655 #define LL_RTC_CALIB_OUTPUT_1HZ (RTC_CR_COE | RTC_CR_COSEL) /*!< Calibration output is 512 Hz */
elmot 1:d0dfbce63a89 656 #define LL_RTC_CALIB_OUTPUT_512HZ (RTC_CR_COE) /*!< Calibration output is 1 Hz */
elmot 1:d0dfbce63a89 657 /**
elmot 1:d0dfbce63a89 658 * @}
elmot 1:d0dfbce63a89 659 */
elmot 1:d0dfbce63a89 660
elmot 1:d0dfbce63a89 661 /** @defgroup RTC_LL_EC_CALIB_INSERTPULSE Calibration pulse insertion
elmot 1:d0dfbce63a89 662 * @{
elmot 1:d0dfbce63a89 663 */
elmot 1:d0dfbce63a89 664 #define LL_RTC_CALIB_INSERTPULSE_NONE (uint32_t)0x00000000U /*!< No RTCCLK pulses are added */
elmot 1:d0dfbce63a89 665 #define LL_RTC_CALIB_INSERTPULSE_SET RTC_CALR_CALP /*!< One RTCCLK pulse is effectively inserted every 2exp11 pulses (frequency increased by 488.5 ppm) */
elmot 1:d0dfbce63a89 666 /**
elmot 1:d0dfbce63a89 667 * @}
elmot 1:d0dfbce63a89 668 */
elmot 1:d0dfbce63a89 669
elmot 1:d0dfbce63a89 670 /** @defgroup RTC_LL_EC_CALIB_PERIOD Calibration period
elmot 1:d0dfbce63a89 671 * @{
elmot 1:d0dfbce63a89 672 */
elmot 1:d0dfbce63a89 673 #define LL_RTC_CALIB_PERIOD_32SEC (uint32_t)0x00000000U /*!< Use a 32-second calibration cycle period */
elmot 1:d0dfbce63a89 674 #define LL_RTC_CALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< Use a 16-second calibration cycle period */
elmot 1:d0dfbce63a89 675 #define LL_RTC_CALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< Use a 8-second calibration cycle period */
elmot 1:d0dfbce63a89 676 /**
elmot 1:d0dfbce63a89 677 * @}
elmot 1:d0dfbce63a89 678 */
elmot 1:d0dfbce63a89 679
elmot 1:d0dfbce63a89 680 /**
elmot 1:d0dfbce63a89 681 * @}
elmot 1:d0dfbce63a89 682 */
elmot 1:d0dfbce63a89 683
elmot 1:d0dfbce63a89 684 /* Exported macro ------------------------------------------------------------*/
elmot 1:d0dfbce63a89 685 /** @defgroup RTC_LL_Exported_Macros RTC Exported Macros
elmot 1:d0dfbce63a89 686 * @{
elmot 1:d0dfbce63a89 687 */
elmot 1:d0dfbce63a89 688
elmot 1:d0dfbce63a89 689 /** @defgroup RTC_LL_EM_WRITE_READ Common Write and read registers Macros
elmot 1:d0dfbce63a89 690 * @{
elmot 1:d0dfbce63a89 691 */
elmot 1:d0dfbce63a89 692
elmot 1:d0dfbce63a89 693 /**
elmot 1:d0dfbce63a89 694 * @brief Write a value in RTC register
elmot 1:d0dfbce63a89 695 * @param __INSTANCE__ RTC Instance
elmot 1:d0dfbce63a89 696 * @param __REG__ Register to be written
elmot 1:d0dfbce63a89 697 * @param __VALUE__ Value to be written in the register
elmot 1:d0dfbce63a89 698 * @retval None
elmot 1:d0dfbce63a89 699 */
elmot 1:d0dfbce63a89 700 #define LL_RTC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
elmot 1:d0dfbce63a89 701
elmot 1:d0dfbce63a89 702 /**
elmot 1:d0dfbce63a89 703 * @brief Read a value in RTC register
elmot 1:d0dfbce63a89 704 * @param __INSTANCE__ RTC Instance
elmot 1:d0dfbce63a89 705 * @param __REG__ Register to be read
elmot 1:d0dfbce63a89 706 * @retval Register value
elmot 1:d0dfbce63a89 707 */
elmot 1:d0dfbce63a89 708 #define LL_RTC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
elmot 1:d0dfbce63a89 709 /**
elmot 1:d0dfbce63a89 710 * @}
elmot 1:d0dfbce63a89 711 */
elmot 1:d0dfbce63a89 712
elmot 1:d0dfbce63a89 713 /** @defgroup RTC_LL_EM_Convert Convert helper Macros
elmot 1:d0dfbce63a89 714 * @{
elmot 1:d0dfbce63a89 715 */
elmot 1:d0dfbce63a89 716
elmot 1:d0dfbce63a89 717 /**
elmot 1:d0dfbce63a89 718 * @brief Helper macro to convert a value from 2 digit decimal format to BCD format
elmot 1:d0dfbce63a89 719 * @param __VALUE__ Byte to be converted
elmot 1:d0dfbce63a89 720 * @retval Converted byte
elmot 1:d0dfbce63a89 721 */
elmot 1:d0dfbce63a89 722 #define __LL_RTC_CONVERT_BIN2BCD(__VALUE__) (uint8_t)((((__VALUE__) / 10U) << 4U) | ((__VALUE__) % 10U))
elmot 1:d0dfbce63a89 723
elmot 1:d0dfbce63a89 724 /**
elmot 1:d0dfbce63a89 725 * @brief Helper macro to convert a value from BCD format to 2 digit decimal format
elmot 1:d0dfbce63a89 726 * @param __VALUE__ BCD value to be converted
elmot 1:d0dfbce63a89 727 * @retval Converted byte
elmot 1:d0dfbce63a89 728 */
elmot 1:d0dfbce63a89 729 #define __LL_RTC_CONVERT_BCD2BIN(__VALUE__) (uint8_t)(((uint8_t)((__VALUE__) & (uint8_t)0xF0U) >> (uint8_t)0x4U) * 10U + ((__VALUE__) & (uint8_t)0x0FU))
elmot 1:d0dfbce63a89 730
elmot 1:d0dfbce63a89 731 /**
elmot 1:d0dfbce63a89 732 * @}
elmot 1:d0dfbce63a89 733 */
elmot 1:d0dfbce63a89 734
elmot 1:d0dfbce63a89 735 /** @defgroup RTC_LL_EM_Date Date helper Macros
elmot 1:d0dfbce63a89 736 * @{
elmot 1:d0dfbce63a89 737 */
elmot 1:d0dfbce63a89 738
elmot 1:d0dfbce63a89 739 /**
elmot 1:d0dfbce63a89 740 * @brief Helper macro to retrieve weekday.
elmot 1:d0dfbce63a89 741 * @param __RTC_DATE__ Date returned by @ref LL_RTC_DATE_Get function.
elmot 1:d0dfbce63a89 742 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 743 * @arg @ref LL_RTC_WEEKDAY_MONDAY
elmot 1:d0dfbce63a89 744 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
elmot 1:d0dfbce63a89 745 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
elmot 1:d0dfbce63a89 746 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
elmot 1:d0dfbce63a89 747 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
elmot 1:d0dfbce63a89 748 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
elmot 1:d0dfbce63a89 749 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
elmot 1:d0dfbce63a89 750 */
elmot 1:d0dfbce63a89 751 #define __LL_RTC_GET_WEEKDAY(__RTC_DATE__) (((__RTC_DATE__) >> RTC_OFFSET_WEEKDAY) & 0x000000FFU)
elmot 1:d0dfbce63a89 752
elmot 1:d0dfbce63a89 753 /**
elmot 1:d0dfbce63a89 754 * @brief Helper macro to retrieve Year in BCD format
elmot 1:d0dfbce63a89 755 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
elmot 1:d0dfbce63a89 756 * @retval Year in BCD format (0x00 . . . 0x99)
elmot 1:d0dfbce63a89 757 */
elmot 1:d0dfbce63a89 758 #define __LL_RTC_GET_YEAR(__RTC_DATE__) ((__RTC_DATE__) & 0x000000FFU)
elmot 1:d0dfbce63a89 759
elmot 1:d0dfbce63a89 760 /**
elmot 1:d0dfbce63a89 761 * @brief Helper macro to retrieve Month in BCD format
elmot 1:d0dfbce63a89 762 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
elmot 1:d0dfbce63a89 763 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 764 * @arg @ref LL_RTC_MONTH_JANUARY
elmot 1:d0dfbce63a89 765 * @arg @ref LL_RTC_MONTH_FEBRUARY
elmot 1:d0dfbce63a89 766 * @arg @ref LL_RTC_MONTH_MARCH
elmot 1:d0dfbce63a89 767 * @arg @ref LL_RTC_MONTH_APRIL
elmot 1:d0dfbce63a89 768 * @arg @ref LL_RTC_MONTH_MAY
elmot 1:d0dfbce63a89 769 * @arg @ref LL_RTC_MONTH_JUNE
elmot 1:d0dfbce63a89 770 * @arg @ref LL_RTC_MONTH_JULY
elmot 1:d0dfbce63a89 771 * @arg @ref LL_RTC_MONTH_AUGUST
elmot 1:d0dfbce63a89 772 * @arg @ref LL_RTC_MONTH_SEPTEMBER
elmot 1:d0dfbce63a89 773 * @arg @ref LL_RTC_MONTH_OCTOBER
elmot 1:d0dfbce63a89 774 * @arg @ref LL_RTC_MONTH_NOVEMBER
elmot 1:d0dfbce63a89 775 * @arg @ref LL_RTC_MONTH_DECEMBER
elmot 1:d0dfbce63a89 776 */
elmot 1:d0dfbce63a89 777 #define __LL_RTC_GET_MONTH(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_MONTH) & 0x000000FFU)
elmot 1:d0dfbce63a89 778
elmot 1:d0dfbce63a89 779 /**
elmot 1:d0dfbce63a89 780 * @brief Helper macro to retrieve Day in BCD format
elmot 1:d0dfbce63a89 781 * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
elmot 1:d0dfbce63a89 782 * @retval Day in BCD format (0x01 . . . 0x31)
elmot 1:d0dfbce63a89 783 */
elmot 1:d0dfbce63a89 784 #define __LL_RTC_GET_DAY(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_DAY) & 0x000000FFU)
elmot 1:d0dfbce63a89 785
elmot 1:d0dfbce63a89 786 /**
elmot 1:d0dfbce63a89 787 * @}
elmot 1:d0dfbce63a89 788 */
elmot 1:d0dfbce63a89 789
elmot 1:d0dfbce63a89 790 /** @defgroup RTC_LL_EM_Time Time helper Macros
elmot 1:d0dfbce63a89 791 * @{
elmot 1:d0dfbce63a89 792 */
elmot 1:d0dfbce63a89 793
elmot 1:d0dfbce63a89 794 /**
elmot 1:d0dfbce63a89 795 * @brief Helper macro to retrieve hour in BCD format
elmot 1:d0dfbce63a89 796 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
elmot 1:d0dfbce63a89 797 * @retval Hours in BCD format (0x01. . .0x12 or between Min_Data=0x00 and Max_Data=0x23)
elmot 1:d0dfbce63a89 798 */
elmot 1:d0dfbce63a89 799 #define __LL_RTC_GET_HOUR(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_HOUR) & 0x000000FFU)
elmot 1:d0dfbce63a89 800
elmot 1:d0dfbce63a89 801 /**
elmot 1:d0dfbce63a89 802 * @brief Helper macro to retrieve minute in BCD format
elmot 1:d0dfbce63a89 803 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
elmot 1:d0dfbce63a89 804 * @retval Minutes in BCD format (0x00. . .0x59)
elmot 1:d0dfbce63a89 805 */
elmot 1:d0dfbce63a89 806 #define __LL_RTC_GET_MINUTE(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_MINUTE) & 0x000000FFU)
elmot 1:d0dfbce63a89 807
elmot 1:d0dfbce63a89 808 /**
elmot 1:d0dfbce63a89 809 * @brief Helper macro to retrieve second in BCD format
elmot 1:d0dfbce63a89 810 * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
elmot 1:d0dfbce63a89 811 * @retval Seconds in format (0x00. . .0x59)
elmot 1:d0dfbce63a89 812 */
elmot 1:d0dfbce63a89 813 #define __LL_RTC_GET_SECOND(__RTC_TIME__) ((__RTC_TIME__) & 0x000000FFU)
elmot 1:d0dfbce63a89 814
elmot 1:d0dfbce63a89 815 /**
elmot 1:d0dfbce63a89 816 * @}
elmot 1:d0dfbce63a89 817 */
elmot 1:d0dfbce63a89 818
elmot 1:d0dfbce63a89 819 /**
elmot 1:d0dfbce63a89 820 * @}
elmot 1:d0dfbce63a89 821 */
elmot 1:d0dfbce63a89 822
elmot 1:d0dfbce63a89 823 /* Exported functions --------------------------------------------------------*/
elmot 1:d0dfbce63a89 824 /** @defgroup RTC_LL_Exported_Functions RTC Exported Functions
elmot 1:d0dfbce63a89 825 * @{
elmot 1:d0dfbce63a89 826 */
elmot 1:d0dfbce63a89 827
elmot 1:d0dfbce63a89 828 /** @defgroup RTC_LL_EF_Configuration Configuration
elmot 1:d0dfbce63a89 829 * @{
elmot 1:d0dfbce63a89 830 */
elmot 1:d0dfbce63a89 831
elmot 1:d0dfbce63a89 832 /**
elmot 1:d0dfbce63a89 833 * @brief Set Hours format (24 hour/day or AM/PM hour format)
elmot 1:d0dfbce63a89 834 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 835 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
elmot 1:d0dfbce63a89 836 * @rmtoll CR FMT LL_RTC_SetHourFormat
elmot 1:d0dfbce63a89 837 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 838 * @param HourFormat This parameter can be one of the following values:
elmot 1:d0dfbce63a89 839 * @arg @ref LL_RTC_HOURFORMAT_24HOUR
elmot 1:d0dfbce63a89 840 * @arg @ref LL_RTC_HOURFORMAT_AMPM
elmot 1:d0dfbce63a89 841 * @retval None
elmot 1:d0dfbce63a89 842 */
elmot 1:d0dfbce63a89 843 __STATIC_INLINE void LL_RTC_SetHourFormat(RTC_TypeDef *RTCx, uint32_t HourFormat)
elmot 1:d0dfbce63a89 844 {
elmot 1:d0dfbce63a89 845 MODIFY_REG(RTCx->CR, RTC_CR_FMT, HourFormat);
elmot 1:d0dfbce63a89 846 }
elmot 1:d0dfbce63a89 847
elmot 1:d0dfbce63a89 848 /**
elmot 1:d0dfbce63a89 849 * @brief Get Hours format (24 hour/day or AM/PM hour format)
elmot 1:d0dfbce63a89 850 * @rmtoll CR FMT LL_RTC_GetHourFormat
elmot 1:d0dfbce63a89 851 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 852 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 853 * @arg @ref LL_RTC_HOURFORMAT_24HOUR
elmot 1:d0dfbce63a89 854 * @arg @ref LL_RTC_HOURFORMAT_AMPM
elmot 1:d0dfbce63a89 855 */
elmot 1:d0dfbce63a89 856 __STATIC_INLINE uint32_t LL_RTC_GetHourFormat(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 857 {
elmot 1:d0dfbce63a89 858 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_FMT));
elmot 1:d0dfbce63a89 859 }
elmot 1:d0dfbce63a89 860
elmot 1:d0dfbce63a89 861 /**
elmot 1:d0dfbce63a89 862 * @brief Select the flag to be routed to RTC_ALARM output
elmot 1:d0dfbce63a89 863 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 864 * @rmtoll CR OSEL LL_RTC_SetAlarmOutEvent
elmot 1:d0dfbce63a89 865 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 866 * @param AlarmOutput This parameter can be one of the following values:
elmot 1:d0dfbce63a89 867 * @arg @ref LL_RTC_ALARMOUT_DISABLE
elmot 1:d0dfbce63a89 868 * @arg @ref LL_RTC_ALARMOUT_ALMA
elmot 1:d0dfbce63a89 869 * @arg @ref LL_RTC_ALARMOUT_ALMB
elmot 1:d0dfbce63a89 870 * @arg @ref LL_RTC_ALARMOUT_WAKEUP
elmot 1:d0dfbce63a89 871 * @retval None
elmot 1:d0dfbce63a89 872 */
elmot 1:d0dfbce63a89 873 __STATIC_INLINE void LL_RTC_SetAlarmOutEvent(RTC_TypeDef *RTCx, uint32_t AlarmOutput)
elmot 1:d0dfbce63a89 874 {
elmot 1:d0dfbce63a89 875 MODIFY_REG(RTCx->CR, RTC_CR_OSEL, AlarmOutput);
elmot 1:d0dfbce63a89 876 }
elmot 1:d0dfbce63a89 877
elmot 1:d0dfbce63a89 878 /**
elmot 1:d0dfbce63a89 879 * @brief Get the flag to be routed to RTC_ALARM output
elmot 1:d0dfbce63a89 880 * @rmtoll CR OSEL LL_RTC_GetAlarmOutEvent
elmot 1:d0dfbce63a89 881 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 882 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 883 * @arg @ref LL_RTC_ALARMOUT_DISABLE
elmot 1:d0dfbce63a89 884 * @arg @ref LL_RTC_ALARMOUT_ALMA
elmot 1:d0dfbce63a89 885 * @arg @ref LL_RTC_ALARMOUT_ALMB
elmot 1:d0dfbce63a89 886 * @arg @ref LL_RTC_ALARMOUT_WAKEUP
elmot 1:d0dfbce63a89 887 */
elmot 1:d0dfbce63a89 888 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutEvent(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 889 {
elmot 1:d0dfbce63a89 890 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_OSEL));
elmot 1:d0dfbce63a89 891 }
elmot 1:d0dfbce63a89 892
elmot 1:d0dfbce63a89 893 /**
elmot 1:d0dfbce63a89 894 * @brief Set RTC_ALARM output type (ALARM in push-pull or open-drain output)
elmot 1:d0dfbce63a89 895 * @note Used only when RTC_ALARM is mapped on PC13
elmot 1:d0dfbce63a89 896 * @rmtoll OR ALARMOUTTYPE LL_RTC_SetAlarmOutputType
elmot 1:d0dfbce63a89 897 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 898 * @param Output This parameter can be one of the following values:
elmot 1:d0dfbce63a89 899 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
elmot 1:d0dfbce63a89 900 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
elmot 1:d0dfbce63a89 901 * @retval None
elmot 1:d0dfbce63a89 902 */
elmot 1:d0dfbce63a89 903 __STATIC_INLINE void LL_RTC_SetAlarmOutputType(RTC_TypeDef *RTCx, uint32_t Output)
elmot 1:d0dfbce63a89 904 {
elmot 1:d0dfbce63a89 905 MODIFY_REG(RTCx->OR, RTC_OR_ALARMOUTTYPE, Output);
elmot 1:d0dfbce63a89 906 }
elmot 1:d0dfbce63a89 907
elmot 1:d0dfbce63a89 908 /**
elmot 1:d0dfbce63a89 909 * @brief Get RTC_ALARM output type (ALARM in push-pull or open-drain output)
elmot 1:d0dfbce63a89 910 * @note used only when RTC_ALARM is mapped on PC13
elmot 1:d0dfbce63a89 911 * @rmtoll OR ALARMOUTTYPE LL_RTC_GetAlarmOutputType
elmot 1:d0dfbce63a89 912 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 913 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 914 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
elmot 1:d0dfbce63a89 915 * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
elmot 1:d0dfbce63a89 916 */
elmot 1:d0dfbce63a89 917 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutputType(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 918 {
elmot 1:d0dfbce63a89 919 return (uint32_t)(READ_BIT(RTCx->OR, RTC_OR_ALARMOUTTYPE));
elmot 1:d0dfbce63a89 920 }
elmot 1:d0dfbce63a89 921
elmot 1:d0dfbce63a89 922 /**
elmot 1:d0dfbce63a89 923 * @brief Enable initialization mode
elmot 1:d0dfbce63a89 924 * @note Initialization mode is used to program time and date register (RTC_TR and RTC_DR)
elmot 1:d0dfbce63a89 925 * and prescaler register (RTC_PRER).
elmot 1:d0dfbce63a89 926 * Counters are stopped and start counting from the new value when INIT is reset.
elmot 1:d0dfbce63a89 927 * @rmtoll ISR INIT LL_RTC_EnableInitMode
elmot 1:d0dfbce63a89 928 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 929 * @retval None
elmot 1:d0dfbce63a89 930 */
elmot 1:d0dfbce63a89 931 __STATIC_INLINE void LL_RTC_EnableInitMode(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 932 {
elmot 1:d0dfbce63a89 933 /* Set the Initialization mode */
elmot 1:d0dfbce63a89 934 WRITE_REG(RTCx->ISR, RTC_INIT_MASK);
elmot 1:d0dfbce63a89 935 }
elmot 1:d0dfbce63a89 936
elmot 1:d0dfbce63a89 937 /**
elmot 1:d0dfbce63a89 938 * @brief Disable initialization mode (Free running mode)
elmot 1:d0dfbce63a89 939 * @rmtoll ISR INIT LL_RTC_DisableInitMode
elmot 1:d0dfbce63a89 940 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 941 * @retval None
elmot 1:d0dfbce63a89 942 */
elmot 1:d0dfbce63a89 943 __STATIC_INLINE void LL_RTC_DisableInitMode(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 944 {
elmot 1:d0dfbce63a89 945 /* Exit Initialization mode */
elmot 1:d0dfbce63a89 946 WRITE_REG(RTCx->ISR, (uint32_t)~RTC_ISR_INIT);
elmot 1:d0dfbce63a89 947 }
elmot 1:d0dfbce63a89 948
elmot 1:d0dfbce63a89 949 /**
elmot 1:d0dfbce63a89 950 * @brief Set Output polarity (pin is low when ALRAF/ALRBF/WUTF is asserted)
elmot 1:d0dfbce63a89 951 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 952 * @rmtoll CR POL LL_RTC_SetOutputPolarity
elmot 1:d0dfbce63a89 953 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 954 * @param Polarity This parameter can be one of the following values:
elmot 1:d0dfbce63a89 955 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
elmot 1:d0dfbce63a89 956 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
elmot 1:d0dfbce63a89 957 * @retval None
elmot 1:d0dfbce63a89 958 */
elmot 1:d0dfbce63a89 959 __STATIC_INLINE void LL_RTC_SetOutputPolarity(RTC_TypeDef *RTCx, uint32_t Polarity)
elmot 1:d0dfbce63a89 960 {
elmot 1:d0dfbce63a89 961 MODIFY_REG(RTCx->CR, RTC_CR_POL, Polarity);
elmot 1:d0dfbce63a89 962 }
elmot 1:d0dfbce63a89 963
elmot 1:d0dfbce63a89 964 /**
elmot 1:d0dfbce63a89 965 * @brief Get Output polarity
elmot 1:d0dfbce63a89 966 * @rmtoll CR POL LL_RTC_GetOutputPolarity
elmot 1:d0dfbce63a89 967 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 968 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 969 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
elmot 1:d0dfbce63a89 970 * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
elmot 1:d0dfbce63a89 971 */
elmot 1:d0dfbce63a89 972 __STATIC_INLINE uint32_t LL_RTC_GetOutputPolarity(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 973 {
elmot 1:d0dfbce63a89 974 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_POL));
elmot 1:d0dfbce63a89 975 }
elmot 1:d0dfbce63a89 976
elmot 1:d0dfbce63a89 977 /**
elmot 1:d0dfbce63a89 978 * @brief Enable Bypass the shadow registers
elmot 1:d0dfbce63a89 979 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 980 * @rmtoll CR BYPSHAD LL_RTC_EnableShadowRegBypass
elmot 1:d0dfbce63a89 981 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 982 * @retval None
elmot 1:d0dfbce63a89 983 */
elmot 1:d0dfbce63a89 984 __STATIC_INLINE void LL_RTC_EnableShadowRegBypass(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 985 {
elmot 1:d0dfbce63a89 986 SET_BIT(RTCx->CR, RTC_CR_BYPSHAD);
elmot 1:d0dfbce63a89 987 }
elmot 1:d0dfbce63a89 988
elmot 1:d0dfbce63a89 989 /**
elmot 1:d0dfbce63a89 990 * @brief Disable Bypass the shadow registers
elmot 1:d0dfbce63a89 991 * @rmtoll CR BYPSHAD LL_RTC_DisableShadowRegBypass
elmot 1:d0dfbce63a89 992 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 993 * @retval None
elmot 1:d0dfbce63a89 994 */
elmot 1:d0dfbce63a89 995 __STATIC_INLINE void LL_RTC_DisableShadowRegBypass(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 996 {
elmot 1:d0dfbce63a89 997 CLEAR_BIT(RTCx->CR, RTC_CR_BYPSHAD);
elmot 1:d0dfbce63a89 998 }
elmot 1:d0dfbce63a89 999
elmot 1:d0dfbce63a89 1000 /**
elmot 1:d0dfbce63a89 1001 * @brief Check if Shadow registers bypass is enabled or not.
elmot 1:d0dfbce63a89 1002 * @rmtoll CR BYPSHAD LL_RTC_IsShadowRegBypassEnabled
elmot 1:d0dfbce63a89 1003 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1004 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 1005 */
elmot 1:d0dfbce63a89 1006 __STATIC_INLINE uint32_t LL_RTC_IsShadowRegBypassEnabled(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1007 {
elmot 1:d0dfbce63a89 1008 return (READ_BIT(RTCx->CR, RTC_CR_BYPSHAD) == (RTC_CR_BYPSHAD));
elmot 1:d0dfbce63a89 1009 }
elmot 1:d0dfbce63a89 1010
elmot 1:d0dfbce63a89 1011 /**
elmot 1:d0dfbce63a89 1012 * @brief Enable RTC_REFIN reference clock detection (50 or 60 Hz)
elmot 1:d0dfbce63a89 1013 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 1014 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
elmot 1:d0dfbce63a89 1015 * @rmtoll CR REFCKON LL_RTC_EnableRefClock
elmot 1:d0dfbce63a89 1016 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1017 * @retval None
elmot 1:d0dfbce63a89 1018 */
elmot 1:d0dfbce63a89 1019 __STATIC_INLINE void LL_RTC_EnableRefClock(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1020 {
elmot 1:d0dfbce63a89 1021 SET_BIT(RTCx->CR, RTC_CR_REFCKON);
elmot 1:d0dfbce63a89 1022 }
elmot 1:d0dfbce63a89 1023
elmot 1:d0dfbce63a89 1024 /**
elmot 1:d0dfbce63a89 1025 * @brief Disable RTC_REFIN reference clock detection (50 or 60 Hz)
elmot 1:d0dfbce63a89 1026 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 1027 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
elmot 1:d0dfbce63a89 1028 * @rmtoll CR REFCKON LL_RTC_DisableRefClock
elmot 1:d0dfbce63a89 1029 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1030 * @retval None
elmot 1:d0dfbce63a89 1031 */
elmot 1:d0dfbce63a89 1032 __STATIC_INLINE void LL_RTC_DisableRefClock(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1033 {
elmot 1:d0dfbce63a89 1034 CLEAR_BIT(RTCx->CR, RTC_CR_REFCKON);
elmot 1:d0dfbce63a89 1035 }
elmot 1:d0dfbce63a89 1036
elmot 1:d0dfbce63a89 1037 /**
elmot 1:d0dfbce63a89 1038 * @brief Set Asynchronous prescaler factor
elmot 1:d0dfbce63a89 1039 * @rmtoll PRER PREDIV_A LL_RTC_SetAsynchPrescaler
elmot 1:d0dfbce63a89 1040 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1041 * @param AsynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7F
elmot 1:d0dfbce63a89 1042 * @retval None
elmot 1:d0dfbce63a89 1043 */
elmot 1:d0dfbce63a89 1044 __STATIC_INLINE void LL_RTC_SetAsynchPrescaler(RTC_TypeDef *RTCx, uint32_t AsynchPrescaler)
elmot 1:d0dfbce63a89 1045 {
elmot 1:d0dfbce63a89 1046 MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_A, AsynchPrescaler << RTC_POSITION_PRER_PREDIV_A);
elmot 1:d0dfbce63a89 1047 }
elmot 1:d0dfbce63a89 1048
elmot 1:d0dfbce63a89 1049 /**
elmot 1:d0dfbce63a89 1050 * @brief Set Synchronous prescaler factor
elmot 1:d0dfbce63a89 1051 * @rmtoll PRER PREDIV_S LL_RTC_SetSynchPrescaler
elmot 1:d0dfbce63a89 1052 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1053 * @param SynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7FFF
elmot 1:d0dfbce63a89 1054 * @retval None
elmot 1:d0dfbce63a89 1055 */
elmot 1:d0dfbce63a89 1056 __STATIC_INLINE void LL_RTC_SetSynchPrescaler(RTC_TypeDef *RTCx, uint32_t SynchPrescaler)
elmot 1:d0dfbce63a89 1057 {
elmot 1:d0dfbce63a89 1058 MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_S, SynchPrescaler);
elmot 1:d0dfbce63a89 1059 }
elmot 1:d0dfbce63a89 1060
elmot 1:d0dfbce63a89 1061 /**
elmot 1:d0dfbce63a89 1062 * @brief Get Asynchronous prescaler factor
elmot 1:d0dfbce63a89 1063 * @rmtoll PRER PREDIV_A LL_RTC_GetAsynchPrescaler
elmot 1:d0dfbce63a89 1064 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1065 * @retval Value between Min_Data = 0 and Max_Data = 0x7F
elmot 1:d0dfbce63a89 1066 */
elmot 1:d0dfbce63a89 1067 __STATIC_INLINE uint32_t LL_RTC_GetAsynchPrescaler(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1068 {
elmot 1:d0dfbce63a89 1069 return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_A) >> RTC_POSITION_PRER_PREDIV_A);
elmot 1:d0dfbce63a89 1070 }
elmot 1:d0dfbce63a89 1071
elmot 1:d0dfbce63a89 1072 /**
elmot 1:d0dfbce63a89 1073 * @brief Get Synchronous prescaler factor
elmot 1:d0dfbce63a89 1074 * @rmtoll PRER PREDIV_S LL_RTC_GetSynchPrescaler
elmot 1:d0dfbce63a89 1075 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1076 * @retval Value between Min_Data = 0 and Max_Data = 0x7FFF
elmot 1:d0dfbce63a89 1077 */
elmot 1:d0dfbce63a89 1078 __STATIC_INLINE uint32_t LL_RTC_GetSynchPrescaler(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1079 {
elmot 1:d0dfbce63a89 1080 return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_S));
elmot 1:d0dfbce63a89 1081 }
elmot 1:d0dfbce63a89 1082
elmot 1:d0dfbce63a89 1083 /**
elmot 1:d0dfbce63a89 1084 * @brief Enable the write protection for RTC registers.
elmot 1:d0dfbce63a89 1085 * @rmtoll WPR KEY LL_RTC_EnableWriteProtection
elmot 1:d0dfbce63a89 1086 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1087 * @retval None
elmot 1:d0dfbce63a89 1088 */
elmot 1:d0dfbce63a89 1089 __STATIC_INLINE void LL_RTC_EnableWriteProtection(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1090 {
elmot 1:d0dfbce63a89 1091 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_DISABLE);
elmot 1:d0dfbce63a89 1092 }
elmot 1:d0dfbce63a89 1093
elmot 1:d0dfbce63a89 1094 /**
elmot 1:d0dfbce63a89 1095 * @brief Disable the write protection for RTC registers.
elmot 1:d0dfbce63a89 1096 * @rmtoll WPR KEY LL_RTC_DisableWriteProtection
elmot 1:d0dfbce63a89 1097 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1098 * @retval None
elmot 1:d0dfbce63a89 1099 */
elmot 1:d0dfbce63a89 1100 __STATIC_INLINE void LL_RTC_DisableWriteProtection(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1101 {
elmot 1:d0dfbce63a89 1102 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_1);
elmot 1:d0dfbce63a89 1103 WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_2);
elmot 1:d0dfbce63a89 1104 }
elmot 1:d0dfbce63a89 1105
elmot 1:d0dfbce63a89 1106 /**
elmot 1:d0dfbce63a89 1107 * @brief Enable RTC_OUT remap
elmot 1:d0dfbce63a89 1108 * @rmtoll OR OUT_RMP LL_RTC_EnableOutRemap
elmot 1:d0dfbce63a89 1109 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1110 * @retval None
elmot 1:d0dfbce63a89 1111 */
elmot 1:d0dfbce63a89 1112 __STATIC_INLINE void LL_RTC_EnableOutRemap(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1113 {
elmot 1:d0dfbce63a89 1114 SET_BIT(RTCx->OR, RTC_OR_OUT_RMP);
elmot 1:d0dfbce63a89 1115 }
elmot 1:d0dfbce63a89 1116
elmot 1:d0dfbce63a89 1117 /**
elmot 1:d0dfbce63a89 1118 * @brief Disable RTC_OUT remap
elmot 1:d0dfbce63a89 1119 * @rmtoll OR OUT_RMP LL_RTC_DisableOutRemap
elmot 1:d0dfbce63a89 1120 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1121 * @retval None
elmot 1:d0dfbce63a89 1122 */
elmot 1:d0dfbce63a89 1123 __STATIC_INLINE void LL_RTC_DisableOutRemap(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1124 {
elmot 1:d0dfbce63a89 1125 CLEAR_BIT(RTCx->OR, RTC_OR_OUT_RMP);
elmot 1:d0dfbce63a89 1126 }
elmot 1:d0dfbce63a89 1127
elmot 1:d0dfbce63a89 1128 /**
elmot 1:d0dfbce63a89 1129 * @}
elmot 1:d0dfbce63a89 1130 */
elmot 1:d0dfbce63a89 1131
elmot 1:d0dfbce63a89 1132 /** @defgroup RTC_LL_EF_Time Time
elmot 1:d0dfbce63a89 1133 * @{
elmot 1:d0dfbce63a89 1134 */
elmot 1:d0dfbce63a89 1135
elmot 1:d0dfbce63a89 1136 /**
elmot 1:d0dfbce63a89 1137 * @brief Set time format (AM/24-hour or PM notation)
elmot 1:d0dfbce63a89 1138 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 1139 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
elmot 1:d0dfbce63a89 1140 * @rmtoll TR PM LL_RTC_TIME_SetFormat
elmot 1:d0dfbce63a89 1141 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1142 * @param TimeFormat This parameter can be one of the following values:
elmot 1:d0dfbce63a89 1143 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
elmot 1:d0dfbce63a89 1144 * @arg @ref LL_RTC_TIME_FORMAT_PM
elmot 1:d0dfbce63a89 1145 * @retval None
elmot 1:d0dfbce63a89 1146 */
elmot 1:d0dfbce63a89 1147 __STATIC_INLINE void LL_RTC_TIME_SetFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
elmot 1:d0dfbce63a89 1148 {
elmot 1:d0dfbce63a89 1149 MODIFY_REG(RTCx->TR, RTC_TR_PM, TimeFormat);
elmot 1:d0dfbce63a89 1150 }
elmot 1:d0dfbce63a89 1151
elmot 1:d0dfbce63a89 1152 /**
elmot 1:d0dfbce63a89 1153 * @brief Get time format (AM or PM notation)
elmot 1:d0dfbce63a89 1154 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
elmot 1:d0dfbce63a89 1155 * before reading this bit
elmot 1:d0dfbce63a89 1156 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
elmot 1:d0dfbce63a89 1157 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
elmot 1:d0dfbce63a89 1158 * @rmtoll TR PM LL_RTC_TIME_GetFormat
elmot 1:d0dfbce63a89 1159 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1160 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 1161 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
elmot 1:d0dfbce63a89 1162 * @arg @ref LL_RTC_TIME_FORMAT_PM
elmot 1:d0dfbce63a89 1163 */
elmot 1:d0dfbce63a89 1164 __STATIC_INLINE uint32_t LL_RTC_TIME_GetFormat(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1165 {
elmot 1:d0dfbce63a89 1166 return (uint32_t)(READ_BIT(RTCx->TR, RTC_TR_PM));
elmot 1:d0dfbce63a89 1167 }
elmot 1:d0dfbce63a89 1168
elmot 1:d0dfbce63a89 1169 /**
elmot 1:d0dfbce63a89 1170 * @brief Set Hours in BCD format
elmot 1:d0dfbce63a89 1171 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 1172 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
elmot 1:d0dfbce63a89 1173 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert hour from binary to BCD format
elmot 1:d0dfbce63a89 1174 * @rmtoll TR HT LL_RTC_TIME_SetHour\n
elmot 1:d0dfbce63a89 1175 * TR HU LL_RTC_TIME_SetHour
elmot 1:d0dfbce63a89 1176 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1177 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
elmot 1:d0dfbce63a89 1178 * @retval None
elmot 1:d0dfbce63a89 1179 */
elmot 1:d0dfbce63a89 1180 __STATIC_INLINE void LL_RTC_TIME_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
elmot 1:d0dfbce63a89 1181 {
elmot 1:d0dfbce63a89 1182 MODIFY_REG(RTCx->TR, (RTC_TR_HT | RTC_TR_HU),
elmot 1:d0dfbce63a89 1183 (((Hours & 0xF0U) << (RTC_POSITION_TR_HT - 4U)) | ((Hours & 0x0FU) << RTC_POSITION_TR_HU)));
elmot 1:d0dfbce63a89 1184 }
elmot 1:d0dfbce63a89 1185
elmot 1:d0dfbce63a89 1186 /**
elmot 1:d0dfbce63a89 1187 * @brief Get Hours in BCD format
elmot 1:d0dfbce63a89 1188 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
elmot 1:d0dfbce63a89 1189 * before reading this bit
elmot 1:d0dfbce63a89 1190 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
elmot 1:d0dfbce63a89 1191 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
elmot 1:d0dfbce63a89 1192 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert hour from BCD to
elmot 1:d0dfbce63a89 1193 * Binary format
elmot 1:d0dfbce63a89 1194 * @rmtoll TR HT LL_RTC_TIME_GetHour\n
elmot 1:d0dfbce63a89 1195 * TR HU LL_RTC_TIME_GetHour
elmot 1:d0dfbce63a89 1196 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1197 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
elmot 1:d0dfbce63a89 1198 */
elmot 1:d0dfbce63a89 1199 __STATIC_INLINE uint32_t LL_RTC_TIME_GetHour(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1200 {
elmot 1:d0dfbce63a89 1201 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 1202
elmot 1:d0dfbce63a89 1203 temp = READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU));
elmot 1:d0dfbce63a89 1204 return (uint32_t)((((temp & RTC_TR_HT) >> RTC_POSITION_TR_HT) << 4U) | ((temp & RTC_TR_HU) >> RTC_POSITION_TR_HU));
elmot 1:d0dfbce63a89 1205 }
elmot 1:d0dfbce63a89 1206
elmot 1:d0dfbce63a89 1207 /**
elmot 1:d0dfbce63a89 1208 * @brief Set Minutes in BCD format
elmot 1:d0dfbce63a89 1209 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 1210 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
elmot 1:d0dfbce63a89 1211 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
elmot 1:d0dfbce63a89 1212 * @rmtoll TR MNT LL_RTC_TIME_SetMinute\n
elmot 1:d0dfbce63a89 1213 * TR MNU LL_RTC_TIME_SetMinute
elmot 1:d0dfbce63a89 1214 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1215 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 1216 * @retval None
elmot 1:d0dfbce63a89 1217 */
elmot 1:d0dfbce63a89 1218 __STATIC_INLINE void LL_RTC_TIME_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
elmot 1:d0dfbce63a89 1219 {
elmot 1:d0dfbce63a89 1220 MODIFY_REG(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU),
elmot 1:d0dfbce63a89 1221 (((Minutes & 0xF0U) << (RTC_POSITION_TR_MT - 4U)) | ((Minutes & 0x0FU) << RTC_POSITION_TR_MU)));
elmot 1:d0dfbce63a89 1222 }
elmot 1:d0dfbce63a89 1223
elmot 1:d0dfbce63a89 1224 /**
elmot 1:d0dfbce63a89 1225 * @brief Get Minutes in BCD format
elmot 1:d0dfbce63a89 1226 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
elmot 1:d0dfbce63a89 1227 * before reading this bit
elmot 1:d0dfbce63a89 1228 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
elmot 1:d0dfbce63a89 1229 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
elmot 1:d0dfbce63a89 1230 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert minute from BCD
elmot 1:d0dfbce63a89 1231 * to Binary format
elmot 1:d0dfbce63a89 1232 * @rmtoll TR MNT LL_RTC_TIME_GetMinute\n
elmot 1:d0dfbce63a89 1233 * TR MNU LL_RTC_TIME_GetMinute
elmot 1:d0dfbce63a89 1234 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1235 * @retval Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 1236 */
elmot 1:d0dfbce63a89 1237 __STATIC_INLINE uint32_t LL_RTC_TIME_GetMinute(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1238 {
elmot 1:d0dfbce63a89 1239 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 1240
elmot 1:d0dfbce63a89 1241 temp = READ_BIT(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU));
elmot 1:d0dfbce63a89 1242 return (uint32_t)((((temp & RTC_TR_MNT) >> RTC_POSITION_TR_MT) << 4U) | ((temp & RTC_TR_MNU) >> RTC_POSITION_TR_MU));
elmot 1:d0dfbce63a89 1243 }
elmot 1:d0dfbce63a89 1244
elmot 1:d0dfbce63a89 1245 /**
elmot 1:d0dfbce63a89 1246 * @brief Set Seconds in BCD format
elmot 1:d0dfbce63a89 1247 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 1248 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
elmot 1:d0dfbce63a89 1249 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
elmot 1:d0dfbce63a89 1250 * @rmtoll TR ST LL_RTC_TIME_SetSecond\n
elmot 1:d0dfbce63a89 1251 * TR SU LL_RTC_TIME_SetSecond
elmot 1:d0dfbce63a89 1252 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1253 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 1254 * @retval None
elmot 1:d0dfbce63a89 1255 */
elmot 1:d0dfbce63a89 1256 __STATIC_INLINE void LL_RTC_TIME_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
elmot 1:d0dfbce63a89 1257 {
elmot 1:d0dfbce63a89 1258 MODIFY_REG(RTCx->TR, (RTC_TR_ST | RTC_TR_SU),
elmot 1:d0dfbce63a89 1259 (((Seconds & 0xF0U) << (RTC_POSITION_TR_ST - 4U)) | ((Seconds & 0x0FU) << RTC_POSITION_TR_SU)));
elmot 1:d0dfbce63a89 1260 }
elmot 1:d0dfbce63a89 1261
elmot 1:d0dfbce63a89 1262 /**
elmot 1:d0dfbce63a89 1263 * @brief Get Seconds in BCD format
elmot 1:d0dfbce63a89 1264 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
elmot 1:d0dfbce63a89 1265 * before reading this bit
elmot 1:d0dfbce63a89 1266 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
elmot 1:d0dfbce63a89 1267 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
elmot 1:d0dfbce63a89 1268 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD
elmot 1:d0dfbce63a89 1269 * to Binary format
elmot 1:d0dfbce63a89 1270 * @rmtoll TR ST LL_RTC_TIME_GetSecond\n
elmot 1:d0dfbce63a89 1271 * TR SU LL_RTC_TIME_GetSecond
elmot 1:d0dfbce63a89 1272 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1273 * @retval Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 1274 */
elmot 1:d0dfbce63a89 1275 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSecond(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1276 {
elmot 1:d0dfbce63a89 1277 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 1278
elmot 1:d0dfbce63a89 1279 temp = READ_BIT(RTCx->TR, (RTC_TR_ST | RTC_TR_SU));
elmot 1:d0dfbce63a89 1280 return (uint32_t)((((temp & RTC_TR_ST) >> RTC_POSITION_TR_ST) << 4U) | ((temp & RTC_TR_SU) >> RTC_POSITION_TR_SU));
elmot 1:d0dfbce63a89 1281 }
elmot 1:d0dfbce63a89 1282
elmot 1:d0dfbce63a89 1283 /**
elmot 1:d0dfbce63a89 1284 * @brief Set time (hour, minute and second) in BCD format
elmot 1:d0dfbce63a89 1285 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 1286 * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
elmot 1:d0dfbce63a89 1287 * @note TimeFormat and Hours should follow the same format
elmot 1:d0dfbce63a89 1288 * @rmtoll TR PM LL_RTC_TIME_Config\n
elmot 1:d0dfbce63a89 1289 * TR HT LL_RTC_TIME_Config\n
elmot 1:d0dfbce63a89 1290 * TR HU LL_RTC_TIME_Config\n
elmot 1:d0dfbce63a89 1291 * TR MNT LL_RTC_TIME_Config\n
elmot 1:d0dfbce63a89 1292 * TR MNU LL_RTC_TIME_Config\n
elmot 1:d0dfbce63a89 1293 * TR ST LL_RTC_TIME_Config\n
elmot 1:d0dfbce63a89 1294 * TR SU LL_RTC_TIME_Config
elmot 1:d0dfbce63a89 1295 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1296 * @param Format12_24 This parameter can be one of the following values:
elmot 1:d0dfbce63a89 1297 * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
elmot 1:d0dfbce63a89 1298 * @arg @ref LL_RTC_TIME_FORMAT_PM
elmot 1:d0dfbce63a89 1299 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
elmot 1:d0dfbce63a89 1300 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 1301 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 1302 * @retval None
elmot 1:d0dfbce63a89 1303 */
elmot 1:d0dfbce63a89 1304 __STATIC_INLINE void LL_RTC_TIME_Config(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
elmot 1:d0dfbce63a89 1305 {
elmot 1:d0dfbce63a89 1306 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 1307
elmot 1:d0dfbce63a89 1308 temp = Format12_24 | \
elmot 1:d0dfbce63a89 1309 (((Hours & 0xF0U) << (RTC_POSITION_TR_HT - 4U)) | ((Hours & 0x0FU) << RTC_POSITION_TR_HU)) | \
elmot 1:d0dfbce63a89 1310 (((Minutes & 0xF0U) << (RTC_POSITION_TR_MT - 4U)) | ((Minutes & 0x0FU) << RTC_POSITION_TR_MU)) | \
elmot 1:d0dfbce63a89 1311 (((Seconds & 0xF0U) << (RTC_POSITION_TR_ST - 4U)) | ((Seconds & 0x0FU) << RTC_POSITION_TR_SU));
elmot 1:d0dfbce63a89 1312 MODIFY_REG(RTCx->TR, (RTC_TR_PM | RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU), temp);
elmot 1:d0dfbce63a89 1313 }
elmot 1:d0dfbce63a89 1314
elmot 1:d0dfbce63a89 1315 /**
elmot 1:d0dfbce63a89 1316 * @brief Get time (hour, minute and second) in BCD format
elmot 1:d0dfbce63a89 1317 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
elmot 1:d0dfbce63a89 1318 * before reading this bit
elmot 1:d0dfbce63a89 1319 * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
elmot 1:d0dfbce63a89 1320 * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
elmot 1:d0dfbce63a89 1321 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
elmot 1:d0dfbce63a89 1322 * are available to get independently each parameter.
elmot 1:d0dfbce63a89 1323 * @rmtoll TR HT LL_RTC_TIME_Get\n
elmot 1:d0dfbce63a89 1324 * TR HU LL_RTC_TIME_Get\n
elmot 1:d0dfbce63a89 1325 * TR MNT LL_RTC_TIME_Get\n
elmot 1:d0dfbce63a89 1326 * TR MNU LL_RTC_TIME_Get\n
elmot 1:d0dfbce63a89 1327 * TR ST LL_RTC_TIME_Get\n
elmot 1:d0dfbce63a89 1328 * TR SU LL_RTC_TIME_Get
elmot 1:d0dfbce63a89 1329 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1330 * @retval Combination of hours, minutes and seconds (Format: 0x00HHMMSS).
elmot 1:d0dfbce63a89 1331 */
elmot 1:d0dfbce63a89 1332 __STATIC_INLINE uint32_t LL_RTC_TIME_Get(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1333 {
elmot 1:d0dfbce63a89 1334 return (uint32_t)((LL_RTC_TIME_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_TIME_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_TIME_GetSecond(RTCx));
elmot 1:d0dfbce63a89 1335 }
elmot 1:d0dfbce63a89 1336
elmot 1:d0dfbce63a89 1337 /**
elmot 1:d0dfbce63a89 1338 * @brief Memorize whether the daylight saving time change has been performed
elmot 1:d0dfbce63a89 1339 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 1340 * @rmtoll CR BCK LL_RTC_TIME_EnableDayLightStore
elmot 1:d0dfbce63a89 1341 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1342 * @retval None
elmot 1:d0dfbce63a89 1343 */
elmot 1:d0dfbce63a89 1344 __STATIC_INLINE void LL_RTC_TIME_EnableDayLightStore(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1345 {
elmot 1:d0dfbce63a89 1346 SET_BIT(RTCx->CR, RTC_CR_BCK);
elmot 1:d0dfbce63a89 1347 }
elmot 1:d0dfbce63a89 1348
elmot 1:d0dfbce63a89 1349 /**
elmot 1:d0dfbce63a89 1350 * @brief Disable memorization whether the daylight saving time change has been performed.
elmot 1:d0dfbce63a89 1351 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 1352 * @rmtoll CR BCK LL_RTC_TIME_DisableDayLightStore
elmot 1:d0dfbce63a89 1353 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1354 * @retval None
elmot 1:d0dfbce63a89 1355 */
elmot 1:d0dfbce63a89 1356 __STATIC_INLINE void LL_RTC_TIME_DisableDayLightStore(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1357 {
elmot 1:d0dfbce63a89 1358 CLEAR_BIT(RTCx->CR, RTC_CR_BCK);
elmot 1:d0dfbce63a89 1359 }
elmot 1:d0dfbce63a89 1360
elmot 1:d0dfbce63a89 1361 /**
elmot 1:d0dfbce63a89 1362 * @brief Check if RTC Day Light Saving stored operation has been enabled or not
elmot 1:d0dfbce63a89 1363 * @rmtoll CR BCK LL_RTC_TIME_IsDayLightStoreEnabled
elmot 1:d0dfbce63a89 1364 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1365 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 1366 */
elmot 1:d0dfbce63a89 1367 __STATIC_INLINE uint32_t LL_RTC_TIME_IsDayLightStoreEnabled(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1368 {
elmot 1:d0dfbce63a89 1369 return (READ_BIT(RTCx->CR, RTC_CR_BCK) == (RTC_CR_BCK));
elmot 1:d0dfbce63a89 1370 }
elmot 1:d0dfbce63a89 1371
elmot 1:d0dfbce63a89 1372 /**
elmot 1:d0dfbce63a89 1373 * @brief Subtract 1 hour (winter time change)
elmot 1:d0dfbce63a89 1374 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 1375 * @rmtoll CR SUB1H LL_RTC_TIME_DecHour
elmot 1:d0dfbce63a89 1376 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1377 * @retval None
elmot 1:d0dfbce63a89 1378 */
elmot 1:d0dfbce63a89 1379 __STATIC_INLINE void LL_RTC_TIME_DecHour(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1380 {
elmot 1:d0dfbce63a89 1381 SET_BIT(RTCx->CR, RTC_CR_SUB1H);
elmot 1:d0dfbce63a89 1382 }
elmot 1:d0dfbce63a89 1383
elmot 1:d0dfbce63a89 1384 /**
elmot 1:d0dfbce63a89 1385 * @brief Add 1 hour (summer time change)
elmot 1:d0dfbce63a89 1386 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 1387 * @rmtoll CR ADD1H LL_RTC_TIME_IncHour
elmot 1:d0dfbce63a89 1388 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1389 * @retval None
elmot 1:d0dfbce63a89 1390 */
elmot 1:d0dfbce63a89 1391 __STATIC_INLINE void LL_RTC_TIME_IncHour(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1392 {
elmot 1:d0dfbce63a89 1393 SET_BIT(RTCx->CR, RTC_CR_ADD1H);
elmot 1:d0dfbce63a89 1394 }
elmot 1:d0dfbce63a89 1395
elmot 1:d0dfbce63a89 1396 /**
elmot 1:d0dfbce63a89 1397 * @brief Get Sub second value in the synchronous prescaler counter.
elmot 1:d0dfbce63a89 1398 * @note You can use both SubSeconds value and SecondFraction (PREDIV_S through
elmot 1:d0dfbce63a89 1399 * LL_RTC_GetSynchPrescaler function) terms returned to convert Calendar
elmot 1:d0dfbce63a89 1400 * SubSeconds value in second fraction ratio with time unit following
elmot 1:d0dfbce63a89 1401 * generic formula:
elmot 1:d0dfbce63a89 1402 * ==> Seconds fraction ratio * time_unit= [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit
elmot 1:d0dfbce63a89 1403 * This conversion can be performed only if no shift operation is pending
elmot 1:d0dfbce63a89 1404 * (ie. SHFP=0) when PREDIV_S >= SS.
elmot 1:d0dfbce63a89 1405 * @rmtoll SSR SS LL_RTC_TIME_GetSubSecond
elmot 1:d0dfbce63a89 1406 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1407 * @retval Sub second value (number between 0 and 65535)
elmot 1:d0dfbce63a89 1408 */
elmot 1:d0dfbce63a89 1409 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSubSecond(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1410 {
elmot 1:d0dfbce63a89 1411 return (uint32_t)(READ_BIT(RTCx->SSR, RTC_SSR_SS));
elmot 1:d0dfbce63a89 1412 }
elmot 1:d0dfbce63a89 1413
elmot 1:d0dfbce63a89 1414 /**
elmot 1:d0dfbce63a89 1415 * @brief Synchronize to a remote clock with a high degree of precision.
elmot 1:d0dfbce63a89 1416 * @note This operation effectively subtracts from (delays) or advance the clock of a fraction of a second.
elmot 1:d0dfbce63a89 1417 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 1418 * @note When REFCKON is set, firmware must not write to Shift control register.
elmot 1:d0dfbce63a89 1419 * @rmtoll SHIFTR ADD1S LL_RTC_TIME_Synchronize\n
elmot 1:d0dfbce63a89 1420 * SHIFTR SUBFS LL_RTC_TIME_Synchronize
elmot 1:d0dfbce63a89 1421 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1422 * @param ShiftSecond This parameter can be one of the following values:
elmot 1:d0dfbce63a89 1423 * @arg @ref LL_RTC_SHIFT_SECOND_DELAY
elmot 1:d0dfbce63a89 1424 * @arg @ref LL_RTC_SHIFT_SECOND_ADVANCE
elmot 1:d0dfbce63a89 1425 * @param Fraction Number of Seconds Fractions (any value from 0 to 0x7FFF)
elmot 1:d0dfbce63a89 1426 * @retval None
elmot 1:d0dfbce63a89 1427 */
elmot 1:d0dfbce63a89 1428 __STATIC_INLINE void LL_RTC_TIME_Synchronize(RTC_TypeDef *RTCx, uint32_t ShiftSecond, uint32_t Fraction)
elmot 1:d0dfbce63a89 1429 {
elmot 1:d0dfbce63a89 1430 WRITE_REG(RTCx->SHIFTR, ShiftSecond | Fraction);
elmot 1:d0dfbce63a89 1431 }
elmot 1:d0dfbce63a89 1432
elmot 1:d0dfbce63a89 1433 /**
elmot 1:d0dfbce63a89 1434 * @}
elmot 1:d0dfbce63a89 1435 */
elmot 1:d0dfbce63a89 1436
elmot 1:d0dfbce63a89 1437 /** @defgroup RTC_LL_EF_Date Date
elmot 1:d0dfbce63a89 1438 * @{
elmot 1:d0dfbce63a89 1439 */
elmot 1:d0dfbce63a89 1440
elmot 1:d0dfbce63a89 1441 /**
elmot 1:d0dfbce63a89 1442 * @brief Set Year in BCD format
elmot 1:d0dfbce63a89 1443 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Year from binary to BCD format
elmot 1:d0dfbce63a89 1444 * @rmtoll DR YT LL_RTC_DATE_SetYear\n
elmot 1:d0dfbce63a89 1445 * DR YU LL_RTC_DATE_SetYear
elmot 1:d0dfbce63a89 1446 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1447 * @param Year Value between Min_Data=0x00 and Max_Data=0x99
elmot 1:d0dfbce63a89 1448 * @retval None
elmot 1:d0dfbce63a89 1449 */
elmot 1:d0dfbce63a89 1450 __STATIC_INLINE void LL_RTC_DATE_SetYear(RTC_TypeDef *RTCx, uint32_t Year)
elmot 1:d0dfbce63a89 1451 {
elmot 1:d0dfbce63a89 1452 MODIFY_REG(RTCx->DR, (RTC_DR_YT | RTC_DR_YU),
elmot 1:d0dfbce63a89 1453 (((Year & 0xF0U) << (RTC_POSITION_DR_YT - 4U)) | ((Year & 0x0FU) << RTC_POSITION_DR_YU)));
elmot 1:d0dfbce63a89 1454 }
elmot 1:d0dfbce63a89 1455
elmot 1:d0dfbce63a89 1456 /**
elmot 1:d0dfbce63a89 1457 * @brief Get Year in BCD format
elmot 1:d0dfbce63a89 1458 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
elmot 1:d0dfbce63a89 1459 * before reading this bit
elmot 1:d0dfbce63a89 1460 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Year from BCD to Binary format
elmot 1:d0dfbce63a89 1461 * @rmtoll DR YT LL_RTC_DATE_GetYear\n
elmot 1:d0dfbce63a89 1462 * DR YU LL_RTC_DATE_GetYear
elmot 1:d0dfbce63a89 1463 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1464 * @retval Value between Min_Data=0x00 and Max_Data=0x99
elmot 1:d0dfbce63a89 1465 */
elmot 1:d0dfbce63a89 1466 __STATIC_INLINE uint32_t LL_RTC_DATE_GetYear(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1467 {
elmot 1:d0dfbce63a89 1468 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 1469
elmot 1:d0dfbce63a89 1470 temp = READ_BIT(RTCx->DR, (RTC_DR_YT | RTC_DR_YU));
elmot 1:d0dfbce63a89 1471 return (uint32_t)((((temp & RTC_DR_YT) >> RTC_POSITION_DR_YT) << 4U) | ((temp & RTC_DR_YU) >> RTC_POSITION_DR_YU));
elmot 1:d0dfbce63a89 1472 }
elmot 1:d0dfbce63a89 1473
elmot 1:d0dfbce63a89 1474 /**
elmot 1:d0dfbce63a89 1475 * @brief Set Week day
elmot 1:d0dfbce63a89 1476 * @rmtoll DR WDU LL_RTC_DATE_SetWeekDay
elmot 1:d0dfbce63a89 1477 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1478 * @param WeekDay This parameter can be one of the following values:
elmot 1:d0dfbce63a89 1479 * @arg @ref LL_RTC_WEEKDAY_MONDAY
elmot 1:d0dfbce63a89 1480 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
elmot 1:d0dfbce63a89 1481 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
elmot 1:d0dfbce63a89 1482 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
elmot 1:d0dfbce63a89 1483 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
elmot 1:d0dfbce63a89 1484 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
elmot 1:d0dfbce63a89 1485 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
elmot 1:d0dfbce63a89 1486 * @retval None
elmot 1:d0dfbce63a89 1487 */
elmot 1:d0dfbce63a89 1488 __STATIC_INLINE void LL_RTC_DATE_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
elmot 1:d0dfbce63a89 1489 {
elmot 1:d0dfbce63a89 1490 MODIFY_REG(RTCx->DR, RTC_DR_WDU, WeekDay << RTC_POSITION_DR_WDU);
elmot 1:d0dfbce63a89 1491 }
elmot 1:d0dfbce63a89 1492
elmot 1:d0dfbce63a89 1493 /**
elmot 1:d0dfbce63a89 1494 * @brief Get Week day
elmot 1:d0dfbce63a89 1495 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
elmot 1:d0dfbce63a89 1496 * before reading this bit
elmot 1:d0dfbce63a89 1497 * @rmtoll DR WDU LL_RTC_DATE_GetWeekDay
elmot 1:d0dfbce63a89 1498 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1499 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 1500 * @arg @ref LL_RTC_WEEKDAY_MONDAY
elmot 1:d0dfbce63a89 1501 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
elmot 1:d0dfbce63a89 1502 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
elmot 1:d0dfbce63a89 1503 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
elmot 1:d0dfbce63a89 1504 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
elmot 1:d0dfbce63a89 1505 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
elmot 1:d0dfbce63a89 1506 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
elmot 1:d0dfbce63a89 1507 */
elmot 1:d0dfbce63a89 1508 __STATIC_INLINE uint32_t LL_RTC_DATE_GetWeekDay(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1509 {
elmot 1:d0dfbce63a89 1510 return (uint32_t)(READ_BIT(RTCx->DR, RTC_DR_WDU) >> RTC_POSITION_DR_WDU);
elmot 1:d0dfbce63a89 1511 }
elmot 1:d0dfbce63a89 1512
elmot 1:d0dfbce63a89 1513 /**
elmot 1:d0dfbce63a89 1514 * @brief Set Month in BCD format
elmot 1:d0dfbce63a89 1515 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Month from binary to BCD format
elmot 1:d0dfbce63a89 1516 * @rmtoll DR MT LL_RTC_DATE_SetMonth\n
elmot 1:d0dfbce63a89 1517 * DR MU LL_RTC_DATE_SetMonth
elmot 1:d0dfbce63a89 1518 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1519 * @param Month This parameter can be one of the following values:
elmot 1:d0dfbce63a89 1520 * @arg @ref LL_RTC_MONTH_JANUARY
elmot 1:d0dfbce63a89 1521 * @arg @ref LL_RTC_MONTH_FEBRUARY
elmot 1:d0dfbce63a89 1522 * @arg @ref LL_RTC_MONTH_MARCH
elmot 1:d0dfbce63a89 1523 * @arg @ref LL_RTC_MONTH_APRIL
elmot 1:d0dfbce63a89 1524 * @arg @ref LL_RTC_MONTH_MAY
elmot 1:d0dfbce63a89 1525 * @arg @ref LL_RTC_MONTH_JUNE
elmot 1:d0dfbce63a89 1526 * @arg @ref LL_RTC_MONTH_JULY
elmot 1:d0dfbce63a89 1527 * @arg @ref LL_RTC_MONTH_AUGUST
elmot 1:d0dfbce63a89 1528 * @arg @ref LL_RTC_MONTH_SEPTEMBER
elmot 1:d0dfbce63a89 1529 * @arg @ref LL_RTC_MONTH_OCTOBER
elmot 1:d0dfbce63a89 1530 * @arg @ref LL_RTC_MONTH_NOVEMBER
elmot 1:d0dfbce63a89 1531 * @arg @ref LL_RTC_MONTH_DECEMBER
elmot 1:d0dfbce63a89 1532 * @retval None
elmot 1:d0dfbce63a89 1533 */
elmot 1:d0dfbce63a89 1534 __STATIC_INLINE void LL_RTC_DATE_SetMonth(RTC_TypeDef *RTCx, uint32_t Month)
elmot 1:d0dfbce63a89 1535 {
elmot 1:d0dfbce63a89 1536 MODIFY_REG(RTCx->DR, (RTC_DR_MT | RTC_DR_MU),
elmot 1:d0dfbce63a89 1537 (((Month & 0xF0U) << (RTC_POSITION_DR_MT - 4U)) | ((Month & 0x0FU) << RTC_POSITION_DR_MU)));
elmot 1:d0dfbce63a89 1538 }
elmot 1:d0dfbce63a89 1539
elmot 1:d0dfbce63a89 1540 /**
elmot 1:d0dfbce63a89 1541 * @brief Get Month in BCD format
elmot 1:d0dfbce63a89 1542 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
elmot 1:d0dfbce63a89 1543 * before reading this bit
elmot 1:d0dfbce63a89 1544 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
elmot 1:d0dfbce63a89 1545 * @rmtoll DR MT LL_RTC_DATE_GetMonth\n
elmot 1:d0dfbce63a89 1546 * DR MU LL_RTC_DATE_GetMonth
elmot 1:d0dfbce63a89 1547 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1548 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 1549 * @arg @ref LL_RTC_MONTH_JANUARY
elmot 1:d0dfbce63a89 1550 * @arg @ref LL_RTC_MONTH_FEBRUARY
elmot 1:d0dfbce63a89 1551 * @arg @ref LL_RTC_MONTH_MARCH
elmot 1:d0dfbce63a89 1552 * @arg @ref LL_RTC_MONTH_APRIL
elmot 1:d0dfbce63a89 1553 * @arg @ref LL_RTC_MONTH_MAY
elmot 1:d0dfbce63a89 1554 * @arg @ref LL_RTC_MONTH_JUNE
elmot 1:d0dfbce63a89 1555 * @arg @ref LL_RTC_MONTH_JULY
elmot 1:d0dfbce63a89 1556 * @arg @ref LL_RTC_MONTH_AUGUST
elmot 1:d0dfbce63a89 1557 * @arg @ref LL_RTC_MONTH_SEPTEMBER
elmot 1:d0dfbce63a89 1558 * @arg @ref LL_RTC_MONTH_OCTOBER
elmot 1:d0dfbce63a89 1559 * @arg @ref LL_RTC_MONTH_NOVEMBER
elmot 1:d0dfbce63a89 1560 * @arg @ref LL_RTC_MONTH_DECEMBER
elmot 1:d0dfbce63a89 1561 */
elmot 1:d0dfbce63a89 1562 __STATIC_INLINE uint32_t LL_RTC_DATE_GetMonth(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1563 {
elmot 1:d0dfbce63a89 1564 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 1565
elmot 1:d0dfbce63a89 1566 temp = READ_BIT(RTCx->DR, (RTC_DR_MT | RTC_DR_MU));
elmot 1:d0dfbce63a89 1567 return (uint32_t)((((temp & RTC_DR_MT) >> RTC_POSITION_DR_MT) << 4U) | ((temp & RTC_DR_MU) >> RTC_POSITION_DR_MU));
elmot 1:d0dfbce63a89 1568 }
elmot 1:d0dfbce63a89 1569
elmot 1:d0dfbce63a89 1570 /**
elmot 1:d0dfbce63a89 1571 * @brief Set Day in BCD format
elmot 1:d0dfbce63a89 1572 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
elmot 1:d0dfbce63a89 1573 * @rmtoll DR DT LL_RTC_DATE_SetDay\n
elmot 1:d0dfbce63a89 1574 * DR DU LL_RTC_DATE_SetDay
elmot 1:d0dfbce63a89 1575 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1576 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
elmot 1:d0dfbce63a89 1577 * @retval None
elmot 1:d0dfbce63a89 1578 */
elmot 1:d0dfbce63a89 1579 __STATIC_INLINE void LL_RTC_DATE_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
elmot 1:d0dfbce63a89 1580 {
elmot 1:d0dfbce63a89 1581 MODIFY_REG(RTCx->DR, (RTC_DR_DT | RTC_DR_DU),
elmot 1:d0dfbce63a89 1582 (((Day & 0xF0U) << (RTC_POSITION_DR_DT - 4U)) | ((Day & 0x0FU) << RTC_POSITION_DR_DU)));
elmot 1:d0dfbce63a89 1583 }
elmot 1:d0dfbce63a89 1584
elmot 1:d0dfbce63a89 1585 /**
elmot 1:d0dfbce63a89 1586 * @brief Get Day in BCD format
elmot 1:d0dfbce63a89 1587 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
elmot 1:d0dfbce63a89 1588 * before reading this bit
elmot 1:d0dfbce63a89 1589 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
elmot 1:d0dfbce63a89 1590 * @rmtoll DR DT LL_RTC_DATE_GetDay\n
elmot 1:d0dfbce63a89 1591 * DR DU LL_RTC_DATE_GetDay
elmot 1:d0dfbce63a89 1592 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1593 * @retval Value between Min_Data=0x01 and Max_Data=0x31
elmot 1:d0dfbce63a89 1594 */
elmot 1:d0dfbce63a89 1595 __STATIC_INLINE uint32_t LL_RTC_DATE_GetDay(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1596 {
elmot 1:d0dfbce63a89 1597 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 1598
elmot 1:d0dfbce63a89 1599 temp = READ_BIT(RTCx->DR, (RTC_DR_DT | RTC_DR_DU));
elmot 1:d0dfbce63a89 1600 return (uint32_t)((((temp & RTC_DR_DT) >> RTC_POSITION_DR_DT) << 4U) | ((temp & RTC_DR_DU) >> RTC_POSITION_DR_DU));
elmot 1:d0dfbce63a89 1601 }
elmot 1:d0dfbce63a89 1602
elmot 1:d0dfbce63a89 1603 /**
elmot 1:d0dfbce63a89 1604 * @brief Set date (WeekDay, Day, Month and Year) in BCD format
elmot 1:d0dfbce63a89 1605 * @rmtoll DR WDU LL_RTC_DATE_Config\n
elmot 1:d0dfbce63a89 1606 * DR MT LL_RTC_DATE_Config\n
elmot 1:d0dfbce63a89 1607 * DR MU LL_RTC_DATE_Config\n
elmot 1:d0dfbce63a89 1608 * DR DT LL_RTC_DATE_Config\n
elmot 1:d0dfbce63a89 1609 * DR DU LL_RTC_DATE_Config\n
elmot 1:d0dfbce63a89 1610 * DR YT LL_RTC_DATE_Config\n
elmot 1:d0dfbce63a89 1611 * DR YU LL_RTC_DATE_Config
elmot 1:d0dfbce63a89 1612 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1613 * @param WeekDay This parameter can be one of the following values:
elmot 1:d0dfbce63a89 1614 * @arg @ref LL_RTC_WEEKDAY_MONDAY
elmot 1:d0dfbce63a89 1615 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
elmot 1:d0dfbce63a89 1616 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
elmot 1:d0dfbce63a89 1617 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
elmot 1:d0dfbce63a89 1618 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
elmot 1:d0dfbce63a89 1619 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
elmot 1:d0dfbce63a89 1620 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
elmot 1:d0dfbce63a89 1621 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
elmot 1:d0dfbce63a89 1622 * @param Month This parameter can be one of the following values:
elmot 1:d0dfbce63a89 1623 * @arg @ref LL_RTC_MONTH_JANUARY
elmot 1:d0dfbce63a89 1624 * @arg @ref LL_RTC_MONTH_FEBRUARY
elmot 1:d0dfbce63a89 1625 * @arg @ref LL_RTC_MONTH_MARCH
elmot 1:d0dfbce63a89 1626 * @arg @ref LL_RTC_MONTH_APRIL
elmot 1:d0dfbce63a89 1627 * @arg @ref LL_RTC_MONTH_MAY
elmot 1:d0dfbce63a89 1628 * @arg @ref LL_RTC_MONTH_JUNE
elmot 1:d0dfbce63a89 1629 * @arg @ref LL_RTC_MONTH_JULY
elmot 1:d0dfbce63a89 1630 * @arg @ref LL_RTC_MONTH_AUGUST
elmot 1:d0dfbce63a89 1631 * @arg @ref LL_RTC_MONTH_SEPTEMBER
elmot 1:d0dfbce63a89 1632 * @arg @ref LL_RTC_MONTH_OCTOBER
elmot 1:d0dfbce63a89 1633 * @arg @ref LL_RTC_MONTH_NOVEMBER
elmot 1:d0dfbce63a89 1634 * @arg @ref LL_RTC_MONTH_DECEMBER
elmot 1:d0dfbce63a89 1635 * @param Year Value between Min_Data=0x00 and Max_Data=0x99
elmot 1:d0dfbce63a89 1636 * @retval None
elmot 1:d0dfbce63a89 1637 */
elmot 1:d0dfbce63a89 1638 __STATIC_INLINE void LL_RTC_DATE_Config(RTC_TypeDef *RTCx, uint32_t WeekDay, uint32_t Day, uint32_t Month, uint32_t Year)
elmot 1:d0dfbce63a89 1639 {
elmot 1:d0dfbce63a89 1640 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 1641
elmot 1:d0dfbce63a89 1642 temp = (WeekDay << RTC_POSITION_DR_WDU) | \
elmot 1:d0dfbce63a89 1643 (((Year & 0xF0U) << (RTC_POSITION_DR_YT - 4U)) | ((Year & 0x0FU) << RTC_POSITION_DR_YU)) | \
elmot 1:d0dfbce63a89 1644 (((Month & 0xF0U) << (RTC_POSITION_DR_MT - 4U)) | ((Month & 0x0FU) << RTC_POSITION_DR_MU)) | \
elmot 1:d0dfbce63a89 1645 (((Day & 0xF0U) << (RTC_POSITION_DR_DT - 4U)) | ((Day & 0x0FU) << RTC_POSITION_DR_DU));
elmot 1:d0dfbce63a89 1646
elmot 1:d0dfbce63a89 1647 MODIFY_REG(RTCx->DR, (RTC_DR_WDU | RTC_DR_MT | RTC_DR_MU | RTC_DR_DT | RTC_DR_DU | RTC_DR_YT | RTC_DR_YU), temp);
elmot 1:d0dfbce63a89 1648 }
elmot 1:d0dfbce63a89 1649
elmot 1:d0dfbce63a89 1650 /**
elmot 1:d0dfbce63a89 1651 * @brief Get date (WeekDay, Day, Month and Year) in BCD format
elmot 1:d0dfbce63a89 1652 * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
elmot 1:d0dfbce63a89 1653 * before reading this bit
elmot 1:d0dfbce63a89 1654 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_YEAR, __LL_RTC_GET_MONTH,
elmot 1:d0dfbce63a89 1655 * and __LL_RTC_GET_DAY are available to get independently each parameter.
elmot 1:d0dfbce63a89 1656 * @rmtoll DR WDU LL_RTC_DATE_Get\n
elmot 1:d0dfbce63a89 1657 * DR MT LL_RTC_DATE_Get\n
elmot 1:d0dfbce63a89 1658 * DR MU LL_RTC_DATE_Get\n
elmot 1:d0dfbce63a89 1659 * DR DT LL_RTC_DATE_Get\n
elmot 1:d0dfbce63a89 1660 * DR DU LL_RTC_DATE_Get\n
elmot 1:d0dfbce63a89 1661 * DR YT LL_RTC_DATE_Get\n
elmot 1:d0dfbce63a89 1662 * DR YU LL_RTC_DATE_Get
elmot 1:d0dfbce63a89 1663 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1664 * @retval Combination of WeekDay, Day, Month and Year (Format: 0xWWDDMMYY).
elmot 1:d0dfbce63a89 1665 */
elmot 1:d0dfbce63a89 1666 __STATIC_INLINE uint32_t LL_RTC_DATE_Get(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1667 {
elmot 1:d0dfbce63a89 1668 return (uint32_t)((LL_RTC_DATE_GetWeekDay(RTCx) << RTC_OFFSET_WEEKDAY) | (LL_RTC_DATE_GetDay(RTCx) << RTC_OFFSET_DAY) | (LL_RTC_DATE_GetMonth(RTCx) << RTC_OFFSET_MONTH) | LL_RTC_DATE_GetYear(RTCx));
elmot 1:d0dfbce63a89 1669 }
elmot 1:d0dfbce63a89 1670
elmot 1:d0dfbce63a89 1671 /**
elmot 1:d0dfbce63a89 1672 * @}
elmot 1:d0dfbce63a89 1673 */
elmot 1:d0dfbce63a89 1674
elmot 1:d0dfbce63a89 1675 /** @defgroup RTC_LL_EF_ALARMA ALARMA
elmot 1:d0dfbce63a89 1676 * @{
elmot 1:d0dfbce63a89 1677 */
elmot 1:d0dfbce63a89 1678
elmot 1:d0dfbce63a89 1679 /**
elmot 1:d0dfbce63a89 1680 * @brief Enable Alarm A
elmot 1:d0dfbce63a89 1681 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 1682 * @rmtoll CR ALRAE LL_RTC_ALMA_Enable
elmot 1:d0dfbce63a89 1683 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1684 * @retval None
elmot 1:d0dfbce63a89 1685 */
elmot 1:d0dfbce63a89 1686 __STATIC_INLINE void LL_RTC_ALMA_Enable(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1687 {
elmot 1:d0dfbce63a89 1688 SET_BIT(RTCx->CR, RTC_CR_ALRAE);
elmot 1:d0dfbce63a89 1689 }
elmot 1:d0dfbce63a89 1690
elmot 1:d0dfbce63a89 1691 /**
elmot 1:d0dfbce63a89 1692 * @brief Disable Alarm A
elmot 1:d0dfbce63a89 1693 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 1694 * @rmtoll CR ALRAE LL_RTC_ALMA_Disable
elmot 1:d0dfbce63a89 1695 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1696 * @retval None
elmot 1:d0dfbce63a89 1697 */
elmot 1:d0dfbce63a89 1698 __STATIC_INLINE void LL_RTC_ALMA_Disable(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1699 {
elmot 1:d0dfbce63a89 1700 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAE);
elmot 1:d0dfbce63a89 1701 }
elmot 1:d0dfbce63a89 1702
elmot 1:d0dfbce63a89 1703 /**
elmot 1:d0dfbce63a89 1704 * @brief Specify the Alarm A masks.
elmot 1:d0dfbce63a89 1705 * @rmtoll ALRMAR MSK4 LL_RTC_ALMA_SetMask\n
elmot 1:d0dfbce63a89 1706 * ALRMAR MSK3 LL_RTC_ALMA_SetMask\n
elmot 1:d0dfbce63a89 1707 * ALRMAR MSK2 LL_RTC_ALMA_SetMask\n
elmot 1:d0dfbce63a89 1708 * ALRMAR MSK1 LL_RTC_ALMA_SetMask
elmot 1:d0dfbce63a89 1709 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1710 * @param Mask This parameter can be a combination of the following values:
elmot 1:d0dfbce63a89 1711 * @arg @ref LL_RTC_ALMA_MASK_NONE
elmot 1:d0dfbce63a89 1712 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
elmot 1:d0dfbce63a89 1713 * @arg @ref LL_RTC_ALMA_MASK_HOURS
elmot 1:d0dfbce63a89 1714 * @arg @ref LL_RTC_ALMA_MASK_MINUTES
elmot 1:d0dfbce63a89 1715 * @arg @ref LL_RTC_ALMA_MASK_SECONDS
elmot 1:d0dfbce63a89 1716 * @arg @ref LL_RTC_ALMA_MASK_ALL
elmot 1:d0dfbce63a89 1717 * @retval None
elmot 1:d0dfbce63a89 1718 */
elmot 1:d0dfbce63a89 1719 __STATIC_INLINE void LL_RTC_ALMA_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
elmot 1:d0dfbce63a89 1720 {
elmot 1:d0dfbce63a89 1721 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1, Mask);
elmot 1:d0dfbce63a89 1722 }
elmot 1:d0dfbce63a89 1723
elmot 1:d0dfbce63a89 1724 /**
elmot 1:d0dfbce63a89 1725 * @brief Get the Alarm A masks.
elmot 1:d0dfbce63a89 1726 * @rmtoll ALRMAR MSK4 LL_RTC_ALMA_GetMask\n
elmot 1:d0dfbce63a89 1727 * ALRMAR MSK3 LL_RTC_ALMA_GetMask\n
elmot 1:d0dfbce63a89 1728 * ALRMAR MSK2 LL_RTC_ALMA_GetMask\n
elmot 1:d0dfbce63a89 1729 * ALRMAR MSK1 LL_RTC_ALMA_GetMask
elmot 1:d0dfbce63a89 1730 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1731 * @retval Returned value can be can be a combination of the following values:
elmot 1:d0dfbce63a89 1732 * @arg @ref LL_RTC_ALMA_MASK_NONE
elmot 1:d0dfbce63a89 1733 * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
elmot 1:d0dfbce63a89 1734 * @arg @ref LL_RTC_ALMA_MASK_HOURS
elmot 1:d0dfbce63a89 1735 * @arg @ref LL_RTC_ALMA_MASK_MINUTES
elmot 1:d0dfbce63a89 1736 * @arg @ref LL_RTC_ALMA_MASK_SECONDS
elmot 1:d0dfbce63a89 1737 * @arg @ref LL_RTC_ALMA_MASK_ALL
elmot 1:d0dfbce63a89 1738 */
elmot 1:d0dfbce63a89 1739 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMask(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1740 {
elmot 1:d0dfbce63a89 1741 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1));
elmot 1:d0dfbce63a89 1742 }
elmot 1:d0dfbce63a89 1743
elmot 1:d0dfbce63a89 1744 /**
elmot 1:d0dfbce63a89 1745 * @brief Enable AlarmA Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
elmot 1:d0dfbce63a89 1746 * @rmtoll ALRMAR WDSEL LL_RTC_ALMA_EnableWeekday
elmot 1:d0dfbce63a89 1747 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1748 * @retval None
elmot 1:d0dfbce63a89 1749 */
elmot 1:d0dfbce63a89 1750 __STATIC_INLINE void LL_RTC_ALMA_EnableWeekday(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1751 {
elmot 1:d0dfbce63a89 1752 SET_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
elmot 1:d0dfbce63a89 1753 }
elmot 1:d0dfbce63a89 1754
elmot 1:d0dfbce63a89 1755 /**
elmot 1:d0dfbce63a89 1756 * @brief Disable AlarmA Week day selection (DU[3:0] represents the date )
elmot 1:d0dfbce63a89 1757 * @rmtoll ALRMAR WDSEL LL_RTC_ALMA_DisableWeekday
elmot 1:d0dfbce63a89 1758 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1759 * @retval None
elmot 1:d0dfbce63a89 1760 */
elmot 1:d0dfbce63a89 1761 __STATIC_INLINE void LL_RTC_ALMA_DisableWeekday(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1762 {
elmot 1:d0dfbce63a89 1763 CLEAR_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
elmot 1:d0dfbce63a89 1764 }
elmot 1:d0dfbce63a89 1765
elmot 1:d0dfbce63a89 1766 /**
elmot 1:d0dfbce63a89 1767 * @brief Set ALARM A Day in BCD format
elmot 1:d0dfbce63a89 1768 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
elmot 1:d0dfbce63a89 1769 * @rmtoll ALRMAR DT LL_RTC_ALMA_SetDay\n
elmot 1:d0dfbce63a89 1770 * ALRMAR DU LL_RTC_ALMA_SetDay
elmot 1:d0dfbce63a89 1771 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1772 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
elmot 1:d0dfbce63a89 1773 * @retval None
elmot 1:d0dfbce63a89 1774 */
elmot 1:d0dfbce63a89 1775 __STATIC_INLINE void LL_RTC_ALMA_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
elmot 1:d0dfbce63a89 1776 {
elmot 1:d0dfbce63a89 1777 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU),
elmot 1:d0dfbce63a89 1778 (((Day & 0xF0U) << (RTC_POSITION_ALMA_DT - 4U)) | ((Day & 0x0FU) << RTC_POSITION_ALMA_DU)));
elmot 1:d0dfbce63a89 1779 }
elmot 1:d0dfbce63a89 1780
elmot 1:d0dfbce63a89 1781 /**
elmot 1:d0dfbce63a89 1782 * @brief Get ALARM A Day in BCD format
elmot 1:d0dfbce63a89 1783 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
elmot 1:d0dfbce63a89 1784 * @rmtoll ALRMAR DT LL_RTC_ALMA_GetDay\n
elmot 1:d0dfbce63a89 1785 * ALRMAR DU LL_RTC_ALMA_GetDay
elmot 1:d0dfbce63a89 1786 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1787 * @retval Value between Min_Data=0x01 and Max_Data=0x31
elmot 1:d0dfbce63a89 1788 */
elmot 1:d0dfbce63a89 1789 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetDay(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1790 {
elmot 1:d0dfbce63a89 1791 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 1792
elmot 1:d0dfbce63a89 1793 temp = READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU));
elmot 1:d0dfbce63a89 1794 return (uint32_t)((((temp & RTC_ALRMAR_DT) >> RTC_POSITION_ALMA_DT) << 4U) | ((temp & RTC_ALRMAR_DU) >> RTC_POSITION_ALMA_DU));
elmot 1:d0dfbce63a89 1795 }
elmot 1:d0dfbce63a89 1796
elmot 1:d0dfbce63a89 1797 /**
elmot 1:d0dfbce63a89 1798 * @brief Set ALARM A Weekday
elmot 1:d0dfbce63a89 1799 * @rmtoll ALRMAR DU LL_RTC_ALMA_SetWeekDay
elmot 1:d0dfbce63a89 1800 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1801 * @param WeekDay This parameter can be one of the following values:
elmot 1:d0dfbce63a89 1802 * @arg @ref LL_RTC_WEEKDAY_MONDAY
elmot 1:d0dfbce63a89 1803 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
elmot 1:d0dfbce63a89 1804 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
elmot 1:d0dfbce63a89 1805 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
elmot 1:d0dfbce63a89 1806 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
elmot 1:d0dfbce63a89 1807 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
elmot 1:d0dfbce63a89 1808 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
elmot 1:d0dfbce63a89 1809 * @retval None
elmot 1:d0dfbce63a89 1810 */
elmot 1:d0dfbce63a89 1811 __STATIC_INLINE void LL_RTC_ALMA_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
elmot 1:d0dfbce63a89 1812 {
elmot 1:d0dfbce63a89 1813 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_DU, WeekDay << RTC_POSITION_ALMA_DU);
elmot 1:d0dfbce63a89 1814 }
elmot 1:d0dfbce63a89 1815
elmot 1:d0dfbce63a89 1816 /**
elmot 1:d0dfbce63a89 1817 * @brief Get ALARM A Weekday
elmot 1:d0dfbce63a89 1818 * @rmtoll ALRMAR DU LL_RTC_ALMA_GetWeekDay
elmot 1:d0dfbce63a89 1819 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1820 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 1821 * @arg @ref LL_RTC_WEEKDAY_MONDAY
elmot 1:d0dfbce63a89 1822 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
elmot 1:d0dfbce63a89 1823 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
elmot 1:d0dfbce63a89 1824 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
elmot 1:d0dfbce63a89 1825 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
elmot 1:d0dfbce63a89 1826 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
elmot 1:d0dfbce63a89 1827 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
elmot 1:d0dfbce63a89 1828 */
elmot 1:d0dfbce63a89 1829 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetWeekDay(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1830 {
elmot 1:d0dfbce63a89 1831 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_DU) >> RTC_POSITION_ALMA_DU);
elmot 1:d0dfbce63a89 1832 }
elmot 1:d0dfbce63a89 1833
elmot 1:d0dfbce63a89 1834 /**
elmot 1:d0dfbce63a89 1835 * @brief Set Alarm A time format (AM/24-hour or PM notation)
elmot 1:d0dfbce63a89 1836 * @rmtoll ALRMAR PM LL_RTC_ALMA_SetTimeFormat
elmot 1:d0dfbce63a89 1837 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1838 * @param TimeFormat This parameter can be one of the following values:
elmot 1:d0dfbce63a89 1839 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
elmot 1:d0dfbce63a89 1840 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
elmot 1:d0dfbce63a89 1841 * @retval None
elmot 1:d0dfbce63a89 1842 */
elmot 1:d0dfbce63a89 1843 __STATIC_INLINE void LL_RTC_ALMA_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
elmot 1:d0dfbce63a89 1844 {
elmot 1:d0dfbce63a89 1845 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM, TimeFormat);
elmot 1:d0dfbce63a89 1846 }
elmot 1:d0dfbce63a89 1847
elmot 1:d0dfbce63a89 1848 /**
elmot 1:d0dfbce63a89 1849 * @brief Get Alarm A time format (AM or PM notation)
elmot 1:d0dfbce63a89 1850 * @rmtoll ALRMAR PM LL_RTC_ALMA_GetTimeFormat
elmot 1:d0dfbce63a89 1851 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1852 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 1853 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
elmot 1:d0dfbce63a89 1854 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
elmot 1:d0dfbce63a89 1855 */
elmot 1:d0dfbce63a89 1856 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTimeFormat(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1857 {
elmot 1:d0dfbce63a89 1858 return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_PM));
elmot 1:d0dfbce63a89 1859 }
elmot 1:d0dfbce63a89 1860
elmot 1:d0dfbce63a89 1861 /**
elmot 1:d0dfbce63a89 1862 * @brief Set ALARM A Hours in BCD format
elmot 1:d0dfbce63a89 1863 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
elmot 1:d0dfbce63a89 1864 * @rmtoll ALRMAR HT LL_RTC_ALMA_SetHour\n
elmot 1:d0dfbce63a89 1865 * ALRMAR HU LL_RTC_ALMA_SetHour
elmot 1:d0dfbce63a89 1866 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1867 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
elmot 1:d0dfbce63a89 1868 * @retval None
elmot 1:d0dfbce63a89 1869 */
elmot 1:d0dfbce63a89 1870 __STATIC_INLINE void LL_RTC_ALMA_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
elmot 1:d0dfbce63a89 1871 {
elmot 1:d0dfbce63a89 1872 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU),
elmot 1:d0dfbce63a89 1873 (((Hours & 0xF0U) << (RTC_POSITION_ALMA_HT - 4U)) | ((Hours & 0x0FU) << RTC_POSITION_ALMA_HU)));
elmot 1:d0dfbce63a89 1874 }
elmot 1:d0dfbce63a89 1875
elmot 1:d0dfbce63a89 1876 /**
elmot 1:d0dfbce63a89 1877 * @brief Get ALARM A Hours in BCD format
elmot 1:d0dfbce63a89 1878 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
elmot 1:d0dfbce63a89 1879 * @rmtoll ALRMAR HT LL_RTC_ALMA_GetHour\n
elmot 1:d0dfbce63a89 1880 * ALRMAR HU LL_RTC_ALMA_GetHour
elmot 1:d0dfbce63a89 1881 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1882 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
elmot 1:d0dfbce63a89 1883 */
elmot 1:d0dfbce63a89 1884 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetHour(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1885 {
elmot 1:d0dfbce63a89 1886 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 1887
elmot 1:d0dfbce63a89 1888 temp = READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU));
elmot 1:d0dfbce63a89 1889 return (uint32_t)((((temp & RTC_ALRMAR_HT) >> RTC_POSITION_ALMA_HT) << 4U) | ((temp & RTC_ALRMAR_HU) >> RTC_POSITION_ALMA_HU));
elmot 1:d0dfbce63a89 1890 }
elmot 1:d0dfbce63a89 1891
elmot 1:d0dfbce63a89 1892 /**
elmot 1:d0dfbce63a89 1893 * @brief Set ALARM A Minutes in BCD format
elmot 1:d0dfbce63a89 1894 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
elmot 1:d0dfbce63a89 1895 * @rmtoll ALRMAR MNT LL_RTC_ALMA_SetMinute\n
elmot 1:d0dfbce63a89 1896 * ALRMAR MNU LL_RTC_ALMA_SetMinute
elmot 1:d0dfbce63a89 1897 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1898 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 1899 * @retval None
elmot 1:d0dfbce63a89 1900 */
elmot 1:d0dfbce63a89 1901 __STATIC_INLINE void LL_RTC_ALMA_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
elmot 1:d0dfbce63a89 1902 {
elmot 1:d0dfbce63a89 1903 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU),
elmot 1:d0dfbce63a89 1904 (((Minutes & 0xF0U) << (RTC_POSITION_ALMA_MT - 4U)) | ((Minutes & 0x0FU) << RTC_POSITION_ALMA_MU)));
elmot 1:d0dfbce63a89 1905 }
elmot 1:d0dfbce63a89 1906
elmot 1:d0dfbce63a89 1907 /**
elmot 1:d0dfbce63a89 1908 * @brief Get ALARM A Minutes in BCD format
elmot 1:d0dfbce63a89 1909 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
elmot 1:d0dfbce63a89 1910 * @rmtoll ALRMAR MNT LL_RTC_ALMA_GetMinute\n
elmot 1:d0dfbce63a89 1911 * ALRMAR MNU LL_RTC_ALMA_GetMinute
elmot 1:d0dfbce63a89 1912 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1913 * @retval Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 1914 */
elmot 1:d0dfbce63a89 1915 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMinute(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1916 {
elmot 1:d0dfbce63a89 1917 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 1918
elmot 1:d0dfbce63a89 1919 temp = READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU));
elmot 1:d0dfbce63a89 1920 return (uint32_t)((((temp & RTC_ALRMAR_MNT) >> RTC_POSITION_ALMA_MT) << 4U) | ((temp & RTC_ALRMAR_MNU) >> RTC_POSITION_ALMA_MU));
elmot 1:d0dfbce63a89 1921 }
elmot 1:d0dfbce63a89 1922
elmot 1:d0dfbce63a89 1923 /**
elmot 1:d0dfbce63a89 1924 * @brief Set ALARM A Seconds in BCD format
elmot 1:d0dfbce63a89 1925 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
elmot 1:d0dfbce63a89 1926 * @rmtoll ALRMAR ST LL_RTC_ALMA_SetSecond\n
elmot 1:d0dfbce63a89 1927 * ALRMAR SU LL_RTC_ALMA_SetSecond
elmot 1:d0dfbce63a89 1928 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1929 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 1930 * @retval None
elmot 1:d0dfbce63a89 1931 */
elmot 1:d0dfbce63a89 1932 __STATIC_INLINE void LL_RTC_ALMA_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
elmot 1:d0dfbce63a89 1933 {
elmot 1:d0dfbce63a89 1934 MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU),
elmot 1:d0dfbce63a89 1935 (((Seconds & 0xF0U) << (RTC_POSITION_ALMA_ST - 4U)) | ((Seconds & 0x0FU) << RTC_POSITION_ALMA_SU)));
elmot 1:d0dfbce63a89 1936 }
elmot 1:d0dfbce63a89 1937
elmot 1:d0dfbce63a89 1938 /**
elmot 1:d0dfbce63a89 1939 * @brief Get ALARM A Seconds in BCD format
elmot 1:d0dfbce63a89 1940 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
elmot 1:d0dfbce63a89 1941 * @rmtoll ALRMAR ST LL_RTC_ALMA_GetSecond\n
elmot 1:d0dfbce63a89 1942 * ALRMAR SU LL_RTC_ALMA_GetSecond
elmot 1:d0dfbce63a89 1943 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1944 * @retval Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 1945 */
elmot 1:d0dfbce63a89 1946 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSecond(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1947 {
elmot 1:d0dfbce63a89 1948 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 1949
elmot 1:d0dfbce63a89 1950 temp = READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU));
elmot 1:d0dfbce63a89 1951 return (uint32_t)((((temp & RTC_ALRMAR_ST) >> RTC_POSITION_ALMA_ST) << 4U) | ((temp & RTC_ALRMAR_SU) >> RTC_POSITION_ALMA_SU));
elmot 1:d0dfbce63a89 1952 }
elmot 1:d0dfbce63a89 1953
elmot 1:d0dfbce63a89 1954 /**
elmot 1:d0dfbce63a89 1955 * @brief Set Alarm A Time (hour, minute and second) in BCD format
elmot 1:d0dfbce63a89 1956 * @rmtoll ALRMAR PM LL_RTC_ALMA_ConfigTime\n
elmot 1:d0dfbce63a89 1957 * ALRMAR HT LL_RTC_ALMA_ConfigTime\n
elmot 1:d0dfbce63a89 1958 * ALRMAR HU LL_RTC_ALMA_ConfigTime\n
elmot 1:d0dfbce63a89 1959 * ALRMAR MNT LL_RTC_ALMA_ConfigTime\n
elmot 1:d0dfbce63a89 1960 * ALRMAR MNU LL_RTC_ALMA_ConfigTime\n
elmot 1:d0dfbce63a89 1961 * ALRMAR ST LL_RTC_ALMA_ConfigTime\n
elmot 1:d0dfbce63a89 1962 * ALRMAR SU LL_RTC_ALMA_ConfigTime
elmot 1:d0dfbce63a89 1963 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1964 * @param Format12_24 This parameter can be one of the following values:
elmot 1:d0dfbce63a89 1965 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
elmot 1:d0dfbce63a89 1966 * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
elmot 1:d0dfbce63a89 1967 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
elmot 1:d0dfbce63a89 1968 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 1969 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 1970 * @retval None
elmot 1:d0dfbce63a89 1971 */
elmot 1:d0dfbce63a89 1972 __STATIC_INLINE void LL_RTC_ALMA_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
elmot 1:d0dfbce63a89 1973 {
elmot 1:d0dfbce63a89 1974 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 1975
elmot 1:d0dfbce63a89 1976 temp = Format12_24 | (((Hours & 0xF0U) << (RTC_POSITION_ALMA_HT - 4U)) | ((Hours & 0x0FU) << RTC_POSITION_ALMA_HU)) | \
elmot 1:d0dfbce63a89 1977 (((Minutes & 0xF0U) << (RTC_POSITION_ALMA_MT - 4U)) | ((Minutes & 0x0FU) << RTC_POSITION_ALMA_MU)) | \
elmot 1:d0dfbce63a89 1978 (((Seconds & 0xF0U) << (RTC_POSITION_ALMA_ST - 4U)) | ((Seconds & 0x0FU) << RTC_POSITION_ALMA_SU));
elmot 1:d0dfbce63a89 1979
elmot 1:d0dfbce63a89 1980 MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM | RTC_ALRMAR_HT | RTC_ALRMAR_HU | RTC_ALRMAR_MNT | RTC_ALRMAR_MNU | RTC_ALRMAR_ST | RTC_ALRMAR_SU, temp);
elmot 1:d0dfbce63a89 1981 }
elmot 1:d0dfbce63a89 1982
elmot 1:d0dfbce63a89 1983 /**
elmot 1:d0dfbce63a89 1984 * @brief Get Alarm B Time (hour, minute and second) in BCD format
elmot 1:d0dfbce63a89 1985 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
elmot 1:d0dfbce63a89 1986 * are available to get independently each parameter.
elmot 1:d0dfbce63a89 1987 * @rmtoll ALRMAR HT LL_RTC_ALMA_GetTime\n
elmot 1:d0dfbce63a89 1988 * ALRMAR HU LL_RTC_ALMA_GetTime\n
elmot 1:d0dfbce63a89 1989 * ALRMAR MNT LL_RTC_ALMA_GetTime\n
elmot 1:d0dfbce63a89 1990 * ALRMAR MNU LL_RTC_ALMA_GetTime\n
elmot 1:d0dfbce63a89 1991 * ALRMAR ST LL_RTC_ALMA_GetTime\n
elmot 1:d0dfbce63a89 1992 * ALRMAR SU LL_RTC_ALMA_GetTime
elmot 1:d0dfbce63a89 1993 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 1994 * @retval Combination of hours, minutes and seconds.
elmot 1:d0dfbce63a89 1995 */
elmot 1:d0dfbce63a89 1996 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTime(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 1997 {
elmot 1:d0dfbce63a89 1998 return (uint32_t)((LL_RTC_ALMA_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMA_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMA_GetSecond(RTCx));
elmot 1:d0dfbce63a89 1999 }
elmot 1:d0dfbce63a89 2000
elmot 1:d0dfbce63a89 2001 /**
elmot 1:d0dfbce63a89 2002 * @brief Set Alarm A Mask the most-significant bits starting at this bit
elmot 1:d0dfbce63a89 2003 * @note This register can be written only when ALRAE is reset in RTC_CR register,
elmot 1:d0dfbce63a89 2004 * or in initialization mode.
elmot 1:d0dfbce63a89 2005 * @rmtoll ALRMASSR MASKSS LL_RTC_ALMA_SetSubSecondMask
elmot 1:d0dfbce63a89 2006 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2007 * @param Mask Value between Min_Data=0x00 and Max_Data=0xF
elmot 1:d0dfbce63a89 2008 * @retval None
elmot 1:d0dfbce63a89 2009 */
elmot 1:d0dfbce63a89 2010 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
elmot 1:d0dfbce63a89 2011 {
elmot 1:d0dfbce63a89 2012 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS, Mask << RTC_POSITION_ALMA_MASKSS);
elmot 1:d0dfbce63a89 2013 }
elmot 1:d0dfbce63a89 2014
elmot 1:d0dfbce63a89 2015 /**
elmot 1:d0dfbce63a89 2016 * @brief Get Alarm A Mask the most-significant bits starting at this bit
elmot 1:d0dfbce63a89 2017 * @rmtoll ALRMASSR MASKSS LL_RTC_ALMA_GetSubSecondMask
elmot 1:d0dfbce63a89 2018 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2019 * @retval Value between Min_Data=0x00 and Max_Data=0xF
elmot 1:d0dfbce63a89 2020 */
elmot 1:d0dfbce63a89 2021 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecondMask(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2022 {
elmot 1:d0dfbce63a89 2023 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS) >> RTC_POSITION_ALMA_MASKSS);
elmot 1:d0dfbce63a89 2024 }
elmot 1:d0dfbce63a89 2025
elmot 1:d0dfbce63a89 2026 /**
elmot 1:d0dfbce63a89 2027 * @brief Set Alarm A Sub seconds value
elmot 1:d0dfbce63a89 2028 * @rmtoll ALRMASSR SS LL_RTC_ALMA_SetSubSecond
elmot 1:d0dfbce63a89 2029 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2030 * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
elmot 1:d0dfbce63a89 2031 * @retval None
elmot 1:d0dfbce63a89 2032 */
elmot 1:d0dfbce63a89 2033 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
elmot 1:d0dfbce63a89 2034 {
elmot 1:d0dfbce63a89 2035 MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_SS, Subsecond);
elmot 1:d0dfbce63a89 2036 }
elmot 1:d0dfbce63a89 2037
elmot 1:d0dfbce63a89 2038 /**
elmot 1:d0dfbce63a89 2039 * @brief Get Alarm A Sub seconds value
elmot 1:d0dfbce63a89 2040 * @rmtoll ALRMASSR SS LL_RTC_ALMA_GetSubSecond
elmot 1:d0dfbce63a89 2041 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2042 * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
elmot 1:d0dfbce63a89 2043 */
elmot 1:d0dfbce63a89 2044 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecond(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2045 {
elmot 1:d0dfbce63a89 2046 return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_SS));
elmot 1:d0dfbce63a89 2047 }
elmot 1:d0dfbce63a89 2048
elmot 1:d0dfbce63a89 2049 /**
elmot 1:d0dfbce63a89 2050 * @}
elmot 1:d0dfbce63a89 2051 */
elmot 1:d0dfbce63a89 2052
elmot 1:d0dfbce63a89 2053 /** @defgroup RTC_LL_EF_ALARMB ALARMB
elmot 1:d0dfbce63a89 2054 * @{
elmot 1:d0dfbce63a89 2055 */
elmot 1:d0dfbce63a89 2056
elmot 1:d0dfbce63a89 2057 /**
elmot 1:d0dfbce63a89 2058 * @brief Enable Alarm B
elmot 1:d0dfbce63a89 2059 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 2060 * @rmtoll CR ALRBE LL_RTC_ALMB_Enable
elmot 1:d0dfbce63a89 2061 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2062 * @retval None
elmot 1:d0dfbce63a89 2063 */
elmot 1:d0dfbce63a89 2064 __STATIC_INLINE void LL_RTC_ALMB_Enable(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2065 {
elmot 1:d0dfbce63a89 2066 SET_BIT(RTCx->CR, RTC_CR_ALRBE);
elmot 1:d0dfbce63a89 2067 }
elmot 1:d0dfbce63a89 2068
elmot 1:d0dfbce63a89 2069 /**
elmot 1:d0dfbce63a89 2070 * @brief Disable Alarm B
elmot 1:d0dfbce63a89 2071 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 2072 * @rmtoll CR ALRBE LL_RTC_ALMB_Disable
elmot 1:d0dfbce63a89 2073 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2074 * @retval None
elmot 1:d0dfbce63a89 2075 */
elmot 1:d0dfbce63a89 2076 __STATIC_INLINE void LL_RTC_ALMB_Disable(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2077 {
elmot 1:d0dfbce63a89 2078 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBE);
elmot 1:d0dfbce63a89 2079 }
elmot 1:d0dfbce63a89 2080
elmot 1:d0dfbce63a89 2081 /**
elmot 1:d0dfbce63a89 2082 * @brief Specify the Alarm B masks.
elmot 1:d0dfbce63a89 2083 * @rmtoll ALRMBR MSK4 LL_RTC_ALMB_SetMask\n
elmot 1:d0dfbce63a89 2084 * ALRMBR MSK3 LL_RTC_ALMB_SetMask\n
elmot 1:d0dfbce63a89 2085 * ALRMBR MSK2 LL_RTC_ALMB_SetMask\n
elmot 1:d0dfbce63a89 2086 * ALRMBR MSK1 LL_RTC_ALMB_SetMask
elmot 1:d0dfbce63a89 2087 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2088 * @param Mask This parameter can be a combination of the following values:
elmot 1:d0dfbce63a89 2089 * @arg @ref LL_RTC_ALMB_MASK_NONE
elmot 1:d0dfbce63a89 2090 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
elmot 1:d0dfbce63a89 2091 * @arg @ref LL_RTC_ALMB_MASK_HOURS
elmot 1:d0dfbce63a89 2092 * @arg @ref LL_RTC_ALMB_MASK_MINUTES
elmot 1:d0dfbce63a89 2093 * @arg @ref LL_RTC_ALMB_MASK_SECONDS
elmot 1:d0dfbce63a89 2094 * @arg @ref LL_RTC_ALMB_MASK_ALL
elmot 1:d0dfbce63a89 2095 * @retval None
elmot 1:d0dfbce63a89 2096 */
elmot 1:d0dfbce63a89 2097 __STATIC_INLINE void LL_RTC_ALMB_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
elmot 1:d0dfbce63a89 2098 {
elmot 1:d0dfbce63a89 2099 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1, Mask);
elmot 1:d0dfbce63a89 2100 }
elmot 1:d0dfbce63a89 2101
elmot 1:d0dfbce63a89 2102 /**
elmot 1:d0dfbce63a89 2103 * @brief Get the Alarm B masks.
elmot 1:d0dfbce63a89 2104 * @rmtoll ALRMBR MSK4 LL_RTC_ALMB_GetMask\n
elmot 1:d0dfbce63a89 2105 * ALRMBR MSK3 LL_RTC_ALMB_GetMask\n
elmot 1:d0dfbce63a89 2106 * ALRMBR MSK2 LL_RTC_ALMB_GetMask\n
elmot 1:d0dfbce63a89 2107 * ALRMBR MSK1 LL_RTC_ALMB_GetMask
elmot 1:d0dfbce63a89 2108 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2109 * @retval Returned value can be can be a combination of the following values:
elmot 1:d0dfbce63a89 2110 * @arg @ref LL_RTC_ALMB_MASK_NONE
elmot 1:d0dfbce63a89 2111 * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
elmot 1:d0dfbce63a89 2112 * @arg @ref LL_RTC_ALMB_MASK_HOURS
elmot 1:d0dfbce63a89 2113 * @arg @ref LL_RTC_ALMB_MASK_MINUTES
elmot 1:d0dfbce63a89 2114 * @arg @ref LL_RTC_ALMB_MASK_SECONDS
elmot 1:d0dfbce63a89 2115 * @arg @ref LL_RTC_ALMB_MASK_ALL
elmot 1:d0dfbce63a89 2116 */
elmot 1:d0dfbce63a89 2117 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMask(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2118 {
elmot 1:d0dfbce63a89 2119 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1));
elmot 1:d0dfbce63a89 2120 }
elmot 1:d0dfbce63a89 2121
elmot 1:d0dfbce63a89 2122 /**
elmot 1:d0dfbce63a89 2123 * @brief Enable AlarmB Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
elmot 1:d0dfbce63a89 2124 * @rmtoll ALRMBR WDSEL LL_RTC_ALMB_EnableWeekday
elmot 1:d0dfbce63a89 2125 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2126 * @retval None
elmot 1:d0dfbce63a89 2127 */
elmot 1:d0dfbce63a89 2128 __STATIC_INLINE void LL_RTC_ALMB_EnableWeekday(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2129 {
elmot 1:d0dfbce63a89 2130 SET_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
elmot 1:d0dfbce63a89 2131 }
elmot 1:d0dfbce63a89 2132
elmot 1:d0dfbce63a89 2133 /**
elmot 1:d0dfbce63a89 2134 * @brief Disable AlarmB Week day selection (DU[3:0] represents the date )
elmot 1:d0dfbce63a89 2135 * @rmtoll ALRMBR WDSEL LL_RTC_ALMB_DisableWeekday
elmot 1:d0dfbce63a89 2136 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2137 * @retval None
elmot 1:d0dfbce63a89 2138 */
elmot 1:d0dfbce63a89 2139 __STATIC_INLINE void LL_RTC_ALMB_DisableWeekday(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2140 {
elmot 1:d0dfbce63a89 2141 CLEAR_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
elmot 1:d0dfbce63a89 2142 }
elmot 1:d0dfbce63a89 2143
elmot 1:d0dfbce63a89 2144 /**
elmot 1:d0dfbce63a89 2145 * @brief Set ALARM B Day in BCD format
elmot 1:d0dfbce63a89 2146 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
elmot 1:d0dfbce63a89 2147 * @rmtoll ALRMBR DT LL_RTC_ALMB_SetDay\n
elmot 1:d0dfbce63a89 2148 * ALRMBR DU LL_RTC_ALMB_SetDay
elmot 1:d0dfbce63a89 2149 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2150 * @param Day Value between Min_Data=0x01 and Max_Data=0x31
elmot 1:d0dfbce63a89 2151 * @retval None
elmot 1:d0dfbce63a89 2152 */
elmot 1:d0dfbce63a89 2153 __STATIC_INLINE void LL_RTC_ALMB_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
elmot 1:d0dfbce63a89 2154 {
elmot 1:d0dfbce63a89 2155 MODIFY_REG(RTC->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU),
elmot 1:d0dfbce63a89 2156 (((Day & 0xF0U) << (RTC_POSITION_ALMB_DT - 4U)) | ((Day & 0x0FU) << RTC_POSITION_ALMB_DU)));
elmot 1:d0dfbce63a89 2157 }
elmot 1:d0dfbce63a89 2158
elmot 1:d0dfbce63a89 2159 /**
elmot 1:d0dfbce63a89 2160 * @brief Get ALARM B Day in BCD format
elmot 1:d0dfbce63a89 2161 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
elmot 1:d0dfbce63a89 2162 * @rmtoll ALRMBR DT LL_RTC_ALMB_GetDay\n
elmot 1:d0dfbce63a89 2163 * ALRMBR DU LL_RTC_ALMB_GetDay
elmot 1:d0dfbce63a89 2164 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2165 * @retval Value between Min_Data=0x01 and Max_Data=0x31
elmot 1:d0dfbce63a89 2166 */
elmot 1:d0dfbce63a89 2167 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetDay(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2168 {
elmot 1:d0dfbce63a89 2169 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 2170
elmot 1:d0dfbce63a89 2171 temp = READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU));
elmot 1:d0dfbce63a89 2172 return (uint32_t)((((temp & RTC_ALRMBR_DT) >> RTC_POSITION_ALMB_DT) << 4U) | ((temp & RTC_ALRMBR_DU) >> RTC_POSITION_ALMB_DU));
elmot 1:d0dfbce63a89 2173 }
elmot 1:d0dfbce63a89 2174
elmot 1:d0dfbce63a89 2175 /**
elmot 1:d0dfbce63a89 2176 * @brief Set ALARM B Weekday
elmot 1:d0dfbce63a89 2177 * @rmtoll ALRMBR DU LL_RTC_ALMB_SetWeekDay
elmot 1:d0dfbce63a89 2178 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2179 * @param WeekDay This parameter can be one of the following values:
elmot 1:d0dfbce63a89 2180 * @arg @ref LL_RTC_WEEKDAY_MONDAY
elmot 1:d0dfbce63a89 2181 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
elmot 1:d0dfbce63a89 2182 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
elmot 1:d0dfbce63a89 2183 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
elmot 1:d0dfbce63a89 2184 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
elmot 1:d0dfbce63a89 2185 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
elmot 1:d0dfbce63a89 2186 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
elmot 1:d0dfbce63a89 2187 * @retval None
elmot 1:d0dfbce63a89 2188 */
elmot 1:d0dfbce63a89 2189 __STATIC_INLINE void LL_RTC_ALMB_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
elmot 1:d0dfbce63a89 2190 {
elmot 1:d0dfbce63a89 2191 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_DU, WeekDay << RTC_POSITION_ALMB_DU);
elmot 1:d0dfbce63a89 2192 }
elmot 1:d0dfbce63a89 2193
elmot 1:d0dfbce63a89 2194 /**
elmot 1:d0dfbce63a89 2195 * @brief Get ALARM B Weekday
elmot 1:d0dfbce63a89 2196 * @rmtoll ALRMBR DU LL_RTC_ALMB_GetWeekDay
elmot 1:d0dfbce63a89 2197 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2198 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 2199 * @arg @ref LL_RTC_WEEKDAY_MONDAY
elmot 1:d0dfbce63a89 2200 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
elmot 1:d0dfbce63a89 2201 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
elmot 1:d0dfbce63a89 2202 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
elmot 1:d0dfbce63a89 2203 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
elmot 1:d0dfbce63a89 2204 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
elmot 1:d0dfbce63a89 2205 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
elmot 1:d0dfbce63a89 2206 */
elmot 1:d0dfbce63a89 2207 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetWeekDay(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2208 {
elmot 1:d0dfbce63a89 2209 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_DU) >> RTC_POSITION_ALMB_DU);
elmot 1:d0dfbce63a89 2210 }
elmot 1:d0dfbce63a89 2211
elmot 1:d0dfbce63a89 2212 /**
elmot 1:d0dfbce63a89 2213 * @brief Set ALARM B time format (AM/24-hour or PM notation)
elmot 1:d0dfbce63a89 2214 * @rmtoll ALRMBR PM LL_RTC_ALMB_SetTimeFormat
elmot 1:d0dfbce63a89 2215 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2216 * @param TimeFormat This parameter can be one of the following values:
elmot 1:d0dfbce63a89 2217 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
elmot 1:d0dfbce63a89 2218 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
elmot 1:d0dfbce63a89 2219 * @retval None
elmot 1:d0dfbce63a89 2220 */
elmot 1:d0dfbce63a89 2221 __STATIC_INLINE void LL_RTC_ALMB_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
elmot 1:d0dfbce63a89 2222 {
elmot 1:d0dfbce63a89 2223 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM, TimeFormat);
elmot 1:d0dfbce63a89 2224 }
elmot 1:d0dfbce63a89 2225
elmot 1:d0dfbce63a89 2226 /**
elmot 1:d0dfbce63a89 2227 * @brief Get ALARM B time format (AM or PM notation)
elmot 1:d0dfbce63a89 2228 * @rmtoll ALRMBR PM LL_RTC_ALMB_GetTimeFormat
elmot 1:d0dfbce63a89 2229 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2230 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 2231 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
elmot 1:d0dfbce63a89 2232 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
elmot 1:d0dfbce63a89 2233 */
elmot 1:d0dfbce63a89 2234 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTimeFormat(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2235 {
elmot 1:d0dfbce63a89 2236 return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_PM));
elmot 1:d0dfbce63a89 2237 }
elmot 1:d0dfbce63a89 2238
elmot 1:d0dfbce63a89 2239 /**
elmot 1:d0dfbce63a89 2240 * @brief Set ALARM B Hours in BCD format
elmot 1:d0dfbce63a89 2241 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
elmot 1:d0dfbce63a89 2242 * @rmtoll ALRMBR HT LL_RTC_ALMB_SetHour\n
elmot 1:d0dfbce63a89 2243 * ALRMBR HU LL_RTC_ALMB_SetHour
elmot 1:d0dfbce63a89 2244 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2245 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
elmot 1:d0dfbce63a89 2246 * @retval None
elmot 1:d0dfbce63a89 2247 */
elmot 1:d0dfbce63a89 2248 __STATIC_INLINE void LL_RTC_ALMB_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
elmot 1:d0dfbce63a89 2249 {
elmot 1:d0dfbce63a89 2250 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU),
elmot 1:d0dfbce63a89 2251 (((Hours & 0xF0U) << (RTC_POSITION_ALMB_HT - 4U)) | ((Hours & 0x0FU) << RTC_POSITION_ALMB_HU)));
elmot 1:d0dfbce63a89 2252 }
elmot 1:d0dfbce63a89 2253
elmot 1:d0dfbce63a89 2254 /**
elmot 1:d0dfbce63a89 2255 * @brief Get ALARM B Hours in BCD format
elmot 1:d0dfbce63a89 2256 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
elmot 1:d0dfbce63a89 2257 * @rmtoll ALRMBR HT LL_RTC_ALMB_GetHour\n
elmot 1:d0dfbce63a89 2258 * ALRMBR HU LL_RTC_ALMB_GetHour
elmot 1:d0dfbce63a89 2259 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2260 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
elmot 1:d0dfbce63a89 2261 */
elmot 1:d0dfbce63a89 2262 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetHour(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2263 {
elmot 1:d0dfbce63a89 2264 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 2265
elmot 1:d0dfbce63a89 2266 temp = READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU));
elmot 1:d0dfbce63a89 2267 return (uint32_t)((((temp & RTC_ALRMBR_HT) >> RTC_POSITION_ALMB_HT) << 4U) | ((temp & RTC_ALRMBR_HU) >> RTC_POSITION_ALMB_HU));
elmot 1:d0dfbce63a89 2268 }
elmot 1:d0dfbce63a89 2269
elmot 1:d0dfbce63a89 2270 /**
elmot 1:d0dfbce63a89 2271 * @brief Set ALARM B Minutes in BCD format
elmot 1:d0dfbce63a89 2272 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
elmot 1:d0dfbce63a89 2273 * @rmtoll ALRMBR MNT LL_RTC_ALMB_SetMinute\n
elmot 1:d0dfbce63a89 2274 * ALRMBR MNU LL_RTC_ALMB_SetMinute
elmot 1:d0dfbce63a89 2275 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2276 * @param Minutes between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 2277 * @retval None
elmot 1:d0dfbce63a89 2278 */
elmot 1:d0dfbce63a89 2279 __STATIC_INLINE void LL_RTC_ALMB_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
elmot 1:d0dfbce63a89 2280 {
elmot 1:d0dfbce63a89 2281 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU),
elmot 1:d0dfbce63a89 2282 (((Minutes & 0xF0U) << (RTC_POSITION_ALMB_MT - 4U)) | ((Minutes & 0x0FU) << RTC_POSITION_ALMB_MU)));
elmot 1:d0dfbce63a89 2283 }
elmot 1:d0dfbce63a89 2284
elmot 1:d0dfbce63a89 2285 /**
elmot 1:d0dfbce63a89 2286 * @brief Get ALARM B Minutes in BCD format
elmot 1:d0dfbce63a89 2287 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
elmot 1:d0dfbce63a89 2288 * @rmtoll ALRMBR MNT LL_RTC_ALMB_GetMinute\n
elmot 1:d0dfbce63a89 2289 * ALRMBR MNU LL_RTC_ALMB_GetMinute
elmot 1:d0dfbce63a89 2290 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2291 * @retval Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 2292 */
elmot 1:d0dfbce63a89 2293 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMinute(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2294 {
elmot 1:d0dfbce63a89 2295 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 2296
elmot 1:d0dfbce63a89 2297 temp = READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU));
elmot 1:d0dfbce63a89 2298 return (uint32_t)((((temp & RTC_ALRMBR_MNT) >> RTC_POSITION_ALMB_MT) << 4U) | ((temp & RTC_ALRMBR_MNU) >> RTC_POSITION_ALMB_MU));
elmot 1:d0dfbce63a89 2299 }
elmot 1:d0dfbce63a89 2300
elmot 1:d0dfbce63a89 2301 /**
elmot 1:d0dfbce63a89 2302 * @brief Set ALARM B Seconds in BCD format
elmot 1:d0dfbce63a89 2303 * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
elmot 1:d0dfbce63a89 2304 * @rmtoll ALRMBR ST LL_RTC_ALMB_SetSecond\n
elmot 1:d0dfbce63a89 2305 * ALRMBR SU LL_RTC_ALMB_SetSecond
elmot 1:d0dfbce63a89 2306 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2307 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 2308 * @retval None
elmot 1:d0dfbce63a89 2309 */
elmot 1:d0dfbce63a89 2310 __STATIC_INLINE void LL_RTC_ALMB_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
elmot 1:d0dfbce63a89 2311 {
elmot 1:d0dfbce63a89 2312 MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU),
elmot 1:d0dfbce63a89 2313 (((Seconds & 0xF0U) << (RTC_POSITION_ALMB_ST - 4U)) | ((Seconds & 0x0FU) << RTC_POSITION_ALMB_SU)));
elmot 1:d0dfbce63a89 2314 }
elmot 1:d0dfbce63a89 2315
elmot 1:d0dfbce63a89 2316 /**
elmot 1:d0dfbce63a89 2317 * @brief Get ALARM B Seconds in BCD format
elmot 1:d0dfbce63a89 2318 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
elmot 1:d0dfbce63a89 2319 * @rmtoll ALRMBR ST LL_RTC_ALMB_GetSecond\n
elmot 1:d0dfbce63a89 2320 * ALRMBR SU LL_RTC_ALMB_GetSecond
elmot 1:d0dfbce63a89 2321 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2322 * @retval Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 2323 */
elmot 1:d0dfbce63a89 2324 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSecond(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2325 {
elmot 1:d0dfbce63a89 2326 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 2327
elmot 1:d0dfbce63a89 2328 temp = READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU));
elmot 1:d0dfbce63a89 2329 return (uint32_t)((((temp & RTC_ALRMBR_ST) >> RTC_POSITION_ALMB_ST) << 4U) | ((temp & RTC_ALRMBR_SU) >> RTC_POSITION_ALMB_SU));
elmot 1:d0dfbce63a89 2330 }
elmot 1:d0dfbce63a89 2331
elmot 1:d0dfbce63a89 2332 /**
elmot 1:d0dfbce63a89 2333 * @brief Set Alarm B Time (hour, minute and second) in BCD format
elmot 1:d0dfbce63a89 2334 * @rmtoll ALRMBR PM LL_RTC_ALMB_ConfigTime\n
elmot 1:d0dfbce63a89 2335 * ALRMBR HT LL_RTC_ALMB_ConfigTime\n
elmot 1:d0dfbce63a89 2336 * ALRMBR HU LL_RTC_ALMB_ConfigTime\n
elmot 1:d0dfbce63a89 2337 * ALRMBR MNT LL_RTC_ALMB_ConfigTime\n
elmot 1:d0dfbce63a89 2338 * ALRMBR MNU LL_RTC_ALMB_ConfigTime\n
elmot 1:d0dfbce63a89 2339 * ALRMBR ST LL_RTC_ALMB_ConfigTime\n
elmot 1:d0dfbce63a89 2340 * ALRMBR SU LL_RTC_ALMB_ConfigTime
elmot 1:d0dfbce63a89 2341 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2342 * @param Format12_24 This parameter can be one of the following values:
elmot 1:d0dfbce63a89 2343 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
elmot 1:d0dfbce63a89 2344 * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
elmot 1:d0dfbce63a89 2345 * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
elmot 1:d0dfbce63a89 2346 * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 2347 * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 2348 * @retval None
elmot 1:d0dfbce63a89 2349 */
elmot 1:d0dfbce63a89 2350 __STATIC_INLINE void LL_RTC_ALMB_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
elmot 1:d0dfbce63a89 2351 {
elmot 1:d0dfbce63a89 2352 register uint32_t temp = 0U;
elmot 1:d0dfbce63a89 2353
elmot 1:d0dfbce63a89 2354 temp = Format12_24 | (((Hours & 0xF0U) << (RTC_POSITION_ALMB_HT - 4U)) | ((Hours & 0x0FU) << RTC_POSITION_ALMB_HU)) | \
elmot 1:d0dfbce63a89 2355 (((Minutes & 0xF0U) << (RTC_POSITION_ALMB_MT - 4U)) | ((Minutes & 0x0FU) << RTC_POSITION_ALMB_MU)) | \
elmot 1:d0dfbce63a89 2356 (((Seconds & 0xF0U) << (RTC_POSITION_ALMB_ST - 4U)) | ((Seconds & 0x0FU) << RTC_POSITION_ALMB_SU));
elmot 1:d0dfbce63a89 2357
elmot 1:d0dfbce63a89 2358 MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM| RTC_ALRMBR_HT | RTC_ALRMBR_HU | RTC_ALRMBR_MNT | RTC_ALRMBR_MNU | RTC_ALRMBR_ST | RTC_ALRMBR_SU, temp);
elmot 1:d0dfbce63a89 2359 }
elmot 1:d0dfbce63a89 2360
elmot 1:d0dfbce63a89 2361 /**
elmot 1:d0dfbce63a89 2362 * @brief Get Alarm B Time (hour, minute and second) in BCD format
elmot 1:d0dfbce63a89 2363 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
elmot 1:d0dfbce63a89 2364 * are available to get independently each parameter.
elmot 1:d0dfbce63a89 2365 * @rmtoll ALRMBR HT LL_RTC_ALMB_GetTime\n
elmot 1:d0dfbce63a89 2366 * ALRMBR HU LL_RTC_ALMB_GetTime\n
elmot 1:d0dfbce63a89 2367 * ALRMBR MNT LL_RTC_ALMB_GetTime\n
elmot 1:d0dfbce63a89 2368 * ALRMBR MNU LL_RTC_ALMB_GetTime\n
elmot 1:d0dfbce63a89 2369 * ALRMBR ST LL_RTC_ALMB_GetTime\n
elmot 1:d0dfbce63a89 2370 * ALRMBR SU LL_RTC_ALMB_GetTime
elmot 1:d0dfbce63a89 2371 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2372 * @retval Combination of hours, minutes and seconds.
elmot 1:d0dfbce63a89 2373 */
elmot 1:d0dfbce63a89 2374 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTime(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2375 {
elmot 1:d0dfbce63a89 2376 return (uint32_t)((LL_RTC_ALMB_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMB_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMB_GetSecond(RTCx));
elmot 1:d0dfbce63a89 2377 }
elmot 1:d0dfbce63a89 2378
elmot 1:d0dfbce63a89 2379 /**
elmot 1:d0dfbce63a89 2380 * @brief Set Alarm B Mask the most-significant bits starting at this bit
elmot 1:d0dfbce63a89 2381 * @note This register can be written only when ALRBE is reset in RTC_CR register,
elmot 1:d0dfbce63a89 2382 * or in initialization mode.
elmot 1:d0dfbce63a89 2383 * @rmtoll ALRMBSSR MASKSS LL_RTC_ALMB_SetSubSecondMask
elmot 1:d0dfbce63a89 2384 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2385 * @param Mask Value between Min_Data=0x00 and Max_Data=0xF
elmot 1:d0dfbce63a89 2386 * @retval None
elmot 1:d0dfbce63a89 2387 */
elmot 1:d0dfbce63a89 2388 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
elmot 1:d0dfbce63a89 2389 {
elmot 1:d0dfbce63a89 2390 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS, Mask << RTC_POSITION_ALMB_MASKSS);
elmot 1:d0dfbce63a89 2391 }
elmot 1:d0dfbce63a89 2392
elmot 1:d0dfbce63a89 2393 /**
elmot 1:d0dfbce63a89 2394 * @brief Get Alarm B Mask the most-significant bits starting at this bit
elmot 1:d0dfbce63a89 2395 * @rmtoll ALRMBSSR MASKSS LL_RTC_ALMB_GetSubSecondMask
elmot 1:d0dfbce63a89 2396 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2397 * @retval Value between Min_Data=0x00 and Max_Data=0xF
elmot 1:d0dfbce63a89 2398 */
elmot 1:d0dfbce63a89 2399 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecondMask(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2400 {
elmot 1:d0dfbce63a89 2401 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS) >> RTC_POSITION_ALMB_MASKSS);
elmot 1:d0dfbce63a89 2402 }
elmot 1:d0dfbce63a89 2403
elmot 1:d0dfbce63a89 2404 /**
elmot 1:d0dfbce63a89 2405 * @brief Set Alarm B Sub seconds value
elmot 1:d0dfbce63a89 2406 * @rmtoll ALRMBSSR SS LL_RTC_ALMB_SetSubSecond
elmot 1:d0dfbce63a89 2407 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2408 * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
elmot 1:d0dfbce63a89 2409 * @retval None
elmot 1:d0dfbce63a89 2410 */
elmot 1:d0dfbce63a89 2411 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
elmot 1:d0dfbce63a89 2412 {
elmot 1:d0dfbce63a89 2413 MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS, Subsecond);
elmot 1:d0dfbce63a89 2414 }
elmot 1:d0dfbce63a89 2415
elmot 1:d0dfbce63a89 2416 /**
elmot 1:d0dfbce63a89 2417 * @brief Get Alarm B Sub seconds value
elmot 1:d0dfbce63a89 2418 * @rmtoll ALRMBSSR SS LL_RTC_ALMB_GetSubSecond
elmot 1:d0dfbce63a89 2419 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2420 * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
elmot 1:d0dfbce63a89 2421 */
elmot 1:d0dfbce63a89 2422 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecond(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2423 {
elmot 1:d0dfbce63a89 2424 return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS));
elmot 1:d0dfbce63a89 2425 }
elmot 1:d0dfbce63a89 2426
elmot 1:d0dfbce63a89 2427 /**
elmot 1:d0dfbce63a89 2428 * @}
elmot 1:d0dfbce63a89 2429 */
elmot 1:d0dfbce63a89 2430
elmot 1:d0dfbce63a89 2431 /** @defgroup RTC_LL_EF_Timestamp Timestamp
elmot 1:d0dfbce63a89 2432 * @{
elmot 1:d0dfbce63a89 2433 */
elmot 1:d0dfbce63a89 2434
elmot 1:d0dfbce63a89 2435 /**
elmot 1:d0dfbce63a89 2436 * @brief Enable internal event timestamp
elmot 1:d0dfbce63a89 2437 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 2438 * @rmtoll CR ITSE LL_RTC_TS_EnableInternalEvent
elmot 1:d0dfbce63a89 2439 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2440 * @retval None
elmot 1:d0dfbce63a89 2441 */
elmot 1:d0dfbce63a89 2442 __STATIC_INLINE void LL_RTC_TS_EnableInternalEvent(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2443 {
elmot 1:d0dfbce63a89 2444 SET_BIT(RTCx->CR, RTC_CR_ITSE);
elmot 1:d0dfbce63a89 2445 }
elmot 1:d0dfbce63a89 2446
elmot 1:d0dfbce63a89 2447 /**
elmot 1:d0dfbce63a89 2448 * @brief Disable internal event timestamp
elmot 1:d0dfbce63a89 2449 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 2450 * @rmtoll CR ITSE LL_RTC_TS_DisableInternalEvent
elmot 1:d0dfbce63a89 2451 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2452 * @retval None
elmot 1:d0dfbce63a89 2453 */
elmot 1:d0dfbce63a89 2454 __STATIC_INLINE void LL_RTC_TS_DisableInternalEvent(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2455 {
elmot 1:d0dfbce63a89 2456 CLEAR_BIT(RTCx->CR, RTC_CR_ITSE);
elmot 1:d0dfbce63a89 2457 }
elmot 1:d0dfbce63a89 2458
elmot 1:d0dfbce63a89 2459 /**
elmot 1:d0dfbce63a89 2460 * @brief Enable Timestamp
elmot 1:d0dfbce63a89 2461 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 2462 * @rmtoll CR TSE LL_RTC_TS_Enable
elmot 1:d0dfbce63a89 2463 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2464 * @retval None
elmot 1:d0dfbce63a89 2465 */
elmot 1:d0dfbce63a89 2466 __STATIC_INLINE void LL_RTC_TS_Enable(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2467 {
elmot 1:d0dfbce63a89 2468 SET_BIT(RTCx->CR, RTC_CR_TSE);
elmot 1:d0dfbce63a89 2469 }
elmot 1:d0dfbce63a89 2470
elmot 1:d0dfbce63a89 2471 /**
elmot 1:d0dfbce63a89 2472 * @brief Disable Timestamp
elmot 1:d0dfbce63a89 2473 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 2474 * @rmtoll CR TSE LL_RTC_TS_Disable
elmot 1:d0dfbce63a89 2475 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2476 * @retval None
elmot 1:d0dfbce63a89 2477 */
elmot 1:d0dfbce63a89 2478 __STATIC_INLINE void LL_RTC_TS_Disable(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2479 {
elmot 1:d0dfbce63a89 2480 CLEAR_BIT(RTCx->CR, RTC_CR_TSE);
elmot 1:d0dfbce63a89 2481 }
elmot 1:d0dfbce63a89 2482
elmot 1:d0dfbce63a89 2483 /**
elmot 1:d0dfbce63a89 2484 * @brief Set Time-stamp event active edge
elmot 1:d0dfbce63a89 2485 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 2486 * @note TSE must be reset when TSEDGE is changed to avoid unwanted TSF setting
elmot 1:d0dfbce63a89 2487 * @rmtoll CR TSEDGE LL_RTC_TS_SetActiveEdge
elmot 1:d0dfbce63a89 2488 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2489 * @param Edge This parameter can be one of the following values:
elmot 1:d0dfbce63a89 2490 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
elmot 1:d0dfbce63a89 2491 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
elmot 1:d0dfbce63a89 2492 * @retval None
elmot 1:d0dfbce63a89 2493 */
elmot 1:d0dfbce63a89 2494 __STATIC_INLINE void LL_RTC_TS_SetActiveEdge(RTC_TypeDef *RTCx, uint32_t Edge)
elmot 1:d0dfbce63a89 2495 {
elmot 1:d0dfbce63a89 2496 MODIFY_REG(RTCx->CR, RTC_CR_TSEDGE, Edge);
elmot 1:d0dfbce63a89 2497 }
elmot 1:d0dfbce63a89 2498
elmot 1:d0dfbce63a89 2499 /**
elmot 1:d0dfbce63a89 2500 * @brief Get Time-stamp event active edge
elmot 1:d0dfbce63a89 2501 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 2502 * @rmtoll CR TSEDGE LL_RTC_TS_GetActiveEdge
elmot 1:d0dfbce63a89 2503 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2504 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 2505 * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
elmot 1:d0dfbce63a89 2506 * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
elmot 1:d0dfbce63a89 2507 */
elmot 1:d0dfbce63a89 2508 __STATIC_INLINE uint32_t LL_RTC_TS_GetActiveEdge(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2509 {
elmot 1:d0dfbce63a89 2510 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TSEDGE));
elmot 1:d0dfbce63a89 2511 }
elmot 1:d0dfbce63a89 2512
elmot 1:d0dfbce63a89 2513 /**
elmot 1:d0dfbce63a89 2514 * @brief Get Timestamp AM/PM notation (AM or 24-hour format)
elmot 1:d0dfbce63a89 2515 * @rmtoll TSTR PM LL_RTC_TS_GetTimeFormat
elmot 1:d0dfbce63a89 2516 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2517 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 2518 * @arg @ref LL_RTC_TS_TIME_FORMAT_AM
elmot 1:d0dfbce63a89 2519 * @arg @ref LL_RTC_TS_TIME_FORMAT_PM
elmot 1:d0dfbce63a89 2520 */
elmot 1:d0dfbce63a89 2521 __STATIC_INLINE uint32_t LL_RTC_TS_GetTimeFormat(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2522 {
elmot 1:d0dfbce63a89 2523 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_PM));
elmot 1:d0dfbce63a89 2524 }
elmot 1:d0dfbce63a89 2525
elmot 1:d0dfbce63a89 2526 /**
elmot 1:d0dfbce63a89 2527 * @brief Get Timestamp Hours in BCD format
elmot 1:d0dfbce63a89 2528 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
elmot 1:d0dfbce63a89 2529 * @rmtoll TSTR HT LL_RTC_TS_GetHour\n
elmot 1:d0dfbce63a89 2530 * TSTR HU LL_RTC_TS_GetHour
elmot 1:d0dfbce63a89 2531 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2532 * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
elmot 1:d0dfbce63a89 2533 */
elmot 1:d0dfbce63a89 2534 __STATIC_INLINE uint32_t LL_RTC_TS_GetHour(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2535 {
elmot 1:d0dfbce63a89 2536 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_HT | RTC_TSTR_HU) >> RTC_POSITION_TS_HU);
elmot 1:d0dfbce63a89 2537 }
elmot 1:d0dfbce63a89 2538
elmot 1:d0dfbce63a89 2539 /**
elmot 1:d0dfbce63a89 2540 * @brief Get Timestamp Minutes in BCD format
elmot 1:d0dfbce63a89 2541 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
elmot 1:d0dfbce63a89 2542 * @rmtoll TSTR MNT LL_RTC_TS_GetMinute\n
elmot 1:d0dfbce63a89 2543 * TSTR MNU LL_RTC_TS_GetMinute
elmot 1:d0dfbce63a89 2544 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2545 * @retval Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 2546 */
elmot 1:d0dfbce63a89 2547 __STATIC_INLINE uint32_t LL_RTC_TS_GetMinute(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2548 {
elmot 1:d0dfbce63a89 2549 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_MNT | RTC_TSTR_MNU) >> RTC_POSITION_TS_MNU);
elmot 1:d0dfbce63a89 2550 }
elmot 1:d0dfbce63a89 2551
elmot 1:d0dfbce63a89 2552 /**
elmot 1:d0dfbce63a89 2553 * @brief Get Timestamp Seconds in BCD format
elmot 1:d0dfbce63a89 2554 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
elmot 1:d0dfbce63a89 2555 * @rmtoll TSTR ST LL_RTC_TS_GetSecond\n
elmot 1:d0dfbce63a89 2556 * TSTR SU LL_RTC_TS_GetSecond
elmot 1:d0dfbce63a89 2557 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2558 * @retval Value between Min_Data=0x00 and Max_Data=0x59
elmot 1:d0dfbce63a89 2559 */
elmot 1:d0dfbce63a89 2560 __STATIC_INLINE uint32_t LL_RTC_TS_GetSecond(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2561 {
elmot 1:d0dfbce63a89 2562 return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_ST | RTC_TSTR_SU));
elmot 1:d0dfbce63a89 2563 }
elmot 1:d0dfbce63a89 2564
elmot 1:d0dfbce63a89 2565 /**
elmot 1:d0dfbce63a89 2566 * @brief Get Timestamp time (hour, minute and second) in BCD format
elmot 1:d0dfbce63a89 2567 * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
elmot 1:d0dfbce63a89 2568 * are available to get independently each parameter.
elmot 1:d0dfbce63a89 2569 * @rmtoll TSTR HT LL_RTC_TS_GetTime\n
elmot 1:d0dfbce63a89 2570 * TSTR HU LL_RTC_TS_GetTime\n
elmot 1:d0dfbce63a89 2571 * TSTR MNT LL_RTC_TS_GetTime\n
elmot 1:d0dfbce63a89 2572 * TSTR MNU LL_RTC_TS_GetTime\n
elmot 1:d0dfbce63a89 2573 * TSTR ST LL_RTC_TS_GetTime\n
elmot 1:d0dfbce63a89 2574 * TSTR SU LL_RTC_TS_GetTime
elmot 1:d0dfbce63a89 2575 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2576 * @retval Combination of hours, minutes and seconds.
elmot 1:d0dfbce63a89 2577 */
elmot 1:d0dfbce63a89 2578 __STATIC_INLINE uint32_t LL_RTC_TS_GetTime(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2579 {
elmot 1:d0dfbce63a89 2580 return (uint32_t)(READ_BIT(RTCx->TSTR,
elmot 1:d0dfbce63a89 2581 RTC_TSTR_HT | RTC_TSTR_HU | RTC_TSTR_MNT | RTC_TSTR_MNU | RTC_TSTR_ST | RTC_TSTR_SU));
elmot 1:d0dfbce63a89 2582 }
elmot 1:d0dfbce63a89 2583
elmot 1:d0dfbce63a89 2584 /**
elmot 1:d0dfbce63a89 2585 * @brief Get Timestamp Week day
elmot 1:d0dfbce63a89 2586 * @rmtoll TSDR WDU LL_RTC_TS_GetWeekDay
elmot 1:d0dfbce63a89 2587 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2588 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 2589 * @arg @ref LL_RTC_WEEKDAY_MONDAY
elmot 1:d0dfbce63a89 2590 * @arg @ref LL_RTC_WEEKDAY_TUESDAY
elmot 1:d0dfbce63a89 2591 * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
elmot 1:d0dfbce63a89 2592 * @arg @ref LL_RTC_WEEKDAY_THURSDAY
elmot 1:d0dfbce63a89 2593 * @arg @ref LL_RTC_WEEKDAY_FRIDAY
elmot 1:d0dfbce63a89 2594 * @arg @ref LL_RTC_WEEKDAY_SATURDAY
elmot 1:d0dfbce63a89 2595 * @arg @ref LL_RTC_WEEKDAY_SUNDAY
elmot 1:d0dfbce63a89 2596 */
elmot 1:d0dfbce63a89 2597 __STATIC_INLINE uint32_t LL_RTC_TS_GetWeekDay(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2598 {
elmot 1:d0dfbce63a89 2599 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU) >> RTC_POSITION_TS_WDU);
elmot 1:d0dfbce63a89 2600 }
elmot 1:d0dfbce63a89 2601
elmot 1:d0dfbce63a89 2602 /**
elmot 1:d0dfbce63a89 2603 * @brief Get Timestamp Month in BCD format
elmot 1:d0dfbce63a89 2604 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
elmot 1:d0dfbce63a89 2605 * @rmtoll TSDR MT LL_RTC_TS_GetMonth\n
elmot 1:d0dfbce63a89 2606 * TSDR MU LL_RTC_TS_GetMonth
elmot 1:d0dfbce63a89 2607 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2608 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 2609 * @arg @ref LL_RTC_MONTH_JANUARY
elmot 1:d0dfbce63a89 2610 * @arg @ref LL_RTC_MONTH_FEBRUARY
elmot 1:d0dfbce63a89 2611 * @arg @ref LL_RTC_MONTH_MARCH
elmot 1:d0dfbce63a89 2612 * @arg @ref LL_RTC_MONTH_APRIL
elmot 1:d0dfbce63a89 2613 * @arg @ref LL_RTC_MONTH_MAY
elmot 1:d0dfbce63a89 2614 * @arg @ref LL_RTC_MONTH_JUNE
elmot 1:d0dfbce63a89 2615 * @arg @ref LL_RTC_MONTH_JULY
elmot 1:d0dfbce63a89 2616 * @arg @ref LL_RTC_MONTH_AUGUST
elmot 1:d0dfbce63a89 2617 * @arg @ref LL_RTC_MONTH_SEPTEMBER
elmot 1:d0dfbce63a89 2618 * @arg @ref LL_RTC_MONTH_OCTOBER
elmot 1:d0dfbce63a89 2619 * @arg @ref LL_RTC_MONTH_NOVEMBER
elmot 1:d0dfbce63a89 2620 * @arg @ref LL_RTC_MONTH_DECEMBER
elmot 1:d0dfbce63a89 2621 */
elmot 1:d0dfbce63a89 2622 __STATIC_INLINE uint32_t LL_RTC_TS_GetMonth(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2623 {
elmot 1:d0dfbce63a89 2624 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_MT | RTC_TSDR_MU) >> RTC_POSITION_TS_MU);
elmot 1:d0dfbce63a89 2625 }
elmot 1:d0dfbce63a89 2626
elmot 1:d0dfbce63a89 2627 /**
elmot 1:d0dfbce63a89 2628 * @brief Get Timestamp Day in BCD format
elmot 1:d0dfbce63a89 2629 * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
elmot 1:d0dfbce63a89 2630 * @rmtoll TSDR DT LL_RTC_TS_GetDay\n
elmot 1:d0dfbce63a89 2631 * TSDR DU LL_RTC_TS_GetDay
elmot 1:d0dfbce63a89 2632 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2633 * @retval Value between Min_Data=0x01 and Max_Data=0x31
elmot 1:d0dfbce63a89 2634 */
elmot 1:d0dfbce63a89 2635 __STATIC_INLINE uint32_t LL_RTC_TS_GetDay(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2636 {
elmot 1:d0dfbce63a89 2637 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_DT | RTC_TSDR_DU));
elmot 1:d0dfbce63a89 2638 }
elmot 1:d0dfbce63a89 2639
elmot 1:d0dfbce63a89 2640 /**
elmot 1:d0dfbce63a89 2641 * @brief Get Timestamp date (WeekDay, Day and Month) in BCD format
elmot 1:d0dfbce63a89 2642 * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_MONTH,
elmot 1:d0dfbce63a89 2643 * and __LL_RTC_GET_DAY are available to get independently each parameter.
elmot 1:d0dfbce63a89 2644 * @rmtoll TSDR WDU LL_RTC_TS_GetDate\n
elmot 1:d0dfbce63a89 2645 * TSDR MT LL_RTC_TS_GetDate\n
elmot 1:d0dfbce63a89 2646 * TSDR MU LL_RTC_TS_GetDate\n
elmot 1:d0dfbce63a89 2647 * TSDR DT LL_RTC_TS_GetDate\n
elmot 1:d0dfbce63a89 2648 * TSDR DU LL_RTC_TS_GetDate
elmot 1:d0dfbce63a89 2649 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2650 * @retval Combination of Weekday, Day and Month
elmot 1:d0dfbce63a89 2651 */
elmot 1:d0dfbce63a89 2652 __STATIC_INLINE uint32_t LL_RTC_TS_GetDate(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2653 {
elmot 1:d0dfbce63a89 2654 return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU | RTC_TSDR_MT | RTC_TSDR_MU | RTC_TSDR_DT | RTC_TSDR_DU));
elmot 1:d0dfbce63a89 2655 }
elmot 1:d0dfbce63a89 2656
elmot 1:d0dfbce63a89 2657 /**
elmot 1:d0dfbce63a89 2658 * @brief Get time-stamp sub second value
elmot 1:d0dfbce63a89 2659 * @rmtoll TSSSR SS LL_RTC_TS_GetSubSecond
elmot 1:d0dfbce63a89 2660 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2661 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
elmot 1:d0dfbce63a89 2662 */
elmot 1:d0dfbce63a89 2663 __STATIC_INLINE uint32_t LL_RTC_TS_GetSubSecond(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2664 {
elmot 1:d0dfbce63a89 2665 return (uint32_t)(READ_BIT(RTCx->TSSSR, RTC_TSSSR_SS));
elmot 1:d0dfbce63a89 2666 }
elmot 1:d0dfbce63a89 2667
elmot 1:d0dfbce63a89 2668 #if defined(RTC_TAMPCR_TAMPTS)
elmot 1:d0dfbce63a89 2669 /**
elmot 1:d0dfbce63a89 2670 * @brief Activate timestamp on tamper detection event
elmot 1:d0dfbce63a89 2671 * @rmtoll TAMPCR TAMPTS LL_RTC_TS_EnableOnTamper
elmot 1:d0dfbce63a89 2672 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2673 * @retval None
elmot 1:d0dfbce63a89 2674 */
elmot 1:d0dfbce63a89 2675 __STATIC_INLINE void LL_RTC_TS_EnableOnTamper(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2676 {
elmot 1:d0dfbce63a89 2677 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPTS);
elmot 1:d0dfbce63a89 2678 }
elmot 1:d0dfbce63a89 2679
elmot 1:d0dfbce63a89 2680 /**
elmot 1:d0dfbce63a89 2681 * @brief Disable timestamp on tamper detection event
elmot 1:d0dfbce63a89 2682 * @rmtoll TAMPCR TAMPTS LL_RTC_TS_DisableOnTamper
elmot 1:d0dfbce63a89 2683 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2684 * @retval None
elmot 1:d0dfbce63a89 2685 */
elmot 1:d0dfbce63a89 2686 __STATIC_INLINE void LL_RTC_TS_DisableOnTamper(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2687 {
elmot 1:d0dfbce63a89 2688 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPTS);
elmot 1:d0dfbce63a89 2689 }
elmot 1:d0dfbce63a89 2690 #endif /* RTC_TAMPCR_TAMPTS */
elmot 1:d0dfbce63a89 2691
elmot 1:d0dfbce63a89 2692 /**
elmot 1:d0dfbce63a89 2693 * @}
elmot 1:d0dfbce63a89 2694 */
elmot 1:d0dfbce63a89 2695
elmot 1:d0dfbce63a89 2696 /** @defgroup RTC_LL_EF_Tamper Tamper
elmot 1:d0dfbce63a89 2697 * @{
elmot 1:d0dfbce63a89 2698 */
elmot 1:d0dfbce63a89 2699
elmot 1:d0dfbce63a89 2700 /**
elmot 1:d0dfbce63a89 2701 * @brief Enable RTC_TAMPx input detection
elmot 1:d0dfbce63a89 2702 * @rmtoll TAMPCR TAMP1E LL_RTC_TAMPER_Enable\n
elmot 1:d0dfbce63a89 2703 * TAMPCR TAMP2E LL_RTC_TAMPER_Enable\n
elmot 1:d0dfbce63a89 2704 * TAMPCR TAMP3E LL_RTC_TAMPER_Enable
elmot 1:d0dfbce63a89 2705 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2706 * @param Tamper This parameter can be a combination of the following values:
elmot 1:d0dfbce63a89 2707 * @arg @ref LL_RTC_TAMPER_1
elmot 1:d0dfbce63a89 2708 * @arg @ref LL_RTC_TAMPER_2
elmot 1:d0dfbce63a89 2709 * @arg @ref LL_RTC_TAMPER_3
elmot 1:d0dfbce63a89 2710 *
elmot 1:d0dfbce63a89 2711 * @retval None
elmot 1:d0dfbce63a89 2712 */
elmot 1:d0dfbce63a89 2713 __STATIC_INLINE void LL_RTC_TAMPER_Enable(RTC_TypeDef *RTCx, uint32_t Tamper)
elmot 1:d0dfbce63a89 2714 {
elmot 1:d0dfbce63a89 2715 SET_BIT(RTCx->TAMPCR, Tamper);
elmot 1:d0dfbce63a89 2716 }
elmot 1:d0dfbce63a89 2717
elmot 1:d0dfbce63a89 2718 /**
elmot 1:d0dfbce63a89 2719 * @brief Clear RTC_TAMPx input detection
elmot 1:d0dfbce63a89 2720 * @rmtoll TAMPCR TAMP1E LL_RTC_TAMPER_Disable\n
elmot 1:d0dfbce63a89 2721 * TAMPCR TAMP2E LL_RTC_TAMPER_Disable\n
elmot 1:d0dfbce63a89 2722 * TAMPCR TAMP3E LL_RTC_TAMPER_Disable
elmot 1:d0dfbce63a89 2723 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2724 * @param Tamper This parameter can be a combination of the following values:
elmot 1:d0dfbce63a89 2725 * @arg @ref LL_RTC_TAMPER_1
elmot 1:d0dfbce63a89 2726 * @arg @ref LL_RTC_TAMPER_2
elmot 1:d0dfbce63a89 2727 * @arg @ref LL_RTC_TAMPER_3
elmot 1:d0dfbce63a89 2728 *
elmot 1:d0dfbce63a89 2729 * @retval None
elmot 1:d0dfbce63a89 2730 */
elmot 1:d0dfbce63a89 2731 __STATIC_INLINE void LL_RTC_TAMPER_Disable(RTC_TypeDef *RTCx, uint32_t Tamper)
elmot 1:d0dfbce63a89 2732 {
elmot 1:d0dfbce63a89 2733 CLEAR_BIT(RTCx->TAMPCR, Tamper);
elmot 1:d0dfbce63a89 2734 }
elmot 1:d0dfbce63a89 2735
elmot 1:d0dfbce63a89 2736 /**
elmot 1:d0dfbce63a89 2737 * @brief Enable Tamper mask flag
elmot 1:d0dfbce63a89 2738 * @note Associated Tamper IT must not enabled when tamper mask is set.
elmot 1:d0dfbce63a89 2739 * @rmtoll TAMPCR TAMP1MF LL_RTC_TAMPER_EnableMask\n
elmot 1:d0dfbce63a89 2740 * TAMPCR TAMP2MF LL_RTC_TAMPER_EnableMask\n
elmot 1:d0dfbce63a89 2741 * TAMPCR TAMP3MF LL_RTC_TAMPER_EnableMask
elmot 1:d0dfbce63a89 2742 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2743 * @param Mask This parameter can be a combination of the following values:
elmot 1:d0dfbce63a89 2744 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER1
elmot 1:d0dfbce63a89 2745 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER2
elmot 1:d0dfbce63a89 2746 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER3
elmot 1:d0dfbce63a89 2747 *
elmot 1:d0dfbce63a89 2748 * @retval None
elmot 1:d0dfbce63a89 2749 */
elmot 1:d0dfbce63a89 2750 __STATIC_INLINE void LL_RTC_TAMPER_EnableMask(RTC_TypeDef *RTCx, uint32_t Mask)
elmot 1:d0dfbce63a89 2751 {
elmot 1:d0dfbce63a89 2752 SET_BIT(RTCx->TAMPCR, Mask);
elmot 1:d0dfbce63a89 2753 }
elmot 1:d0dfbce63a89 2754
elmot 1:d0dfbce63a89 2755 /**
elmot 1:d0dfbce63a89 2756 * @brief Disable Tamper mask flag
elmot 1:d0dfbce63a89 2757 * @rmtoll TAMPCR TAMP1MF LL_RTC_TAMPER_DisableMask\n
elmot 1:d0dfbce63a89 2758 * TAMPCR TAMP2MF LL_RTC_TAMPER_DisableMask\n
elmot 1:d0dfbce63a89 2759 * TAMPCR TAMP3MF LL_RTC_TAMPER_DisableMask
elmot 1:d0dfbce63a89 2760 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2761 * @param Mask This parameter can be a combination of the following values:
elmot 1:d0dfbce63a89 2762 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER1
elmot 1:d0dfbce63a89 2763 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER2
elmot 1:d0dfbce63a89 2764 * @arg @ref LL_RTC_TAMPER_MASK_TAMPER3
elmot 1:d0dfbce63a89 2765 *
elmot 1:d0dfbce63a89 2766 * @retval None
elmot 1:d0dfbce63a89 2767 */
elmot 1:d0dfbce63a89 2768 __STATIC_INLINE void LL_RTC_TAMPER_DisableMask(RTC_TypeDef *RTCx, uint32_t Mask)
elmot 1:d0dfbce63a89 2769 {
elmot 1:d0dfbce63a89 2770 CLEAR_BIT(RTCx->TAMPCR, Mask);
elmot 1:d0dfbce63a89 2771 }
elmot 1:d0dfbce63a89 2772
elmot 1:d0dfbce63a89 2773 /**
elmot 1:d0dfbce63a89 2774 * @brief Enable backup register erase after Tamper event detection
elmot 1:d0dfbce63a89 2775 * @rmtoll TAMPCR TAMP1NOERASE LL_RTC_TAMPER_EnableEraseBKP\n
elmot 1:d0dfbce63a89 2776 * TAMPCR TAMP2NOERASE LL_RTC_TAMPER_EnableEraseBKP\n
elmot 1:d0dfbce63a89 2777 * TAMPCR TAMP3NOERASE LL_RTC_TAMPER_EnableEraseBKP
elmot 1:d0dfbce63a89 2778 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2779 * @param Tamper This parameter can be a combination of the following values:
elmot 1:d0dfbce63a89 2780 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1
elmot 1:d0dfbce63a89 2781 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2
elmot 1:d0dfbce63a89 2782 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER3
elmot 1:d0dfbce63a89 2783 *
elmot 1:d0dfbce63a89 2784 * @retval None
elmot 1:d0dfbce63a89 2785 */
elmot 1:d0dfbce63a89 2786 __STATIC_INLINE void LL_RTC_TAMPER_EnableEraseBKP(RTC_TypeDef *RTCx, uint32_t Tamper)
elmot 1:d0dfbce63a89 2787 {
elmot 1:d0dfbce63a89 2788 CLEAR_BIT(RTCx->TAMPCR, Tamper);
elmot 1:d0dfbce63a89 2789 }
elmot 1:d0dfbce63a89 2790
elmot 1:d0dfbce63a89 2791 /**
elmot 1:d0dfbce63a89 2792 * @brief Disable backup register erase after Tamper event detection
elmot 1:d0dfbce63a89 2793 * @rmtoll TAMPCR TAMP1NOERASE LL_RTC_TAMPER_DisableEraseBKP\n
elmot 1:d0dfbce63a89 2794 * TAMPCR TAMP2NOERASE LL_RTC_TAMPER_DisableEraseBKP\n
elmot 1:d0dfbce63a89 2795 * TAMPCR TAMP3NOERASE LL_RTC_TAMPER_DisableEraseBKP
elmot 1:d0dfbce63a89 2796 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2797 * @param Tamper This parameter can be a combination of the following values:
elmot 1:d0dfbce63a89 2798 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1
elmot 1:d0dfbce63a89 2799 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2
elmot 1:d0dfbce63a89 2800 * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER3
elmot 1:d0dfbce63a89 2801 *
elmot 1:d0dfbce63a89 2802 * @retval None
elmot 1:d0dfbce63a89 2803 */
elmot 1:d0dfbce63a89 2804 __STATIC_INLINE void LL_RTC_TAMPER_DisableEraseBKP(RTC_TypeDef *RTCx, uint32_t Tamper)
elmot 1:d0dfbce63a89 2805 {
elmot 1:d0dfbce63a89 2806 SET_BIT(RTCx->TAMPCR, Tamper);
elmot 1:d0dfbce63a89 2807 }
elmot 1:d0dfbce63a89 2808
elmot 1:d0dfbce63a89 2809 #if defined(RTC_TAMPCR_TAMPPUDIS)
elmot 1:d0dfbce63a89 2810 /**
elmot 1:d0dfbce63a89 2811 * @brief Disable RTC_TAMPx pull-up disable (Disable precharge of RTC_TAMPx pins)
elmot 1:d0dfbce63a89 2812 * @rmtoll TAMPCR TAMPPUDIS LL_RTC_TAMPER_DisablePullUp
elmot 1:d0dfbce63a89 2813 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2814 * @retval None
elmot 1:d0dfbce63a89 2815 */
elmot 1:d0dfbce63a89 2816 __STATIC_INLINE void LL_RTC_TAMPER_DisablePullUp(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2817 {
elmot 1:d0dfbce63a89 2818 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPPUDIS);
elmot 1:d0dfbce63a89 2819 }
elmot 1:d0dfbce63a89 2820
elmot 1:d0dfbce63a89 2821 /**
elmot 1:d0dfbce63a89 2822 * @brief Enable RTC_TAMPx pull-up disable ( Precharge RTC_TAMPx pins before sampling)
elmot 1:d0dfbce63a89 2823 * @rmtoll TAMPCR TAMPPUDIS LL_RTC_TAMPER_EnablePullUp
elmot 1:d0dfbce63a89 2824 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2825 * @retval None
elmot 1:d0dfbce63a89 2826 */
elmot 1:d0dfbce63a89 2827 __STATIC_INLINE void LL_RTC_TAMPER_EnablePullUp(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2828 {
elmot 1:d0dfbce63a89 2829 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPPUDIS);
elmot 1:d0dfbce63a89 2830 }
elmot 1:d0dfbce63a89 2831 #endif /* RTC_TAMPCR_TAMPPUDIS */
elmot 1:d0dfbce63a89 2832
elmot 1:d0dfbce63a89 2833 #if defined(RTC_TAMPCR_TAMPPRCH)
elmot 1:d0dfbce63a89 2834 /**
elmot 1:d0dfbce63a89 2835 * @brief Set RTC_TAMPx precharge duration
elmot 1:d0dfbce63a89 2836 * @rmtoll TAMPCR TAMPPRCH LL_RTC_TAMPER_SetPrecharge
elmot 1:d0dfbce63a89 2837 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2838 * @param Duration This parameter can be one of the following values:
elmot 1:d0dfbce63a89 2839 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
elmot 1:d0dfbce63a89 2840 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
elmot 1:d0dfbce63a89 2841 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
elmot 1:d0dfbce63a89 2842 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
elmot 1:d0dfbce63a89 2843 * @retval None
elmot 1:d0dfbce63a89 2844 */
elmot 1:d0dfbce63a89 2845 __STATIC_INLINE void LL_RTC_TAMPER_SetPrecharge(RTC_TypeDef *RTCx, uint32_t Duration)
elmot 1:d0dfbce63a89 2846 {
elmot 1:d0dfbce63a89 2847 MODIFY_REG(RTCx->TAMPCR, RTC_TAMPCR_TAMPPRCH, Duration);
elmot 1:d0dfbce63a89 2848 }
elmot 1:d0dfbce63a89 2849
elmot 1:d0dfbce63a89 2850 /**
elmot 1:d0dfbce63a89 2851 * @brief Get RTC_TAMPx precharge duration
elmot 1:d0dfbce63a89 2852 * @rmtoll TAMPCR TAMPPRCH LL_RTC_TAMPER_GetPrecharge
elmot 1:d0dfbce63a89 2853 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2854 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 2855 * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
elmot 1:d0dfbce63a89 2856 * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
elmot 1:d0dfbce63a89 2857 * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
elmot 1:d0dfbce63a89 2858 * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
elmot 1:d0dfbce63a89 2859 */
elmot 1:d0dfbce63a89 2860 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPrecharge(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2861 {
elmot 1:d0dfbce63a89 2862 return (uint32_t)(READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPPRCH));
elmot 1:d0dfbce63a89 2863 }
elmot 1:d0dfbce63a89 2864 #endif /* RTC_TAMPCR_TAMPPRCH */
elmot 1:d0dfbce63a89 2865
elmot 1:d0dfbce63a89 2866 #if defined(RTC_TAMPCR_TAMPFLT)
elmot 1:d0dfbce63a89 2867 /**
elmot 1:d0dfbce63a89 2868 * @brief Set RTC_TAMPx filter count
elmot 1:d0dfbce63a89 2869 * @rmtoll TAMPCR TAMPFLT LL_RTC_TAMPER_SetFilterCount
elmot 1:d0dfbce63a89 2870 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2871 * @param FilterCount This parameter can be one of the following values:
elmot 1:d0dfbce63a89 2872 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
elmot 1:d0dfbce63a89 2873 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
elmot 1:d0dfbce63a89 2874 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
elmot 1:d0dfbce63a89 2875 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
elmot 1:d0dfbce63a89 2876 * @retval None
elmot 1:d0dfbce63a89 2877 */
elmot 1:d0dfbce63a89 2878 __STATIC_INLINE void LL_RTC_TAMPER_SetFilterCount(RTC_TypeDef *RTCx, uint32_t FilterCount)
elmot 1:d0dfbce63a89 2879 {
elmot 1:d0dfbce63a89 2880 MODIFY_REG(RTCx->TAMPCR, RTC_TAMPCR_TAMPFLT, FilterCount);
elmot 1:d0dfbce63a89 2881 }
elmot 1:d0dfbce63a89 2882
elmot 1:d0dfbce63a89 2883 /**
elmot 1:d0dfbce63a89 2884 * @brief Get RTC_TAMPx filter count
elmot 1:d0dfbce63a89 2885 * @rmtoll TAMPCR TAMPFLT LL_RTC_TAMPER_GetFilterCount
elmot 1:d0dfbce63a89 2886 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2887 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 2888 * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
elmot 1:d0dfbce63a89 2889 * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
elmot 1:d0dfbce63a89 2890 * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
elmot 1:d0dfbce63a89 2891 * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
elmot 1:d0dfbce63a89 2892 */
elmot 1:d0dfbce63a89 2893 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetFilterCount(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2894 {
elmot 1:d0dfbce63a89 2895 return (uint32_t)(READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPFLT));
elmot 1:d0dfbce63a89 2896 }
elmot 1:d0dfbce63a89 2897 #endif /* RTC_TAMPCR_TAMPFLT */
elmot 1:d0dfbce63a89 2898
elmot 1:d0dfbce63a89 2899 #if defined(RTC_TAMPCR_TAMPFREQ)
elmot 1:d0dfbce63a89 2900 /**
elmot 1:d0dfbce63a89 2901 * @brief Set Tamper sampling frequency
elmot 1:d0dfbce63a89 2902 * @rmtoll TAMPCR TAMPFREQ LL_RTC_TAMPER_SetSamplingFreq
elmot 1:d0dfbce63a89 2903 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2904 * @param SamplingFreq This parameter can be one of the following values:
elmot 1:d0dfbce63a89 2905 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
elmot 1:d0dfbce63a89 2906 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
elmot 1:d0dfbce63a89 2907 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
elmot 1:d0dfbce63a89 2908 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
elmot 1:d0dfbce63a89 2909 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
elmot 1:d0dfbce63a89 2910 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
elmot 1:d0dfbce63a89 2911 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
elmot 1:d0dfbce63a89 2912 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
elmot 1:d0dfbce63a89 2913 * @retval None
elmot 1:d0dfbce63a89 2914 */
elmot 1:d0dfbce63a89 2915 __STATIC_INLINE void LL_RTC_TAMPER_SetSamplingFreq(RTC_TypeDef *RTCx, uint32_t SamplingFreq)
elmot 1:d0dfbce63a89 2916 {
elmot 1:d0dfbce63a89 2917 MODIFY_REG(RTCx->TAMPCR, RTC_TAMPCR_TAMPFREQ, SamplingFreq);
elmot 1:d0dfbce63a89 2918 }
elmot 1:d0dfbce63a89 2919
elmot 1:d0dfbce63a89 2920 /**
elmot 1:d0dfbce63a89 2921 * @brief Get Tamper sampling frequency
elmot 1:d0dfbce63a89 2922 * @rmtoll TAMPCR TAMPFREQ LL_RTC_TAMPER_GetSamplingFreq
elmot 1:d0dfbce63a89 2923 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2924 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 2925 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
elmot 1:d0dfbce63a89 2926 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
elmot 1:d0dfbce63a89 2927 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
elmot 1:d0dfbce63a89 2928 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
elmot 1:d0dfbce63a89 2929 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
elmot 1:d0dfbce63a89 2930 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
elmot 1:d0dfbce63a89 2931 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
elmot 1:d0dfbce63a89 2932 * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
elmot 1:d0dfbce63a89 2933 */
elmot 1:d0dfbce63a89 2934 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetSamplingFreq(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2935 {
elmot 1:d0dfbce63a89 2936 return (uint32_t)(READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPFREQ));
elmot 1:d0dfbce63a89 2937 }
elmot 1:d0dfbce63a89 2938 #endif /* RTC_TAMPCR_TAMPFREQ */
elmot 1:d0dfbce63a89 2939
elmot 1:d0dfbce63a89 2940 /**
elmot 1:d0dfbce63a89 2941 * @brief Enable Active level for Tamper input
elmot 1:d0dfbce63a89 2942 * @rmtoll TAMPCR TAMP1TRG LL_RTC_TAMPER_EnableActiveLevel\n
elmot 1:d0dfbce63a89 2943 * TAMPCR TAMP2TRG LL_RTC_TAMPER_EnableActiveLevel\n
elmot 1:d0dfbce63a89 2944 * TAMPCR TAMP3TRG LL_RTC_TAMPER_EnableActiveLevel
elmot 1:d0dfbce63a89 2945 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2946 * @param Tamper This parameter can be a combination of the following values:
elmot 1:d0dfbce63a89 2947 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
elmot 1:d0dfbce63a89 2948 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2
elmot 1:d0dfbce63a89 2949 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3
elmot 1:d0dfbce63a89 2950 *
elmot 1:d0dfbce63a89 2951 * @retval None
elmot 1:d0dfbce63a89 2952 */
elmot 1:d0dfbce63a89 2953 __STATIC_INLINE void LL_RTC_TAMPER_EnableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper)
elmot 1:d0dfbce63a89 2954 {
elmot 1:d0dfbce63a89 2955 SET_BIT(RTCx->TAMPCR, Tamper);
elmot 1:d0dfbce63a89 2956 }
elmot 1:d0dfbce63a89 2957
elmot 1:d0dfbce63a89 2958 /**
elmot 1:d0dfbce63a89 2959 * @brief Disable Active level for Tamper input
elmot 1:d0dfbce63a89 2960 * @rmtoll TAMPCR TAMP1TRG LL_RTC_TAMPER_DisableActiveLevel\n
elmot 1:d0dfbce63a89 2961 * TAMPCR TAMP2TRG LL_RTC_TAMPER_DisableActiveLevel\n
elmot 1:d0dfbce63a89 2962 * TAMPCR TAMP3TRG LL_RTC_TAMPER_DisableActiveLevel
elmot 1:d0dfbce63a89 2963 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2964 * @param Tamper This parameter can be a combination of the following values:
elmot 1:d0dfbce63a89 2965 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
elmot 1:d0dfbce63a89 2966 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2
elmot 1:d0dfbce63a89 2967 * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3
elmot 1:d0dfbce63a89 2968 *
elmot 1:d0dfbce63a89 2969 * @retval None
elmot 1:d0dfbce63a89 2970 */
elmot 1:d0dfbce63a89 2971 __STATIC_INLINE void LL_RTC_TAMPER_DisableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper)
elmot 1:d0dfbce63a89 2972 {
elmot 1:d0dfbce63a89 2973 CLEAR_BIT(RTCx->TAMPCR, Tamper);
elmot 1:d0dfbce63a89 2974 }
elmot 1:d0dfbce63a89 2975
elmot 1:d0dfbce63a89 2976 /**
elmot 1:d0dfbce63a89 2977 * @}
elmot 1:d0dfbce63a89 2978 */
elmot 1:d0dfbce63a89 2979
elmot 1:d0dfbce63a89 2980 #if defined(RTC_WAKEUP_SUPPORT)
elmot 1:d0dfbce63a89 2981 /** @defgroup RTC_LL_EF_Wakeup Wakeup
elmot 1:d0dfbce63a89 2982 * @{
elmot 1:d0dfbce63a89 2983 */
elmot 1:d0dfbce63a89 2984
elmot 1:d0dfbce63a89 2985 /**
elmot 1:d0dfbce63a89 2986 * @brief Enable Wakeup timer
elmot 1:d0dfbce63a89 2987 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 2988 * @rmtoll CR WUTE LL_RTC_WAKEUP_Enable
elmot 1:d0dfbce63a89 2989 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 2990 * @retval None
elmot 1:d0dfbce63a89 2991 */
elmot 1:d0dfbce63a89 2992 __STATIC_INLINE void LL_RTC_WAKEUP_Enable(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 2993 {
elmot 1:d0dfbce63a89 2994 SET_BIT(RTCx->CR, RTC_CR_WUTE);
elmot 1:d0dfbce63a89 2995 }
elmot 1:d0dfbce63a89 2996
elmot 1:d0dfbce63a89 2997 /**
elmot 1:d0dfbce63a89 2998 * @brief Disable Wakeup timer
elmot 1:d0dfbce63a89 2999 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 3000 * @rmtoll CR WUTE LL_RTC_WAKEUP_Disable
elmot 1:d0dfbce63a89 3001 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3002 * @retval None
elmot 1:d0dfbce63a89 3003 */
elmot 1:d0dfbce63a89 3004 __STATIC_INLINE void LL_RTC_WAKEUP_Disable(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3005 {
elmot 1:d0dfbce63a89 3006 CLEAR_BIT(RTCx->CR, RTC_CR_WUTE);
elmot 1:d0dfbce63a89 3007 }
elmot 1:d0dfbce63a89 3008
elmot 1:d0dfbce63a89 3009 /**
elmot 1:d0dfbce63a89 3010 * @brief Check if Wakeup timer is enabled or not
elmot 1:d0dfbce63a89 3011 * @rmtoll CR WUTE LL_RTC_WAKEUP_IsEnabled
elmot 1:d0dfbce63a89 3012 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3013 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3014 */
elmot 1:d0dfbce63a89 3015 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_IsEnabled(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3016 {
elmot 1:d0dfbce63a89 3017 return (READ_BIT(RTCx->CR, RTC_CR_WUTE) == (RTC_CR_WUTE));
elmot 1:d0dfbce63a89 3018 }
elmot 1:d0dfbce63a89 3019
elmot 1:d0dfbce63a89 3020 /**
elmot 1:d0dfbce63a89 3021 * @brief Select Wakeup clock
elmot 1:d0dfbce63a89 3022 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 3023 * @note Bit can be written only when RTC_CR WUTE bit = 0 and RTC_ISR WUTWF bit = 1
elmot 1:d0dfbce63a89 3024 * @rmtoll CR WUCKSEL LL_RTC_WAKEUP_SetClock
elmot 1:d0dfbce63a89 3025 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3026 * @param WakeupClock This parameter can be one of the following values:
elmot 1:d0dfbce63a89 3027 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
elmot 1:d0dfbce63a89 3028 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
elmot 1:d0dfbce63a89 3029 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
elmot 1:d0dfbce63a89 3030 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
elmot 1:d0dfbce63a89 3031 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
elmot 1:d0dfbce63a89 3032 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
elmot 1:d0dfbce63a89 3033 * @retval None
elmot 1:d0dfbce63a89 3034 */
elmot 1:d0dfbce63a89 3035 __STATIC_INLINE void LL_RTC_WAKEUP_SetClock(RTC_TypeDef *RTCx, uint32_t WakeupClock)
elmot 1:d0dfbce63a89 3036 {
elmot 1:d0dfbce63a89 3037 MODIFY_REG(RTCx->CR, RTC_CR_WUCKSEL, WakeupClock);
elmot 1:d0dfbce63a89 3038 }
elmot 1:d0dfbce63a89 3039
elmot 1:d0dfbce63a89 3040 /**
elmot 1:d0dfbce63a89 3041 * @brief Get Wakeup clock
elmot 1:d0dfbce63a89 3042 * @rmtoll CR WUCKSEL LL_RTC_WAKEUP_GetClock
elmot 1:d0dfbce63a89 3043 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3044 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 3045 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
elmot 1:d0dfbce63a89 3046 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
elmot 1:d0dfbce63a89 3047 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
elmot 1:d0dfbce63a89 3048 * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
elmot 1:d0dfbce63a89 3049 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
elmot 1:d0dfbce63a89 3050 * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
elmot 1:d0dfbce63a89 3051 */
elmot 1:d0dfbce63a89 3052 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetClock(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3053 {
elmot 1:d0dfbce63a89 3054 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_WUCKSEL));
elmot 1:d0dfbce63a89 3055 }
elmot 1:d0dfbce63a89 3056
elmot 1:d0dfbce63a89 3057 /**
elmot 1:d0dfbce63a89 3058 * @brief Set Wakeup auto-reload value
elmot 1:d0dfbce63a89 3059 * @note Bit can be written only when WUTWF is set to 1 in RTC_ISR
elmot 1:d0dfbce63a89 3060 * @rmtoll WUTR WUT LL_RTC_WAKEUP_SetAutoReload
elmot 1:d0dfbce63a89 3061 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3062 * @param Value Value between Min_Data=0x00 and Max_Data=0xFFFF
elmot 1:d0dfbce63a89 3063 * @retval None
elmot 1:d0dfbce63a89 3064 */
elmot 1:d0dfbce63a89 3065 __STATIC_INLINE void LL_RTC_WAKEUP_SetAutoReload(RTC_TypeDef *RTCx, uint32_t Value)
elmot 1:d0dfbce63a89 3066 {
elmot 1:d0dfbce63a89 3067 MODIFY_REG(RTCx->WUTR, RTC_WUTR_WUT, Value);
elmot 1:d0dfbce63a89 3068 }
elmot 1:d0dfbce63a89 3069
elmot 1:d0dfbce63a89 3070 /**
elmot 1:d0dfbce63a89 3071 * @brief Get Wakeup auto-reload value
elmot 1:d0dfbce63a89 3072 * @rmtoll WUTR WUT LL_RTC_WAKEUP_GetAutoReload
elmot 1:d0dfbce63a89 3073 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3074 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
elmot 1:d0dfbce63a89 3075 */
elmot 1:d0dfbce63a89 3076 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetAutoReload(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3077 {
elmot 1:d0dfbce63a89 3078 return (uint32_t)(READ_BIT(RTCx->WUTR, RTC_WUTR_WUT));
elmot 1:d0dfbce63a89 3079 }
elmot 1:d0dfbce63a89 3080
elmot 1:d0dfbce63a89 3081 /**
elmot 1:d0dfbce63a89 3082 * @}
elmot 1:d0dfbce63a89 3083 */
elmot 1:d0dfbce63a89 3084 #endif /* RTC_WAKEUP_SUPPORT */
elmot 1:d0dfbce63a89 3085
elmot 1:d0dfbce63a89 3086 #if defined(RTC_BACKUP_SUPPORT)
elmot 1:d0dfbce63a89 3087 /** @defgroup RTC_LL_EF_Backup_Registers Backup_Registers
elmot 1:d0dfbce63a89 3088 * @{
elmot 1:d0dfbce63a89 3089 */
elmot 1:d0dfbce63a89 3090
elmot 1:d0dfbce63a89 3091 /**
elmot 1:d0dfbce63a89 3092 * @brief Writes a data in a specified RTC Backup data register.
elmot 1:d0dfbce63a89 3093 * @rmtoll BKPxR BKP LL_RTC_BAK_SetRegister
elmot 1:d0dfbce63a89 3094 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3095 * @param BackupRegister This parameter can be one of the following values:
elmot 1:d0dfbce63a89 3096 * @arg @ref LL_RTC_BKP_DR0
elmot 1:d0dfbce63a89 3097 * @arg @ref LL_RTC_BKP_DR1
elmot 1:d0dfbce63a89 3098 * @arg @ref LL_RTC_BKP_DR2
elmot 1:d0dfbce63a89 3099 * @arg @ref LL_RTC_BKP_DR3
elmot 1:d0dfbce63a89 3100 * @arg @ref LL_RTC_BKP_DR4
elmot 1:d0dfbce63a89 3101 * @arg @ref LL_RTC_BKP_DR5
elmot 1:d0dfbce63a89 3102 * @arg @ref LL_RTC_BKP_DR6
elmot 1:d0dfbce63a89 3103 * @arg @ref LL_RTC_BKP_DR7
elmot 1:d0dfbce63a89 3104 * @arg @ref LL_RTC_BKP_DR8
elmot 1:d0dfbce63a89 3105 * @arg @ref LL_RTC_BKP_DR9
elmot 1:d0dfbce63a89 3106 * @arg @ref LL_RTC_BKP_DR10
elmot 1:d0dfbce63a89 3107 * @arg @ref LL_RTC_BKP_DR11
elmot 1:d0dfbce63a89 3108 * @arg @ref LL_RTC_BKP_DR12
elmot 1:d0dfbce63a89 3109 * @arg @ref LL_RTC_BKP_DR13
elmot 1:d0dfbce63a89 3110 * @arg @ref LL_RTC_BKP_DR14
elmot 1:d0dfbce63a89 3111 * @arg @ref LL_RTC_BKP_DR15
elmot 1:d0dfbce63a89 3112 * @arg @ref LL_RTC_BKP_DR16
elmot 1:d0dfbce63a89 3113 * @arg @ref LL_RTC_BKP_DR17
elmot 1:d0dfbce63a89 3114 * @arg @ref LL_RTC_BKP_DR18
elmot 1:d0dfbce63a89 3115 * @arg @ref LL_RTC_BKP_DR19
elmot 1:d0dfbce63a89 3116 * @arg @ref LL_RTC_BKP_DR20
elmot 1:d0dfbce63a89 3117 * @arg @ref LL_RTC_BKP_DR21
elmot 1:d0dfbce63a89 3118 * @arg @ref LL_RTC_BKP_DR22
elmot 1:d0dfbce63a89 3119 * @arg @ref LL_RTC_BKP_DR23
elmot 1:d0dfbce63a89 3120 * @arg @ref LL_RTC_BKP_DR24
elmot 1:d0dfbce63a89 3121 * @arg @ref LL_RTC_BKP_DR25
elmot 1:d0dfbce63a89 3122 * @arg @ref LL_RTC_BKP_DR26
elmot 1:d0dfbce63a89 3123 * @arg @ref LL_RTC_BKP_DR27
elmot 1:d0dfbce63a89 3124 * @arg @ref LL_RTC_BKP_DR28
elmot 1:d0dfbce63a89 3125 * @arg @ref LL_RTC_BKP_DR29
elmot 1:d0dfbce63a89 3126 * @arg @ref LL_RTC_BKP_DR30
elmot 1:d0dfbce63a89 3127 * @arg @ref LL_RTC_BKP_DR31
elmot 1:d0dfbce63a89 3128 * @param Data Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
elmot 1:d0dfbce63a89 3129 * @retval None
elmot 1:d0dfbce63a89 3130 */
elmot 1:d0dfbce63a89 3131 __STATIC_INLINE void LL_RTC_BAK_SetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister, uint32_t Data)
elmot 1:d0dfbce63a89 3132 {
elmot 1:d0dfbce63a89 3133 register uint32_t tmp = 0U;
elmot 1:d0dfbce63a89 3134
elmot 1:d0dfbce63a89 3135 tmp = (uint32_t)(&(RTCx->BKP0R));
elmot 1:d0dfbce63a89 3136 tmp += (BackupRegister * 4U);
elmot 1:d0dfbce63a89 3137
elmot 1:d0dfbce63a89 3138 /* Write the specified register */
elmot 1:d0dfbce63a89 3139 *(__IO uint32_t *)tmp = (uint32_t)Data;
elmot 1:d0dfbce63a89 3140 }
elmot 1:d0dfbce63a89 3141
elmot 1:d0dfbce63a89 3142 /**
elmot 1:d0dfbce63a89 3143 * @brief Reads data from the specified RTC Backup data Register.
elmot 1:d0dfbce63a89 3144 * @rmtoll BKPxR BKP LL_RTC_BAK_GetRegister
elmot 1:d0dfbce63a89 3145 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3146 * @param BackupRegister This parameter can be one of the following values:
elmot 1:d0dfbce63a89 3147 * @arg @ref LL_RTC_BKP_DR0
elmot 1:d0dfbce63a89 3148 * @arg @ref LL_RTC_BKP_DR1
elmot 1:d0dfbce63a89 3149 * @arg @ref LL_RTC_BKP_DR2
elmot 1:d0dfbce63a89 3150 * @arg @ref LL_RTC_BKP_DR3
elmot 1:d0dfbce63a89 3151 * @arg @ref LL_RTC_BKP_DR4
elmot 1:d0dfbce63a89 3152 * @arg @ref LL_RTC_BKP_DR5
elmot 1:d0dfbce63a89 3153 * @arg @ref LL_RTC_BKP_DR6
elmot 1:d0dfbce63a89 3154 * @arg @ref LL_RTC_BKP_DR7
elmot 1:d0dfbce63a89 3155 * @arg @ref LL_RTC_BKP_DR8
elmot 1:d0dfbce63a89 3156 * @arg @ref LL_RTC_BKP_DR9
elmot 1:d0dfbce63a89 3157 * @arg @ref LL_RTC_BKP_DR10
elmot 1:d0dfbce63a89 3158 * @arg @ref LL_RTC_BKP_DR11
elmot 1:d0dfbce63a89 3159 * @arg @ref LL_RTC_BKP_DR12
elmot 1:d0dfbce63a89 3160 * @arg @ref LL_RTC_BKP_DR13
elmot 1:d0dfbce63a89 3161 * @arg @ref LL_RTC_BKP_DR14
elmot 1:d0dfbce63a89 3162 * @arg @ref LL_RTC_BKP_DR15
elmot 1:d0dfbce63a89 3163 * @arg @ref LL_RTC_BKP_DR16
elmot 1:d0dfbce63a89 3164 * @arg @ref LL_RTC_BKP_DR17
elmot 1:d0dfbce63a89 3165 * @arg @ref LL_RTC_BKP_DR18
elmot 1:d0dfbce63a89 3166 * @arg @ref LL_RTC_BKP_DR19
elmot 1:d0dfbce63a89 3167 * @arg @ref LL_RTC_BKP_DR20
elmot 1:d0dfbce63a89 3168 * @arg @ref LL_RTC_BKP_DR21
elmot 1:d0dfbce63a89 3169 * @arg @ref LL_RTC_BKP_DR22
elmot 1:d0dfbce63a89 3170 * @arg @ref LL_RTC_BKP_DR23
elmot 1:d0dfbce63a89 3171 * @arg @ref LL_RTC_BKP_DR24
elmot 1:d0dfbce63a89 3172 * @arg @ref LL_RTC_BKP_DR25
elmot 1:d0dfbce63a89 3173 * @arg @ref LL_RTC_BKP_DR26
elmot 1:d0dfbce63a89 3174 * @arg @ref LL_RTC_BKP_DR27
elmot 1:d0dfbce63a89 3175 * @arg @ref LL_RTC_BKP_DR28
elmot 1:d0dfbce63a89 3176 * @arg @ref LL_RTC_BKP_DR29
elmot 1:d0dfbce63a89 3177 * @arg @ref LL_RTC_BKP_DR30
elmot 1:d0dfbce63a89 3178 * @arg @ref LL_RTC_BKP_DR31
elmot 1:d0dfbce63a89 3179 * @retval Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
elmot 1:d0dfbce63a89 3180 */
elmot 1:d0dfbce63a89 3181 __STATIC_INLINE uint32_t LL_RTC_BAK_GetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister)
elmot 1:d0dfbce63a89 3182 {
elmot 1:d0dfbce63a89 3183 register uint32_t tmp = 0U;
elmot 1:d0dfbce63a89 3184
elmot 1:d0dfbce63a89 3185 tmp = (uint32_t)(&(RTCx->BKP0R));
elmot 1:d0dfbce63a89 3186 tmp += (BackupRegister * 4U);
elmot 1:d0dfbce63a89 3187
elmot 1:d0dfbce63a89 3188 /* Read the specified register */
elmot 1:d0dfbce63a89 3189 return (*(__IO uint32_t *)tmp);
elmot 1:d0dfbce63a89 3190 }
elmot 1:d0dfbce63a89 3191
elmot 1:d0dfbce63a89 3192 /**
elmot 1:d0dfbce63a89 3193 * @}
elmot 1:d0dfbce63a89 3194 */
elmot 1:d0dfbce63a89 3195 #endif /* RTC_BACKUP_SUPPORT */
elmot 1:d0dfbce63a89 3196
elmot 1:d0dfbce63a89 3197 /** @defgroup RTC_LL_EF_Calibration Calibration
elmot 1:d0dfbce63a89 3198 * @{
elmot 1:d0dfbce63a89 3199 */
elmot 1:d0dfbce63a89 3200
elmot 1:d0dfbce63a89 3201 /**
elmot 1:d0dfbce63a89 3202 * @brief Set Calibration output frequency (1 Hz or 512 Hz)
elmot 1:d0dfbce63a89 3203 * @note Bits are write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 3204 * @rmtoll CR COE LL_RTC_CAL_SetOutputFreq\n
elmot 1:d0dfbce63a89 3205 * CR COSEL LL_RTC_CAL_SetOutputFreq
elmot 1:d0dfbce63a89 3206 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3207 * @param Frequency This parameter can be one of the following values:
elmot 1:d0dfbce63a89 3208 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE
elmot 1:d0dfbce63a89 3209 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ
elmot 1:d0dfbce63a89 3210 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
elmot 1:d0dfbce63a89 3211 * @retval None
elmot 1:d0dfbce63a89 3212 */
elmot 1:d0dfbce63a89 3213 __STATIC_INLINE void LL_RTC_CAL_SetOutputFreq(RTC_TypeDef *RTCx, uint32_t Frequency)
elmot 1:d0dfbce63a89 3214 {
elmot 1:d0dfbce63a89 3215 MODIFY_REG(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL, Frequency);
elmot 1:d0dfbce63a89 3216 }
elmot 1:d0dfbce63a89 3217
elmot 1:d0dfbce63a89 3218 /**
elmot 1:d0dfbce63a89 3219 * @brief Get Calibration output frequency (1 Hz or 512 Hz)
elmot 1:d0dfbce63a89 3220 * @rmtoll CR COE LL_RTC_CAL_GetOutputFreq\n
elmot 1:d0dfbce63a89 3221 * CR COSEL LL_RTC_CAL_GetOutputFreq
elmot 1:d0dfbce63a89 3222 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3223 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 3224 * @arg @ref LL_RTC_CALIB_OUTPUT_NONE
elmot 1:d0dfbce63a89 3225 * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ
elmot 1:d0dfbce63a89 3226 * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
elmot 1:d0dfbce63a89 3227 */
elmot 1:d0dfbce63a89 3228 __STATIC_INLINE uint32_t LL_RTC_CAL_GetOutputFreq(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3229 {
elmot 1:d0dfbce63a89 3230 return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL));
elmot 1:d0dfbce63a89 3231 }
elmot 1:d0dfbce63a89 3232
elmot 1:d0dfbce63a89 3233 /**
elmot 1:d0dfbce63a89 3234 * @brief Insert or not One RTCCLK pulse every 2exp11 pulses (frequency increased by 488.5 ppm)
elmot 1:d0dfbce63a89 3235 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 3236 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR
elmot 1:d0dfbce63a89 3237 * @rmtoll CALR CALP LL_RTC_CAL_SetPulse
elmot 1:d0dfbce63a89 3238 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3239 * @param Pulse This parameter can be one of the following values:
elmot 1:d0dfbce63a89 3240 * @arg @ref LL_RTC_CALIB_INSERTPULSE_NONE
elmot 1:d0dfbce63a89 3241 * @arg @ref LL_RTC_CALIB_INSERTPULSE_SET
elmot 1:d0dfbce63a89 3242 * @retval None
elmot 1:d0dfbce63a89 3243 */
elmot 1:d0dfbce63a89 3244 __STATIC_INLINE void LL_RTC_CAL_SetPulse(RTC_TypeDef *RTCx, uint32_t Pulse)
elmot 1:d0dfbce63a89 3245 {
elmot 1:d0dfbce63a89 3246 MODIFY_REG(RTCx->CALR, RTC_CALR_CALP, Pulse);
elmot 1:d0dfbce63a89 3247 }
elmot 1:d0dfbce63a89 3248
elmot 1:d0dfbce63a89 3249 /**
elmot 1:d0dfbce63a89 3250 * @brief Check if one RTCCLK has been inserted or not every 2exp11 pulses (frequency increased by 488.5 ppm)
elmot 1:d0dfbce63a89 3251 * @rmtoll CALR CALP LL_RTC_CAL_IsPulseInserted
elmot 1:d0dfbce63a89 3252 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3253 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3254 */
elmot 1:d0dfbce63a89 3255 __STATIC_INLINE uint32_t LL_RTC_CAL_IsPulseInserted(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3256 {
elmot 1:d0dfbce63a89 3257 return (READ_BIT(RTCx->CALR, RTC_CALR_CALP) == (RTC_CALR_CALP));
elmot 1:d0dfbce63a89 3258 }
elmot 1:d0dfbce63a89 3259
elmot 1:d0dfbce63a89 3260 /**
elmot 1:d0dfbce63a89 3261 * @brief Set the calibration cycle period
elmot 1:d0dfbce63a89 3262 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 3263 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR
elmot 1:d0dfbce63a89 3264 * @rmtoll CALR CALW8 LL_RTC_CAL_SetPeriod\n
elmot 1:d0dfbce63a89 3265 * CALR CALW16 LL_RTC_CAL_SetPeriod
elmot 1:d0dfbce63a89 3266 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3267 * @param Period This parameter can be one of the following values:
elmot 1:d0dfbce63a89 3268 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC
elmot 1:d0dfbce63a89 3269 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC
elmot 1:d0dfbce63a89 3270 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC
elmot 1:d0dfbce63a89 3271 * @retval None
elmot 1:d0dfbce63a89 3272 */
elmot 1:d0dfbce63a89 3273 __STATIC_INLINE void LL_RTC_CAL_SetPeriod(RTC_TypeDef *RTCx, uint32_t Period)
elmot 1:d0dfbce63a89 3274 {
elmot 1:d0dfbce63a89 3275 MODIFY_REG(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16, Period);
elmot 1:d0dfbce63a89 3276 }
elmot 1:d0dfbce63a89 3277
elmot 1:d0dfbce63a89 3278 /**
elmot 1:d0dfbce63a89 3279 * @brief Get the calibration cycle period
elmot 1:d0dfbce63a89 3280 * @rmtoll CALR CALW8 LL_RTC_CAL_GetPeriod\n
elmot 1:d0dfbce63a89 3281 * CALR CALW16 LL_RTC_CAL_GetPeriod
elmot 1:d0dfbce63a89 3282 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3283 * @retval Returned value can be one of the following values:
elmot 1:d0dfbce63a89 3284 * @arg @ref LL_RTC_CALIB_PERIOD_32SEC
elmot 1:d0dfbce63a89 3285 * @arg @ref LL_RTC_CALIB_PERIOD_16SEC
elmot 1:d0dfbce63a89 3286 * @arg @ref LL_RTC_CALIB_PERIOD_8SEC
elmot 1:d0dfbce63a89 3287 */
elmot 1:d0dfbce63a89 3288 __STATIC_INLINE uint32_t LL_RTC_CAL_GetPeriod(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3289 {
elmot 1:d0dfbce63a89 3290 return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16));
elmot 1:d0dfbce63a89 3291 }
elmot 1:d0dfbce63a89 3292
elmot 1:d0dfbce63a89 3293 /**
elmot 1:d0dfbce63a89 3294 * @brief Set Calibration minus
elmot 1:d0dfbce63a89 3295 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 3296 * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR
elmot 1:d0dfbce63a89 3297 * @rmtoll CALR CALM LL_RTC_CAL_SetMinus
elmot 1:d0dfbce63a89 3298 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3299 * @param CalibMinus Value between Min_Data=0x00 and Max_Data=0x1FF
elmot 1:d0dfbce63a89 3300 * @retval None
elmot 1:d0dfbce63a89 3301 */
elmot 1:d0dfbce63a89 3302 __STATIC_INLINE void LL_RTC_CAL_SetMinus(RTC_TypeDef *RTCx, uint32_t CalibMinus)
elmot 1:d0dfbce63a89 3303 {
elmot 1:d0dfbce63a89 3304 MODIFY_REG(RTCx->CALR, RTC_CALR_CALM, CalibMinus);
elmot 1:d0dfbce63a89 3305 }
elmot 1:d0dfbce63a89 3306
elmot 1:d0dfbce63a89 3307 /**
elmot 1:d0dfbce63a89 3308 * @brief Get Calibration minus
elmot 1:d0dfbce63a89 3309 * @rmtoll CALR CALM LL_RTC_CAL_GetMinus
elmot 1:d0dfbce63a89 3310 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3311 * @retval Value between Min_Data=0x00 and Max_Data= 0x1FF
elmot 1:d0dfbce63a89 3312 */
elmot 1:d0dfbce63a89 3313 __STATIC_INLINE uint32_t LL_RTC_CAL_GetMinus(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3314 {
elmot 1:d0dfbce63a89 3315 return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALM));
elmot 1:d0dfbce63a89 3316 }
elmot 1:d0dfbce63a89 3317
elmot 1:d0dfbce63a89 3318 /**
elmot 1:d0dfbce63a89 3319 * @}
elmot 1:d0dfbce63a89 3320 */
elmot 1:d0dfbce63a89 3321
elmot 1:d0dfbce63a89 3322 /** @defgroup RTC_LL_EF_FLAG_Management FLAG_Management
elmot 1:d0dfbce63a89 3323 * @{
elmot 1:d0dfbce63a89 3324 */
elmot 1:d0dfbce63a89 3325
elmot 1:d0dfbce63a89 3326 /**
elmot 1:d0dfbce63a89 3327 * @brief Get Internal Time-stamp flag
elmot 1:d0dfbce63a89 3328 * @rmtoll ISR ITSF LL_RTC_IsActiveFlag_ITS
elmot 1:d0dfbce63a89 3329 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3330 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3331 */
elmot 1:d0dfbce63a89 3332 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITS(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3333 {
elmot 1:d0dfbce63a89 3334 return (READ_BIT(RTCx->ISR, RTC_ISR_ITSF) == (RTC_ISR_ITSF));
elmot 1:d0dfbce63a89 3335 }
elmot 1:d0dfbce63a89 3336
elmot 1:d0dfbce63a89 3337 /**
elmot 1:d0dfbce63a89 3338 * @brief Get Recalibration pending Flag
elmot 1:d0dfbce63a89 3339 * @rmtoll ISR RECALPF LL_RTC_IsActiveFlag_RECALP
elmot 1:d0dfbce63a89 3340 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3341 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3342 */
elmot 1:d0dfbce63a89 3343 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RECALP(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3344 {
elmot 1:d0dfbce63a89 3345 return (READ_BIT(RTCx->ISR, RTC_ISR_RECALPF) == (RTC_ISR_RECALPF));
elmot 1:d0dfbce63a89 3346 }
elmot 1:d0dfbce63a89 3347
elmot 1:d0dfbce63a89 3348 #if defined(RTC_TAMPER3_SUPPORT)
elmot 1:d0dfbce63a89 3349 /**
elmot 1:d0dfbce63a89 3350 * @brief Get RTC_TAMP3 detection flag
elmot 1:d0dfbce63a89 3351 * @rmtoll ISR TAMP3F LL_RTC_IsActiveFlag_TAMP3
elmot 1:d0dfbce63a89 3352 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3353 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3354 */
elmot 1:d0dfbce63a89 3355 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3356 {
elmot 1:d0dfbce63a89 3357 return (READ_BIT(RTCx->ISR, RTC_ISR_TAMP3F) == (RTC_ISR_TAMP3F));
elmot 1:d0dfbce63a89 3358 }
elmot 1:d0dfbce63a89 3359 #endif /* RTC_TAMPER3_SUPPORT */
elmot 1:d0dfbce63a89 3360
elmot 1:d0dfbce63a89 3361 #if defined(RTC_TAMPER2_SUPPORT)
elmot 1:d0dfbce63a89 3362 /**
elmot 1:d0dfbce63a89 3363 * @brief Get RTC_TAMP2 detection flag
elmot 1:d0dfbce63a89 3364 * @rmtoll ISR TAMP2F LL_RTC_IsActiveFlag_TAMP2
elmot 1:d0dfbce63a89 3365 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3366 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3367 */
elmot 1:d0dfbce63a89 3368 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3369 {
elmot 1:d0dfbce63a89 3370 return (READ_BIT(RTCx->ISR, RTC_ISR_TAMP2F) == (RTC_ISR_TAMP2F));
elmot 1:d0dfbce63a89 3371 }
elmot 1:d0dfbce63a89 3372 #endif /* RTC_TAMPER2_SUPPORT */
elmot 1:d0dfbce63a89 3373
elmot 1:d0dfbce63a89 3374 #if defined(RTC_TAMPER1_SUPPORT)
elmot 1:d0dfbce63a89 3375 /**
elmot 1:d0dfbce63a89 3376 * @brief Get RTC_TAMP1 detection flag
elmot 1:d0dfbce63a89 3377 * @rmtoll ISR TAMP1F LL_RTC_IsActiveFlag_TAMP1
elmot 1:d0dfbce63a89 3378 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3379 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3380 */
elmot 1:d0dfbce63a89 3381 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3382 {
elmot 1:d0dfbce63a89 3383 return (READ_BIT(RTCx->ISR, RTC_ISR_TAMP1F) == (RTC_ISR_TAMP1F));
elmot 1:d0dfbce63a89 3384 }
elmot 1:d0dfbce63a89 3385 #endif /* RTC_TAMPER1_SUPPORT */
elmot 1:d0dfbce63a89 3386
elmot 1:d0dfbce63a89 3387 /**
elmot 1:d0dfbce63a89 3388 * @brief Get Time-stamp overflow flag
elmot 1:d0dfbce63a89 3389 * @rmtoll ISR TSOVF LL_RTC_IsActiveFlag_TSOV
elmot 1:d0dfbce63a89 3390 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3391 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3392 */
elmot 1:d0dfbce63a89 3393 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOV(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3394 {
elmot 1:d0dfbce63a89 3395 return (READ_BIT(RTCx->ISR, RTC_ISR_TSOVF) == (RTC_ISR_TSOVF));
elmot 1:d0dfbce63a89 3396 }
elmot 1:d0dfbce63a89 3397
elmot 1:d0dfbce63a89 3398 /**
elmot 1:d0dfbce63a89 3399 * @brief Get Time-stamp flag
elmot 1:d0dfbce63a89 3400 * @rmtoll ISR TSF LL_RTC_IsActiveFlag_TS
elmot 1:d0dfbce63a89 3401 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3402 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3403 */
elmot 1:d0dfbce63a89 3404 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TS(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3405 {
elmot 1:d0dfbce63a89 3406 return (READ_BIT(RTCx->ISR, RTC_ISR_TSF) == (RTC_ISR_TSF));
elmot 1:d0dfbce63a89 3407 }
elmot 1:d0dfbce63a89 3408
elmot 1:d0dfbce63a89 3409 #if defined(RTC_WAKEUP_SUPPORT)
elmot 1:d0dfbce63a89 3410 /**
elmot 1:d0dfbce63a89 3411 * @brief Get Wakeup timer flag
elmot 1:d0dfbce63a89 3412 * @rmtoll ISR WUTF LL_RTC_IsActiveFlag_WUT
elmot 1:d0dfbce63a89 3413 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3414 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3415 */
elmot 1:d0dfbce63a89 3416 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUT(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3417 {
elmot 1:d0dfbce63a89 3418 return (READ_BIT(RTCx->ISR, RTC_ISR_WUTF) == (RTC_ISR_WUTF));
elmot 1:d0dfbce63a89 3419 }
elmot 1:d0dfbce63a89 3420 #endif /* RTC_WAKEUP_SUPPORT */
elmot 1:d0dfbce63a89 3421
elmot 1:d0dfbce63a89 3422 /**
elmot 1:d0dfbce63a89 3423 * @brief Get Alarm B flag
elmot 1:d0dfbce63a89 3424 * @rmtoll ISR ALRBF LL_RTC_IsActiveFlag_ALRB
elmot 1:d0dfbce63a89 3425 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3426 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3427 */
elmot 1:d0dfbce63a89 3428 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRB(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3429 {
elmot 1:d0dfbce63a89 3430 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRBF) == (RTC_ISR_ALRBF));
elmot 1:d0dfbce63a89 3431 }
elmot 1:d0dfbce63a89 3432
elmot 1:d0dfbce63a89 3433 /**
elmot 1:d0dfbce63a89 3434 * @brief Get Alarm A flag
elmot 1:d0dfbce63a89 3435 * @rmtoll ISR ALRAF LL_RTC_IsActiveFlag_ALRA
elmot 1:d0dfbce63a89 3436 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3437 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3438 */
elmot 1:d0dfbce63a89 3439 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRA(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3440 {
elmot 1:d0dfbce63a89 3441 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRAF) == (RTC_ISR_ALRAF));
elmot 1:d0dfbce63a89 3442 }
elmot 1:d0dfbce63a89 3443
elmot 1:d0dfbce63a89 3444 /**
elmot 1:d0dfbce63a89 3445 * @brief Clear Internal Time-stamp flag
elmot 1:d0dfbce63a89 3446 * @rmtoll ISR ITSF LL_RTC_ClearFlag_ITS
elmot 1:d0dfbce63a89 3447 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3448 * @retval None
elmot 1:d0dfbce63a89 3449 */
elmot 1:d0dfbce63a89 3450 __STATIC_INLINE void LL_RTC_ClearFlag_ITS(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3451 {
elmot 1:d0dfbce63a89 3452 WRITE_REG(RTCx->ISR, (~((RTC_ISR_ITSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
elmot 1:d0dfbce63a89 3453 }
elmot 1:d0dfbce63a89 3454
elmot 1:d0dfbce63a89 3455 #if defined(RTC_TAMPER3_SUPPORT)
elmot 1:d0dfbce63a89 3456 /**
elmot 1:d0dfbce63a89 3457 * @brief Clear RTC_TAMP3 detection flag
elmot 1:d0dfbce63a89 3458 * @rmtoll ISR TAMP3F LL_RTC_ClearFlag_TAMP3
elmot 1:d0dfbce63a89 3459 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3460 * @retval None
elmot 1:d0dfbce63a89 3461 */
elmot 1:d0dfbce63a89 3462 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP3(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3463 {
elmot 1:d0dfbce63a89 3464 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP3F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
elmot 1:d0dfbce63a89 3465 }
elmot 1:d0dfbce63a89 3466 #endif /* RTC_TAMPER3_SUPPORT */
elmot 1:d0dfbce63a89 3467
elmot 1:d0dfbce63a89 3468 #if defined(RTC_TAMPER2_SUPPORT)
elmot 1:d0dfbce63a89 3469 /**
elmot 1:d0dfbce63a89 3470 * @brief Clear RTC_TAMP2 detection flag
elmot 1:d0dfbce63a89 3471 * @rmtoll ISR TAMP2F LL_RTC_ClearFlag_TAMP2
elmot 1:d0dfbce63a89 3472 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3473 * @retval None
elmot 1:d0dfbce63a89 3474 */
elmot 1:d0dfbce63a89 3475 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP2(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3476 {
elmot 1:d0dfbce63a89 3477 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP2F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
elmot 1:d0dfbce63a89 3478 }
elmot 1:d0dfbce63a89 3479 #endif /* RTC_TAMPER2_SUPPORT */
elmot 1:d0dfbce63a89 3480
elmot 1:d0dfbce63a89 3481 #if defined(RTC_TAMPER1_SUPPORT)
elmot 1:d0dfbce63a89 3482 /**
elmot 1:d0dfbce63a89 3483 * @brief Clear RTC_TAMP1 detection flag
elmot 1:d0dfbce63a89 3484 * @rmtoll ISR TAMP1F LL_RTC_ClearFlag_TAMP1
elmot 1:d0dfbce63a89 3485 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3486 * @retval None
elmot 1:d0dfbce63a89 3487 */
elmot 1:d0dfbce63a89 3488 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP1(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3489 {
elmot 1:d0dfbce63a89 3490 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP1F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
elmot 1:d0dfbce63a89 3491 }
elmot 1:d0dfbce63a89 3492 #endif /* RTC_TAMPER1_SUPPORT */
elmot 1:d0dfbce63a89 3493
elmot 1:d0dfbce63a89 3494 /**
elmot 1:d0dfbce63a89 3495 * @brief Clear Time-stamp overflow flag
elmot 1:d0dfbce63a89 3496 * @rmtoll ISR TSOVF LL_RTC_ClearFlag_TSOV
elmot 1:d0dfbce63a89 3497 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3498 * @retval None
elmot 1:d0dfbce63a89 3499 */
elmot 1:d0dfbce63a89 3500 __STATIC_INLINE void LL_RTC_ClearFlag_TSOV(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3501 {
elmot 1:d0dfbce63a89 3502 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSOVF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
elmot 1:d0dfbce63a89 3503 }
elmot 1:d0dfbce63a89 3504
elmot 1:d0dfbce63a89 3505 /**
elmot 1:d0dfbce63a89 3506 * @brief Clear Time-stamp flag
elmot 1:d0dfbce63a89 3507 * @rmtoll ISR TSF LL_RTC_ClearFlag_TS
elmot 1:d0dfbce63a89 3508 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3509 * @retval None
elmot 1:d0dfbce63a89 3510 */
elmot 1:d0dfbce63a89 3511 __STATIC_INLINE void LL_RTC_ClearFlag_TS(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3512 {
elmot 1:d0dfbce63a89 3513 WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
elmot 1:d0dfbce63a89 3514 }
elmot 1:d0dfbce63a89 3515
elmot 1:d0dfbce63a89 3516 #if defined(RTC_WAKEUP_SUPPORT)
elmot 1:d0dfbce63a89 3517 /**
elmot 1:d0dfbce63a89 3518 * @brief Clear Wakeup timer flag
elmot 1:d0dfbce63a89 3519 * @rmtoll ISR WUTF LL_RTC_ClearFlag_WUT
elmot 1:d0dfbce63a89 3520 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3521 * @retval None
elmot 1:d0dfbce63a89 3522 */
elmot 1:d0dfbce63a89 3523 __STATIC_INLINE void LL_RTC_ClearFlag_WUT(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3524 {
elmot 1:d0dfbce63a89 3525 WRITE_REG(RTCx->ISR, (~((RTC_ISR_WUTF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
elmot 1:d0dfbce63a89 3526 }
elmot 1:d0dfbce63a89 3527 #endif /* RTC_WAKEUP_SUPPORT */
elmot 1:d0dfbce63a89 3528
elmot 1:d0dfbce63a89 3529 /**
elmot 1:d0dfbce63a89 3530 * @brief Clear Alarm B flag
elmot 1:d0dfbce63a89 3531 * @rmtoll ISR ALRBF LL_RTC_ClearFlag_ALRB
elmot 1:d0dfbce63a89 3532 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3533 * @retval None
elmot 1:d0dfbce63a89 3534 */
elmot 1:d0dfbce63a89 3535 __STATIC_INLINE void LL_RTC_ClearFlag_ALRB(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3536 {
elmot 1:d0dfbce63a89 3537 WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRBF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
elmot 1:d0dfbce63a89 3538 }
elmot 1:d0dfbce63a89 3539
elmot 1:d0dfbce63a89 3540 /**
elmot 1:d0dfbce63a89 3541 * @brief Clear Alarm A flag
elmot 1:d0dfbce63a89 3542 * @rmtoll ISR ALRAF LL_RTC_ClearFlag_ALRA
elmot 1:d0dfbce63a89 3543 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3544 * @retval None
elmot 1:d0dfbce63a89 3545 */
elmot 1:d0dfbce63a89 3546 __STATIC_INLINE void LL_RTC_ClearFlag_ALRA(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3547 {
elmot 1:d0dfbce63a89 3548 WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRAF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
elmot 1:d0dfbce63a89 3549 }
elmot 1:d0dfbce63a89 3550
elmot 1:d0dfbce63a89 3551 /**
elmot 1:d0dfbce63a89 3552 * @brief Get Initialization flag
elmot 1:d0dfbce63a89 3553 * @rmtoll ISR INITF LL_RTC_IsActiveFlag_INIT
elmot 1:d0dfbce63a89 3554 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3555 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3556 */
elmot 1:d0dfbce63a89 3557 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INIT(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3558 {
elmot 1:d0dfbce63a89 3559 return (READ_BIT(RTCx->ISR, RTC_ISR_INITF) == (RTC_ISR_INITF));
elmot 1:d0dfbce63a89 3560 }
elmot 1:d0dfbce63a89 3561
elmot 1:d0dfbce63a89 3562 /**
elmot 1:d0dfbce63a89 3563 * @brief Get Registers synchronization flag
elmot 1:d0dfbce63a89 3564 * @rmtoll ISR RSF LL_RTC_IsActiveFlag_RS
elmot 1:d0dfbce63a89 3565 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3566 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3567 */
elmot 1:d0dfbce63a89 3568 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RS(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3569 {
elmot 1:d0dfbce63a89 3570 return (READ_BIT(RTCx->ISR, RTC_ISR_RSF) == (RTC_ISR_RSF));
elmot 1:d0dfbce63a89 3571 }
elmot 1:d0dfbce63a89 3572
elmot 1:d0dfbce63a89 3573 /**
elmot 1:d0dfbce63a89 3574 * @brief Clear Registers synchronization flag
elmot 1:d0dfbce63a89 3575 * @rmtoll ISR RSF LL_RTC_ClearFlag_RS
elmot 1:d0dfbce63a89 3576 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3577 * @retval None
elmot 1:d0dfbce63a89 3578 */
elmot 1:d0dfbce63a89 3579 __STATIC_INLINE void LL_RTC_ClearFlag_RS(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3580 {
elmot 1:d0dfbce63a89 3581 WRITE_REG(RTCx->ISR, (~((RTC_ISR_RSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
elmot 1:d0dfbce63a89 3582 }
elmot 1:d0dfbce63a89 3583
elmot 1:d0dfbce63a89 3584 /**
elmot 1:d0dfbce63a89 3585 * @brief Get Initialization status flag
elmot 1:d0dfbce63a89 3586 * @rmtoll ISR INITS LL_RTC_IsActiveFlag_INITS
elmot 1:d0dfbce63a89 3587 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3588 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3589 */
elmot 1:d0dfbce63a89 3590 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INITS(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3591 {
elmot 1:d0dfbce63a89 3592 return (READ_BIT(RTCx->ISR, RTC_ISR_INITS) == (RTC_ISR_INITS));
elmot 1:d0dfbce63a89 3593 }
elmot 1:d0dfbce63a89 3594
elmot 1:d0dfbce63a89 3595 /**
elmot 1:d0dfbce63a89 3596 * @brief Get Shift operation pending flag
elmot 1:d0dfbce63a89 3597 * @rmtoll ISR SHPF LL_RTC_IsActiveFlag_SHP
elmot 1:d0dfbce63a89 3598 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3599 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3600 */
elmot 1:d0dfbce63a89 3601 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SHP(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3602 {
elmot 1:d0dfbce63a89 3603 return (READ_BIT(RTCx->ISR, RTC_ISR_SHPF) == (RTC_ISR_SHPF));
elmot 1:d0dfbce63a89 3604 }
elmot 1:d0dfbce63a89 3605
elmot 1:d0dfbce63a89 3606 #if defined(RTC_WAKEUP_SUPPORT)
elmot 1:d0dfbce63a89 3607 /**
elmot 1:d0dfbce63a89 3608 * @brief Get Wakeup timer write flag
elmot 1:d0dfbce63a89 3609 * @rmtoll ISR WUTWF LL_RTC_IsActiveFlag_WUTW
elmot 1:d0dfbce63a89 3610 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3611 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3612 */
elmot 1:d0dfbce63a89 3613 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTW(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3614 {
elmot 1:d0dfbce63a89 3615 return (READ_BIT(RTCx->ISR, RTC_ISR_WUTWF) == (RTC_ISR_WUTWF));
elmot 1:d0dfbce63a89 3616 }
elmot 1:d0dfbce63a89 3617 #endif /* RTC_WAKEUP_SUPPORT */
elmot 1:d0dfbce63a89 3618
elmot 1:d0dfbce63a89 3619 /**
elmot 1:d0dfbce63a89 3620 * @brief Get Alarm B write flag
elmot 1:d0dfbce63a89 3621 * @rmtoll ISR ALRBWF LL_RTC_IsActiveFlag_ALRBW
elmot 1:d0dfbce63a89 3622 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3623 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3624 */
elmot 1:d0dfbce63a89 3625 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBW(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3626 {
elmot 1:d0dfbce63a89 3627 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRBWF) == (RTC_ISR_ALRBWF));
elmot 1:d0dfbce63a89 3628 }
elmot 1:d0dfbce63a89 3629
elmot 1:d0dfbce63a89 3630 /**
elmot 1:d0dfbce63a89 3631 * @brief Get Alarm A write flag
elmot 1:d0dfbce63a89 3632 * @rmtoll ISR ALRAWF LL_RTC_IsActiveFlag_ALRAW
elmot 1:d0dfbce63a89 3633 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3634 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3635 */
elmot 1:d0dfbce63a89 3636 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAW(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3637 {
elmot 1:d0dfbce63a89 3638 return (READ_BIT(RTCx->ISR, RTC_ISR_ALRAWF) == (RTC_ISR_ALRAWF));
elmot 1:d0dfbce63a89 3639 }
elmot 1:d0dfbce63a89 3640
elmot 1:d0dfbce63a89 3641 /**
elmot 1:d0dfbce63a89 3642 * @}
elmot 1:d0dfbce63a89 3643 */
elmot 1:d0dfbce63a89 3644
elmot 1:d0dfbce63a89 3645 /** @defgroup RTC_LL_EF_IT_Management IT_Management
elmot 1:d0dfbce63a89 3646 * @{
elmot 1:d0dfbce63a89 3647 */
elmot 1:d0dfbce63a89 3648
elmot 1:d0dfbce63a89 3649 /**
elmot 1:d0dfbce63a89 3650 * @brief Enable Time-stamp interrupt
elmot 1:d0dfbce63a89 3651 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 3652 * @rmtoll CR TSIE LL_RTC_EnableIT_TS
elmot 1:d0dfbce63a89 3653 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3654 * @retval None
elmot 1:d0dfbce63a89 3655 */
elmot 1:d0dfbce63a89 3656 __STATIC_INLINE void LL_RTC_EnableIT_TS(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3657 {
elmot 1:d0dfbce63a89 3658 SET_BIT(RTCx->CR, RTC_CR_TSIE);
elmot 1:d0dfbce63a89 3659 }
elmot 1:d0dfbce63a89 3660
elmot 1:d0dfbce63a89 3661 /**
elmot 1:d0dfbce63a89 3662 * @brief Disable Time-stamp interrupt
elmot 1:d0dfbce63a89 3663 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 3664 * @rmtoll CR TSIE LL_RTC_DisableIT_TS
elmot 1:d0dfbce63a89 3665 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3666 * @retval None
elmot 1:d0dfbce63a89 3667 */
elmot 1:d0dfbce63a89 3668 __STATIC_INLINE void LL_RTC_DisableIT_TS(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3669 {
elmot 1:d0dfbce63a89 3670 CLEAR_BIT(RTCx->CR, RTC_CR_TSIE);
elmot 1:d0dfbce63a89 3671 }
elmot 1:d0dfbce63a89 3672
elmot 1:d0dfbce63a89 3673 #if defined(RTC_WAKEUP_SUPPORT)
elmot 1:d0dfbce63a89 3674 /**
elmot 1:d0dfbce63a89 3675 * @brief Enable Wakeup timer interrupt
elmot 1:d0dfbce63a89 3676 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 3677 * @rmtoll CR WUTIE LL_RTC_EnableIT_WUT
elmot 1:d0dfbce63a89 3678 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3679 * @retval None
elmot 1:d0dfbce63a89 3680 */
elmot 1:d0dfbce63a89 3681 __STATIC_INLINE void LL_RTC_EnableIT_WUT(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3682 {
elmot 1:d0dfbce63a89 3683 SET_BIT(RTCx->CR, RTC_CR_WUTIE);
elmot 1:d0dfbce63a89 3684 }
elmot 1:d0dfbce63a89 3685
elmot 1:d0dfbce63a89 3686 /**
elmot 1:d0dfbce63a89 3687 * @brief Disable Wakeup timer interrupt
elmot 1:d0dfbce63a89 3688 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 3689 * @rmtoll CR WUTIE LL_RTC_DisableIT_WUT
elmot 1:d0dfbce63a89 3690 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3691 * @retval None
elmot 1:d0dfbce63a89 3692 */
elmot 1:d0dfbce63a89 3693 __STATIC_INLINE void LL_RTC_DisableIT_WUT(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3694 {
elmot 1:d0dfbce63a89 3695 CLEAR_BIT(RTCx->CR, RTC_CR_WUTIE);
elmot 1:d0dfbce63a89 3696 }
elmot 1:d0dfbce63a89 3697 #endif /* RTC_WAKEUP_SUPPORT */
elmot 1:d0dfbce63a89 3698
elmot 1:d0dfbce63a89 3699 /**
elmot 1:d0dfbce63a89 3700 * @brief Enable Alarm B interrupt
elmot 1:d0dfbce63a89 3701 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 3702 * @rmtoll CR ALRBIE LL_RTC_EnableIT_ALRB
elmot 1:d0dfbce63a89 3703 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3704 * @retval None
elmot 1:d0dfbce63a89 3705 */
elmot 1:d0dfbce63a89 3706 __STATIC_INLINE void LL_RTC_EnableIT_ALRB(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3707 {
elmot 1:d0dfbce63a89 3708 SET_BIT(RTCx->CR, RTC_CR_ALRBIE);
elmot 1:d0dfbce63a89 3709 }
elmot 1:d0dfbce63a89 3710
elmot 1:d0dfbce63a89 3711 /**
elmot 1:d0dfbce63a89 3712 * @brief Disable Alarm B interrupt
elmot 1:d0dfbce63a89 3713 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 3714 * @rmtoll CR ALRBIE LL_RTC_DisableIT_ALRB
elmot 1:d0dfbce63a89 3715 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3716 * @retval None
elmot 1:d0dfbce63a89 3717 */
elmot 1:d0dfbce63a89 3718 __STATIC_INLINE void LL_RTC_DisableIT_ALRB(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3719 {
elmot 1:d0dfbce63a89 3720 CLEAR_BIT(RTCx->CR, RTC_CR_ALRBIE);
elmot 1:d0dfbce63a89 3721 }
elmot 1:d0dfbce63a89 3722
elmot 1:d0dfbce63a89 3723 /**
elmot 1:d0dfbce63a89 3724 * @brief Enable Alarm A interrupt
elmot 1:d0dfbce63a89 3725 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 3726 * @rmtoll CR ALRAIE LL_RTC_EnableIT_ALRA
elmot 1:d0dfbce63a89 3727 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3728 * @retval None
elmot 1:d0dfbce63a89 3729 */
elmot 1:d0dfbce63a89 3730 __STATIC_INLINE void LL_RTC_EnableIT_ALRA(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3731 {
elmot 1:d0dfbce63a89 3732 SET_BIT(RTCx->CR, RTC_CR_ALRAIE);
elmot 1:d0dfbce63a89 3733 }
elmot 1:d0dfbce63a89 3734
elmot 1:d0dfbce63a89 3735 /**
elmot 1:d0dfbce63a89 3736 * @brief Disable Alarm A interrupt
elmot 1:d0dfbce63a89 3737 * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
elmot 1:d0dfbce63a89 3738 * @rmtoll CR ALRAIE LL_RTC_DisableIT_ALRA
elmot 1:d0dfbce63a89 3739 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3740 * @retval None
elmot 1:d0dfbce63a89 3741 */
elmot 1:d0dfbce63a89 3742 __STATIC_INLINE void LL_RTC_DisableIT_ALRA(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3743 {
elmot 1:d0dfbce63a89 3744 CLEAR_BIT(RTCx->CR, RTC_CR_ALRAIE);
elmot 1:d0dfbce63a89 3745 }
elmot 1:d0dfbce63a89 3746
elmot 1:d0dfbce63a89 3747 #if defined(RTC_TAMPER3_SUPPORT)
elmot 1:d0dfbce63a89 3748 /**
elmot 1:d0dfbce63a89 3749 * @brief Enable Tamper 3 interrupt
elmot 1:d0dfbce63a89 3750 * @rmtoll TAMPCR TAMP3IE LL_RTC_EnableIT_TAMP3
elmot 1:d0dfbce63a89 3751 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3752 * @retval None
elmot 1:d0dfbce63a89 3753 */
elmot 1:d0dfbce63a89 3754 __STATIC_INLINE void LL_RTC_EnableIT_TAMP3(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3755 {
elmot 1:d0dfbce63a89 3756 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP3IE);
elmot 1:d0dfbce63a89 3757 }
elmot 1:d0dfbce63a89 3758
elmot 1:d0dfbce63a89 3759 /**
elmot 1:d0dfbce63a89 3760 * @brief Disable Tamper 3 interrupt
elmot 1:d0dfbce63a89 3761 * @rmtoll TAMPCR TAMP3IE LL_RTC_DisableIT_TAMP3
elmot 1:d0dfbce63a89 3762 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3763 * @retval None
elmot 1:d0dfbce63a89 3764 */
elmot 1:d0dfbce63a89 3765 __STATIC_INLINE void LL_RTC_DisableIT_TAMP3(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3766 {
elmot 1:d0dfbce63a89 3767 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP3IE);
elmot 1:d0dfbce63a89 3768 }
elmot 1:d0dfbce63a89 3769 #endif /* RTC_TAMPER3_SUPPORT */
elmot 1:d0dfbce63a89 3770
elmot 1:d0dfbce63a89 3771 #if defined(RTC_TAMPER2_SUPPORT)
elmot 1:d0dfbce63a89 3772 /**
elmot 1:d0dfbce63a89 3773 * @brief Enable Tamper 2 interrupt
elmot 1:d0dfbce63a89 3774 * @rmtoll TAMPCR TAMP2IE LL_RTC_EnableIT_TAMP2
elmot 1:d0dfbce63a89 3775 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3776 * @retval None
elmot 1:d0dfbce63a89 3777 */
elmot 1:d0dfbce63a89 3778 __STATIC_INLINE void LL_RTC_EnableIT_TAMP2(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3779 {
elmot 1:d0dfbce63a89 3780 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP2IE);
elmot 1:d0dfbce63a89 3781 }
elmot 1:d0dfbce63a89 3782
elmot 1:d0dfbce63a89 3783 /**
elmot 1:d0dfbce63a89 3784 * @brief Disable Tamper 2 interrupt
elmot 1:d0dfbce63a89 3785 * @rmtoll TAMPCR TAMP2IE LL_RTC_DisableIT_TAMP2
elmot 1:d0dfbce63a89 3786 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3787 * @retval None
elmot 1:d0dfbce63a89 3788 */
elmot 1:d0dfbce63a89 3789 __STATIC_INLINE void LL_RTC_DisableIT_TAMP2(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3790 {
elmot 1:d0dfbce63a89 3791 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP2IE);
elmot 1:d0dfbce63a89 3792 }
elmot 1:d0dfbce63a89 3793 #endif /* RTC_TAMPER2_SUPPORT */
elmot 1:d0dfbce63a89 3794
elmot 1:d0dfbce63a89 3795 #if defined(RTC_TAMPER1_SUPPORT)
elmot 1:d0dfbce63a89 3796 /**
elmot 1:d0dfbce63a89 3797 * @brief Enable Tamper 1 interrupt
elmot 1:d0dfbce63a89 3798 * @rmtoll TAMPCR TAMP1IE LL_RTC_EnableIT_TAMP1
elmot 1:d0dfbce63a89 3799 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3800 * @retval None
elmot 1:d0dfbce63a89 3801 */
elmot 1:d0dfbce63a89 3802 __STATIC_INLINE void LL_RTC_EnableIT_TAMP1(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3803 {
elmot 1:d0dfbce63a89 3804 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP1IE);
elmot 1:d0dfbce63a89 3805 }
elmot 1:d0dfbce63a89 3806
elmot 1:d0dfbce63a89 3807 /**
elmot 1:d0dfbce63a89 3808 * @brief Disable Tamper 1 interrupt
elmot 1:d0dfbce63a89 3809 * @rmtoll TAMPCR TAMP1IE LL_RTC_DisableIT_TAMP1
elmot 1:d0dfbce63a89 3810 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3811 * @retval None
elmot 1:d0dfbce63a89 3812 */
elmot 1:d0dfbce63a89 3813 __STATIC_INLINE void LL_RTC_DisableIT_TAMP1(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3814 {
elmot 1:d0dfbce63a89 3815 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP1IE);
elmot 1:d0dfbce63a89 3816 }
elmot 1:d0dfbce63a89 3817 #endif /* RTC_TAMPER1_SUPPORT */
elmot 1:d0dfbce63a89 3818
elmot 1:d0dfbce63a89 3819 /**
elmot 1:d0dfbce63a89 3820 * @brief Enable all Tamper Interrupt
elmot 1:d0dfbce63a89 3821 * @rmtoll TAMPCR TAMPIE LL_RTC_EnableIT_TAMP
elmot 1:d0dfbce63a89 3822 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3823 * @retval None
elmot 1:d0dfbce63a89 3824 */
elmot 1:d0dfbce63a89 3825 __STATIC_INLINE void LL_RTC_EnableIT_TAMP(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3826 {
elmot 1:d0dfbce63a89 3827 SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPIE);
elmot 1:d0dfbce63a89 3828 }
elmot 1:d0dfbce63a89 3829
elmot 1:d0dfbce63a89 3830 /**
elmot 1:d0dfbce63a89 3831 * @brief Disable all Tamper Interrupt
elmot 1:d0dfbce63a89 3832 * @rmtoll TAMPCR TAMPIE LL_RTC_DisableIT_TAMP
elmot 1:d0dfbce63a89 3833 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3834 * @retval None
elmot 1:d0dfbce63a89 3835 */
elmot 1:d0dfbce63a89 3836 __STATIC_INLINE void LL_RTC_DisableIT_TAMP(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3837 {
elmot 1:d0dfbce63a89 3838 CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPIE);
elmot 1:d0dfbce63a89 3839 }
elmot 1:d0dfbce63a89 3840
elmot 1:d0dfbce63a89 3841 /**
elmot 1:d0dfbce63a89 3842 * @brief Check if Time-stamp interrupt is enabled or not
elmot 1:d0dfbce63a89 3843 * @rmtoll CR TSIE LL_RTC_IsEnabledIT_TS
elmot 1:d0dfbce63a89 3844 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3845 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3846 */
elmot 1:d0dfbce63a89 3847 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TS(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3848 {
elmot 1:d0dfbce63a89 3849 return (READ_BIT(RTCx->CR, RTC_CR_TSIE) == (RTC_CR_TSIE));
elmot 1:d0dfbce63a89 3850 }
elmot 1:d0dfbce63a89 3851
elmot 1:d0dfbce63a89 3852 #if defined(RTC_WAKEUP_SUPPORT)
elmot 1:d0dfbce63a89 3853 /**
elmot 1:d0dfbce63a89 3854 * @brief Check if Wakeup timer interrupt is enabled or not
elmot 1:d0dfbce63a89 3855 * @rmtoll CR WUTIE LL_RTC_IsEnabledIT_WUT
elmot 1:d0dfbce63a89 3856 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3857 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3858 */
elmot 1:d0dfbce63a89 3859 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_WUT(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3860 {
elmot 1:d0dfbce63a89 3861 return (READ_BIT(RTCx->CR, RTC_CR_WUTIE) == (RTC_CR_WUTIE));
elmot 1:d0dfbce63a89 3862 }
elmot 1:d0dfbce63a89 3863 #endif /* RTC_WAKEUP_SUPPORT */
elmot 1:d0dfbce63a89 3864
elmot 1:d0dfbce63a89 3865 /**
elmot 1:d0dfbce63a89 3866 * @brief Check if Alarm B interrupt is enabled or not
elmot 1:d0dfbce63a89 3867 * @rmtoll CR ALRBIE LL_RTC_IsEnabledIT_ALRB
elmot 1:d0dfbce63a89 3868 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3869 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3870 */
elmot 1:d0dfbce63a89 3871 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRB(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3872 {
elmot 1:d0dfbce63a89 3873 return (READ_BIT(RTCx->CR, RTC_CR_ALRBIE) == (RTC_CR_ALRBIE));
elmot 1:d0dfbce63a89 3874 }
elmot 1:d0dfbce63a89 3875
elmot 1:d0dfbce63a89 3876 /**
elmot 1:d0dfbce63a89 3877 * @brief Check if Alarm A interrupt is enabled or not
elmot 1:d0dfbce63a89 3878 * @rmtoll CR ALRAIE LL_RTC_IsEnabledIT_ALRA
elmot 1:d0dfbce63a89 3879 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3880 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3881 */
elmot 1:d0dfbce63a89 3882 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRA(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3883 {
elmot 1:d0dfbce63a89 3884 return (READ_BIT(RTCx->CR, RTC_CR_ALRAIE) == (RTC_CR_ALRAIE));
elmot 1:d0dfbce63a89 3885 }
elmot 1:d0dfbce63a89 3886
elmot 1:d0dfbce63a89 3887 #if defined(RTC_TAMPER3_SUPPORT)
elmot 1:d0dfbce63a89 3888 /**
elmot 1:d0dfbce63a89 3889 * @brief Check if Tamper 3 interrupt is enabled or not
elmot 1:d0dfbce63a89 3890 * @rmtoll TAMPCR TAMP3IE LL_RTC_IsEnabledIT_TAMP3
elmot 1:d0dfbce63a89 3891 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3892 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3893 */
elmot 1:d0dfbce63a89 3894 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP3(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3895 {
elmot 1:d0dfbce63a89 3896 return (READ_BIT(RTCx->TAMPCR,
elmot 1:d0dfbce63a89 3897 RTC_TAMPCR_TAMP3IE) == (RTC_TAMPCR_TAMP3IE));
elmot 1:d0dfbce63a89 3898 }
elmot 1:d0dfbce63a89 3899 #endif /* RTC_TAMPER3_SUPPORT */
elmot 1:d0dfbce63a89 3900
elmot 1:d0dfbce63a89 3901 #if defined(RTC_TAMPER2_SUPPORT)
elmot 1:d0dfbce63a89 3902 /**
elmot 1:d0dfbce63a89 3903 * @brief Check if Tamper 2 interrupt is enabled or not
elmot 1:d0dfbce63a89 3904 * @rmtoll TAMPCR TAMP2IE LL_RTC_IsEnabledIT_TAMP2
elmot 1:d0dfbce63a89 3905 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3906 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3907 */
elmot 1:d0dfbce63a89 3908 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP2(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3909 {
elmot 1:d0dfbce63a89 3910 return (READ_BIT(RTCx->TAMPCR,
elmot 1:d0dfbce63a89 3911 RTC_TAMPCR_TAMP2IE) == (RTC_TAMPCR_TAMP2IE));
elmot 1:d0dfbce63a89 3912 #endif /* RTC_TAMPER2_SUPPORT */
elmot 1:d0dfbce63a89 3913 }
elmot 1:d0dfbce63a89 3914
elmot 1:d0dfbce63a89 3915 #if defined(RTC_TAMPER1_SUPPORT)
elmot 1:d0dfbce63a89 3916 /**
elmot 1:d0dfbce63a89 3917 * @brief Check if Tamper 1 interrupt is enabled or not
elmot 1:d0dfbce63a89 3918 * @rmtoll TAMPCR TAMP1IE LL_RTC_IsEnabledIT_TAMP1
elmot 1:d0dfbce63a89 3919 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3920 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3921 */
elmot 1:d0dfbce63a89 3922 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP1(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3923 {
elmot 1:d0dfbce63a89 3924 return (READ_BIT(RTCx->TAMPCR,
elmot 1:d0dfbce63a89 3925 RTC_TAMPCR_TAMP1IE) == (RTC_TAMPCR_TAMP1IE));
elmot 1:d0dfbce63a89 3926 }
elmot 1:d0dfbce63a89 3927 #endif /* RTC_TAMPER1_SUPPORT */
elmot 1:d0dfbce63a89 3928
elmot 1:d0dfbce63a89 3929 /**
elmot 1:d0dfbce63a89 3930 * @brief Check if all the TAMPER interrupts are enabled or not
elmot 1:d0dfbce63a89 3931 * @rmtoll TAMPCR TAMPIE LL_RTC_IsEnabledIT_TAMP
elmot 1:d0dfbce63a89 3932 * @param RTCx RTC Instance
elmot 1:d0dfbce63a89 3933 * @retval State of bit (1 or 0).
elmot 1:d0dfbce63a89 3934 */
elmot 1:d0dfbce63a89 3935 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP(RTC_TypeDef *RTCx)
elmot 1:d0dfbce63a89 3936 {
elmot 1:d0dfbce63a89 3937 return (READ_BIT(RTCx->TAMPCR,
elmot 1:d0dfbce63a89 3938 RTC_TAMPCR_TAMPIE) == (RTC_TAMPCR_TAMPIE));
elmot 1:d0dfbce63a89 3939 }
elmot 1:d0dfbce63a89 3940
elmot 1:d0dfbce63a89 3941 /**
elmot 1:d0dfbce63a89 3942 * @}
elmot 1:d0dfbce63a89 3943 */
elmot 1:d0dfbce63a89 3944
elmot 1:d0dfbce63a89 3945 #if defined(USE_FULL_LL_DRIVER)
elmot 1:d0dfbce63a89 3946 /** @defgroup RTC_LL_EF_Init Initialization and de-initialization functions
elmot 1:d0dfbce63a89 3947 * @{
elmot 1:d0dfbce63a89 3948 */
elmot 1:d0dfbce63a89 3949
elmot 1:d0dfbce63a89 3950 ErrorStatus LL_RTC_DeInit(RTC_TypeDef *RTCx);
elmot 1:d0dfbce63a89 3951 ErrorStatus LL_RTC_Init(RTC_TypeDef *RTCx, LL_RTC_InitTypeDef *RTC_InitStruct);
elmot 1:d0dfbce63a89 3952 void LL_RTC_StructInit(LL_RTC_InitTypeDef *RTC_InitStruct);
elmot 1:d0dfbce63a89 3953 ErrorStatus LL_RTC_TIME_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_TimeTypeDef *RTC_TimeStruct);
elmot 1:d0dfbce63a89 3954 void LL_RTC_TIME_StructInit(LL_RTC_TimeTypeDef *RTC_TimeStruct);
elmot 1:d0dfbce63a89 3955 ErrorStatus LL_RTC_DATE_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_DateTypeDef *RTC_DateStruct);
elmot 1:d0dfbce63a89 3956 void LL_RTC_DATE_StructInit(LL_RTC_DateTypeDef *RTC_DateStruct);
elmot 1:d0dfbce63a89 3957 ErrorStatus LL_RTC_ALMA_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
elmot 1:d0dfbce63a89 3958 ErrorStatus LL_RTC_ALMB_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
elmot 1:d0dfbce63a89 3959 void LL_RTC_ALMA_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
elmot 1:d0dfbce63a89 3960 void LL_RTC_ALMB_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
elmot 1:d0dfbce63a89 3961 ErrorStatus LL_RTC_EnterInitMode(RTC_TypeDef *RTCx);
elmot 1:d0dfbce63a89 3962 ErrorStatus LL_RTC_ExitInitMode(RTC_TypeDef *RTCx);
elmot 1:d0dfbce63a89 3963 ErrorStatus LL_RTC_WaitForSynchro(RTC_TypeDef *RTCx);
elmot 1:d0dfbce63a89 3964
elmot 1:d0dfbce63a89 3965 /**
elmot 1:d0dfbce63a89 3966 * @}
elmot 1:d0dfbce63a89 3967 */
elmot 1:d0dfbce63a89 3968 #endif /* USE_FULL_LL_DRIVER */
elmot 1:d0dfbce63a89 3969
elmot 1:d0dfbce63a89 3970 /**
elmot 1:d0dfbce63a89 3971 * @}
elmot 1:d0dfbce63a89 3972 */
elmot 1:d0dfbce63a89 3973
elmot 1:d0dfbce63a89 3974 /**
elmot 1:d0dfbce63a89 3975 * @}
elmot 1:d0dfbce63a89 3976 */
elmot 1:d0dfbce63a89 3977
elmot 1:d0dfbce63a89 3978 #endif /* defined(RTC) */
elmot 1:d0dfbce63a89 3979
elmot 1:d0dfbce63a89 3980 /**
elmot 1:d0dfbce63a89 3981 * @}
elmot 1:d0dfbce63a89 3982 */
elmot 1:d0dfbce63a89 3983
elmot 1:d0dfbce63a89 3984 #ifdef __cplusplus
elmot 1:d0dfbce63a89 3985 }
elmot 1:d0dfbce63a89 3986 #endif
elmot 1:d0dfbce63a89 3987
elmot 1:d0dfbce63a89 3988 #endif /* __STM32L4xx_LL_RTC_H */
elmot 1:d0dfbce63a89 3989
elmot 1:d0dfbce63a89 3990 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/