public interface Pin
IODevice
to external signal receiver or
transmitter.Modifier and Type | Interface and Description |
---|---|
static class |
Pin.Mode
Mode represents particular duty of a pin.
|
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(PinEventListener listener)
Adds the specified listener to receive events from this pin.
|
IODevice |
getDevice()
Return an
IODevice the pin belongs to. |
byte |
getIndex()
Returns the index of the pin on its device.
|
Pin.Mode |
getMode()
Returns current mode of the pin.
|
Set<Pin.Mode> |
getSupportedModes()
Returns a set of modes supported by the pin.
|
long |
getValue()
Returns current value of the pin.
|
void |
removeAllEventListeners()
Remove all listeners from this pin.
|
void |
removeEventListener(PinEventListener listener)
Removes the specified listener so that it no longer receives events from
this pin.
|
void |
setMode(Pin.Mode mode)
Assigns new mode to the pin.
|
void |
setValue(long value)
Sets the value to the pin.
|
boolean |
supports(Pin.Mode mode)
Checks if the pin supports the mode
|
byte getIndex()
Pin.Mode getMode()
void setMode(Pin.Mode mode) throws IOException, IllegalArgumentException
mode
- the mode the pin should get intoIOException
- when assigning is failed due a communication issueIllegalArgumentException
- when the pin does not support the modeboolean supports(Pin.Mode mode)
mode
- the modeSet<Pin.Mode> getSupportedModes()
long getValue()
void setValue(long value) throws IOException, IllegalStateException
Pin.Mode.INPUT
or Pin.Mode.ANALOG
.value
- the value to be assigned to the pinIOException
- when setting fails due a communication issueIllegalStateException
- when the pin is in input mode such as
Pin.Mode.INPUT
or Pin.Mode.ANALOG
.void addEventListener(PinEventListener listener)
listener
- the listenervoid removeEventListener(PinEventListener listener)
listener
- the listenervoid removeAllEventListeners()
Copyright © 2017. All rights reserved.