Private
Public Access
2
0

gpio: Introduce mraa_gpio_init_by_name API

This commit introduces mraa_gpio_init_by_name API for initializing
a GPIO by its line name provided by the kernel. This feature depends
on the GPIO chardev support and also the line names present in devicetree
or board files. Accessing GPIO using its line name, removes the dependency
from MRAA specific pin mapping and provides a cleaner way to access GPIOs.
This will solve the issue created by an external gpiochip probing before
the SoC's internal gpio controller and thereby making the MRAA pin mapping
wrong.

Currently, this API only supports initializing a single GPIO at a time.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
This commit is contained in:
Manivannan Sadhasivam
2019-05-02 11:09:51 +05:30
committed by Manivannan Sadhasivam
parent 111e6be8f7
commit 0a12c5a017
5 changed files with 186 additions and 24 deletions

View File

@@ -124,6 +124,14 @@ typedef mraa_gpio_event* mraa_gpio_events_t;
*/
mraa_gpio_context mraa_gpio_init(int pin);
/**
* Initialise gpio_context, based on gpio line name
*
* @param name GPIO line name, i.e GPIO-A
* @returns gpio context or NULL
*/
mraa_gpio_context mraa_gpio_init_by_name(char* name);
/**
* Initialise gpio_context, based on board number, for multiple pins (can be one).
*