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