Merge pull request #4142 from productize/master

EFM32: Fixed `pwmout_all_inactive` being inversed
pull/2203/merge
Sam Grove 2017-04-19 02:27:19 -05:00 committed by GitHub
commit 01767268cd
1 changed files with 4 additions and 3 deletions

View File

@ -131,7 +131,7 @@ bool pwmout_all_inactive(void) {
return true; return true;
} }
#else #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; return true;
} }
#endif #endif
@ -210,10 +210,11 @@ void pwmout_init(pwmout_t *obj, PinName pin)
#else #else
// On P1, the route location is statically defined for the entire timer. // On P1, the route location is statically defined for the entire timer.
PWM_TIMER->ROUTE &= ~_TIMER_ROUTE_LOCATION_MASK; 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; PWM_TIMER->ROUTE |= pinmap_find_function(pin,PinMap_PWM) << _TIMER_ROUTE_LOCATION_SHIFT;
} else { } 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 #endif