|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DigitalPin
An object representation of a digital input/output pin on a microprocessor.
Creates an action of a specific unit of digital input/output. The action
verbs are read
and write
. Its
setters are setWrite
and setRead
. Its
main getter is getValue
. Its auxiliary getter
getId
returns the identifier of a particular digital
input/output pin. And getTime
provides a marker of when the
input/output operation occured.
DigitalPin objects should be created by the DigitalPinDriver factory.
DigitalPinDriver
Field Summary |
---|
Fields inherited from interface com.sentilla.system.Action |
---|
DONE, ERROR, IDLE, PENDING |
Method Summary | |
---|---|
int |
getId()
Asynchronous interface to get the pin id for this DigitalPin object. |
int |
getTime()
Asynchronous interface to get the time that the last operation, read or write, occured. |
boolean |
getValue()
Asynchronous interface to get the last value read from or written to the digital pin. |
boolean |
read()
Read the value of a specified digital pin. |
DigitalPin |
setRead()
Asynchronous interface to initiate a read operation. |
DigitalPin |
setWrite(boolean high)
Asynchronous interface to initiate a write operation. |
void |
write(boolean high)
Write a value to a specified digital pin. |
void |
writePort(byte portmask,
byte value)
Write the values of only a subset of pins of a port. |
Methods inherited from interface com.sentilla.system.Action |
---|
block, block, cancel, getActionState, isDone, submit |
Method Detail |
---|
void write(boolean high)
The write operation sets the pin in output mode and the pin remains in this mode after the write operation completes.
high
- true to set the pin high, false to set the pin lowboolean read()
The read operation is also used to set the pin to input mode.
The value of the pin may be ignored if read()
is
used to set the direction of the pin to input.
void writePort(byte portmask, byte value)
The portmask designates a subset of the pins that need to be changed (set to 1). The subset pins are set bit-to-bit.
portmask
- mask of the pins that should be changedvalue
- specifies the values of the pinsDigitalPin setWrite(boolean high)
Prepares the Action to write a value but does not initiate the write operation
until submit()
is called.
high
- true to set the pin high, false to set the pin low
DigitalPin setRead()
Prepares the Action to read a value but does not initiate the read operation
until submit()
is called.
boolean getValue()
This function will not initiate a read or write operation.
int getId()
id is specified by port and pin value in hex. For example, Port 2, Pin 3 is represented by id 0x23.
int getTime()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |