Function rc_gpio_init#
Defined in File gpio.h
Function Documentation#
-
int rc_gpio_init(int chip, int pin, int handle_flags)#
Configures a gpio pin as input or output.
This configures the pin by making a gpio handle request to the character device driver. It accepts the same gpio handle request flags as defined in <linux/gpio.h>
GPIOHANDLE_REQUEST_INPUT
GPIOHANDLE_REQUEST_OUTPUT
GPIOHANDLE_REQUEST_ACTIVE_LOW
GPIOHANDLE_REQUEST_OPEN_DRAIN
GPIOHANDLE_REQUEST_OPEN_SOURCE
Obviously the INPUT and OUTPUT flags cannot be used at the same time. If you don’t know what the other flags mean just stick with INPUT and OUTPUT modes, that covers 99% of use cases.
- Parameters:
chip – [in] The chip number, /dev/gpiochipX
pin – [in] The pin ID
handle_flags – [in] The handle flags
- Returns:
0 on success or -1 on failure.