fix the issue that didn't receive event from gpio pin.
authorsangwon03.an@samsung.com <sangwon03.an@samsung.com>
Tue, 19 Sep 2017 23:58:24 +0000 (16:58 -0700)
committersangwon03.an@samsung.com <sangwon03.an@samsung.com>
Tue, 19 Sep 2017 23:58:24 +0000 (16:58 -0700)
gpio.c is synchronized with ARTIK053 repo.

os/drivers/gpio/gpio.c

index a913553..50fb005 100644 (file)
@@ -186,8 +186,8 @@ static void gpio_sample(FAR struct gpio_upperhalf_s *priv)
 
 #if !defined(CONFIG_DISABLE_POLL) || !defined(CONFIG_DISABLE_SIGNALS)
        change  = sample ^ priv->gu_sample;
-       rising  = (change && priv->gu_sample);
-       falling = (change && ~priv->gu_sample);
+       rising  = (change && sample);
+       falling = (change && !sample);
 
        /* Visit each opened reference to the device */
        for (opriv = priv->gu_open; opriv; opriv = opriv->go_flink) {
@@ -286,10 +286,10 @@ static void gpio_enable(FAR struct gpio_upperhalf_s *priv)
        /* Enable/disable GPIO interrupts */
        DEBUGASSERT(lower->ops->enable);
        if (rising || falling) {
-               lower->ops->enable(lower, rising, falling, gpio_interrupt);
+               lower->ops->enable(lower, true, true, gpio_interrupt);
        } else {
                /* Disable further interrupts */
-               lower->ops->enable(lower, 0, 0, NULL);
+               lower->ops->enable(lower, false, false, NULL);
        }
 
        irqrestore(flags);