@@ -37,6 +37,11 @@ static void (*WakeUpUartCb)(void) = NULL;
37
37
38
38
#if defined(PWR_FLAG_WUF )
39
39
#define PWR_FLAG_WU PWR_FLAG_WUF
40
+ #elif defined(PWR_WAKEUP_ALL_FLAG )
41
+ #define PWR_FLAG_WU PWR_WAKEUP_ALL_FLAG
42
+ #endif
43
+ #if defined(PWR_FLAG_SBF )
44
+ #define PWR_FLAG_SB PWR_FLAG_SBF
40
45
#endif
41
46
42
47
/**
@@ -82,7 +87,14 @@ void LowPower_EnableWakeUpPin(uint32_t pin, uint32_t mode)
82
87
PinName p = digitalPinToPinName (pin );
83
88
if (p != NC ) {
84
89
#ifdef PWR_WAKEUP_PIN1
85
- if (p == SYS_WKUP1 ) {
90
+ if ((p == SYS_WKUP1 )
91
+ #ifdef PWR_WAKEUP_PIN1_1
92
+ || (p == SYS_WKUP1_1 )
93
+ #endif
94
+ #ifdef PWR_WAKEUP_PIN1_2
95
+ || (p == SYS_WKUP1_2 )
96
+ #endif
97
+ ) {
86
98
wkup_pin = PWR_WAKEUP_PIN1 ;
87
99
#ifdef PWR_WAKEUP_PIN1_HIGH
88
100
if (mode != RISING ) {
@@ -92,7 +104,14 @@ void LowPower_EnableWakeUpPin(uint32_t pin, uint32_t mode)
92
104
}
93
105
#endif /* PWR_WAKEUP_PIN1 */
94
106
#ifdef PWR_WAKEUP_PIN2
95
- if (p == SYS_WKUP2 ) {
107
+ if ((p == SYS_WKUP2 )
108
+ #ifdef PWR_WAKEUP_PIN2_1
109
+ || (p == SYS_WKUP2_1 )
110
+ #endif
111
+ #ifdef PWR_WAKEUP_PIN2_2
112
+ || (p == SYS_WKUP2_2 )
113
+ #endif
114
+ ) {
96
115
wkup_pin = PWR_WAKEUP_PIN2 ;
97
116
#ifdef PWR_WAKEUP_PIN2_HIGH
98
117
if (mode != RISING ) {
@@ -102,7 +121,14 @@ void LowPower_EnableWakeUpPin(uint32_t pin, uint32_t mode)
102
121
}
103
122
#endif /* PWR_WAKEUP_PIN2 */
104
123
#ifdef PWR_WAKEUP_PIN3
105
- if (p == SYS_WKUP3 ) {
124
+ if ((p == SYS_WKUP3 )
125
+ #ifdef PWR_WAKEUP_PIN3_1
126
+ || (p == SYS_WKUP3_1 )
127
+ #endif
128
+ #ifdef PWR_WAKEUP_PIN3_2
129
+ || (p == SYS_WKUP3_2 )
130
+ #endif
131
+ ) {
106
132
wkup_pin = PWR_WAKEUP_PIN3 ;
107
133
#ifdef PWR_WAKEUP_PIN3_HIGH
108
134
if (mode != RISING ) {
@@ -112,7 +138,14 @@ void LowPower_EnableWakeUpPin(uint32_t pin, uint32_t mode)
112
138
}
113
139
#endif /* PWR_WAKEUP_PIN3 */
114
140
#ifdef PWR_WAKEUP_PIN4
115
- if (p == SYS_WKUP4 ) {
141
+ if ((p == SYS_WKUP4 )
142
+ #ifdef PWR_WAKEUP_PIN4_1
143
+ || (p == SYS_WKUP4_1 )
144
+ #endif
145
+ #ifdef PWR_WAKEUP_PIN4_2
146
+ || (p == SYS_WKUP4_2 )
147
+ #endif
148
+ ) {
116
149
wkup_pin = PWR_WAKEUP_PIN4 ;
117
150
#ifdef PWR_WAKEUP_PIN4_HIGH
118
151
if (mode != RISING ) {
@@ -122,7 +155,14 @@ void LowPower_EnableWakeUpPin(uint32_t pin, uint32_t mode)
122
155
}
123
156
#endif /* PWR_WAKEUP_PIN4 */
124
157
#ifdef PWR_WAKEUP_PIN5
125
- if (p == SYS_WKUP5 ) {
158
+ if ((p == SYS_WKUP5 )
159
+ #ifdef PWR_WAKEUP_PIN5_1
160
+ || (p == SYS_WKUP5_1 )
161
+ #endif
162
+ #ifdef PWR_WAKEUP_PIN5_2
163
+ || (p == SYS_WKUP5_2 )
164
+ #endif
165
+ ) {
126
166
wkup_pin = PWR_WAKEUP_PIN5 ;
127
167
#ifdef PWR_WAKEUP_PIN5_HIGH
128
168
if (mode != RISING ) {
@@ -132,7 +172,14 @@ void LowPower_EnableWakeUpPin(uint32_t pin, uint32_t mode)
132
172
}
133
173
#endif /* PWR_WAKEUP_PIN5 */
134
174
#ifdef PWR_WAKEUP_PIN6
135
- if (p == SYS_WKUP6 ) {
175
+ if ((p == SYS_WKUP6 )
176
+ #ifdef PWR_WAKEUP_PIN6_1
177
+ || (p == SYS_WKUP6_1 )
178
+ #endif
179
+ #ifdef PWR_WAKEUP_PIN6_2
180
+ || (p == SYS_WKUP6_2 )
181
+ #endif
182
+ ) {
136
183
wkup_pin = PWR_WAKEUP_PIN6 ;
137
184
#ifdef PWR_WAKEUP_PIN6_HIGH
138
185
if (mode != RISING ) {
@@ -142,12 +189,26 @@ void LowPower_EnableWakeUpPin(uint32_t pin, uint32_t mode)
142
189
}
143
190
#endif /* PWR_WAKEUP_PIN6 */
144
191
#ifdef PWR_WAKEUP_PIN7
145
- if (p == SYS_WKUP7 ) {
192
+ if ((p == SYS_WKUP7 )
193
+ #ifdef PWR_WAKEUP_PIN7_1
194
+ || (p == SYS_WKUP7_1 )
195
+ #endif
196
+ #ifdef PWR_WAKEUP_PIN7_2
197
+ || (p == SYS_WKUP7_2 )
198
+ #endif
199
+ ) {
146
200
wkup_pin = PWR_WAKEUP_PIN7 ;
147
201
}
148
202
#endif /* PWR_WAKEUP_PIN7 */
149
203
#ifdef PWR_WAKEUP_PIN8
150
- if (p == SYS_WKUP8 ) {
204
+ if ((p == SYS_WKUP8 )
205
+ #ifdef PWR_WAKEUP_PIN8_1
206
+ || (p == SYS_WKUP8_1 )
207
+ #endif
208
+ #ifdef PWR_WAKEUP_PIN8_2
209
+ || (p == SYS_WKUP8_2 )
210
+ #endif
211
+ ) {
151
212
wkup_pin = PWR_WAKEUP_PIN8 ;
152
213
}
153
214
#endif /* PWR_WAKEUP_PIN8 */
@@ -201,6 +262,10 @@ void LowPower_stop(serial_t *obj)
201
262
/* Enable Ultra low power mode */
202
263
HAL_PWREx_EnableUltraLowPower ();
203
264
#endif
265
+ #if defined(PWR_CR1_ULPMEN ) || defined(PWR_CR3_ULPMEN )
266
+ /* Enable Ultra low power mode */
267
+ HAL_PWREx_EnableUltraLowPowerMode ();
268
+ #endif
204
269
#if defined(PWR_CR_FWU )
205
270
/* Enable the fast wake up from Ultra low power mode */
206
271
HAL_PWREx_EnableFastWakeUp ();
0 commit comments