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