Skip to content

Commit 0176726

Browse files
authored
Merge pull request #4142 from productize/master
EFM32: Fixed `pwmout_all_inactive` being inversed
2 parents c710f46 + d396306 commit 0176726

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

targets/TARGET_Silicon_Labs/TARGET_EFM32/pwmout_api.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ bool pwmout_all_inactive(void) {
131131
return true;
132132
}
133133
#else
134-
if(PWM_TIMER->ROUTE & (TIMER_ROUTE_CC0PEN | TIMER_ROUTE_CC1PEN | TIMER_ROUTE_CC2PEN)) {
134+
if (!(PWM_TIMER->ROUTE & (TIMER_ROUTE_CC0PEN | TIMER_ROUTE_CC1PEN | TIMER_ROUTE_CC2PEN))) {
135135
return true;
136136
}
137137
#endif
@@ -210,10 +210,11 @@ void pwmout_init(pwmout_t *obj, PinName pin)
210210
#else
211211
// On P1, the route location is statically defined for the entire timer.
212212
PWM_TIMER->ROUTE &= ~_TIMER_ROUTE_LOCATION_MASK;
213-
if(pwmout_all_inactive()) {
213+
// Make sure the route location is not overwritten
214+
if(pwmout_all_inactive()) {
214215
PWM_TIMER->ROUTE |= pinmap_find_function(pin,PinMap_PWM) << _TIMER_ROUTE_LOCATION_SHIFT;
215216
} else {
216-
MBED_ASSERT((pinmap_find_function(pin,PinMap_PWM) << _TIMER_ROUTE_LOCATION_SHIFT) == (PWM_TIMER->ROUTE & _TIMER_ROUTE_LOCATION_MASK));
217+
MBED_ASSERT(PWM_TIMER->ROUTE & _TIMER_ROUTE_LOCATION_MASK == pinmap_find_function(pin,PinMap_PWM) << _TIMER_ROUTE_LOCATION_SHIFT);
217218
}
218219
#endif
219220

0 commit comments

Comments
 (0)