001

Committer:
ganlikun
Date:
Sun Jun 12 14:02:44 2022 +0000
Revision:
0:13413ea9a877
00

Who changed what in which revision?

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