SunSPOT API V3.0


com.sun.spot.sensorboard.io
Class InputPin

java.lang.Object
  extended by com.sun.spot.sensorboard.io.InputPin
All Implemented Interfaces:
IInputPin

public class InputPin
extends Object
implements IInputPin

Accessor object for input only GPIO pins.


Constructor Summary
InputPin(PinDescriptor idx, IGPIOController cntrl)
           
 
Method Summary
 void addIInputPinListener(IInputPinListener who)
          Adds the specified input pin listener to receive callbacks from this input pin.
 IInputPinListener[] getIInputPinListeners()
          Returns an array of all the input pin listeners registered on this input pin.
 PinDescriptor getIndex()
          Return the PinDescriptor associated with this input pin.
 boolean isHigh()
          Return true if the input bit is high.
 boolean isLow()
          Return true if the input bit is low.
 void notifyIInputPinListeners(boolean nowHigh)
          Called by pin's IGPIOController when pin state changes.
 void removeIInputPinListener(IInputPinListener who)
          Removes the specified input pin listener so that it no longer receives callbacks from this input pin.
 void waitForChange()
          Block the current thread until the pin's state changes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputPin

public InputPin(PinDescriptor idx,
                IGPIOController cntrl)
Method Detail

isLow

public boolean isLow()
Return true if the input bit is low.

Specified by:
isLow in interface IInputPin
Returns:
true if the input bit is low.

isHigh

public boolean isHigh()
Return true if the input bit is high.

Specified by:
isHigh in interface IInputPin
Returns:
true if the input bit is high.

waitForChange

public void waitForChange()
Block the current thread until the pin's state changes. (This now uses interrupts and no longer polls.) Note: waitForChange does not inhibit deep sleep.

Specified by:
waitForChange in interface IInputPin

getIndex

public PinDescriptor getIndex()
Return the PinDescriptor associated with this input pin.

Specified by:
getIndex in interface IInputPin
Returns:
the PinDescriptor associated with this input pin.

addIInputPinListener

public void addIInputPinListener(IInputPinListener who)
Adds the specified input pin listener to receive callbacks from this input pin. Note: that if pin changes happen too fast some transitions may be missed. At least 3 milliseconds is required between pin changes.

Specified by:
addIInputPinListener in interface IInputPin
Parameters:
who - the input pin listener to add.

removeIInputPinListener

public void removeIInputPinListener(IInputPinListener who)
Removes the specified input pin listener so that it no longer receives callbacks from this input pin. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this input pin.

Specified by:
removeIInputPinListener in interface IInputPin
Parameters:
who - the input pin listener to remove.

getIInputPinListeners

public IInputPinListener[] getIInputPinListeners()
Returns an array of all the input pin listeners registered on this input pin.

Specified by:
getIInputPinListeners in interface IInputPin
Returns:
all of this input pin's listeners or an empty array if noinput input pin listeners are currently registered.

notifyIInputPinListeners

public void notifyIInputPinListeners(boolean nowHigh)
Called by pin's IGPIOController when pin state changes. Spawns threads to notify any registered IInputPinListeners.

Parameters:
nowHigh - true if pin is currently set to high state.

SunSPOT API V3.0


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