daisy::MultiSlaveSpiHandle¶
Module: LIBDAISY / PERIPHERAL / SERIAL
#include <spiMultislave.h>
Public Classes¶
Name | |
---|---|
struct | Config |
Public Functions¶
Name | |
---|---|
MultiSlaveSpiHandle() | |
MultiSlaveSpiHandle(const MultiSlaveSpiHandle & other) =delete | |
SpiHandle::Result | Init(const Config & config) |
const Config & | GetConfig() const |
SpiHandle::Result | BlockingTransmit(size_t device_index, uint8_t * buff, size_t size, uint32_t timeout =100) |
SpiHandle::Result | BlockingReceive(size_t device_index, uint8_t * buff, uint16_t size, uint32_t timeout =100) |
SpiHandle::Result | BlockingTransmitAndReceive(size_t device_index, uint8_t * tx_buff, uint8_t * rx_buff, size_t size, uint32_t timeout =100) |
SpiHandle::Result | DmaTransmit(size_t device_index, uint8_t * buff, size_t size, SpiHandle::StartCallbackFunctionPtr start_callback, SpiHandle::EndCallbackFunctionPtr end_callback, void * callback_context) |
SpiHandle::Result | DmaReceive(size_t device_index, uint8_t * buff, size_t size, SpiHandle::StartCallbackFunctionPtr start_callback, SpiHandle::EndCallbackFunctionPtr end_callback, void * callback_context) |
SpiHandle::Result | DmaTransmitAndReceive(size_t device_index, uint8_t * tx_buff, uint8_t * rx_buff, size_t size, SpiHandle::StartCallbackFunctionPtr start_callback, SpiHandle::EndCallbackFunctionPtr end_callback, void * callback_context) |
int | CheckError() |
Public Attributes¶
Name | |
---|---|
constexpr size_t | max_num_devices_ |
Detailed Description¶
Handler for a serial peripheral interface that connects to multiple devices on one bus such that up to 4 devices can share the same MOSI, MISO and SCLK pins. Each device has its own NSS/CS pin which is software driven by the MultiSlaveSpiHandle.
Public Functions Documentation¶
function MultiSlaveSpiHandle¶
function MultiSlaveSpiHandle¶
function Init¶
Initializes handler
function GetConfig¶
Returns the current config.
function BlockingTransmit¶
SpiHandle::Result BlockingTransmit(
size_t device_index,
uint8_t * buff,
size_t size,
uint32_t timeout =100
)
Parameters:
- device_index the index of the device
- buff input buffer
- size buffer size
- timeout timeout time in ms
Blocking transmit
function BlockingReceive¶
SpiHandle::Result BlockingReceive(
size_t device_index,
uint8_t * buff,
uint16_t size,
uint32_t timeout =100
)
Parameters:
- device_index the index of the device
- buff input buffer
- size buffer size
- timeout timeout time in ms
Return: Whether the receive was successful or not
Polling Receive
function BlockingTransmitAndReceive¶
SpiHandle::Result BlockingTransmitAndReceive(
size_t device_index,
uint8_t * tx_buff,
uint8_t * rx_buff,
size_t size,
uint32_t timeout =100
)
Parameters:
- device_index the index of the device
- tx_buff the transmit buffer
- rx_buff the receive buffer
- size the length of the transaction
- timeout timeout time in ms
Blocking transmit and receive
function DmaTransmit¶
SpiHandle::Result DmaTransmit(
size_t device_index,
uint8_t * buff,
size_t size,
SpiHandle::StartCallbackFunctionPtr start_callback,
SpiHandle::EndCallbackFunctionPtr end_callback,
void * callback_context
)
Parameters:
- device_index the index of the device
- buff transmit buffer
- size buffer size
- start_callback A callback to execute when the transfer starts, or NULL.
- end_callback A callback to execute when the transfer finishes, or NULL.
- callback_context A pointer that will be passed back to you in the callbacks.
Return: Whether the transmit was successful or not
DMA-based transmit
function DmaReceive¶
SpiHandle::Result DmaReceive(
size_t device_index,
uint8_t * buff,
size_t size,
SpiHandle::StartCallbackFunctionPtr start_callback,
SpiHandle::EndCallbackFunctionPtr end_callback,
void * callback_context
)
Parameters:
- device_index the index of the device
- buff receive buffer
- size buffer size
- start_callback A callback to execute when the transfer starts, or NULL.
- end_callback A callback to execute when the transfer finishes, or NULL.
- callback_context A pointer that will be passed back to you in the callbacks.
Return: Whether the receive was successful or not
DMA-based receive
function DmaTransmitAndReceive¶
SpiHandle::Result DmaTransmitAndReceive(
size_t device_index,
uint8_t * tx_buff,
uint8_t * rx_buff,
size_t size,
SpiHandle::StartCallbackFunctionPtr start_callback,
SpiHandle::EndCallbackFunctionPtr end_callback,
void * callback_context
)
Parameters:
- device_index the index of the device
- tx_buff the transmit buffer
- rx_buff the receive buffer
- size buffer size
- start_callback A callback to execute when the transfer starts, or NULL.
- end_callback A callback to execute when the transfer finishes, or NULL.
- callback_context A pointer that will be passed back to you in the callbacks.
Return: Whether the receive was successful or not
DMA-based transmit and receive
function CheckError¶
Return: the result of HAL_SPI_GetError() to the user.
Public Attributes Documentation¶
variable max_num_devices_¶
Updated on 2024-01-03 at 19:41:01 +0000