Contiki 3.x
Files | Functions
SensorTag/LaunchPad SPI functions

Files

file  board-spi.c
 Board-specific SPI driver common to the Sensortag and LaunchPad.
 
file  board-spi.h
 Header file for the Sensortag/LaunchPad SPI Driver.
 

Functions

bool board_spi_write (const uint8_t *buf, size_t length)
 Write to an SPI device. More...
 
bool board_spi_read (uint8_t *buf, size_t length)
 Read from an SPI device. More...
 
void board_spi_flush (void)
 Clear data from the SPI interface. More...
 
void board_spi_open (uint32_t bit_rate, uint32_t clk_pin)
 Initialize the SPI interface. More...
 
void board_spi_close (void)
 Close the SPI interface. More...
 

Detailed Description

Function Documentation

void board_spi_close ( void  )

Close the SPI interface.

Returns
True when successful.

This function will stop clocks to the SSI module and will set MISO, MOSI and CLK to a low leakage state. It is recommended to call this function after a chain of calls to board_spi_read() and board_spi_write()

Definition at line 145 of file board-spi.c.

References BOARD_IOID_SPI_MOSI.

Referenced by ext_flash_close().

void board_spi_flush ( void  )

Clear data from the SPI interface.

Returns
none

Definition at line 105 of file board-spi.c.

References SSI0_BASE.

Referenced by wait_ready().

void board_spi_open ( uint32_t  bit_rate,
uint32_t  clk_pin 
)

Initialize the SPI interface.

Parameters
bit_rateThe bit rate to use
clk_pinThe IOID for the clock pin. This can be IOID_0 etc
Returns
none

This function will make sure the peripheral is powered, clocked and initialised. A chain of calls to board_spi_read(), board_spi_write() and board_spi_flush() must be preceded by a call to this function. It is recommended to call board_spi_close() after such chain of calls.

Definition at line 116 of file board-spi.c.

References BOARD_IOID_SPI_MOSI, and SSI0_BASE.

Referenced by ext_flash_open().

bool board_spi_read ( uint8_t *  buf,
size_t  length 
)

Read from an SPI device.

Parameters
bufThe buffer to store data
lengthThe number of bytes to read
Returns
True when successful.

Calls to this function must be preceded by a call to board_spi_open(). It is recommended to call board_spi_close() at the end of an operation.

Definition at line 83 of file board-spi.c.

References SSI0_BASE.

Referenced by ext_flash_read(), verify_part(), and wait_ready().

bool board_spi_write ( const uint8_t *  buf,
size_t  length 
)

Write to an SPI device.

Parameters
bufThe buffer with the data to write
lengthThe number of bytes to write
Returns
True when successful.

Calls to this function must be preceded by a call to board_spi_open(). It is recommended to call board_spi_close() at the end of an operation.

Definition at line 64 of file board-spi.c.

References SSI0_BASE.

Referenced by ext_flash_erase(), ext_flash_read(), ext_flash_write(), power_down(), power_standby(), verify_part(), wait_ready(), and write_enable().