drivers: gpio_mcux_lpc: fix bug configuring interrupts with GPIO_INT_WAKEUP
If GPIO_INT_WAKEUP is in the trig argument, the selection of trigger mode breaks because the GPIO_INT_WAKEUP flag breaks the equal comparisons. Signed-off-by: Mike J. Chen <mjchen@google.com>
This commit is contained in:
parent
d8358b29a0
commit
122b14bc68
1 changed files with 4 additions and 1 deletions
|
@ -263,8 +263,11 @@ static int gpio_mcux_lpc_pint_interrupt_cfg(const struct device *dev,
|
|||
const struct gpio_mcux_lpc_config *config = dev->config;
|
||||
enum nxp_pint_trigger interrupt_mode = NXP_PINT_NONE;
|
||||
uint32_t port = config->port_no;
|
||||
bool wake = ((trig & GPIO_INT_WAKEUP) == GPIO_INT_WAKEUP);
|
||||
int ret;
|
||||
|
||||
trig &= ~GPIO_INT_WAKEUP;
|
||||
|
||||
switch (mode) {
|
||||
case GPIO_INT_MODE_DISABLED:
|
||||
nxp_pint_pin_disable((port * 32) + pin);
|
||||
|
@ -292,7 +295,7 @@ static int gpio_mcux_lpc_pint_interrupt_cfg(const struct device *dev,
|
|||
}
|
||||
|
||||
/* PINT treats GPIO pins as continuous. Each port has 32 pins */
|
||||
ret = nxp_pint_pin_enable((port * 32) + pin, interrupt_mode, (trig & GPIO_INT_WAKEUP));
|
||||
ret = nxp_pint_pin_enable((port * 32) + pin, interrupt_mode, wake);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue