source: trunk/firmware/Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal_rtc.h

Last change on this file was 6, checked in by f.jahn, 8 months ago
File size: 43.4 KB
Line 
1/**
2 ******************************************************************************
3 * @file stm32g0xx_hal_rtc.h
4 * @author MCD Application Team
5 * @brief Header file of RTC HAL module.
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>&copy; Copyright (c) 2018 STMicroelectronics.
10 * All rights reserved.</center></h2>
11 *
12 * This software component is licensed by ST under BSD 3-Clause license,
13 * the "License"; You may not use this file except in compliance with the
14 * License. You may obtain a copy of the License at:
15 * opensource.org/licenses/BSD-3-Clause
16 *
17 ******************************************************************************
18 */
19
20/* Define to prevent recursive inclusion -------------------------------------*/
21#ifndef STM32G0xx_HAL_RTC_H
22#define STM32G0xx_HAL_RTC_H
23
24#ifdef __cplusplus
25 extern "C" {
26#endif
27
28/* Includes ------------------------------------------------------------------*/
29#include "stm32g0xx_hal_def.h"
30
31/** @addtogroup STM32G0xx_HAL_Driver
32 * @{
33 */
34
35/** @defgroup RTC RTC
36 * @{
37 */
38
39/* Exported types ------------------------------------------------------------*/
40/** @defgroup RTC_Exported_Types RTC Exported Types
41 * @{
42 */
43
44/**
45 * @brief HAL State structures definition
46 */
47typedef enum
48{
49 HAL_RTC_STATE_RESET = 0x00U, /*!< RTC not yet initialized or disabled */
50 HAL_RTC_STATE_READY = 0x01U, /*!< RTC initialized and ready for use */
51 HAL_RTC_STATE_BUSY = 0x02U, /*!< RTC process is ongoing */
52 HAL_RTC_STATE_TIMEOUT = 0x03U, /*!< RTC timeout state */
53 HAL_RTC_STATE_ERROR = 0x04U /*!< RTC error state */
54
55}HAL_RTCStateTypeDef;
56
57/**
58 * @brief RTC Configuration Structure definition
59 */
60typedef struct
61{
62 uint32_t HourFormat; /*!< Specifies the RTC Hour Format.
63 This parameter can be a value of @ref RTC_Hour_Formats */
64
65 uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value.
66 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F */
67
68 uint32_t SynchPrediv; /*!< Specifies the RTC Synchronous Predivider value.
69 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF */
70
71 uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC output.
72 This parameter can be a value of @ref RTCEx_Output_selection_Definitions */
73
74 uint32_t OutPutRemap; /*!< Specifies the remap for RTC output.
75 This parameter can be a value of @ref RTC_Output_ALARM_OUT_Remap */
76
77 uint32_t OutPutPolarity; /*!< Specifies the polarity of the output signal.
78 This parameter can be a value of @ref RTC_Output_Polarity_Definitions */
79
80 uint32_t OutPutType; /*!< Specifies the RTC Output Pin mode.
81 This parameter can be a value of @ref RTC_Output_Type_ALARM_OUT */
82
83 uint32_t OutPutPullUp; /*!< Specifies the RTC Output Pull-Up mode.
84 This parameter can be a value of @ref RTC_Output_PullUp_ALARM_OUT */
85}RTC_InitTypeDef;
86
87/**
88 * @brief RTC Time structure definition
89 */
90typedef struct
91{
92 uint8_t Hours; /*!< Specifies the RTC Time Hour.
93 This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the RTC_HourFormat_12 is selected.
94 This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the RTC_HourFormat_24 is selected */
95
96 uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
97 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
98
99 uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
100 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
101
102 uint8_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
103 This parameter can be a value of @ref RTC_AM_PM_Definitions */
104
105 uint32_t SubSeconds; /*!< Specifies the RTC_SSR RTC Sub Second register content.
106 This parameter corresponds to a time unit range between [0-1] Second
107 with [1 Sec / SecondFraction +1] granularity */
108
109 uint32_t SecondFraction; /*!< Specifies the range or granularity of Sub Second register content
110 corresponding to Synchronous pre-scaler factor value (PREDIV_S)
111 This parameter corresponds to a time unit range between [0-1] Second
112 with [1 Sec / SecondFraction +1] granularity.
113 This field will be used only by HAL_RTC_GetTime function */
114
115 uint32_t DayLightSaving; /*!< Specifies RTC_DayLightSaveOperation: the value of hour adjustment.
116 This parameter can be a value of @ref RTC_DayLightSaving_Definitions */
117
118 uint32_t StoreOperation; /*!< Specifies RTC_StoreOperation value to be written in the BKP bit
119 in CR register to store the operation.
120 This parameter can be a value of @ref RTC_StoreOperation_Definitions */
121}RTC_TimeTypeDef;
122
123/**
124 * @brief RTC Date structure definition
125 */
126typedef struct
127{
128 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay.
129 This parameter can be a value of @ref RTC_WeekDay_Definitions */
130
131 uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format).
132 This parameter can be a value of @ref RTC_Month_Date_Definitions */
133
134 uint8_t Date; /*!< Specifies the RTC Date.
135 This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
136
137 uint8_t Year; /*!< Specifies the RTC Date Year.
138 This parameter must be a number between Min_Data = 0 and Max_Data = 99 */
139
140}RTC_DateTypeDef;
141
142/**
143 * @brief RTC Alarm structure definition
144 */
145typedef struct
146{
147 RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */
148
149 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks.
150 This parameter can be a value of @ref RTC_AlarmMask_Definitions */
151
152 uint32_t AlarmSubSecondMask; /*!< Specifies the RTC Alarm SubSeconds Masks.
153 This parameter can be a value of @ref RTC_Alarm_Sub_Seconds_Masks_Definitions */
154
155 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on Date or WeekDay.
156 This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */
157
158 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Date/WeekDay.
159 If the Alarm Date is selected, this parameter must be set to a value in the 1-31 range.
160 If the Alarm WeekDay is selected, this parameter can be a value of @ref RTC_WeekDay_Definitions */
161
162 uint32_t Alarm; /*!< Specifies the alarm .
163 This parameter can be a value of @ref RTC_Alarms_Definitions */
164}RTC_AlarmTypeDef;
165
166/**
167 * @brief RTC Handle Structure definition
168 */
169#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
170typedef struct __RTC_HandleTypeDef
171#else
172typedef struct
173#endif
174{
175 RTC_TypeDef *Instance; /*!< Register base address */
176
177 uint32_t TampOffset; /*!< Offset to TAMP instance */
178
179 RTC_InitTypeDef Init; /*!< RTC required parameters */
180
181 HAL_LockTypeDef Lock; /*!< RTC locking object */
182
183 __IO HAL_RTCStateTypeDef State; /*!< Time communication state */
184
185#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
186 void (* AlarmAEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Alarm A Event callback */
187
188 void (* AlarmBEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Alarm B Event callback */
189
190 void (* TimeStampEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC TimeStamp Event callback */
191
192 void (* WakeUpTimerEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC WakeUpTimer Event callback */
193
194 void (* Tamper1EventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Tamper 1 Event callback */
195
196 void (* Tamper2EventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Tamper 2 Event callback */
197
198
199 void (* InternalTamper3EventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Internal Tamper 3 Event callback */
200
201 void (* InternalTamper4EventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Internal Tamper 4 Event callback */
202
203 void (* InternalTamper5EventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Internal Tamper 5 Event callback */
204
205 void (* InternalTamper6EventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Internal Tamper 6 Event callback */
206
207
208 void (* MspInitCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Msp Init callback */
209
210 void (* MspDeInitCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Msp DeInit callback */
211
212#endif /* (USE_HAL_RTC_REGISTER_CALLBACKS) */
213
214}RTC_HandleTypeDef;
215
216#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
217/**
218 * @brief HAL LPTIM Callback ID enumeration definition
219 */
220typedef enum
221{
222 HAL_RTC_ALARM_A_EVENT_CB_ID = 0x00U, /*!< RTC Alarm A Event Callback ID */
223 HAL_RTC_ALARM_B_EVENT_CB_ID = 0x01U, /*!< RTC Alarm B Event Callback ID */
224 HAL_RTC_TIMESTAMP_EVENT_CB_ID = 0x02U, /*!< RTC TimeStamp Event Callback ID */
225 HAL_RTC_WAKEUPTIMER_EVENT_CB_ID = 0x03U, /*!< RTC WakeUp Timer Event Callback ID */
226 HAL_RTC_TAMPER1_EVENT_CB_ID = 0x04U, /*!< RTC Tamper 1 Callback ID */
227 HAL_RTC_TAMPER2_EVENT_CB_ID = 0x05U, /*!< RTC Tamper 2 Callback ID */
228 HAL_RTC_INTERNAL_TAMPER3_EVENT_CB_ID = 0x09U, /*!< RTC Internal Tamper 3 Callback ID */
229 HAL_RTC_INTERNAL_TAMPER4_EVENT_CB_ID = 0x0AU, /*!< RTC Internal Tamper 4 Callback ID */
230 HAL_RTC_INTERNAL_TAMPER5_EVENT_CB_ID = 0x0BU, /*!< RTC Internal Tamper 5 Callback ID */
231 HAL_RTC_INTERNAL_TAMPER6_EVENT_CB_ID = 0x0CU, /*!< RTC Internal Tamper 6 Callback ID */
232 HAL_RTC_MSPINIT_CB_ID = 0x0EU, /*!< RTC Msp Init callback ID */
233 HAL_RTC_MSPDEINIT_CB_ID = 0x0FU /*!< RTC Msp DeInit callback ID */
234}HAL_RTC_CallbackIDTypeDef;
235
236/**
237 * @brief HAL RTC Callback pointer definition
238 */
239typedef void (*pRTC_CallbackTypeDef)(RTC_HandleTypeDef * hrtc); /*!< pointer to an RTC callback function */
240#endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
241
242/**
243 * @}
244 */
245
246/* Exported constants --------------------------------------------------------*/
247/** @defgroup RTC_Exported_Constants RTC Exported Constants
248 * @{
249 */
250
251/** @defgroup RTC_Hour_Formats RTC Hour Formats
252 * @{
253 */
254#define RTC_HOURFORMAT_24 0x00000000u
255#define RTC_HOURFORMAT_12 RTC_CR_FMT
256/**
257 * @}
258 */
259
260/** @defgroup RTCEx_Output_selection_Definitions RTCEx Output Selection Definition
261 * @{
262 */
263#define RTC_OUTPUT_DISABLE 0x00000000u
264#define RTC_OUTPUT_ALARMA RTC_CR_OSEL_0
265#define RTC_OUTPUT_ALARMB RTC_CR_OSEL_1
266#define RTC_OUTPUT_WAKEUP RTC_CR_OSEL
267#define RTC_OUTPUT_TAMPER RTC_CR_TAMPOE
268/**
269 * @}
270 */
271
272/** @defgroup RTC_Output_Polarity_Definitions RTC Output Polarity Definitions
273 * @{
274 */
275#define RTC_OUTPUT_POLARITY_HIGH 0x00000000u
276#define RTC_OUTPUT_POLARITY_LOW RTC_CR_POL
277/**
278 * @}
279 */
280
281/** @defgroup RTC_Output_Type_ALARM_OUT RTC Output Type ALARM OUT
282 * @{
283 */
284#define RTC_OUTPUT_TYPE_PUSHPULL 0x00000000u
285#define RTC_OUTPUT_TYPE_OPENDRAIN RTC_CR_TAMPALRM_TYPE
286/**
287 * @}
288 */
289
290/** @defgroup RTC_Output_PullUp_ALARM_OUT RTC Output Pull-Up ALARM OUT
291 * @{
292 */
293#define RTC_OUTPUT_PULLUP_NONE 0x00000000u
294#define RTC_OUTPUT_PULLUP_ON RTC_CR_TAMPALRM_PU
295/**
296 * @}
297 */
298
299/** @defgroup RTC_Output_ALARM_OUT_Remap RTC Output ALARM OUT Remap
300 * @{
301 */
302#define RTC_OUTPUT_REMAP_NONE 0x00000000u
303#define RTC_OUTPUT_REMAP_POS1 RTC_CR_OUT2EN
304/**
305 * @}
306 */
307
308/** @defgroup RTC_AM_PM_Definitions RTC AM PM Definitions
309 * @{
310 */
311#define RTC_HOURFORMAT12_AM ((uint8_t)0x00U)
312#define RTC_HOURFORMAT12_PM ((uint8_t)0x40U)
313/**
314 * @}
315 */
316
317/** @defgroup RTC_DayLightSaving_Definitions RTC DayLightSaving Definitions
318 * @{
319 */
320#define RTC_DAYLIGHTSAVING_SUB1H RTC_CR_SUB1H
321#define RTC_DAYLIGHTSAVING_ADD1H RTC_CR_ADD1H
322#define RTC_DAYLIGHTSAVING_NONE 0x00000000u
323/**
324 * @}
325 */
326
327/** @defgroup RTC_StoreOperation_Definitions RTC StoreOperation Definitions
328 * @{
329 */
330#define RTC_STOREOPERATION_RESET 0x00000000u
331#define RTC_STOREOPERATION_SET RTC_CR_BKP
332/**
333 * @}
334 */
335
336/** @defgroup RTC_Input_parameter_format_definitions RTC Input Parameter Format Definitions
337 * @{
338 */
339#define RTC_FORMAT_BIN 0x00000000u
340#define RTC_FORMAT_BCD 0x00000001u
341/**
342 * @}
343 */
344
345/** @defgroup RTC_Month_Date_Definitions RTC Month Date Definitions
346 * @{
347 */
348
349/* Coded in BCD format */
350#define RTC_MONTH_JANUARY ((uint8_t)0x01U)
351#define RTC_MONTH_FEBRUARY ((uint8_t)0x02U)
352#define RTC_MONTH_MARCH ((uint8_t)0x03U)
353#define RTC_MONTH_APRIL ((uint8_t)0x04U)
354#define RTC_MONTH_MAY ((uint8_t)0x05U)
355#define RTC_MONTH_JUNE ((uint8_t)0x06U)
356#define RTC_MONTH_JULY ((uint8_t)0x07U)
357#define RTC_MONTH_AUGUST ((uint8_t)0x08U)
358#define RTC_MONTH_SEPTEMBER ((uint8_t)0x09U)
359#define RTC_MONTH_OCTOBER ((uint8_t)0x10U)
360#define RTC_MONTH_NOVEMBER ((uint8_t)0x11U)
361#define RTC_MONTH_DECEMBER ((uint8_t)0x12U)
362
363/**
364 * @}
365 */
366
367/** @defgroup RTC_WeekDay_Definitions RTC WeekDay Definitions
368 * @{
369 */
370#define RTC_WEEKDAY_MONDAY ((uint8_t)0x01U)
371#define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02U)
372#define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03U)
373#define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04U)
374#define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05U)
375#define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06U)
376#define RTC_WEEKDAY_SUNDAY ((uint8_t)0x07U)
377
378/**
379 * @}
380 */
381
382/** @defgroup RTC_AlarmDateWeekDay_Definitions RTC AlarmDateWeekDay Definitions
383 * @{
384 */
385#define RTC_ALARMDATEWEEKDAYSEL_DATE 0x00000000u
386#define RTC_ALARMDATEWEEKDAYSEL_WEEKDAY RTC_ALRMAR_WDSEL
387
388/**
389 * @}
390 */
391
392/** @defgroup RTC_AlarmMask_Definitions RTC AlarmMask Definitions
393 * @{
394 */
395#define RTC_ALARMMASK_NONE 0x00000000u
396#define RTC_ALARMMASK_DATEWEEKDAY RTC_ALRMAR_MSK4
397#define RTC_ALARMMASK_HOURS RTC_ALRMAR_MSK3
398#define RTC_ALARMMASK_MINUTES RTC_ALRMAR_MSK2
399#define RTC_ALARMMASK_SECONDS RTC_ALRMAR_MSK1
400#define RTC_ALARMMASK_ALL (RTC_ALARMMASK_NONE | RTC_ALARMMASK_DATEWEEKDAY | \
401 RTC_ALARMMASK_HOURS | RTC_ALARMMASK_MINUTES | \
402 RTC_ALARMMASK_SECONDS)
403
404/**
405 * @}
406 */
407
408/** @defgroup RTC_Alarms_Definitions RTC Alarms Definitions
409 * @{
410 */
411#define RTC_ALARM_A RTC_CR_ALRAE
412#define RTC_ALARM_B RTC_CR_ALRBE
413
414/**
415 * @}
416 */
417
418
419 /** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions RTC Alarm Sub Seconds Masks Definitions
420 * @{
421 */
422#define RTC_ALARMSUBSECONDMASK_ALL 0x00000000u /*!< All Alarm SS fields are masked.
423 There is no comparison on sub seconds
424 for Alarm */
425#define RTC_ALARMSUBSECONDMASK_SS14_1 RTC_ALRMASSR_MASKSS_0 /*!< SS[14:1] not used in Alarm
426 comparison. Only SS[0] is compared. */
427#define RTC_ALARMSUBSECONDMASK_SS14_2 RTC_ALRMASSR_MASKSS_1 /*!< SS[14:2] not used in Alarm
428 comparison. Only SS[1:0] are compared */
429#define RTC_ALARMSUBSECONDMASK_SS14_3 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_1) /*!< SS[14:3] not used in Alarm
430 comparison. Only SS[2:0] are compared */
431#define RTC_ALARMSUBSECONDMASK_SS14_4 RTC_ALRMASSR_MASKSS_2 /*!< SS[14:4] not used in Alarm
432 comparison. Only SS[3:0] are compared */
433#define RTC_ALARMSUBSECONDMASK_SS14_5 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_2) /*!< SS[14:5] not used in Alarm
434 comparison. Only SS[4:0] are compared */
435#define RTC_ALARMSUBSECONDMASK_SS14_6 (RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_2) /*!< SS[14:6] not used in Alarm
436 comparison. Only SS[5:0] are compared */
437#define RTC_ALARMSUBSECONDMASK_SS14_7 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_2) /*!< SS[14:7] not used in Alarm
438 comparison. Only SS[6:0] are compared */
439#define RTC_ALARMSUBSECONDMASK_SS14_8 RTC_ALRMASSR_MASKSS_3 /*!< SS[14:8] not used in Alarm
440 comparison. Only SS[7:0] are compared */
441#define RTC_ALARMSUBSECONDMASK_SS14_9 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_3) /*!< SS[14:9] not used in Alarm
442 comparison. Only SS[8:0] are compared */
443#define RTC_ALARMSUBSECONDMASK_SS14_10 (RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_3) /*!< SS[14:10] not used in Alarm
444 comparison. Only SS[9:0] are compared */
445#define RTC_ALARMSUBSECONDMASK_SS14_11 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_3) /*!< SS[14:11] not used in Alarm
446 comparison. Only SS[10:0] are compared */
447#define RTC_ALARMSUBSECONDMASK_SS14_12 (RTC_ALRMASSR_MASKSS_2 | RTC_ALRMASSR_MASKSS_3) /*!< SS[14:12] not used in Alarm
448 comparison.Only SS[11:0] are compared */
449#define RTC_ALARMSUBSECONDMASK_SS14_13 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_2 | RTC_ALRMASSR_MASKSS_3) /*!< SS[14:13] not used in Alarm
450 comparison. Only SS[12:0] are compared */
451#define RTC_ALARMSUBSECONDMASK_SS14 (RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_2 | RTC_ALRMASSR_MASKSS_3) /*!< SS[14] not used in Alarm
452 comparison.Only SS[13:0] are compared */
453#define RTC_ALARMSUBSECONDMASK_NONE RTC_ALRMASSR_MASKSS /*!< SS[14:0] are compared and must match
454 to activate alarm. */
455/**
456 * @}
457 */
458
459/** @defgroup RTC_Interrupts_Definitions RTC Interrupts Definitions
460 * @{
461 */
462#define RTC_IT_TS RTC_CR_TSIE /*!< Enable Timestamp Interrupt */
463#define RTC_IT_WUT RTC_CR_WUTIE /*!< Enable Wakeup timer Interrupt */
464#define RTC_IT_ALRA RTC_CR_ALRAIE /*!< Enable Alarm A Interrupt */
465#define RTC_IT_ALRB RTC_CR_ALRBIE /*!< Enable Alarm B Interrupt */
466/**
467 * @}
468 */
469
470/** @defgroup RTC_Flag_Mask RTC Flag Mask (5bits) describe in RTC_Flags_Definitions
471 * @{
472 */
473#define RTC_FLAG_MASK 0x001Fu /*!< RTC flags mask (5bits) */
474/**
475 * @}
476 */
477
478/** @defgroup RTC_Flags_Definitions RTC Flags Definitions
479 * Elements values convention: 000000XX000YYYYYb
480 * - YYYYY : Interrupt flag position in the XX register (5bits)
481 * - XX : Interrupt status register (2bits)
482 * - 01: ICSR register
483 * - 10: SR or SCR or MISR or SMISR registers
484 * @{
485 */
486#define RTC_FLAG_RECALPF (0x00000100U | RTC_ICSR_RECALPF_Pos) /*!< Recalibration pending Flag */
487#define RTC_FLAG_INITF (0x00000100U | RTC_ICSR_INITF_Pos) /*!< Initialization flag */
488#define RTC_FLAG_RSF (0x00000100U | RTC_ICSR_RSF_Pos) /*!< Registers synchronization flag */
489#define RTC_FLAG_INITS (0x00000100U | RTC_ICSR_INITS_Pos) /*!< Initialization status flag */
490#define RTC_FLAG_SHPF (0x00000100U | RTC_ICSR_SHPF_Pos) /*!< Shift operation pending flag */
491#define RTC_FLAG_WUTWF (0x00000100U | RTC_ICSR_WUTWF_Pos) /*!< Wakeup timer write flag */
492#define RTC_FLAG_ALRBWF (0x00000100U | RTC_ICSR_ALRBWF_Pos) /*!< Alarm B write flag */
493#define RTC_FLAG_ALRAWF (0x00000100U | RTC_ICSR_ALRAWF_Pos) /*!< Alarm A write flag */
494#define RTC_FLAG_ITSF (0x00000200U | RTC_SR_ITSF_Pos) /*!< Internal Time-stamp flag */
495#define RTC_FLAG_TSOVF (0x00000200U | RTC_SR_TSOVF_Pos) /*!< Time-stamp overflow flag */
496#define RTC_FLAG_TSF (0x00000200U | RTC_SR_TSF_Pos) /*!< Time-stamp flag */
497#define RTC_FLAG_WUTF (0x00000200U | RTC_SR_WUTF_Pos) /*!< Wakeup timer flag */
498#define RTC_FLAG_ALRBF (0x00000200U | RTC_SR_ALRBF_Pos) /*!< Alarm B flag */
499#define RTC_FLAG_ALRAF (0x00000200U | RTC_SR_ALRAF_Pos) /*!< Alarm A flag */
500/**
501 * @}
502 */
503
504/** @defgroup RTC_Clear_Flags_Definitions RTC Clear Flags Definitions
505 * @{
506 */
507#define RTC_CLEAR_ITSF RTC_SCR_CITSF /*!< Clear Internal Time-stamp flag */
508#define RTC_CLEAR_TSOVF RTC_SCR_CTSOVF /*!< Clear Time-stamp overflow flag */
509#define RTC_CLEAR_TSF RTC_SCR_CTSF /*!< Clear Time-stamp flag */
510#define RTC_CLEAR_WUTF RTC_SCR_CWUTF /*!< Clear Wakeup timer flag */
511#define RTC_CLEAR_ALRBF RTC_SCR_CALRBF /*!< Clear Alarm B flag */
512#define RTC_CLEAR_ALRAF RTC_SCR_CALRAF /*!< Clear Alarm A flag */
513/**
514 * @}
515 */
516
517/**
518 * @}
519 */
520
521/* Exported macros -----------------------------------------------------------*/
522/** @defgroup RTC_Exported_Macros RTC Exported Macros
523 * @{
524 */
525
526/** @brief Reset RTC handle state
527 * @param __HANDLE__ RTC handle.
528 * @retval None
529 */
530#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
531#define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) do{\
532 (__HANDLE__)->State = HAL_RTC_STATE_RESET;\
533 (__HANDLE__)->MspInitCallback = NULL;\
534 (__HANDLE__)->MspDeInitCallback = NULL;\
535 }while(0)
536#else
537#define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET)
538#endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
539
540/**
541 * @brief Disable the write protection for RTC registers.
542 * @param __HANDLE__ specifies the RTC handle.
543 * @retval None
544 */
545#define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) \
546 do{ \
547 (__HANDLE__)->Instance->WPR = 0xCAU; \
548 (__HANDLE__)->Instance->WPR = 0x53U; \
549 } while(0U)
550
551/**
552 * @brief Enable the write protection for RTC registers.
553 * @param __HANDLE__ specifies the RTC handle.
554 * @retval None
555 */
556#define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) \
557 do{ \
558 (__HANDLE__)->Instance->WPR = 0xFFU; \
559 } while(0U)
560
561/**
562 * @brief Add 1 hour (summer time change).
563 * @param __HANDLE__ specifies the RTC handle.
564 * @param __BKP__ Backup
565 * This parameter can be:
566 * @arg @ref RTC_STOREOPERATION_RESET
567 * @arg @ref RTC_STOREOPERATION_SET
568 * @retval None
569 */
570#define __HAL_RTC_DAYLIGHT_SAVING_TIME_ADD1H(__HANDLE__, __BKP__) \
571 do { \
572 __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__); \
573 SET_BIT((__HANDLE__)->Instance->CR, RTC_CR_ADD1H); \
574 MODIFY_REG((__HANDLE__)->Instance->CR, RTC_CR_BKP , (__BKP__)); \
575 __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__); \
576 } while(0);
577
578/**
579 * @brief Subtract 1 hour (winter time change).
580 * @param __HANDLE__ specifies the RTC handle.
581 * @param __BKP__ Backup
582 * This parameter can be:
583 * @arg @ref RTC_STOREOPERATION_RESET
584 * @arg @ref RTC_STOREOPERATION_SET
585 * @retval None
586 */
587#define __HAL_RTC_DAYLIGHT_SAVING_TIME_SUB1H(__HANDLE__, __BKP__) \
588 do { \
589 __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__); \
590 SET_BIT((__HANDLE__)->Instance->CR, RTC_CR_SUB1H); \
591 MODIFY_REG((__HANDLE__)->Instance->CR, RTC_CR_BKP , (__BKP__)); \
592 __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__); \
593 } while(0);
594
595 /**
596 * @brief Enable the RTC ALARMA peripheral.
597 * @param __HANDLE__ specifies the RTC handle.
598 * @retval None
599 */
600#define __HAL_RTC_ALARMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRAE))
601
602/**
603 * @brief Disable the RTC ALARMA peripheral.
604 * @param __HANDLE__ specifies the RTC handle.
605 * @retval None
606 */
607#define __HAL_RTC_ALARMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRAE))
608
609/**
610 * @brief Enable the RTC ALARMB peripheral.
611 * @param __HANDLE__ specifies the RTC handle.
612 * @retval None
613 */
614#define __HAL_RTC_ALARMB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRBE))
615
616/**
617 * @brief Disable the RTC ALARMB peripheral.
618 * @param __HANDLE__ specifies the RTC handle.
619 * @retval None
620 */
621#define __HAL_RTC_ALARMB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRBE))
622
623/**
624 * @brief Enable the RTC Alarm interrupt.
625 * @param __HANDLE__ specifies the RTC handle.
626 * @param __INTERRUPT__ specifies the RTC Alarm interrupt sources to be enabled or disabled.
627 * This parameter can be any combination of the following values:
628 * @arg @ref RTC_IT_ALRA Alarm A interrupt, @ref RTC_Interrupts_Definitions
629 * @arg @ref RTC_IT_ALRB Alarm B interrupt
630 * @retval None
631 */
632#define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
633
634/**
635 * @brief Disable the RTC Alarm interrupt.
636 * @param __HANDLE__ specifies the RTC handle.
637 * @param __INTERRUPT__ specifies the RTC Alarm interrupt sources to be enabled or disabled.
638 * This parameter can be any combination of the following values:
639 * @arg @ref RTC_IT_ALRA Alarm A interrupt
640 * @arg @ref RTC_IT_ALRB Alarm B interrupt
641 * @retval None
642 */
643#define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
644
645/**
646 * @brief Check whether the specified RTC Alarm interrupt has occurred or not.
647 * @param __HANDLE__ specifies the RTC handle.
648 * @param __INTERRUPT__ specifies the RTC Alarm interrupt sources to check.
649 * This parameter can be:
650 * @arg @ref RTC_IT_ALRA Alarm A interrupt
651 * @arg @ref RTC_IT_ALRB Alarm B interrupt
652 * @retval None
653 */
654#define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->SR)& ((__INTERRUPT__)>> 12U)) != 0U)? 1U : 0U)
655
656/**
657 * @brief Check whether the specified RTC Alarm interrupt has been enabled or not.
658 * @param __HANDLE__ specifies the RTC handle.
659 * @param __INTERRUPT__ specifies the RTC Alarm interrupt sources to check.
660 * This parameter can be:
661 * @arg @ref RTC_IT_ALRA Alarm A interrupt
662 * @arg @ref RTC_IT_ALRB Alarm B interrupt
663 * @retval None
664 */
665#define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != 0U) ? 1U : 0U)
666
667/**
668 * @brief Get the selected RTC Alarms flag status.
669 * @param __HANDLE__ specifies the RTC handle.
670 * @param __FLAG__ specifies the RTC Alarm Flag sources to check.
671 * This parameter can be:
672 * @arg @ref RTC_FLAG_ALRAF
673 * @arg @ref RTC_FLAG_ALRBF
674 * @arg @ref RTC_FLAG_ALRAWF
675 * @arg @ref RTC_FLAG_ALRBWF
676 * @retval None
677 */
678#define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__), (__FLAG__)))
679
680/**
681 * @brief Clear the RTC Alarms pending flags.
682 * @param __HANDLE__ specifies the RTC handle.
683 * @param __FLAG__ specifies the RTC Alarm Flag sources to clear.
684 * This parameter can be:
685 * @arg @ref RTC_FLAG_ALRAF
686 * @arg @ref RTC_FLAG_ALRBF
687 * @retval None
688 */
689#define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__FLAG__) == RTC_FLAG_ALRAF) ? (__HAL_RTC_CLEAR_FLAG((__HANDLE__), RTC_CLEAR_ALRAF)) : \
690 (__HAL_RTC_CLEAR_FLAG((__HANDLE__), RTC_CLEAR_ALRBF)))
691
692/**
693 * @brief Enable interrupt on the RTC Alarm associated Exti line.
694 * @retval None
695 */
696#define __HAL_RTC_ALARM_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_ALARM_EVENT)
697
698/**
699 * @brief Disable interrupt on the RTC Alarm associated Exti line.
700 * @retval None
701 */
702#define __HAL_RTC_ALARM_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_ALARM_EVENT))
703
704/**
705 * @brief Enable event on the RTC Alarm associated Exti line.
706 * @retval None.
707 */
708#define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_ALARM_EVENT)
709
710/**
711 * @brief Disable event on the RTC Alarm associated Exti line.
712 * @retval None.
713 */
714#define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_ALARM_EVENT))
715
716/**
717 * @}
718 */
719
720/* Include RTC HAL Extended module */
721#include "stm32g0xx_hal_rtc_ex.h"
722
723/* Exported functions --------------------------------------------------------*/
724/** @defgroup RTC_Exported_Functions RTC Exported Functions
725 * @{
726 */
727
728/** @defgroup RTC_Exported_Functions_Group1 Initialization and de-initialization functions
729 * @{
730 */
731/* Initialization and de-initialization functions ****************************/
732HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc);
733HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc);
734
735void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc);
736void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc);
737
738/* Callbacks Register/UnRegister functions ***********************************/
739#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
740HAL_StatusTypeDef HAL_RTC_RegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID, pRTC_CallbackTypeDef pCallback);
741HAL_StatusTypeDef HAL_RTC_UnRegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID);
742#endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */
743
744/**
745 * @}
746 */
747
748/** @defgroup RTC_Exported_Functions_Group2 RTC Time and Date functions
749 * @{
750 */
751/* RTC Time and Date functions ************************************************/
752HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
753HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
754HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
755HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
756/**
757 * @}
758 */
759
760/** @defgroup RTC_Exported_Functions_Group3 RTC Alarm functions
761 * @{
762 */
763/* RTC Alarm functions ********************************************************/
764HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
765HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
766HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm);
767HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format);
768void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc);
769HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
770void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc);
771/**
772 * @}
773 */
774
775/** @defgroup RTC_Exported_Functions_Group4 Peripheral Control functions
776 * @{
777 */
778/* Peripheral Control functions ***********************************************/
779HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc);
780/**
781 * @}
782 */
783
784/** @defgroup RTC_Exported_Functions_Group5 Peripheral State functions
785 * @{
786 */
787/* Peripheral State functions *************************************************/
788HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
789/**
790 * @}
791 */
792
793/**
794 * @}
795 */
796
797/* Private types -------------------------------------------------------------*/
798/* Private variables ---------------------------------------------------------*/
799/* Private constants ---------------------------------------------------------*/
800/** @defgroup RTC_Private_Constants RTC Private Constants
801 * @{
802 */
803/* Masks Definition */
804#define RTC_TR_RESERVED_MASK (RTC_TR_PM | RTC_TR_HT | RTC_TR_HU | \
805 RTC_TR_MNT | RTC_TR_MNU| RTC_TR_ST | \
806 RTC_TR_SU)
807#define RTC_DR_RESERVED_MASK (RTC_DR_YT | RTC_DR_YU | RTC_DR_WDU | \
808 RTC_DR_MT | RTC_DR_MU | RTC_DR_DT | \
809 RTC_DR_DU)
810#define RTC_INIT_MASK 0xFFFFFFFFu
811#define RTC_RSF_MASK (~(RTC_ICSR_INIT | RTC_ICSR_RSF))
812
813#define RTC_TIMEOUT_VALUE 1000u
814
815#define RTC_EXTI_LINE_ALARM_EVENT EXTI_IMR1_IM19 /*!< External interrupt line 19 Connected to the RTC Alarm event */
816
817/**
818 * @}
819 */
820
821/* Private macros ------------------------------------------------------------*/
822/** @defgroup RTC_Private_Macros RTC Private Macros
823 * @{
824 */
825
826/** @defgroup RTC_IS_RTC_Definitions RTC Private macros to check input parameters
827 * @{
828 */
829#define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_OUTPUT_DISABLE) || \
830 ((OUTPUT) == RTC_OUTPUT_ALARMA) || \
831 ((OUTPUT) == RTC_OUTPUT_ALARMB) || \
832 ((OUTPUT) == RTC_OUTPUT_WAKEUP) || \
833 ((OUTPUT) == RTC_OUTPUT_TAMPER))
834
835#define IS_RTC_HOUR_FORMAT(FORMAT) (((FORMAT) == RTC_HOURFORMAT_12) || \
836 ((FORMAT) == RTC_HOURFORMAT_24))
837
838#define IS_RTC_OUTPUT_POL(POL) (((POL) == RTC_OUTPUT_POLARITY_HIGH) || \
839 ((POL) == RTC_OUTPUT_POLARITY_LOW))
840
841#define IS_RTC_OUTPUT_TYPE(TYPE) (((TYPE) == RTC_OUTPUT_TYPE_OPENDRAIN) || \
842 ((TYPE) == RTC_OUTPUT_TYPE_PUSHPULL))
843
844#define IS_RTC_OUTPUT_PULLUP(TYPE) (((TYPE) == RTC_OUTPUT_PULLUP_NONE) || \
845 ((TYPE) == RTC_OUTPUT_PULLUP_ON))
846
847#define IS_RTC_OUTPUT_REMAP(REMAP) (((REMAP) == RTC_OUTPUT_REMAP_NONE) || \
848 ((REMAP) == RTC_OUTPUT_REMAP_POS1))
849
850#define IS_RTC_HOURFORMAT12(PM) (((PM) == RTC_HOURFORMAT12_AM) || \
851 ((PM) == RTC_HOURFORMAT12_PM))
852
853#define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DAYLIGHTSAVING_SUB1H) || \
854 ((SAVE) == RTC_DAYLIGHTSAVING_ADD1H) || \
855 ((SAVE) == RTC_DAYLIGHTSAVING_NONE))
856
857#define IS_RTC_STORE_OPERATION(OPERATION) (((OPERATION) == RTC_STOREOPERATION_RESET) || \
858 ((OPERATION) == RTC_STOREOPERATION_SET))
859
860#define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_FORMAT_BIN) || \
861 ((FORMAT) == RTC_FORMAT_BCD))
862
863#define IS_RTC_YEAR(YEAR) ((YEAR) <= 99u)
864
865#define IS_RTC_MONTH(MONTH) (((MONTH) >= 1u) && ((MONTH) <= 12u))
866
867#define IS_RTC_DATE(DATE) (((DATE) >= 1u) && ((DATE) <= 31u))
868
869#define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \
870 ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \
871 ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \
872 ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \
873 ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \
874 ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \
875 ((WEEKDAY) == RTC_WEEKDAY_SUNDAY))
876
877#define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) >0u) && ((DATE) <= 31u))
878
879#define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \
880 ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \
881 ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \
882 ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \
883 ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \
884 ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \
885 ((WEEKDAY) == RTC_WEEKDAY_SUNDAY))
886
887#define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL) (((SEL) == RTC_ALARMDATEWEEKDAYSEL_DATE) || \
888 ((SEL) == RTC_ALARMDATEWEEKDAYSEL_WEEKDAY))
889
890#define IS_RTC_ALARM_MASK(MASK) (((MASK) & ~(RTC_ALARMMASK_ALL)) == 0U)
891
892#define IS_RTC_ALARM(ALARM) (((ALARM) == RTC_ALARM_A) || \
893 ((ALARM) == RTC_ALARM_B))
894
895#define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= RTC_ALRMASSR_SS)
896
897#define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_ALARMSUBSECONDMASK_ALL) || \
898 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_1) || \
899 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_2) || \
900 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_3) || \
901 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_4) || \
902 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_5) || \
903 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_6) || \
904 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_7) || \
905 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_8) || \
906 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_9) || \
907 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_10) || \
908 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_11) || \
909 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_12) || \
910 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_13) || \
911 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14) || \
912 ((MASK) == RTC_ALARMSUBSECONDMASK_NONE))
913
914#define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7Fu)
915
916#define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7FFFu)
917
918#define IS_RTC_HOUR12(HOUR) (((HOUR) > 0u) && ((HOUR) <= 12u))
919
920#define IS_RTC_HOUR24(HOUR) ((HOUR) <= 23u)
921
922#define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= 59u)
923
924#define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= 59u)
925
926/**
927 * @}
928 */
929
930/**
931 * @}
932 */
933
934/* Private functions -------------------------------------------------------------*/
935/** @defgroup RTC_Private_Functions RTC Private Functions
936 * @{
937 */
938HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef* hrtc);
939HAL_StatusTypeDef RTC_ExitInitMode(RTC_HandleTypeDef *hrtc);
940uint8_t RTC_ByteToBcd2(uint8_t Value);
941uint8_t RTC_Bcd2ToByte(uint8_t Value);
942/**
943 * @}
944 */
945
946
947/**
948 * @}
949 */
950
951/**
952 * @}
953 */
954
955#ifdef __cplusplus
956}
957#endif
958
959#endif /* STM32G0xx_HAL_RTC_H */
960
961/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Note: See TracBrowser for help on using the repository browser.