Tsungta Wu / Mbed OS mbed_SPIS_multiByte_example
Embed: (wiki syntax)

« Back to documentation index

Asynchronous SPI Hardware Abstraction Layer

Asynchronous SPI Hardware Abstraction Layer
[Hal]

Functions

void spi_master_transfer_multibyte (spi_mb_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.
uint32_t spi_irq_handler_asynch_multibyte (spi_mb_t *obj)
 The asynchronous IRQ handler.
uint8_t spi_active_multibyte (spi_mb_t *obj)
 Attempts to determine if the SPI peripheral is already in use.
void spi_abort_asynch_multibyte (spi_mb_t *obj)
 Abort an SPI transfer.

Function Documentation

void spi_abort_asynch_multibyte ( spi_mb_t obj )

Abort an SPI transfer.

Parameters:
objThe SPI peripheral to stop

Definition at line 536 of file spi_api_multibyte.c.

uint8_t spi_active_multibyte ( spi_mb_t obj )

Attempts to determine if the SPI peripheral is already in use.

If a temporary DMA channel has been allocated, peripheral is in use. If a permanent DMA channel has been allocated, check if the DMA channel is in use. If not, proceed as though no DMA channel were allocated. If no DMA channel is allocated, check whether tx and rx buffers have been assigned. For each assigned buffer, check if the corresponding buffer position is less than the buffer length. If buffers do not indicate activity, check if there are any bytes in the FIFOs.

Parameters:
[in]objThe SPI object to check for activity
Returns:
Non-zero if the SPI port is active or zero if it is not.

Definition at line 529 of file spi_api_multibyte.c.

uint32_t spi_irq_handler_asynch_multibyte ( spi_mb_t obj )

The asynchronous IRQ handler.

Reads the received values out of the RX FIFO, writes values into the TX FIFO and checks for transfer termination conditions, such as buffer overflows or transfer complete.

Parameters:
[in]objThe SPI object that holds the transfer information
Returns:
Event flags if a transfer termination condition was met; otherwise 0.

Definition at line 522 of file spi_api_multibyte.c.

void spi_master_transfer_multibyte ( spi_mb_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.

Buffer pointers and lengths are specified in tx_buff and rx_buff

Parameters:
[in]objThe SPI object that holds the transfer information
[in]txThe transmit buffer
[in]tx_lengthThe number of bytes to transmit
[in]rxThe receive buffer
[in]rx_lengthThe number of bytes to receive
[in]bit_widthThe bit width of buffer words
[in]eventThe logical OR of events to be registered
[in]handlerSPI interrupt handler
[in]hintA suggestion for how to use DMA with this transfer

Definition at line 503 of file spi_api_multibyte.c.