Skip to content

Class daisy::MultiSlaveSpiHandle

ClassList > daisy > MultiSlaveSpiHandle

More...

  • #include <spiMultislave.h>

Classes

Type Name
struct Config

Public Static Attributes

Type Name
constexpr size_t max_num_devices_ = 4

Public Functions

Type Name
SpiHandle::Result BlockingReceive (size_t device_index, uint8_t * buff, uint16_t size, uint32_t timeout=100)
SpiHandle::Result BlockingTransmit (size_t device_index, uint8_t * buff, size_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)
int CheckError ()
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 DmaTransmit (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)
const Config & GetConfig () const
SpiHandle::Result Init (const Config & config)
MultiSlaveSpiHandle ()
MultiSlaveSpiHandle (const MultiSlaveSpiHandle & other) = delete

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 Static Attributes Documentation

variable max_num_devices_

constexpr size_t daisy::MultiSlaveSpiHandle::max_num_devices_;

Public Functions Documentation

function BlockingReceive

SpiHandle::Result daisy::MultiSlaveSpiHandle::BlockingReceive (
    size_t device_index,
    uint8_t * buff,
    uint16_t size,
    uint32_t timeout=100
) 

Polling Receive

Parameters:

  • device_index the index of the device
  • buff input buffer
  • size buffer size
  • timeout timeout time in ms

Returns:

Whether the receive was successful or not


function BlockingTransmit

SpiHandle::Result daisy::MultiSlaveSpiHandle::BlockingTransmit (
    size_t device_index,
    uint8_t * buff,
    size_t size,
    uint32_t timeout=100
) 

Blocking transmit

Parameters:

  • device_index the index of the device
  • buff input buffer
  • size buffer size
  • timeout timeout time in ms

function BlockingTransmitAndReceive

SpiHandle::Result daisy::MultiSlaveSpiHandle::BlockingTransmitAndReceive (
    size_t device_index,
    uint8_t * tx_buff,
    uint8_t * rx_buff,
    size_t size,
    uint32_t timeout=100
) 

Blocking transmit and receive

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

function CheckError

int daisy::MultiSlaveSpiHandle::CheckError () 

Returns:

the result of HAL_SPI_GetError() to the user.


function DmaReceive

SpiHandle::Result daisy::MultiSlaveSpiHandle::DmaReceive (
    size_t device_index,
    uint8_t * buff,
    size_t size,
    SpiHandle::StartCallbackFunctionPtr start_callback,
    SpiHandle::EndCallbackFunctionPtr end_callback,
    void * callback_context
) 

DMA-based receive

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.

Returns:

Whether the receive was successful or not


function DmaTransmit

SpiHandle::Result daisy::MultiSlaveSpiHandle::DmaTransmit (
    size_t device_index,
    uint8_t * buff,
    size_t size,
    SpiHandle::StartCallbackFunctionPtr start_callback,
    SpiHandle::EndCallbackFunctionPtr end_callback,
    void * callback_context
) 

DMA-based transmit

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.

Returns:

Whether the transmit was successful or not


function DmaTransmitAndReceive

SpiHandle::Result daisy::MultiSlaveSpiHandle::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
) 

DMA-based transmit and receive

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.

Returns:

Whether the receive was successful or not


function GetConfig

inline const  Config & daisy::MultiSlaveSpiHandle::GetConfig () const

Returns the current config.


function Init

SpiHandle::Result daisy::MultiSlaveSpiHandle::Init (
    const  Config & config
) 

Initializes handler


function MultiSlaveSpiHandle [½]

inline daisy::MultiSlaveSpiHandle::MultiSlaveSpiHandle () 

function MultiSlaveSpiHandle [2/2]

daisy::MultiSlaveSpiHandle::MultiSlaveSpiHandle (
    const  MultiSlaveSpiHandle & other
) = delete


The documentation for this class was generated from the following file external-docs/libDaisy/src/per/spiMultislave.h