Sun SPOT API
Green Release  


com.sun.spot.sensorboard.hardware
Class ADT7411

java.lang.Object
  extended by com.sun.spot.sensorboard.hardware.SimpleSPIControlledIOChip
      extended by com.sun.spot.sensorboard.hardware.ADT7411
All Implemented Interfaces:
IDriver, IADT7411, ISPIControlledIOChip

public class ADT7411
extends SimpleSPIControlledIOChip
implements IDriver, IADT7411

Class implementing SPI access to the ADT7411 a-to-d converter. It extends SimpleSPIControlledIOChip and provides a constructor that initialises the device. This initialised ADT7411 object can then be used by the classes derived from AbstractADT7411RangeInput to communicate with the device.

Author:
Syntropy

Constructor Summary
ADT7411(ISPI spi)
          Constructor that initialises the device
 
Method Summary
 String name()
          An identifying name for the driver (e.g.
 byte read(byte addr)
          Read a byte from the ADC
 void setAveraging(boolean val)
          Set the global averaging bit of the ADC , if set to true then the part will internally sample 16 times before setting the average value, if false that behaviour is turned off.
 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).
 void write(byte addr, byte value)
          Write a byte to the ADC
 
Methods inherited from class com.sun.spot.sensorboard.hardware.SimpleSPIControlledIOChip
claimedPins, claimPin, getSPI
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.spot.sensorboard.hardware.ISPIControlledIOChip
claimedPins, claimPin, getSPI
 

Constructor Detail

ADT7411

public ADT7411(ISPI spi)
Constructor that initialises the device

Parameters:
spi - ISPI to be used to access the device
Method Detail

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

setAveraging

public void setAveraging(boolean val)
Set the global averaging bit of the ADC , if set to true then the part will internally sample 16 times before setting the average value, if false that behaviour is turned off. when averaging is active the sample rate is slower.

Parameters:
val - state to set averaging to

read

public byte read(byte addr)
Read a byte from the ADC

Specified by:
read in interface IADT7411
Parameters:
addr - address to be read
Returns:
byte read

write

public void write(byte addr,
                  byte value)
Write a byte to the ADC

Specified by:
write in interface IADT7411
Parameters:
addr - address to write
value - to be written

Sun SPOT API
Green Release  


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