Driver for the Serial Peripheral Interface (SPI).
Provides functions for configuring and using the SPI.
static void spi_disable |
( |
SPI_t * |
spi | ) |
|
|
inlinestatic |
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 | ) |
|
|
inlinestatic |
Enables the SPI.
- Parameters
-
spi | Base address of the SPI instance. |
static void spi_enable_master_mode |
( |
SPI_t * |
spi | ) |
|
|
inlinestatic |
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 | ) |
|
|
inlinestatic |
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 | ) |
|
|
inlinestatic |
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 | ) |
|
|
inlinestatic |
static void spi_put |
( |
SPI_t * |
spi, |
|
|
uint8_t |
data |
|
) |
| |
|
inlinestatic |
Put one data byte to a SPI peripheral.
- Parameters
-
spi | Base address of the SPI instance. |
data | The data byte to be loaded |
References data.
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
-
- 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
-
References Assert.
Referenced by run_baudrate_set_test(), and spi_master_setup_device().