Private
Public Access
2
0

gpio.c: mraa_gpio_get_* now return -1 in error cases

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2015-04-24 16:07:17 +01:00
parent 0b382100d2
commit 2679a916be
3 changed files with 5 additions and 3 deletions

View File

@@ -195,7 +195,7 @@ mraa_result_t mraa_gpio_owner(mraa_gpio_context dev, mraa_boolean_t owner);
mraa_result_t mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap);
/**
* Get a pin number of the gpio
* Get a pin number of the gpio, invalid will return -1
*
* @param dev The Gpio context
* @return Pin number
@@ -203,7 +203,7 @@ mraa_result_t mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap);
int mraa_gpio_get_pin(mraa_gpio_context dev);
/**
* Get a gpio number as used within sysfs
* Get a gpio number as used within sysfs, invalid will return -1
*
* @param dev The Gpio context
* @return gpio number

View File

@@ -292,7 +292,7 @@ class Gpio
}
/**
* Get pin number of Gpio. If raw param is True will return the
* number as used within sysfs
* number as used within sysfs. Invalid will return -1.
*
* @param raw (optional) get the raw gpio number.
* @return Pin number

View File

@@ -595,6 +595,7 @@ mraa_gpio_get_pin(mraa_gpio_context dev)
{
if (dev == NULL) {
syslog(LOG_ERR, "gpio: context is invalid");
return -1;
}
return dev->phy_pin;
}
@@ -604,6 +605,7 @@ mraa_gpio_get_pin_raw(mraa_gpio_context dev)
{
if (dev == NULL) {
syslog(LOG_ERR, "gpio: context is invalid");
return -1;
}
return dev->pin;
}