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