owned by linux kernel driver
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/gpio.h>
zed_oled {
compatible = "pmodoled-gpio";
vbat-gpio = <&gpio_oled 0 0>;
vdd-gpio = <&gpio_oled 1 0>;
...
}
of_get_named_gpio(struct device_node *np, const char *propname, int index))
gpio_is_valid() // ensure GPIO exists
gpio_request()
gpio_request_array(led_gpios, ARRAY_SIZE(led_gpios))
struct gpio {
unsigned gpio;
unsigned long flags;
const char *label;
}
int gpio_direction_input(unsigned gpio)
int gpio_direction_output(unsigned gpio)
int gpio_get_value(unsigned gpio)
int gpio_set_value(unsigned gpio, int value)
// 0 for low, nonzero for high
GPIOs defined on external chips require sleeping due to being slow from processor’s perspective
int gpio_get_value_cansleep(unsigned gpio)
int gpio_set_value_cansleep(unsigned gpio, int value)
using GPIO lines of a processor to emulate a communications protocol when a dedicated hardware controller isn’t available
Linux includes drivers over GPIO: I2C, SPI, HID over I2C, MDIO
Not a real time garunteed
Documentation/devicetree/bindings/<bus>/<bus>-gpio.txt
GPIO Keys
Keyboard
autorepeat: hold to repeat