GPIO Input

From: Generic

Class: herosdevices.core.gpio.GPIOInput

Driver Quality Index: beta

Requires the following packages

gpiod

A single GPIO configured as input.

The access to the GPIO is based on libgpiod and thus uses the standard linux kernel interface (i.e. /dev/gpiochip* devices).

Bold arguments are mandatory. For more information on the listed arguments refer to the class documentation: herosdevices.core.gpio.GPIOInput If parameters appear in this list but not in the class definition, please recursively check the linked base classes for the definition of the parameter.

Argument

Type

Default Value

Description

gpiochip

int

number of the gpiochip as exposed by the linux kernel.

pin

int

number of the GPIO pin

drive

str

PUSH_PULL

Currently unused.

bias

str

AS_IS

bis to apply to the GPIO pin. Possible values: AS_IS (default), DISABLED, PULL_DOWN, PULL_UP, UNKNOWN

debounce_ms

int

5

debouncing time in milliseconds.

edge_detection

str

NONE

If given it performs the specified edge detection an issues an edge event. Valid values are BOTH, FALLING, NONE, RISING. For this to work, an asyncio loop has to given as well.

loop

AbstractEventLoop | None

None

asyncio loop in which the edge detection task can be performed. This is required if edge detection is set.

The following JSON strings can be used to start a HERO device representation of GPIOInput using BOSS.

{
    "_id": "gpio-in-test",
    "classname": "herosdevices.core.gpio.GPIOInput",
    "arguments": {
        "gpiochip": 0,
        "pin": 5,
        "bias": "PULL_DOWN",
        "edge_detection": "BOTH",
        "loop": "@_boss_loop"
    },
    "datasource": {
        "async": false,
        "interval": 5
    }
}

from examples/generic/gpio-input-edge-detect.json

{
    "_id": "my_GPIOInput",
    "classname": "herosdevices.core.gpio.GPIOInput",
    "arguments": {
        "gpiochip": "int",
        "pin": "int",
        "drive": "PUSH_PULL",
        "bias": "AS_IS",
        "debounce_ms": 5,
        "edge_detection": "NONE",
        "loop": null
    }
}

generated from signature

digraph inheritanceb9d6798780 { bgcolor=transparent; rankdir=TB; size=""; "herosdevices.core.gpio.GPIOInput" [URL="../../../autoapi/herosdevices/core/gpio/index.html#herosdevices.core.gpio.GPIOInput",color="#5fabe8",fillcolor="#5fabe827",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,penwidth=2,shape=box,style="rounded,filled",target="_top",tooltip="A single GPIO configured as input."]; "herosdevices.interfaces.atomiq.Measurable" -> "herosdevices.core.gpio.GPIOInput" [arrowsize=1,color="#5fabe8",dir="back",penwidth=2,style="setlinewidth(0.5)"]; "herosdevices.interfaces.Interface" [URL="../../../autoapi/herosdevices/interfaces/index.html#herosdevices.interfaces.Interface",color="#5fabe8",fillcolor="#5fabe827",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,penwidth=2,shape=box,style="rounded,filled",target="_top",tooltip="Generic Interface to describe and check capabilities of a device driver."]; "herosdevices.interfaces.atomiq.AtomiqInterface" [URL="../../../autoapi/herosdevices/interfaces/atomiq/index.html#herosdevices.interfaces.atomiq.AtomiqInterface",color="#5fabe8",fillcolor="#5fabe827",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,penwidth=2,shape=box,style="rounded,filled",target="_top",tooltip="This interface defines the necessary methods for a HERO to seamlessly being converted into an atomiq component."]; "herosdevices.interfaces.Interface" -> "herosdevices.interfaces.atomiq.AtomiqInterface" [arrowsize=1,color="#5fabe8",dir="back",penwidth=2,style="setlinewidth(0.5)"]; "herosdevices.interfaces.atomiq.Measurable" [URL="../../../autoapi/herosdevices/interfaces/atomiq/index.html#herosdevices.interfaces.atomiq.Measurable",color="#5fabe8",fillcolor="#5fabe827",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,penwidth=2,shape=box,style="rounded,filled",target="_top",tooltip="HERO implementation of :external+atomiq:py:class:`atomiq.components.primitives.Measurable`."]; "herosdevices.interfaces.atomiq.AtomiqInterface" -> "herosdevices.interfaces.atomiq.Measurable" [arrowsize=1,color="#5fabe8",dir="back",penwidth=2,style="setlinewidth(0.5)"]; }