Atmel Software Framework

SPI - Serial Peripheral Interface


Driver for the Serial Peripheral Interface (SPI).

Provides functions for configuring and using the SPI.

Modules

 Related Project(s)
 

In this section you can find all the projects related to the SPI - Serial Peripheral Interface.


Functions

static void spi_disable (SPI_t *spi)
 Disables the SPI.
static void spi_enable (SPI_t *spi)
 Enables the SPI.
static void spi_enable_master_mode (SPI_t *spi)
 Activate SPI master mode of a SPI peripheral.
static uint8_t spi_get (SPI_t *spi)
 Get one data byte to a SPI peripheral.
static bool spi_is_enabled (SPI_t *spi)
 Tests if the SPI is enabled.
static bool spi_is_tx_ok (SPI_t *spi)
 Tests if the SPI contains a received character.
static void spi_put (SPI_t *spi, uint8_t data)
 Put one data byte to a SPI peripheral.
int8_t spi_xmega_set_baud_div (SPI_t *spi, uint32_t baudrate, uint32_t clkper_hz)
 Calculates the SPI baudrate divider.

static void spi_disable ( SPI_t *  spi  )  [inline, static]

Disables the SPI.

Ensures that nothing is transferred while setting up buffers.

Parameters:
spi Base address of the SPI instance.
Warning:
This may cause data loss if used on a slave SPI.
static void spi_enable ( SPI_t *  spi  )  [inline, static]

Enables the SPI.

Parameters:
spi Base address of the SPI instance.
static void spi_enable_master_mode ( SPI_t *  spi  )  [inline, static]

Activate SPI master mode of a SPI peripheral.

Parameters:
spi Base address of the SPI instance.
Warning:
This may cause data loss if used on a slave SPI.

Referenced by spi_master_init().

static uint8_t spi_get ( SPI_t *  spi  )  [inline, static]

Get one data byte to a SPI peripheral.

Parameters:
spi Base address of the SPI instance.
Returns:
The data byte

Referenced by spi_read_single().

static bool spi_is_enabled ( SPI_t *  spi  )  [inline, static]

Tests if the SPI is enabled.

Parameters:
spi Base address of the SPI instance.
Returns:
1 if the SPI is enabled, otherwise 0.
static bool spi_is_tx_ok ( SPI_t *  spi  )  [inline, static]

Tests if the SPI contains a received character.

Parameters:
spi Base address of the SPI instance.
Returns:
1 if the SPI Receive Holding Register is full, otherwise 0.

Referenced by hx8347a_send_byte(), spi_is_rx_full(), spi_is_rx_ready(), spi_is_tx_empty(), and spi_is_tx_ready().

static void spi_put ( SPI_t *  spi,
uint8_t  data 
) [inline, static]

Put one data byte to a SPI peripheral.

Parameters:
spi Base address of the SPI instance.
data The data byte to be loaded

Referenced by spi_write_single().

int8_t spi_xmega_set_baud_div ( SPI_t *  spi,
uint32_t  baudrate,
uint32_t  clkper_hz 
)

Calculates the SPI baudrate divider.

Parameters:
baudrate The expected baudrate on the SPI.
clkper_hz SPI module input clock frequency (Peripheral clock, Hz).
spi The SPI module address
Returns:
Divider or error code.
Return values:
>=0 Success.
<0 Error.
Parameters:
baudrate The expected baudrate on the SPI.
clkper_hz SPI module input clock frequency (Peripheral clock, Hz).
spi The SPI module address
Returns:
Status of operation.
Return values:
>=0 Success.
<0 Error.

References Assert.

Referenced by run_baudrate_set_test(), and spi_master_setup_device().

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines