20 #ifndef MBED_SPI_API_H    21 #define MBED_SPI_API_H    26 #include "PeripheralNames.h"    31 #include "hal/dma_api.h"    32 #include "hal/buffer.h"   137 typedef struct spi_s spi_t;
   167     SPI_MODE_IDLE_LOW_SAMPLE_FIRST_EDGE,
   168     SPI_MODE_IDLE_LOW_SAMPLE_SECOND_EDGE,
   169     SPI_MODE_IDLE_HIGH_SAMPLE_FIRST_EDGE,
   170     SPI_MODE_IDLE_HIGH_SAMPLE_SECOND_EDGE,
   177     SPI_BIT_ORDERING_MSB_FIRST,
   178     SPI_BIT_ORDERING_LSB_FIRST,
   214 void spi_init(spi_t *obj, 
bool is_slave, PinName mosi, PinName miso, PinName mclk, PinName ssel);
   223 void spi_format(spi_t *obj, uint8_t bits, spi_mode_t mode, spi_bit_ordering_t bit_ordering);
   242 uint32_t 
spi_transfer(spi_t *obj, 
const void *tx, uint32_t tx_len, 
void *rx, uint32_t rx_len, 
const void *fill_symbol);
   316 #ifdef DEVICE_SPI_ASYNCH   340 #endif // DEVICE_SPI_ASYNCH   344 void spi_free(spi_t *obj);
   348 #endif // __cplusplus   352 #endif // MBED_SPI_API_H void spi_init(spi_t *obj, bool is_slave, PinName mosi, PinName miso, PinName mclk, PinName ssel)
Initialized a spi peripheral. 
bool hw_cs_handle
If true, in SPI master mode Chip Select can be handled by hardware. 
const PinMap * spi_slave_mosi_pinmap(void)
Get the pins that support SPI MOSI. 
bool support_slave_mode
If true, the device can handle SPI slave mode using hardware management on the specified ssel pin...
const PinMap * spi_slave_clk_pinmap(void)
Get the pins that support SPI CLK. 
struct _spi_async_event_t spi_async_event_t
Event data reported to interrupt's callback. 
uint32_t minimum_frequency
Minimum frequency supported must be set by target device and it will be assessed during testing...
_spi_bit_ordering_t
SPI bit ordering. 
void(* spi_async_handler_f)(spi_t *obj, void *ctx, spi_async_event_t *event)
Interrupt callback signature. 
const PinMap * spi_slave_miso_pinmap(void)
Get the pins that support SPI MISO. 
Event data reported to interrupt's callback. 
uint32_t maximum_frequency
Maximum frequency supported must be set by target device and it will be assessed during testing...
uint8_t clk_modes
specifies supported modes from spi_mode_t. 
const PinMap * spi_master_clk_pinmap(void)
Get the pins that support SPI CLK. 
void spi_transfer_async_abort(spi_t *obj)
Abort the current asynchronous operation. 
uint8_t bit_order
specifies supported bit order from spi_bit_ordering_t. 
SPIName spi_get_module(PinName mosi, PinName miso, PinName mclk)
Returns a variant of the SPIName enum uniquely identifying a SPI peripheral of the device...
void spi_get_capabilities(SPIName name, PinName ssel, bool slave, spi_capabilities_t *cap)
Fills the given spi_capabilities_t structure with the capabilities of the given peripheral. 
Describes the capabilities of a SPI peripherals. 
bool async_mode
If true, in async mode is supported. 
enum _spi_mode_t spi_mode_t
SPI modes. 
uint32_t spi_frequency(spi_t *obj, uint32_t hz)
Set the frequency target. 
enum _spi_bit_ordering_t spi_bit_ordering_t
SPI bit ordering. 
uint16_t slave_delay_between_symbols_ns
specifies required number of ns between transmission of successive symbols in slave mode...
bool spi_transfer_async(spi_t *obj, const void *tx, uint32_t tx_len, void *rx, uint32_t rx_len, const void *fill_symbol, spi_async_handler_f handler, void *ctx, DMAUsage hint)
Transfer data returning immediately. 
void spi_format(spi_t *obj, uint8_t bits, spi_mode_t mode, spi_bit_ordering_t bit_ordering)
Configure the format to be used by the SPI peripheral. 
const PinMap * spi_master_cs_pinmap(void)
Get the pins that support SPI CS. 
const PinMap * spi_master_mosi_pinmap(void)
Get the pins that support SPI MOSI. 
uint32_t spi_transfer(spi_t *obj, const void *tx, uint32_t tx_len, void *rx, uint32_t rx_len, const void *fill_symbol)
Transfer data blocking until the end of the operation. 
bool half_duplex
If true, the device also supports SPI transmissions using only 3 wires. 
const PinMap * spi_slave_cs_pinmap(void)
Get the pins that support SPI CS. 
uint32_t word_length
Each bit represents the corresponding word length. 
const PinMap * spi_master_miso_pinmap(void)
Get the pins that support SPI MISO.