roneos
Operating System for the r-one robot
 All Data Structures Files Functions Variables Typedefs Groups
spi.h File Reference

SPI interface with MSP 430. More...

Go to the source code of this file.

Functions

void SPIInit (void)
 Initializes SPI unit. More...
 
void SPISelectDevice (uint8 device)
 Selects a SPI device and sets its wordsize. More...
 
void SPISelectDeviceISR (uint8 device)
 Selects a SPI device and enable high A,B,C. More...
 
void SPIDeselect (void)
 Cancels all selections. More...
 
void SPIDeselectSynchronous (void)
 Cancels all selections. Then immediately sends a byte of 0xFF. More...
 
boolean SPIDeselectISR (void)
 Deselects all select/latch pins Waits till all transfers are finished. More...
 
void SPISemaphoreGiveFromISR (void)
 
boolean SPIXmitNullByte (uint8 dat)
 Transmits a byte to nothing via SPI. You must already have the mutex and config set up. Does not set the Slave Select line on anything, so you can clock to nothing. Allows for delays such as to the SD Card. More...
 
void SPIXmitNullBytes (uint8 device, uint16 numBytes)
 Transmits a variable number of 0xFF bytes to nothing via SPI. Does not need the mutex to be gotten or the bus to be configured. Essentially talks a set number of null bytes to nothing. Required to send null bytes to set up an SD card like device. Sets the transmit line to high to ensure that the line stays high (required for SD cards). More...
 
void SPIConfigure (uint32 ulBase, uint8 wordSize, uint8 mode, uint32 frequency)
 Sets the SPI word size and data format This function must be called after you have the mutex - after radio max clock freq = 10mhz MSP430 max fre clkI cycles - we might be violating this SD card -fast frequency ~= 2 MHz sound chip - 2s to be 400kHz at first, then bump up speed. More...
 
void SPIConfigureDevice (uint8 device)
 Configures a SPI device to have the correct SPI mode, frequency, and word size. More...
 

Detailed Description

SPI interface with MSP 430.

Since
Mar 26, 2011
Author
James McLurkin

Function Documentation

void SPIConfigure ( uint32  ulBase,
uint8  wordSize,
uint8  mode,
uint32  frequency 
)

Sets the SPI word size and data format This function must be called after you have the mutex - after radio max clock freq = 10mhz MSP430 max fre clkI cycles - we might be violating this SD card -fast frequency ~= 2 MHz sound chip - 2s to be 400kHz at first, then bump up speed.

Parameters
ulBaseis the SSI port
wordSizeis the new word size to be set
modeis the new transmission mode
frequencyis the frequency that the SPI clock will run at
Returns
void
void SPIConfigureDevice ( uint8  device)

Configures a SPI device to have the correct SPI mode, frequency, and word size.

@ param device The device that needs to be configured.

Returns
void
void SPIDeselect ( void  )

Cancels all selections.

Makes all SPI devices inactive.

Returns
void
boolean SPIDeselectISR ( void  )

Deselects all select/latch pins Waits till all transfers are finished.

Returns
if their is a error return FALSE else ture
void SPIDeselectSynchronous ( void  )

Cancels all selections. Then immediately sends a byte of 0xFF.

Makes all SPI devices inactive. Then immediately sends a byte of 0xFF.

Returns
void
void SPIInit ( void  )

Initializes SPI unit.

Enables peripherals Configures GPIO Sets radio, accelerometer, and LED as output Sets word size as 0

Returns
void
void SPISelectDevice ( uint8  device)

Selects a SPI device and sets its wordsize.

Does not select anything if the input parameter is not recognized.

Parameters
deviceto be selected
Returns
void
void SPISelectDeviceISR ( uint8  device)

Selects a SPI device and enable high A,B,C.

Parameters
deviceto be selected
Returns
void
void SPISemaphoreGiveFromISR ( void  )
Returns
void
boolean SPIXmitNullByte ( uint8  dat)

Transmits a byte to nothing via SPI. You must already have the mutex and config set up. Does not set the Slave Select line on anything, so you can clock to nothing. Allows for delays such as to the SD Card.

Parameters
datThe byte that will be sent to nothing.
Returns
boolean TRUE if it was sent correctly, FALSE otherwise.
void SPIXmitNullBytes ( uint8  device,
uint16  numBytes 
)

Transmits a variable number of 0xFF bytes to nothing via SPI. Does not need the mutex to be gotten or the bus to be configured. Essentially talks a set number of null bytes to nothing. Required to send null bytes to set up an SD card like device. Sets the transmit line to high to ensure that the line stays high (required for SD cards).

Parameters
deviceThe device that the fake bytes will be configured to send to.
numBytesThe number of bytes that will be sent..
Returns
boolean TRUE if it was sent correctly, FALSE otherwise.