drivers/gpio_sam: Fix incorrect flag checking

Corrected the checking for edge/level interrupts in the flags
variable.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
This commit is contained in:
Rajavardhan Gundi 2018-09-03 20:23:33 +05:30 committed by Anas Nashif
commit dc45def9d0

View file

@ -48,23 +48,20 @@ static int gpio_sam_config(struct device *dev, int access_op, u32_t pin,
/* Setup interrupt configuration. */
if (flags & GPIO_INT) {
if (flags & GPIO_INT_DOUBLE_EDGE) {
return -ENOTSUP;
}
/* Enable the interrupt. */
pio->PIO_IER = mask;
/* Enable the additional interrupt modes. */
pio->PIO_AIMER = mask;
switch (flags) {
case GPIO_INT_LEVEL:
pio->PIO_LSR = mask;
break;
case GPIO_INT_EDGE:
if (flags & GPIO_INT_EDGE) {
pio->PIO_ESR = mask;
break;
case GPIO_INT_DOUBLE_EDGE:
return -ENOTSUP;
default:
return -ENOTSUP;
} else {
pio->PIO_LSR = mask;
}
if (flags & GPIO_INT_ACTIVE_HIGH) {