Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
spi.h File Reference

Architecture independent SPI (Serial Peripheral Interface) API. More...

#include "std.h"
#include "mcu_periph/spi_arch.h"
#include "mcu_periph/sys_time.h"
+ Include dependency graph for spi.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  spi_transaction
 SPI transaction structure. More...
 
struct  spi_periph
 SPI peripheral structure. More...
 

Macros

#define SPI_BLOCKING_TIMEOUT   1.f
 
#define SPI_TRANSACTION_QUEUE_LEN   8
 SPI transaction queue length. More...
 
#define SPI_SLAVE0   0
 
#define SPI_SLAVE1   1
 
#define SPI_SLAVE2   2
 
#define SPI_SLAVE3   3
 
#define SPI_SLAVE4   4
 
#define SPI_SLAVE5   5
 
#define SPI_SLAVE6   6
 
#define SPI_SLAVE7   7
 
#define SPI_SLAVE8   8
 

Typedefs

typedef void(* SPICallback) (struct spi_transaction *trans)
 SPI Callback function. More...
 

Enumerations

enum  SPIMode { SPIMaster , SPISlave }
 
enum  SPISlaveSelect { SPISelectUnselect , SPISelect , SPIUnselect , SPINoSelect }
 SPI slave selection behavior options. More...
 
enum  SPIClockPhase { SPICphaEdge1 , SPICphaEdge2 }
 SPI CPHA (clock phase) options. More...
 
enum  SPIClockPolarity { SPICpolIdleLow , SPICpolIdleHigh }
 SPI CPOL (clock polarity) options. More...
 
enum  SPIDataSizeSelect { SPIDss8bit , SPIDss16bit }
 SPI data word size of transfer. More...
 
enum  SPITransactionStatus {
  SPITransPending , SPITransRunning , SPITransSuccess , SPITransFailed ,
  SPITransDone
}
 SPI transaction status. More...
 
enum  SPIStatus { SPIIdle , SPIRunning }
 SPI peripheral status. More...
 
enum  SPIBitOrder { SPIMSBFirst , SPILSBFirst }
 
enum  SPIClockDiv {
  SPIDiv2 , SPIDiv4 , SPIDiv8 , SPIDiv16 ,
  SPIDiv32 , SPIDiv64 , SPIDiv128 , SPIDiv256
}
 Peripheral clock divider. More...
 

Functions

void spi0_init (void)
 
void spi0_arch_init (void)
 Architecture dependent SPI0 initialization. More...
 
void spi1_init (void)
 
void spi1_arch_init (void)
 Architecture dependent SPI1 initialization. More...
 
void spi2_init (void)
 
void spi2_arch_init (void)
 Architecture dependent SPI2 initialization. More...
 
void spi_init (struct spi_periph *p)
 Initialize a spi peripheral. More...
 
void spi_init_slaves (void)
 Initialize all used slaves and unselect them. More...
 
bool spi_submit (struct spi_periph *p, struct spi_transaction *t)
 Submit a spi transaction. More...
 
static bool spi_blocking_transceive (struct spi_periph *p, struct spi_transaction *t)
 Perform a spi transaction (blocking). More...
 
void spi_slave_select (uint8_t slave)
 Select a slave. More...
 
void spi_slave_unselect (uint8_t slave)
 Unselect a slave. More...
 
bool spi_lock (struct spi_periph *p, uint8_t slave)
 Lock the SPI fifo. More...
 
bool spi_resume (struct spi_periph *p, uint8_t slave)
 Resume the SPI fifo. More...
 
void spi_slave_init (struct spi_periph *p)
 Initialize a spi peripheral in slave mode. More...
 
bool spi_slave_register (struct spi_periph *p, struct spi_transaction *t)
 Register a spi transaction in slave mode (only one transaction can be registered). More...
 
bool spi_slave_wait (struct spi_periph *p)
 Initialized and wait for the next transaction. More...
 

Variables

struct spi_periph spi0
 
struct spi_periph spi1
 receive transferred over DMA More...
 
struct spi_periph spi2
 receive transferred over DMA More...
 

Detailed Description

Architecture independent SPI (Serial Peripheral Interface) API.

Also see the SPI interface page.

Definition in file spi.h.

Macro Definition Documentation

◆ SPI_BLOCKING_TIMEOUT

#define SPI_BLOCKING_TIMEOUT   1.f

Definition at line 40 of file spi.h.