Microchip® Advanced Software Framework

xmega_spi/spi_master.h File Reference
#include "compiler.h"
#include "status_codes.h"
#include "ioport.h"
#include "spi.h"
#include "conf_spi_master.h"

Data Structures

struct  spi_device
 Polled SPI device definition. More...
 

Macros

#define SPI_CPHA   (1 << 0)
 Clock phase. More...
 
#define SPI_CPOL   (1 << 1)
 Clock polarity. More...
 
#define SPI_MODE_0   0
 SPI mode 0. More...
 
#define SPI_MODE_1   (SPI_CPHA)
 SPI mode 1. More...
 
#define SPI_MODE_2   (SPI_CPOL)
 SPI mode 2. More...
 
#define SPI_MODE_3   (SPI_CPOL | SPI_CPHA)
 SPI mode 3. More...
 
Spi Master Management Configuration
#define CONFIG_SPI_MASTER_DUMMY   0xFF
 Default Config Spi Master Dummy Field. More...
 

Typedefs

typedef uint32_t board_spi_select_id_t
 
typedef uint8_t spi_flags_t
 

Functions

void spi_deselect_device (SPI_t *spi, struct spi_device *device)
 Deselect given device on the SPI bus. More...
 
void spi_disable (SPI_t *spi)
 Disables the SPI. More...
 
void spi_enable (SPI_t *spi)
 Enables the SPI. More...
 
bool spi_is_enabled (SPI_t *spi)
 Tests if the SPI is enabled. More...
 
static bool spi_is_rx_full (SPI_t *spi)
 Tests if the SPI contains a received character. More...
 
static bool spi_is_rx_ready (SPI_t *spi)
 Checks if all reception is ready. More...
 
static bool spi_is_tx_empty (SPI_t *spi)
 Checks if all transmissions are complete. More...
 
static bool spi_is_tx_ready (SPI_t *spi)
 Checks if all transmissions is ready. More...
 
void spi_master_init (SPI_t *spi)
 Initializes the SPI in master mode. More...
 
void spi_master_setup_device (SPI_t *spi, struct spi_device *device, spi_flags_t flags, unsigned long baud_rate, board_spi_select_id_t sel_id)
 Setup a SPI device. More...
 
status_code_t spi_read_packet (SPI_t *spi, uint8_t *data, size_t len)
 Receive a sequence of bytes from a SPI device. More...
 
static void spi_read_single (SPI_t *spi, uint8_t *data)
 Receive one byte from a SPI device. More...
 
void spi_select_device (SPI_t *spi, struct spi_device *device)
 Select given device on the SPI bus. More...
 
status_code_t spi_write_packet (SPI_t *spi, const uint8_t *data, size_t len)
 Send a sequence of bytes to a SPI device. More...
 
static __always_inline void spi_write_single (SPI_t *spi, uint8_t data)
 Write one byte to a SPI device. More...