Package com.kosdev.kos.core.service.gpio
Class GpioPin
java.lang.Object
com.kosdev.kos.core.service.gpio.GpioPin
- Direct Known Subclasses:
GpioInputPin,GpioOutputPin
Base class fir GPIO pins.
- Since:
- 9
- Version:
- 9
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturn the resolved chip number.Return the pin binding provided at the time the pin was created.intReturn the resolved pin number on the specified chip.booleanReturn true if the pin connected to hardware.
-
Constructor Details
-
GpioPin
public GpioPin()
-
-
Method Details
-
getPinBinding
Return the pin binding provided at the time the pin was created. This is used to bind the software pin to an actual physical pin on the device when it comes online.- Since:
- 9
-
getChipNum
public int getChipNum()Return the resolved chip number. This will be-1until the chip is bound to real hardware. If the definition specifies a name that doesn't match any chip, or a chip number that doesn't actually exist, this will remain-1. This can be useful for debugging chip / pin mappings.- Returns:
- the GPIO chip number
-
getPinNum
public int getPinNum()Return the resolved pin number on the specified chip. This will be-1until the chip is bound to real hardware and the pin number is verified. If the definition specifies a name that doesn't match any pin, or a pin number that doesn't actually exist, this will remain-1. This can be useful for debugging chip / pin mappings.- Returns:
- the GPIO pin number
- Since:
- 9
-
isConnected
public boolean isConnected()Return true if the pin connected to hardware. This means the hardware is online and the pin definition matches the hardware. It is possible for the pin to disconnect if the remote node the pin is on reboots, or the adapter restarts.- Returns:
- true if the pin is connected to hardware
- Since:
- 9
-