Class daisy::SpiHandle¶
#include <spi.h>
Classes¶
Type | Name |
---|---|
struct | Config |
Public Types¶
Type | Name |
---|---|
enum | DmaDirection |
typedef void(* | EndCallbackFunctionPtr |
enum | Result |
typedef void(* | StartCallbackFunctionPtr |
Public Functions¶
Detailed Description¶
Handler for serial peripheral interface
Public Types Documentation¶
enum DmaDirection¶
typedef EndCallbackFunctionPtr¶
A callback to be executed after a dma transfer is completed.
enum Result¶
Return values for Spi functions.
typedef StartCallbackFunctionPtr¶
A callback to be executed right before a dma transfer is started.
Public Functions Documentation¶
function BlockingReceive¶
Polling Receive
Parameters:
buffer
input buffersize
buffer sizetimeout
How long to timeout for in milliseconds
Returns:
Whether the receive was successful or not
function BlockingTransmit¶
Blocking transmit
Parameters:
buff
input buffersize
buffer sizetimeout
how long in milliseconds the function will wait before returning without successful communication
function BlockingTransmitAndReceive¶
Result daisy::SpiHandle::BlockingTransmitAndReceive (
uint8_t * tx_buff,
uint8_t * rx_buff,
size_t size,
uint32_t timeout=100
)
Blocking transmit and receive
Parameters:
tx_buff
the transmit bufferrx_buff
the receive buffersize
the length of the transactiontimeout
how long in milliseconds the function will wait before returning without successful communication
function CheckError¶
Returns:
the result of HAL_SPI_GetError() to the user.
function DmaReceive¶
Result daisy::SpiHandle::DmaReceive (
uint8_t * buff,
size_t size,
SpiHandle::StartCallbackFunctionPtr start_callback,
SpiHandle::EndCallbackFunctionPtr end_callback,
void * callback_context
)
DMA-based receive
Parameters:
*buff
input buffersize
buffer sizestart_callback
A callback to execute when the transfer starts, or NULL. The callback is called from an interrupt, so keep it fast.end_callback
A callback to execute when the transfer finishes, or NULL. The callback is called from an interrupt, so keep it fast.callback_context
A pointer that will be passed back to you in the callbacks.
Returns:
Whether the receive was successful or not
function DmaTransmit¶
Result daisy::SpiHandle::DmaTransmit (
uint8_t * buff,
size_t size,
SpiHandle::StartCallbackFunctionPtr start_callback,
SpiHandle::EndCallbackFunctionPtr end_callback,
void * callback_context
)
DMA-based transmit
Parameters:
*buff
input buffersize
buffer sizestart_callback
A callback to execute when the transfer starts, or NULL. The callback is called from an interrupt, so keep it fast.end_callback
A callback to execute when the transfer finishes, or NULL. The callback is called from an interrupt, so keep it fast.callback_context
A pointer that will be passed back to you in the callbacks.
Returns:
Whether the transmit was successful or not
function DmaTransmitAndReceive¶
Result daisy::SpiHandle::DmaTransmitAndReceive (
uint8_t * tx_buff,
uint8_t * rx_buff,
size_t size,
SpiHandle::StartCallbackFunctionPtr start_callback,
SpiHandle::EndCallbackFunctionPtr end_callback,
void * callback_context
)
DMA-based transmit and receive
Parameters:
tx_buff
the transmit bufferrx_buff
the receive buffersize
buffer sizestart_callback
A callback to execute when the transfer starts, or NULL. The callback is called from an interrupt, so keep it fast.end_callback
A callback to execute when the transfer finishes, or NULL. The callback is called from an interrupt, so keep it fast.callback_context
A pointer that will be passed back to you in the callbacks.
Returns:
Whether the receive was successful or not
function GetConfig¶
Returns the current config.
function Init¶
Initializes handler
function SpiHandle [½]¶
function SpiHandle [2/2]¶
function operator=¶
The documentation for this class was generated from the following file external-docs/libDaisy/src/per/spi.h