SunSPOT API V3.0


com.sun.spot.peripheral.external
Class ExternalBoard

java.lang.Object
  extended by com.sun.spot.peripheral.external.ExternalBoard
All Implemented Interfaces:
IExternalBoard
Direct Known Subclasses:
AtmegaExternalBoard

public class ExternalBoard
extends Object
implements IExternalBoard

Represents an external board. Used primarily to manage the properties stored in the serial flash memory of any SPOT external board. Acts as the base class for specific board implemenations.


Field Summary
protected static int BOARD_MAGIC_WORD
           
static String ID_PROPERTY_NAME
           
 
Constructor Summary
  ExternalBoard(PeripheralChipSelect pcs)
          Create an interface to the external board
protected ExternalBoard(String partId)
          Create an interface to an external board
 
Method Summary
protected  void forceChipSelectPin(PeripheralChipSelect pin)
          Force the chip select pin to be as specified.
 int getBoardIndex()
          Returns the position of this board in the stack (0 or 1)
 Properties getProperties()
          Get the properties of this board.
 IFlashMemoryDevice getSerialFlash()
          Get the serial flash memory device
protected  void hardwareNotValid()
          Handle the case where no board id matches
 boolean isInstalled()
           
protected  BoardDeviceSPI newBoardDeviceSPI(int deviceAddress, int spiConfiguration)
          Get a BoardDeviceSPI for accessing a device on the board.
 void setProperties(Properties p)
          Set the properties of this board
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_PROPERTY_NAME

public static final String ID_PROPERTY_NAME
See Also:
Constant Field Values

BOARD_MAGIC_WORD

protected static final int BOARD_MAGIC_WORD
See Also:
Constant Field Values
Constructor Detail

ExternalBoard

public ExternalBoard(PeripheralChipSelect pcs)
Create an interface to the external board

Parameters:
pcs - The chip select pin of the board

ExternalBoard

protected ExternalBoard(String partId)
Create an interface to an external board

Parameters:
partId - The part id to match against
Method Detail

getProperties

public Properties getProperties()
Get the properties of this board.

Specified by:
getProperties in interface IExternalBoard
Returns:
The properties which will be empty if unable to read them

setProperties

public void setProperties(Properties p)
                   throws IOException
Set the properties of this board

Specified by:
setProperties in interface IExternalBoard
Parameters:
p - The properties to set.
Throws:
IOException

getSerialFlash

public IFlashMemoryDevice getSerialFlash()
Get the serial flash memory device

Specified by:
getSerialFlash in interface IExternalBoard
Returns:
The memory as an IFlashMemoryDevice

newBoardDeviceSPI

protected BoardDeviceSPI newBoardDeviceSPI(int deviceAddress,
                                           int spiConfiguration)
Get a BoardDeviceSPI for accessing a device on the board. See ISpiMaster for details of SPI configuration settings.

Parameters:
deviceAddress - the index of the device
spiConfiguration - value to be written into SPI_CSR for transfers to this device
Returns:
the BoardDeviceSPI for access to the device

hardwareNotValid

protected void hardwareNotValid()
Handle the case where no board id matches


forceChipSelectPin

protected void forceChipSelectPin(PeripheralChipSelect pin)
Force the chip select pin to be as specified. This is an unusual occurance, since the chip select pin is usually determined by matching against the external board map

Parameters:
pin - SpiPcs for the board

isInstalled

public boolean isInstalled()
Returns:
true if this board is physically present

getBoardIndex

public int getBoardIndex()
Description copied from interface: IExternalBoard
Returns the position of this board in the stack (0 or 1)

Specified by:
getBoardIndex in interface IExternalBoard
Returns:
the position of this board in the stack (0 or 1)

SunSPOT API V3.0


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