mirror of https://github.com/ARMmbed/mbed-os.git
EFM32: Fixed `pwmout_all_inactive` being inversed
If one of the CC channel pins is enabled, `pwmout_all_inactive` it means a channel is active so it should return `true`. This commit also contains some cleanup in `pwm_init`.pull/4142/head
parent
a514216c8b
commit
d396306a10
|
@ -131,7 +131,7 @@ bool pwmout_all_inactive(void) {
|
|||
return true;
|
||||
}
|
||||
#else
|
||||
if(PWM_TIMER->ROUTE & (TIMER_ROUTE_CC0PEN | TIMER_ROUTE_CC1PEN | TIMER_ROUTE_CC2PEN)) {
|
||||
if (!(PWM_TIMER->ROUTE & (TIMER_ROUTE_CC0PEN | TIMER_ROUTE_CC1PEN | TIMER_ROUTE_CC2PEN))) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
@ -210,10 +210,11 @@ void pwmout_init(pwmout_t *obj, PinName pin)
|
|||
#else
|
||||
// On P1, the route location is statically defined for the entire timer.
|
||||
PWM_TIMER->ROUTE &= ~_TIMER_ROUTE_LOCATION_MASK;
|
||||
if(pwmout_all_inactive()) {
|
||||
// Make sure the route location is not overwritten
|
||||
if(pwmout_all_inactive()) {
|
||||
PWM_TIMER->ROUTE |= pinmap_find_function(pin,PinMap_PWM) << _TIMER_ROUTE_LOCATION_SHIFT;
|
||||
} else {
|
||||
MBED_ASSERT((pinmap_find_function(pin,PinMap_PWM) << _TIMER_ROUTE_LOCATION_SHIFT) == (PWM_TIMER->ROUTE & _TIMER_ROUTE_LOCATION_MASK));
|
||||
MBED_ASSERT(PWM_TIMER->ROUTE & _TIMER_ROUTE_LOCATION_MASK == pinmap_find_function(pin,PinMap_PWM) << _TIMER_ROUTE_LOCATION_SHIFT);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue