20 #ifndef MBED_SPI_API_H    21 #define MBED_SPI_API_H    25 #include "hal/dma_api.h"    26 #include "hal/buffer.h"    30 #define SPI_EVENT_ERROR       (1 << 1)    31 #define SPI_EVENT_COMPLETE    (1 << 2)    32 #define SPI_EVENT_RX_OVERFLOW (1 << 3)    33 #define SPI_EVENT_ALL         (SPI_EVENT_ERROR | SPI_EVENT_COMPLETE | SPI_EVENT_RX_OVERFLOW)    35 #define SPI_EVENT_INTERNAL_TRANSFER_COMPLETE (1 << 30) // Internal flag to report that an event occurred    37 #define SPI_FILL_WORD         (0xFFFF)    38 #define SPI_FILL_CHAR         (0xFF)    52 typedef struct spi_s 
spi_t;
   117 #ifdef DEVICE_SPI_COUNT   125 SPIName spi_get_peripheral_name(PinName mosi, PinName miso, PinName mclk);
   137 void spi_init(
spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel);
   314 #if DEVICE_SPI_ASYNCH   332 void spi_master_transfer(
spi_t *obj, 
const void *tx, 
size_t tx_length, 
void *rx, 
size_t rx_length, uint8_t bit_width, uint32_t handler, uint32_t event, DMAUsage hint);
   369 #endif // __cplusplus   373 #endif // MBED_SPI_API_H uint8_t spi_active(spi_t *obj)
Attempts to determine if the SPI peripheral is already in use. 
const PinMap * spi_master_mosi_pinmap(void)
Get the pins that support SPI MOSI. 
Generic buffer structure. 
uint32_t spi_irq_handler_asynch(spi_t *obj)
The asynchronous IRQ handler. 
void spi_slave_write(spi_t *obj, int value)
Write a value to the SPI peripheral in slave mode. 
void spi_format(spi_t *obj, int bits, int mode, int slave)
Configure the SPI format. 
void spi_frequency(spi_t *obj, int hz)
Set the SPI baud rate. 
void spi_master_transfer(spi_t *obj, const void *tx, size_t tx_length, void *rx, size_t rx_length, uint8_t bit_width, uint32_t handler, uint32_t event, DMAUsage hint)
Begin the SPI transfer. 
const PinMap * spi_master_miso_pinmap(void)
Get the pins that support SPI MISO. 
const PinMap * spi_master_cs_pinmap(void)
Get the pins that support SPI CS. 
const PinMap * spi_master_clk_pinmap(void)
Get the pins that support SPI CLK. 
void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)
Initialize the SPI peripheral. 
int spi_slave_read(spi_t *obj)
Get a received value out of the SPI receive buffer in slave mode. 
void spi_free(spi_t *obj)
Release a SPI object. 
int spi_master_write(spi_t *obj, int value)
Write a byte out in master mode and receive a value. 
int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, char write_fill)
Write a block out in master mode and receive a value. 
const PinMap * spi_slave_cs_pinmap(void)
Get the pins that support SPI CS. 
const PinMap * spi_slave_mosi_pinmap(void)
Get the pins that support SPI MOSI. 
void spi_abort_asynch(spi_t *obj)
Abort an SPI transfer. 
int spi_slave_receive(spi_t *obj)
Check if a value is available to read. 
const PinMap * spi_slave_clk_pinmap(void)
Get the pins that support SPI CLK. 
uint8_t spi_get_module(spi_t *obj)
Get the module number. 
const PinMap * spi_slave_miso_pinmap(void)
Get the pins that support SPI MISO. 
int spi_busy(spi_t *obj)
Checks if the specified SPI peripheral is in use. 
Asynch SPI HAL structure.