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