Class GpioPinBinding

java.lang.Object
com.kosdev.kos.core.service.gpio.GpioPinBinding
Direct Known Subclasses:
GpioInputPinDef, GpioOutputPinDef

public class GpioPinBinding extends Object
Definition of a GPIO pin. A pin is defined as a combination of a GPIO chip and a pin on that chip. GPIO chips appear as /dev/gpiochipX device files where X is the chip number starting at zero. Pins are defined as an index into the pin list for the chip starting at zero. While it is possible to define a pin in terms of a chip number and pin number, there is a risk that when running on other hardware, such as during testing, the chip/pin may be a valid combination on that device yet not be electrically safe, such as a pin designed as an input be used as an output. To avoid this, it is possible to specify the chip and pin by symbolic names as defined by the GPIO driver when it registers with the kernel. As the controller between devices are likely to be different, any pins defined on wrong hardware will never become live.

This pin definition allows chip and pin to be defined as either a name or number. If names are used, the name will be checked against real hardware when it comes online. If a number is specified, it is assumed to be correct and it will used as supplied. If both are supplied, the number will be used instead of the name. This approach allows the chip name to be set to validate the hardware is correct, but a number used for the pin as within the correct chip the pin is fixed.

Since:
9
Version:
9
  • Constructor Details

    • GpioPinBinding

      public GpioPinBinding()