gpio: Add a function to get a pin number from mraa_gpio_context
Signed-off-by: Kenta Yonekura <yoneken@ieee.org> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -192,6 +192,14 @@ 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
|
||||
*
|
||||
* @param dev The Gpio context
|
||||
* @return Pin number
|
||||
*/
|
||||
int mraa_gpio_get_pin(mraa_gpio_context dev);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -183,6 +183,14 @@ class Gpio {
|
||||
mraa_result_t useMmap(bool enable) {
|
||||
return mraa_gpio_use_mmaped(m_gpio, (mraa_boolean_t) enable);
|
||||
}
|
||||
/**
|
||||
* Get pin number of Gpio
|
||||
*
|
||||
* @return Pin number
|
||||
*/
|
||||
int getPin() {
|
||||
return mraa_gpio_get_pin(m_gpio);
|
||||
}
|
||||
private:
|
||||
mraa_gpio_context m_gpio;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user