SunSPOT API V3.0


com.sun.spot.peripheral
Class PIOPin

java.lang.Object
  extended by com.sun.spot.peripheral.PIOPin

public class PIOPin
extends Object

A PIOPin is a convenient way of manipulating an individual PIO pin. It's maybe not as efficient as going direct to the PIO but it's simpler. The normal way of using PIOPin is: 1. Create a PIOPin or get one from Spot.getInstance().getSpotPins() 2. Claim the pin 3. Open it for input or output 4. Set it high or low


Field Summary
static int IO
          multiplex option that puts the pin under control of the PIO (this is the default for PIOPins)
 int multiplex
          The multiplex selection for this pin
static int PERIPHERAL_A
          multiplex option that puts the pin under control of PERIPHERAL A
static int PERIPHERAL_B
          multiplex option that puts the pin under control of PERIPHERAL B
 int pin
          The PIO pin mask for this pin
 IAT91_PIO pio
          The PIO for this pin
 
Constructor Summary
PIOPin(IAT91_PIO pio, int pin)
          Create a PIOPin that's controlled by a PIO
PIOPin(IAT91_PIO pio, int pin, int multiplex)
           
 
Method Summary
 void claim()
          Attempt to claim this pin
 void disableIrq()
          Disable pin change interrupts on this pin
 void enableIrq()
          Enable pin change interrupts on this pin
 boolean isHigh()
           
 boolean isLow()
           
 void openForInput()
          Open this pin for input
 void openForOutput()
          Open this pin for output
 void release()
          Release the claim on this pin
 void setHigh()
          Set this pin high
 void setLow()
          Set this pin low
 void setState(boolean state)
          Set this pin to the specified state
 String toString()
          Returns a string representation of the object.
 void waitForIrq()
          Wait for a pin change interrupt on this pin
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IO

public static final int IO
multiplex option that puts the pin under control of the PIO (this is the default for PIOPins)

See Also:
Constant Field Values

PERIPHERAL_A

public static final int PERIPHERAL_A
multiplex option that puts the pin under control of PERIPHERAL A

See Also:
Constant Field Values

PERIPHERAL_B

public static final int PERIPHERAL_B
multiplex option that puts the pin under control of PERIPHERAL B

See Also:
Constant Field Values

pin

public int pin
The PIO pin mask for this pin


pio

public IAT91_PIO pio
The PIO for this pin


multiplex

public int multiplex
The multiplex selection for this pin

Constructor Detail

PIOPin

public PIOPin(IAT91_PIO pio,
              int pin,
              int multiplex)
Parameters:
pio - the PIO that controls this pin
pin - the pin mask (i.e. only one bit set)
multiplex - the multiplex option

PIOPin

public PIOPin(IAT91_PIO pio,
              int pin)
Create a PIOPin that's controlled by a PIO

Parameters:
pio - the PIO that controls this pin
pin - the pin mask
Method Detail

claim

public void claim()
Attempt to claim this pin


release

public void release()
Release the claim on this pin


openForOutput

public void openForOutput()
Open this pin for output


openForInput

public void openForInput()
Open this pin for input


setState

public void setState(boolean state)
Set this pin to the specified state

Parameters:
state - if true set to high, else low

setHigh

public void setHigh()
Set this pin high


setLow

public void setLow()
Set this pin low


isHigh

public boolean isHigh()
Returns:
true if this pin is high

isLow

public boolean isLow()
Returns:
true if this pin is low

enableIrq

public void enableIrq()
Enable pin change interrupts on this pin


waitForIrq

public void waitForIrq()
                throws InterruptedException
Wait for a pin change interrupt on this pin

Throws:
InterruptedException

disableIrq

public void disableIrq()
Disable pin change interrupts on this pin


toString

public String toString()
Description copied from class: Object
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Overrides:
toString in class Object
Returns:
a string representation of the object.

SunSPOT API V3.0


Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.