Sun SPOT API
Green Release  


com.sun.spot.sensorboard.peripheral
Class TriColorLED

java.lang.Object
  extended by com.sun.spot.sensorboard.peripheral.TriColorLED
All Implemented Interfaces:
IDriver, ILed, ITriColorLED

public class TriColorLED
extends Object
implements ITriColorLED, IDriver

Provides access to the colored LEDs

Author:
jn151271, arshan 09-Mar-2005 ChangeLog 20-June-2006 Im changing the way this represents an LED, we represent the functional aspects here, but the communication on the SPI bus is moved back to the LEDController -arshan 17-April-2006 changed initial rgb values to -1 , so that any initial value setting will change the hardware values

Constructor Summary
TriColorLED(PinDescriptor pidx, ITriColorLEDController cntrl)
           
 
Method Summary
 int getBlue()
           
 LEDColor getColor()
          get the current color of the LED
 int getGreen()
           
 int getRed()
           
 boolean isOn()
           
 String name()
          An identifying name for the driver (e.g.
 void setColor(LEDColor rgb)
          Set the color of the LED
 void setOff()
          Turn the LED off
 void setOn()
          Turn the LED on, using the currently stored intensity values (initially full brightness)
 void setOn(boolean on)
          Turn the LED on or off
 void setRGB(int redRGB, int greenRGB, int blueRGB)
          Set the colour of the LED.
 void setUp()
          Activate or reactivate the driver (after a deep sleep or when another driver refused to deep sleep).
 boolean tearDown()
          Deactivate the driver (usually in preparation for deep sleep).
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TriColorLED

public TriColorLED(PinDescriptor pidx,
                   ITriColorLEDController cntrl)
Method Detail

setRGB

public void setRGB(int redRGB,
                   int greenRGB,
                   int blueRGB)
Description copied from interface: ITriColorLED
Set the colour of the LED. The colour will only change if the LED is on, but the values supplied are stored.

Specified by:
setRGB in interface ITriColorLED
Parameters:
redRGB - the intensity of the red portion, in the range 0-255
greenRGB - the intensity of the green portion, in the range 0-255
blueRGB - the intensity of the blue portion, in the range 0-255

setColor

public void setColor(LEDColor rgb)
Description copied from interface: ITriColorLED
Set the color of the LED

Specified by:
setColor in interface ITriColorLED

setOn

public void setOn()
Turn the LED on, using the currently stored intensity values (initially full brightness)

Specified by:
setOn in interface ILed

setOff

public void setOff()
Turn the LED off

Specified by:
setOff in interface ILed

setOn

public void setOn(boolean on)
Turn the LED on or off

Specified by:
setOn in interface ILed
Parameters:
on - turn on if true

isOn

public boolean isOn()
Specified by:
isOn in interface ILed
Returns:
the current state of the LED

getBlue

public int getBlue()
Specified by:
getBlue in interface ITriColorLED
Returns:
the current setting for the blue led

getGreen

public int getGreen()
Specified by:
getGreen in interface ITriColorLED
Returns:
the current setting for the green led

getColor

public LEDColor getColor()
Description copied from interface: ITriColorLED
get the current color of the LED

Specified by:
getColor in interface ITriColorLED

getRed

public int getRed()
Specified by:
getRed in interface ITriColorLED
Returns:
the current setting for the red led

name

public String name()
Description copied from interface: IDriver
An identifying name for the driver (e.g. "AIC" for the AIC driver).

Specified by:
name in interface IDriver
Returns:
The driver name

tearDown

public boolean tearDown()
Description copied from interface: IDriver
Deactivate the driver (usually in preparation for deep sleep). The driver should store any important state and release all resources it has claimed from other drivers.

Specified by:
tearDown in interface IDriver
Returns:
True if the driver is able to deactivate, false if it cannot deactivate (e.g. due to being busy with a data transfer). If any driver returns false, no deep sleep occurs and all other drivers will be reactivated.

setUp

public void setUp()
Description copied from interface: IDriver
Activate or reactivate the driver (after a deep sleep or when another driver refused to deep sleep). The driver should claim all the resources it needs from other drivers and reinitialize its hardware. It should also restore any state saved before tearDown.

Specified by:
setUp in interface IDriver

Sun SPOT API
Green Release  


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