public interface ThePi extends PiVals
Pi1
,
Pi2
, or
Pi3 for Pi3, P4 and Pi0
. Insofar this interface
acts as an abstract class (allowing multiple inheritance for future
applications).make()
method here
(respectively the one called in said sub interfaces) will yield a Pi
object holding the type and some application data of a concrete Pi
device.ThePi
) object will be usually held and usually
made
within
ClientPigpiod
object holding also the pigpiod (socket) access
data and comfortably implementing the IO.ThePi
's inner class
Port
may be used to hold data (and
behaviour) of one of this Pi's IO ports.Pi1
,
Pi2
,
Pi3
,
ClientPigpiod
Modifier and Type | Interface and Description |
---|---|
static class |
ThePi.ComBeh
Predefined behaviour for ThePi objects.
|
static class |
ThePi.Impl
Internal implementation class.
|
static class |
ThePi.Port
A port on this Pi.
|
Modifier and Type | Field and Description |
---|---|
static String |
defaultHost
The pigpiod default host.
|
GPIO_INP, GPIO_OUT, GPIOmax, GPIOmin, GPIOutM, H1, HI, L0, LO, PI_PUD_DOWN, PI_PUD_DT, PI_PUD_KP, PI_PUD_OFF, PI_PUD_UP, PIN0, PIN00, PIN01, PIN02, PIN04, PIN06, PIN09, PIN0V, PIN1, PIN14, PIN17, PIN2, PIN20, PIN25, PIN3V, PIN4, PIN5V, PIN6, PIN9, PINig, PINix, PIO_ALT0, PIO_ALT1, PIO_ALT2, PIO_ALT3, PIO_ALT4, PIO_ALT5
AUTHOR, BLANK_STRING, cons, CONSOL_ENCODING, COPYRIGHT, D, D_NaN, D_NegInf, D_PosInf, EMPTY_INT_A, EMPTY_STRING, FILE_ENCODING, FRW_CLLD, FS, FSS, H, hasCons, HOST_IP, HOST_IPv4, HOST_NAME, INIT_ERROR, JAR_ENCODING, JH, JOB_DONE_OK, JRL, LOG_OUT_ERROR, M, MAIN_THREAD_EXC, NO_BYTES, NO_CLASSES, NO_DOUBLES, NO_OBJECTS, NO_PARS_ERROR, NO_STRINGS, NOT_WINDOWS, ON_PI, ONE_DAY, ONE_HOUR, ONE_LEAP_YEAR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, ONE_YEAR, OS, PROG_NAME, PROG_SHORT, PS, RUNTIME, S, SHY, UD, UL, UL_UR_da, UR
Modifier and Type | Method and Description |
---|---|
int |
gpio2pin(int gpio)
Pin number to GPIO number lookup.
|
static String |
gpio2String(int gpio)
Format a GPIO number.
|
int |
gpio4pin(int pin)
Pin number to GPIO number lookup.
|
default int |
gpio4pinChck(CharSequence signal,
int pin)
Pin number to GPIO number lookup with check.
|
static boolean |
gpioMayOut(int gpio)
Allows a GPIO number output.
|
default int |
gpios4pins(int[] pins)
Pin number array to GPIO mask lookup.
|
default int |
gpios4pinsChck(CharSequence signal,
int[] pins)
Pins array to GPIO mask lookup with check.
|
String |
host()
The Pi's hostname for a pigpiod socket connection.
|
static ThePi |
make(String host,
int port,
int timeout,
int type)
Make a Pi.
|
default String |
pinDescr(int pin,
int pud) |
default ThePi.Port |
portByGPIO(int gpio,
String name)
Make an input/output port for this Pi.
|
default ThePi.Port |
portByPin(int pin,
String name)
Make an input/output port for this Pi.
|
int |
sockP()
The Pi's socket port number for a pigpiod socket connection.
|
int |
timeout()
The Pi's tiemout for a pigpiod socket connect in ms.
|
int |
type()
The Pi's type.
|
static final String defaultHost
Pi3
, Pi1
or Pi2
.default ThePi.Port portByPin(int pin, String name) throws IOException
ThePi
object and associated with it a ThePi.Port
object will be made an returned. ThePi
object can't be garbage
collected before all of the ThePi.Port
objects made for it.name
- a short (best 7 char) description of the pin's attached device
like "red LED", "servo16" etc.; must not be emptypin
- 0, 1..40 (26 [+8]) is the legal IO connector pin numberIOException
- if the pin does not allow input and output operations
with a comprehensive messagedefault ThePi.Port portByGPIO(int gpio, String name) throws IOException
name
- a short (best 7 char) description of the pin's attached device
like "red LED", "servo16" etc.; must not be emptygpio
- 0..32 or PiVals.PINig
an operable / legal GPIO numberIOException
- if the pin does not allow the IO operation intended
with a comprehensive messagestatic boolean gpioMayOut(int gpio)
PiVals.PINig
.PiVals.PINig
(ignore pin/gpio) will not be performed (and here ignored without error).gpio
- a GPIO number{@link #PINig}
static String gpio2String(int gpio)
GPIO00 .. GPIO31
or gpio32 ..gpio56
. PiVals.PIN3V
etc. will
be formated as gnd
, 3V3
, 5V0
, ignore
.PiVals.PINix
) will get none
.gpio
- a GPIO numberdefault String pinDescr(int pin, int pud)
int gpio4pin(int pin)
pin
- 0, 1..40 (26 [+8]) is the legal IO connector pin numberPiVals.PIN0V
, PiVals.PIN3V
,
PiVals.PIN5V
, PiVals.PINix
: undefined, i.e. illegal pin number
or PiVals.PINig
ignore for pin = 0default int gpios4pins(int[] pins)
pins
- an array of legal pin numbers 1..40 (26 [+8]) or 0 for ignoregpios4pinsChck(CharSequence, int[])
int gpio2pin(int gpio)
gpio
- 0..39 a GPIO number (eventually) available on the
Pi's 40 (26) pins connector.default int gpio4pinChck(CharSequence signal, int pin) throws IOException
gpio4pin(int)
. Additionally it raises an
IOException
with a comprehensive message, when the pin is no
real IO pin for a GPIO in the range 0..31.signal
- a short (best 7 char) description of the pin's
attached device like "red LED", "Ubat_12" etc.
It is used for the IOexception message, onlypin
- 0, 1..40 (26 [+8]) is the legal IO connector pin numberPiVals.PIN0V
, PiVals.PIN3V
,
PiVals.PIN5V
, PiVals.PINix
: undefined, i.e. illegal pin number
or PiVals.PINig
ignore for pin = 0IOException
- if the pin does not allow the IO operation intended
with a comprehensive messagedefault int gpios4pinsChck(CharSequence signal, int[] pins) throws IOException
gpios4pins(int[])
. Additionally it raises an
IOException
with a comprehensive message, when the pin is no
real IO pin for a GPIO in the range 0..31 (instead of just returning 0).signal
- a short (best 7 char) description of the pin / signal
or device group like "redLEDs", "relaysH" etc.
It is used for the IOexception message, onlyIOException
- on the first pinin the array not allowing
the IO operation intended with a comprehensive messagegpios4pins(int[])
int sockP()
ThePi
itself; see ClientPigpiod
.String host()
ThePi
itself; see ClientPigpiod
.defaultHost
int timeout()
ThePi
itself; see ClientPigpiod
.int type()
Pi1
and instanceof Pi2
, respectively.static ThePi make(String host, int port, int timeout, int type)
Pi3
(default),
a Pi2
or a Pi1
object according to the other parameters.
As the Pi4 and Pi0 have the same GPIO assignment as a Pi3 they all are
represented by a Pi3
object. host
,
(socket) port
and timeout
Pi3.make(String, int, int, int)
,
Pi1.make(String, int, int)