SunSPOT API V5.0


com.sun.spot.peripheral.external
Class BoardDeviceSPI

java.lang.Object
  extended by com.sun.spot.peripheral.external.BoardDeviceSPI
All Implemented Interfaces:
ISPI

public class BoardDeviceSPI
extends Object
implements ISPI

SPI implementation that hides the use of a DeviceSelector before sending SPI commands.

See ISPI for details of usage.


Constructor Summary
BoardDeviceSPI(int deviceAddress, PeripheralChipSelect chipSelect, int spiConfiguration)
          Create a BoardDeviceSPI using the supplied device address.
 
Method Summary
 void send16bits(int i)
          Send 16 bits of data.
 void sendSPICommand(byte[] commandSequence, byte[] readByteSequence)
          Send and receive using SPI.
 void sendSPICommand(byte[] commandSequence, int commandLength, byte[] readByteSequence, int readLength)
          Send and receive using SPI.
 void sendSPICommand(byte[] commandSequence, int commandLength, byte[] readByteSequence, int readLength, int readOffset)
          Send and receive using SPI.
 void setConfiguration(int config)
          Set the configuration of the SPI communications for this device.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoardDeviceSPI

public BoardDeviceSPI(int deviceAddress,
                      PeripheralChipSelect chipSelect,
                      int spiConfiguration)
Create a BoardDeviceSPI using the supplied device address. See ISpiMaster for details of SPI configuration settings.

Parameters:
deviceAddress - The device address to use when accessing the SPI
chipSelect - The board chip select of the board that this device is on
spiConfiguration - Value to be written into SPI_CSR for transfers to this device
Method Detail

send16bits

public void send16bits(int i)
Description copied from interface: ISPI
Send 16 bits of data.

Specified by:
send16bits in interface ISPI
Parameters:
i - The data to send (least sig. 16 bits only), MSB first.

sendSPICommand

public void sendSPICommand(byte[] commandSequence,
                           byte[] readByteSequence)
Description copied from interface: ISPI
Send and receive using SPI. Data is sent and received at the same time. All the data in the commandSequence is sent, and n bytes are simultaneously received, where n is the length of the readByteSequence.

Specified by:
sendSPICommand in interface ISPI
Parameters:
commandSequence - The data to send
readByteSequence - An array into which the received data is placed

sendSPICommand

public void sendSPICommand(byte[] commandSequence,
                           int commandLength,
                           byte[] readByteSequence,
                           int readLength)
Description copied from interface: ISPI
Send and receive using SPI. Data is sent and received at the same time.

Specified by:
sendSPICommand in interface ISPI
Parameters:
commandSequence - The data to send
commandLength - The number of bytes to send
readByteSequence - An array into which the received data is placed
readLength - The number of bytes to receive

sendSPICommand

public void sendSPICommand(byte[] commandSequence,
                           int commandLength,
                           byte[] readByteSequence,
                           int readLength,
                           int readOffset)
Description copied from interface: ISPI
Send and receive using SPI. Receiving can be delayed relative to sending.

Specified by:
sendSPICommand in interface ISPI
Parameters:
commandSequence - The data to send
commandLength - The number of bytes to send
readByteSequence - An array into which the received data is placed
readLength - The number of bytes to receive
readOffset - The number of bytes to send before beginning reception

setConfiguration

public void setConfiguration(int config)
Description copied from interface: ISPI
Set the configuration of the SPI communications for this device. The configuration sets up speed etc as per SPI_CSRx. Constants for the configuration are defined in: ISpiMaster

Specified by:
setConfiguration in interface ISPI
Parameters:
config - The configuration of the SPI communications to use for this device.

SunSPOT API V5.0


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