@@ -97,79 +97,76 @@ void LowPower_EnableWakeUpPin(uint32_t pin, uint32_t mode)
97
97
uint32_t wkup_pin ;
98
98
PinName p = digitalPinToPinName (pin );
99
99
if (p != NC ) {
100
- switch (p ) {
101
- default :
102
100
#ifdef PWR_WAKEUP_PIN1
103
- case SYS_WKUP1 :
104
- wkup_pin = PWR_WAKEUP_PIN1 ;
101
+ if ( p == SYS_WKUP1 ) {
102
+ wkup_pin = PWR_WAKEUP_PIN1 ;
105
103
#ifdef PWR_WAKEUP_PIN1_HIGH
106
- if (mode != RISING ) {
107
- wkup_pin = PWR_WAKEUP_PIN1_LOW ;
108
- }
104
+ if (mode != RISING ) {
105
+ wkup_pin = PWR_WAKEUP_PIN1_LOW ;
106
+ }
109
107
#endif
110
- break ;
108
+ }
111
109
#endif /* PWR_WAKEUP_PIN1 */
112
110
#ifdef PWR_WAKEUP_PIN2
113
- case SYS_WKUP2 :
114
- wkup_pin = PWR_WAKEUP_PIN2 ;
111
+ if ( p == SYS_WKUP2 ) {
112
+ wkup_pin = PWR_WAKEUP_PIN2 ;
115
113
#ifdef PWR_WAKEUP_PIN2_HIGH
116
- if (mode != RISING ) {
117
- wkup_pin = PWR_WAKEUP_PIN2_LOW ;
118
- }
114
+ if (mode != RISING ) {
115
+ wkup_pin = PWR_WAKEUP_PIN2_LOW ;
116
+ }
119
117
#endif
120
- break ;
118
+ }
121
119
#endif /* PWR_WAKEUP_PIN2 */
122
120
#ifdef PWR_WAKEUP_PIN3
123
- case SYS_WKUP3 :
124
- wkup_pin = PWR_WAKEUP_PIN3 ;
121
+ if ( p == SYS_WKUP3 ) {
122
+ wkup_pin = PWR_WAKEUP_PIN3 ;
125
123
#ifdef PWR_WAKEUP_PIN3_HIGH
126
- if (mode != RISING ) {
127
- wkup_pin = PWR_WAKEUP_PIN3_LOW ;
128
- }
124
+ if (mode != RISING ) {
125
+ wkup_pin = PWR_WAKEUP_PIN3_LOW ;
126
+ }
129
127
#endif
130
- break ;
128
+ }
131
129
#endif /* PWR_WAKEUP_PIN3 */
132
130
#ifdef PWR_WAKEUP_PIN4
133
- case SYS_WKUP4 :
134
- wkup_pin = PWR_WAKEUP_PIN4 ;
131
+ if ( p == SYS_WKUP4 ) {
132
+ wkup_pin = PWR_WAKEUP_PIN4 ;
135
133
#ifdef PWR_WAKEUP_PIN4_HIGH
136
- if (mode != RISING ) {
137
- wkup_pin = PWR_WAKEUP_PIN4_LOW ;
138
- }
134
+ if (mode != RISING ) {
135
+ wkup_pin = PWR_WAKEUP_PIN4_LOW ;
136
+ }
139
137
#endif
140
- break ;
138
+ }
141
139
#endif /* PWR_WAKEUP_PIN4 */
142
140
#ifdef PWR_WAKEUP_PIN5
143
- case SYS_WKUP5 :
144
- wkup_pin = PWR_WAKEUP_PIN5 ;
141
+ if ( p == SYS_WKUP5 ) {
142
+ wkup_pin = PWR_WAKEUP_PIN5 ;
145
143
#ifdef PWR_WAKEUP_PIN5_HIGH
146
- if (mode != RISING ) {
147
- wkup_pin = PWR_WAKEUP_PIN5_LOW ;
148
- }
144
+ if (mode != RISING ) {
145
+ wkup_pin = PWR_WAKEUP_PIN5_LOW ;
146
+ }
149
147
#endif
150
- break ;
148
+ }
151
149
#endif /* PWR_WAKEUP_PIN5 */
152
150
#ifdef PWR_WAKEUP_PIN6
153
- case SYS_WKUP6 :
154
- wkup_pin = PWR_WAKEUP_PIN6 ;
151
+ if ( p == SYS_WKUP6 ) {
152
+ wkup_pin = PWR_WAKEUP_PIN6 ;
155
153
#ifdef PWR_WAKEUP_PIN6_HIGH
156
- if (mode != RISING ) {
157
- wkup_pin = PWR_WAKEUP_PIN6_LOW ;
158
- }
154
+ if (mode != RISING ) {
155
+ wkup_pin = PWR_WAKEUP_PIN6_LOW ;
156
+ }
159
157
#endif
160
- break ;
158
+ }
161
159
#endif /* PWR_WAKEUP_PIN6 */
162
160
#ifdef PWR_WAKEUP_PIN7
163
- case SYS_WKUP7 :
164
- wkup_pin = PWR_WAKEUP_PIN7 ;
165
- break ;
161
+ if ( p == SYS_WKUP7 ) {
162
+ wkup_pin = PWR_WAKEUP_PIN7 ;
163
+ }
166
164
#endif /* PWR_WAKEUP_PIN7 */
167
165
#ifdef PWR_WAKEUP_PIN8
168
- case SYS_WKUP8 :
169
- wkup_pin = PWR_WAKEUP_PIN8 ;
170
- break ;
171
- #endif /* PWR_WAKEUP_PIN8 */
166
+ if (p == SYS_WKUP8 ) {
167
+ wkup_pin = PWR_WAKEUP_PIN8 ;
172
168
}
169
+ #endif /* PWR_WAKEUP_PIN8 */
173
170
HAL_PWR_EnableWakeUpPin (wkup_pin );
174
171
}
175
172
}
0 commit comments