mbed library sources
Fork of mbed-src by
Asynchronous SPI Hardware Abstraction Layer
Functions | |
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. | |
uint32_t | spi_irq_handler_asynch (spi_t *obj) |
The asynchronous IRQ handler. | |
uint8_t | spi_active (spi_t *obj) |
Attempts to determine if the SPI peripheral is already in use. | |
void | spi_abort_asynch (spi_t *obj) |
Abort an SPI transfer. |
Function Documentation
void spi_abort_asynch | ( | spi_t * | obj ) |
Abort an SPI transfer.
- Parameters:
-
obj The SPI peripheral to stop
uint8_t spi_active | ( | spi_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] obj The SPI object to check for activity
- Returns:
- non-zero if the SPI port is active or zero if it is not.
uint32_t spi_irq_handler_asynch | ( | spi_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] obj The SPI object which holds the transfer information
- Returns:
- event flags if a transfer termination condition was met or 0 otherwise.
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.
Buffer pointers and lengths are specified in tx_buff and rx_buff
- Parameters:
-
[in] obj The SPI object which holds the transfer information [in] tx The buffer to send [in] tx_length The number of words to transmit [in] rx The buffer to receive [in] rx_length The number of words to receive [in] bit_width The bit width of buffer words [in] event The logical OR of events to be registered [in] handler SPI interrupt handler [in] hint A suggestion for how to use DMA with this transfer
Generated on Tue Jul 12 2022 17:14:56 by
![doxygen](doxygen.png)