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