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