:orphan:

GPIO Input
==========

**From:** Generic

**Class:** :py:class:`herosdevices.core.gpio.GPIOInput`


**Driver Quality Index:** beta


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).

.. tabs:: 


   .. tab:: Arguments
   
   
      Bold arguments are mandatory. For more information on the listed arguments refer to the class             documentation: :py:class:`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.
      
      
      .. list-table:: 
         :widths: 50 50 50 100
         :header-rows: 1
      
         * - Argument
           - Type
           - Default Value
           - Description
         * - **gpiochip**
           - **<class 'int'>**
           - 
           - number of the gpiochip as exposed by the linux kernel.
         * - **pin**
           - **<class 'int'>**
           - 
           - number of the GPIO pin
         * - drive
           - <class 'str'>
           - PUSH_PULL
           - Currently unused.
         * - bias
           - <class 'str'>
           - AS_IS
           - bis to apply to the GPIO pin. Possible values: AS_IS (default), DISABLED, PULL_DOWN, PULL_UP, UNKNOWN
         * - debounce_ms
           - <class 'int'>
           - 5
           - debouncing time in milliseconds.
         * - edge_detection
           - <class '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
           - asyncio.events.AbstractEventLoop | None
           - None
           - asyncio loop in which the edge detection task can be performed. This is required if edge detection is set.
      

   .. tab:: Example JSON for BOSS
   
      The following JSON strings can be used to start a HERO device representation of             :py:class:`GPIOInput <herosdevices.core.gpio.GPIOInput>` using             `BOSS <https://boss-eb4966.gitlab.io/>`_.
      
      .. code-block:: json
      
         {
             "_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
             }
         }
      
      :sup:`from examples/generic/gpio-input-edge-detect.json` 
      
      
      .. code-block:: json
      
         {
             "_id": "my_GPIOInput",
             "classname": "herosdevices.core.gpio.GPIOInput",
             "arguments": {
                 "gpiochip": "<class 'int'>",
                 "pin": "<class 'int'>",
                 "drive": "PUSH_PULL",
                 "bias": "AS_IS",
                 "debounce_ms": 5,
                 "edge_detection": "NONE",
                 "loop": null
             }
         }
      
      :sup:`generated from signature`
   .. tab:: Inheritance
   
   
      .. inheritance-diagram:: herosdevices.core.gpio.GPIOInput
      
