SunSPOT API V5.0


com.sun.spot.sensorboard.capabilities
Interface IGPIOController

All Known Implementing Classes:
EDemoController

public interface IGPIOController

Controller interface of a GPIO controller. This interface should be able to deal with pins of types input, output and a superset that can be switched dynamically from one to the other.

Author:
arshan

Method Summary
 void disablePinChangeInterrupts(IInputPin pin)
          Stop a pin generating pin change interrupts.
 void enablePinChangeInterrupts(IInputPin pin)
          Allow the input pin specified to generate pin change interrupts.
 boolean getPinDirection(PinDescriptor pidx)
          Get the current direction for the specified input/output pin.
 boolean getPinValue(PinDescriptor pidx)
          Get the current value of the pin, this can be called on both outputs and inputs.
 void setPinDirection(PinDescriptor pidx, boolean output)
          Set the mask for the indicated pin to the indicated direction.
 void setPinValue(PinDescriptor pidx, boolean value)
          Ask the controller to set the pin value.
 

Method Detail

setPinValue

void setPinValue(PinDescriptor pidx,
                 boolean value)
Ask the controller to set the pin value.

Parameters:
pidx - pin to set value of
value - binary value

getPinValue

boolean getPinValue(PinDescriptor pidx)
Get the current value of the pin, this can be called on both outputs and inputs.

Parameters:
pidx - pin to get value of
Returns:
true if pin is currently high

setPinDirection

void setPinDirection(PinDescriptor pidx,
                     boolean output)
Set the mask for the indicated pin to the indicated direction.

Parameters:
pidx - pin to be modified
output - true if user wants the pin to be an output
Throws:
IOPinException - attempt to set pin to illegal direction

getPinDirection

boolean getPinDirection(PinDescriptor pidx)
Get the current direction for the specified input/output pin. This method is meant to be used by accessor objects to the IGPIOController, and bypasses the sanity checks that are assumed to be done by those accessors.

Parameters:
pidx - pin to be modified
Returns:
true if pin is currently an output pin

enablePinChangeInterrupts

void enablePinChangeInterrupts(IInputPin pin)
Allow the input pin specified to generate pin change interrupts. An interrupt can be generated on a low-to-high transition, a high-to-low transition, or both. After enabling the interrupt use:
 synchronized(pin.getIndex()) { pin.getIndex().wait(); } 
to wait for it. Enabling a pin change interrupt does not inhibit deep sleep. Note: only the master isolate actually interacts with the hardware. Any child isolates send a request to enable interrupts to the master isolate. Upon an interrupt the master isolate will send a message to the child isolate.

Parameters:
pin - the input pin

disablePinChangeInterrupts

void disablePinChangeInterrupts(IInputPin pin)
Stop a pin generating pin change interrupts.

Parameters:
pin - the input pin

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.