mraa.c: mraa_pin_mode_test should check against b->gpio_count -1
authorBrendan Le Foll <brendan.le.foll@intel.com>
Thu, 18 Dec 2014 14:20:14 +0000 (14:20 +0000)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Thu, 18 Dec 2014 14:28:36 +0000 (14:28 +0000)
It's already the case for rpi & MMAX but it should be noted that on 1 indexed
boards gpio_count should be +1

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
src/mraa.c

index 765135d..70be118 100644 (file)
@@ -228,7 +228,7 @@ mraa_pin_mode_test(int pin, mraa_pinmodes_t mode)
         if (plat == NULL)
             return 0;
     }
-    if (pin > plat->phy_pin_count || pin < 0)
+    if (pin > (plat->phy_pin_count -1) || pin < 0)
         return 0;
 
     switch(mode) {