|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ISpiMaster
Interface to the SPI master controller. The SPI transfers are done by C code (in spi.c). The transfer is done using DMA in most cases (some small transfers don't bother with it). Each call to the transfer operations defined in this interface require a SpiPcs parameter which defines the peripheral chip select that is to be used (ie which of the 4 channels) plus the configuration required. The configuration is as per the SPI_CSRx register definition. Constants for the fields in the CSR are defined in this interface. Details can be found in the Atmel AT91RM9200 datasheet.
| Field Summary | |
|---|---|
static int |
CSR_BITS_10
|
static int |
CSR_BITS_11
|
static int |
CSR_BITS_12
|
static int |
CSR_BITS_13
|
static int |
CSR_BITS_14
|
static int |
CSR_BITS_15
|
static int |
CSR_BITS_16
|
static int |
CSR_BITS_8
|
static int |
CSR_BITS_9
|
static int |
CSR_CPOL
|
static int |
CSR_DLYBCT
|
static int |
CSR_DLYBCT_1
|
static int |
CSR_DLYBCT_10
|
static int |
CSR_DLYBCT_100
|
static int |
CSR_DLYBCT_2
|
static int |
CSR_DLYBCT_200
|
static int |
CSR_DLYBCT_50
|
static int |
CSR_DLYBS
|
static int |
CSR_MODE0
|
static int |
CSR_MODE1
|
static int |
CSR_MODE2
|
static int |
CSR_MODE3
|
static int |
CSR_NCPHA
|
static int |
CSR_SCBR
|
static int |
CSR_SCBR_1MHZ
|
static int |
CSR_SCBR_250K
|
static int |
CSR_SCBR_2MHZ
|
static int |
CSR_SCBR_3MHZ
|
static int |
CSR_SCBR_6MHZ
|
| Method Summary | |
|---|---|
void |
sendAndReceive(SpiPcs pcs,
int txSize,
byte[] tx,
int rxOffset,
int rxSize,
byte[] rx)
General SPI send and receive |
void |
sendAndReceive(SpiPcs pcs,
int deviceAddress,
int txSize,
byte[] tx,
int rxOffset,
int rxSize,
byte[] rx)
General SPI send and receive |
int |
sendReceive8(SpiPcs pcs,
int data)
SPI send of 8 bits, plus simultaneous receive of 8 bits |
int |
sendReceive8PlusReceive16(SpiPcs pcs,
int first)
SPI send of 8 bits, plus simultaneous receive of 8 bits, then receive 16 bits |
int |
sendReceive8PlusSend16(SpiPcs pcs,
int first,
int subsequent)
SPI send of 8 bits, plus simultaneous receive of 8 bits, then send 16 bits |
int |
sendReceive8PlusSendN(SpiPcs pcs,
int first,
int size,
byte[] subsequent)
SPI send of 8 bits, simultaneous receive of 8 bits, then send of multiple 8 bits |
int |
sendReceive8PlusVariableReceiveN(SpiPcs pcs,
int first,
byte[] subsequent,
PIOPin fifo_pin)
Specialised SPI send of 8 bits, simultaneous receive of 8 bits, then receive of multiple 8 bits This routine is highly specialised for the CC2420 the number of bytes received is determined by the 7 bit value read as the first byte after the initial 8 bits |
void |
setLoopback(boolean b)
Allows the loopback feature to be turned on and off. |
| Field Detail |
|---|
static final int CSR_CPOL
static final int CSR_NCPHA
static final int CSR_MODE0
static final int CSR_MODE1
static final int CSR_MODE2
static final int CSR_MODE3
static final int CSR_BITS_8
static final int CSR_BITS_9
static final int CSR_BITS_10
static final int CSR_BITS_11
static final int CSR_BITS_12
static final int CSR_BITS_13
static final int CSR_BITS_14
static final int CSR_BITS_15
static final int CSR_BITS_16
static final int CSR_SCBR
static final int CSR_SCBR_1MHZ
static final int CSR_SCBR_2MHZ
static final int CSR_SCBR_3MHZ
static final int CSR_SCBR_6MHZ
static final int CSR_SCBR_250K
static final int CSR_DLYBS
static final int CSR_DLYBCT
static final int CSR_DLYBCT_1
static final int CSR_DLYBCT_2
static final int CSR_DLYBCT_10
static final int CSR_DLYBCT_50
static final int CSR_DLYBCT_100
static final int CSR_DLYBCT_200
| Method Detail |
|---|
int sendReceive8(SpiPcs pcs,
int data)
pcs - SPI Peripheral Chip Select to usedata - the data to send in bits 7:0
int sendReceive8PlusSend16(SpiPcs pcs,
int first,
int subsequent)
pcs - SPI Peripheral Chip Select to usefirst - the data to send in bits 0:7subsequent - the subsequent bytes to send, bits 15:8 then bits 7:0
int sendReceive8PlusSendN(SpiPcs pcs,
int first,
int size,
byte[] subsequent)
pcs - SPI Peripheral Chip Select to usefirst - the first 8 bits to send in bits 7:0size - number of bytes to sendsubsequent - the bytes to send
void sendAndReceive(SpiPcs pcs,
int txSize,
byte[] tx,
int rxOffset,
int rxSize,
byte[] rx)
pcs - SPI Peripheral Chip Select to usetxSize - the number of bytes to sendtx - the bytes to sendrxOffset - positive integer indicating the number of bytes transmitted before rx beginsrxSize - the number of bytes to receiverx - buffer for the received bytes
void sendAndReceive(SpiPcs pcs,
int deviceAddress,
int txSize,
byte[] tx,
int rxOffset,
int rxSize,
byte[] rx)
pcs - SPI Peripheral Chip Select to usedeviceAddress - Board device address to usetxSize - the number of bytes to sendtx - the bytes to sendrxOffset - positive integer indicating the number of bytes transmitted before rx beginsrxSize - the number of bytes to receiverx - buffer for the received bytes
int sendReceive8PlusReceive16(SpiPcs pcs,
int first)
pcs - SPI Peripheral Chip Select to usefirst - the data to send in bits 0:7
int sendReceive8PlusVariableReceiveN(SpiPcs pcs,
int first,
byte[] subsequent,
PIOPin fifo_pin)
pcs - SPI Peripheral Chip Select to usefirst - the first 8 bits to send in bits 7:0subsequent - byte array to receive data; length (max 127 not including length byte) will be written into first bytefifo_pin - pin to test for overflow. The INVERSE state of this bit is written into the top bit of the length byte.
void setLoopback(boolean b)
b - true to turn loopback on, false to turn it off
|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||