mirror of https://github.com/ARMmbed/mbed-os.git
SiLabs: GPIO interrupts disabled/enabled incorrectly
GPIO_IntEnable/Disable was called with incorrect params due to missing parens. Operator precedence of & vs << caused the call to be blank if the port (MSB) nibble of pin was not zero.pull/1501/head
parent
ee329e5df7
commit
c1e5c0b907
|
@ -147,7 +147,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
|
|||
bool was_disabled = false;
|
||||
if(GPIO->IEN == 0) was_disabled = true;
|
||||
|
||||
GPIO_IntConfig((GPIO_Port_TypeDef)(obj->pin >> 4 & 0xF), obj->pin &0xF, obj->risingEdge, obj->fallingEdge, obj->risingEdge || obj->fallingEdge);
|
||||
GPIO_IntConfig((GPIO_Port_TypeDef)((obj->pin >> 4) & 0xF), obj->pin &0xF, obj->risingEdge, obj->fallingEdge, obj->risingEdge || obj->fallingEdge);
|
||||
if ((GPIO->IEN != 0) && (obj->risingEdge || obj->fallingEdge) && was_disabled) {
|
||||
blockSleepMode(GPIO_LEAST_ACTIVE_SLEEPMODE);
|
||||
}
|
||||
|
@ -156,12 +156,12 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
|
|||
inline void gpio_irq_enable(gpio_irq_t *obj)
|
||||
{
|
||||
if(GPIO->IEN == 0) blockSleepMode(GPIO_LEAST_ACTIVE_SLEEPMODE);
|
||||
GPIO_IntEnable(1 << obj->pin & 0xF); // pin mask for pins to enable
|
||||
GPIO_IntEnable(1 << (obj->pin & 0xF)); // pin mask for pins to enable
|
||||
}
|
||||
|
||||
inline void gpio_irq_disable(gpio_irq_t *obj)
|
||||
{
|
||||
GPIO_IntDisable(1 << obj->pin & 0xF); // pin mask for pins to disable
|
||||
GPIO_IntDisable(1 << (obj->pin & 0xF)); // pin mask for pins to disable
|
||||
if(GPIO->IEN == 0) unblockSleepMode(GPIO_LEAST_ACTIVE_SLEEPMODE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue