Private
Public Access
2
0

gpio.hpp: Add direction read call for C++ & SWIG APIs

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2016-02-05 15:43:28 +00:00
parent cc4fe26c09
commit 8710280142

View File

@@ -235,6 +235,23 @@ class Gpio
{
return (Result )mraa_gpio_dir(m_gpio, (mraa_gpio_dir_t) dir);
}
/**
* Read Gpio direction
*
* @throw std::runtime_error in case of failure
* @return Result of operation
*/
Dir
readDir()
{
mraa_gpio_dir_t dir;
if (mraa_gpio_read_dir(m_gpio, &dir) != MRAA_SUCCESS) {
throw std::runtime_error("Failed to read direction");
}
return (Dir) dir;
}
/**
* Read value from Gpio
*