arsd.gpio

PRERELEASE EXPERIMENTAL MODULE / SUBJECT TO CHANGE WITHOUT WARNING / LIKELY TO CONTAIN BUGS

Wrapper for gpio use on Linux. It uses the new kernel interface directly, and thus requires a Linux kernel version newer than 4.9. It also requires a Linux kernel newer than 4.9 (apt upgrade your raspian install if you don't already have that).

Note that the kernel documentation is very clear: do NOT use this for anything you plan to distribute to others. It is really just for tinkering, not production. And if the kernel people say that, I say it like 1000x more.

More...

Members

Classes

CErrorException
class CErrorException

Enums

GPIOLINE_CHANGED_REQUESTED
anonymousenum GPIOLINE_CHANGED_REQUESTED

line status change events

Manifest constants

GPIOEVENT_EVENT_FALLING_EDGE
enum GPIOEVENT_EVENT_FALLING_EDGE;

GPIO event types

GPIOEVENT_EVENT_RISING_EDGE
enum GPIOEVENT_EVENT_RISING_EDGE;

GPIO event types

GPIOEVENT_REQUEST_BOTH_EDGES
enum GPIOEVENT_REQUEST_BOTH_EDGES;
GPIOEVENT_REQUEST_FALLING_EDGE
enum GPIOEVENT_REQUEST_FALLING_EDGE;

Eventrequest flags

GPIOEVENT_REQUEST_RISING_EDGE
enum GPIOEVENT_REQUEST_RISING_EDGE;

Eventrequest flags

GPIOHANDLES_MAX
enum GPIOHANDLES_MAX;

Maximum number of requested handles

GPIOHANDLE_GET_LINE_VALUES_IOCTL
enum GPIOHANDLE_GET_LINE_VALUES_IOCTL;

.

GPIOHANDLE_REQUEST_ACTIVE_LOW
enum GPIOHANDLE_REQUEST_ACTIVE_LOW;
GPIOHANDLE_REQUEST_BIAS_DISABLE
enum GPIOHANDLE_REQUEST_BIAS_DISABLE;
GPIOHANDLE_REQUEST_BIAS_PULL_DOWN
enum GPIOHANDLE_REQUEST_BIAS_PULL_DOWN;
GPIOHANDLE_REQUEST_BIAS_PULL_UP
enum GPIOHANDLE_REQUEST_BIAS_PULL_UP;

Linerequest flags

GPIOHANDLE_REQUEST_INPUT
enum GPIOHANDLE_REQUEST_INPUT;
GPIOHANDLE_REQUEST_OPEN_DRAIN
enum GPIOHANDLE_REQUEST_OPEN_DRAIN;
GPIOHANDLE_REQUEST_OPEN_SOURCE
enum GPIOHANDLE_REQUEST_OPEN_SOURCE;
GPIOHANDLE_REQUEST_OUTPUT
enum GPIOHANDLE_REQUEST_OUTPUT;

Linerequest flags

GPIOHANDLE_SET_CONFIG_IOCTL
enum GPIOHANDLE_SET_CONFIG_IOCTL;
GPIOHANDLE_SET_LINE_VALUES_IOCTL
enum GPIOHANDLE_SET_LINE_VALUES_IOCTL;

.

GPIOLINE_FLAG_ACTIVE_LOW
enum GPIOLINE_FLAG_ACTIVE_LOW;
GPIOLINE_FLAG_BIAS_DISABLE
enum GPIOLINE_FLAG_BIAS_DISABLE;
GPIOLINE_FLAG_BIAS_PULL_DOWN
enum GPIOLINE_FLAG_BIAS_PULL_DOWN;
GPIOLINE_FLAG_BIAS_PULL_UP
enum GPIOLINE_FLAG_BIAS_PULL_UP;
GPIOLINE_FLAG_IS_OUT
enum GPIOLINE_FLAG_IS_OUT;

Informational flags

GPIOLINE_FLAG_KERNEL
enum GPIOLINE_FLAG_KERNEL;
GPIOLINE_FLAG_OPEN_DRAIN
enum GPIOLINE_FLAG_OPEN_DRAIN;
GPIOLINE_FLAG_OPEN_SOURCE
enum GPIOLINE_FLAG_OPEN_SOURCE;

Informational flags

GPIO_GET_CHIPINFO_IOCTL
enum GPIO_GET_CHIPINFO_IOCTL;
GPIO_GET_LINEEVENT_IOCTL
enum GPIO_GET_LINEEVENT_IOCTL;
GPIO_GET_LINEHANDLE_IOCTL
enum GPIO_GET_LINEHANDLE_IOCTL;
GPIO_GET_LINEINFO_IOCTL
enum GPIO_GET_LINEINFO_IOCTL;
GPIO_GET_LINEINFO_UNWATCH_IOCTL
enum GPIO_GET_LINEINFO_UNWATCH_IOCTL;
GPIO_GET_LINEINFO_WATCH_IOCTL
enum GPIO_GET_LINEINFO_WATCH_IOCTL;

.

Structs

GpioChip
struct GpioChip
gpiochip_info
struct gpiochip_info

Information about a certain GPIO chip. ioctl GPIO_GET_CHIPINFO_IOCTL

gpioevent_data
struct gpioevent_data

The actual event being pushed to userspace

gpioevent_request
struct gpioevent_request

Information about a GPIO event request

gpiohandle_config
struct gpiohandle_config

Configuration for a GPIO handle request Note: only in kernel newer than early 2020

gpiohandle_data
struct gpiohandle_data

Information of values on a GPIO handle

gpiohandle_request
struct gpiohandle_request

Information about a GPIO handle request

gpioline_info
struct gpioline_info

Information about a certain GPIO line

gpioline_info_changed
struct gpioline_info_changed

Information about a change in status of a GPIO line

Detailed Description

This is a PRERELEASE EXPERIMENTAL MODULE SUBJECT TO CHANGE WITHOUT WARNING. It is LIKELY TO CONTAIN BUGS!

GPIOHANDLE_REQUEST_BIAS_PULL_UP and friends were added to the kernel in early 2020, so bleeding edge feature that is unlikely to work if you aren't that new too. My rpis do NOT support it. (the python library sets similar values tho by poking memory registers. I'm not gonna do that here, you can also solve it with electric circuit design (6k-ish ohm pull up and/or pull down resistor) or just knowing your own setup... so meh.)

Meta

License

GPL-2.0 WITH Linux-syscall-note because it includes copy/pasted Linux kernel header code.