DCT Lightfoot v3 API specification

com.dctl.hardware.gpio
Class GPIO

java.lang.Object
  |
  +--com.dctl.hardware.gpio.GPIO

public class GPIO
extends Object

GPIO handler class. This attaches to a particular GPIO port and allows bits to be set/read


Constructor Summary
GPIO(char port)
          Create a GPIO instance
GPIO(char port, int mask)
          Create a GPIO instance using a port and mask
 
Method Summary
 boolean getBit()
          Get the bit - only useful if only one bit is specified in the mask
 int getBit(int bit)
          Get a bit
 int getBits()
          Get all the bits
 int getDirection()
          Get the direction for the port
 boolean getInput(int bit)
          Get the input state for a bit
 void setBit(boolean value)
          Set the bit - only useful if only one bit is specified in the mask
 void setBit(int bit, int value)
          Set a bit
 void setBits(int bits)
          Set all the bits
 void setDirection(int direction)
          Set the direction for the port
 void setInput()
          Set the bit to be input - only useful if only one bit is valid in the mask
 void setInput(int bit, boolean state)
          Set the input state for a bit
 void setOutput()
          Set the bit to be output - only useful if only one bit is valid in the mask
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GPIO

public GPIO(char port,
            int mask)
     throws IllegalArgumentException,
            SystemException
Create a GPIO instance using a port and mask

Parameters:
port - The port as a letter from 'A' to 'F'
mask - The mask to use
Throws:
IllegalArgumentException - if the port does not exist
SystemException - if there is an error in the operation

GPIO

public GPIO(char port)
     throws IllegalArgumentException,
            SystemException
Create a GPIO instance

Parameters:
port - The port as a letter from 'A' to 'F'
Throws:
IllegalArgumentException - if the port does not exist
SystemException - if there is an error in the operation
Method Detail

setInput

public void setInput(int bit,
                     boolean state)
              throws SystemException
Set the input state for a bit

Parameters:
bit - The bit to set the input state for
state - True for input, false for output
Throws:
SystemException - if there is an error in the operation

setInput

public void setInput()
              throws SystemException
Set the bit to be input - only useful if only one bit is valid in the mask

Throws:
SystemException - if there is an error in the operation

setOutput

public void setOutput()
               throws SystemException
Set the bit to be output - only useful if only one bit is valid in the mask

Throws:
SystemException - if there is an error in the operation

setDirection

public void setDirection(int direction)
                  throws SystemException
Set the direction for the port

Parameters:
direction - The direction, a bit set to 1 indicates input otherwise output
Throws:
SystemException - if there is an error in the operation

getInput

public boolean getInput(int bit)
                 throws SystemException
Get the input state for a bit

Parameters:
bit - The bit to get the input state for
Returns:
true if this is input, false for output
Throws:
SystemException - if there is an error in the operation

getDirection

public int getDirection()
                 throws SystemException
Get the direction for the port

Returns:
the direction, a bit set to 1 indicates input otherwise output
Throws:
SystemException - if there is an error in the operation

setBit

public void setBit(int bit,
                   int value)
            throws SystemException
Set a bit

Parameters:
bit - The bit to set
value - The value
Throws:
SystemException - if there is an error in the operation

setBits

public void setBits(int bits)
             throws SystemException
Set all the bits

Parameters:
bits - The bits to set
Throws:
SystemException - if there is an error in the operation

setBit

public void setBit(boolean value)
            throws SystemException
Set the bit - only useful if only one bit is specified in the mask

Parameters:
value - true to set the bit, false to clear it
Throws:
SystemException - if there is an error

getBit

public int getBit(int bit)
           throws SystemException
Get a bit

Parameters:
bit - The bit to get
Returns:
1 if the bit is set, 0 if not
Throws:
SystemException - if there is an error in the operation

getBits

public int getBits()
            throws SystemException
Get all the bits

Returns:
the bits
Throws:
SystemException - if there is an error in the operation

getBit

public boolean getBit()
               throws SystemException
Get the bit - only useful if only one bit is specified in the mask

Returns:
true if set, false if not
SystemException

DCT Lightfoot v3 API specification

DCT Lightfoot v3 API specification