Midnight Sun Firmware
Loading...
Searching...
No Matches
SPI
Collaboration diagram for SPI:

Classes

struct  Payload
 SPI Datagram payload storage. More...
 

Public Types

enum class  Port { SPI_PORT_1 , SPI_PORT_2 , NUM_SPI_PORTS }
 SPI Port definition. More...
 

Public Member Functions

 SPI (Payload &data)
 Constructs a SPI object with provided payload data. More...
 
 SPI ()=default
 Default constructor for SPI object.
 
std::string serialize (const CommandCode &commandCode) const
 Serializes SPI data with command code for transmission. More...
 
void deserialize (std::string &spiDatagramPayload)
 Deserializes SPI data from payload string. More...
 
void setSPIPort (const Port &spiPort)
 Sets the target SPI port. More...
 
void setBuffer (const uint8_t *data, size_t length)
 Sets data in the SPI buffer. More...
 
void clearBuffer ()
 Clear the SPI data buffer.
 
Port getSPIPort () const
 Gets the target SPI port. More...
 
size_t getBufferLength () const
 Gets the SPI buffer length. More...
 
const uint8_t * getBuffer () const
 Gets the SPI buffer. More...
 

Static Public Attributes

static constexpr size_t SPI_MAX_BUFFER_SIZE = 256
 

Private Attributes

Payload m_spiDatagram
 

Member Enumeration Documentation

◆ Port

enum class Port
strong

SPI Port definition.

Enumerator
SPI_PORT_1 

SPI Port 1

SPI_PORT_2 

SPI Port 2

NUM_SPI_PORTS 

Number of SPI ports

Constructor & Destructor Documentation

◆ SPI()

SPI ( Payload data)
explicit

Constructs a SPI object with provided payload data.

Parameters
dataReference to payload data

Member Function Documentation

◆ deserialize()

void deserialize ( std::string &  spiDatagramPayload)

Deserializes SPI data from payload string.

Parameters
spiDatagramPayloadString containing serialized SPI data

◆ getBuffer()

const uint8_t * getBuffer ( ) const

Gets the SPI buffer.

Returns
Pointer to the buffer array

◆ getBufferLength()

size_t getBufferLength ( ) const

Gets the SPI buffer length.

Returns
Buffer length

◆ getSPIPort()

SPI::Port getSPIPort ( ) const

Gets the target SPI port.

Returns
Target port

◆ serialize()

std::string serialize ( const CommandCode commandCode) const

Serializes SPI data with command code for transmission.

Parameters
commandCodeCommand code to include in serialized data
Returns
Serialized string containing SPI data

◆ setBuffer()

void setBuffer ( const uint8_t *  data,
size_t  length 
)

Sets data in the SPI buffer.

Parameters
dataPointer to data to copy into buffer
lengthLength of data to copy

◆ setSPIPort()

void setSPIPort ( const Port spiPort)

Sets the target SPI port.

Parameters
spiPortPort to set as target

Member Data Documentation

◆ m_spiDatagram

Payload m_spiDatagram
private

Private datagram payload

◆ SPI_MAX_BUFFER_SIZE

constexpr size_t SPI_MAX_BUFFER_SIZE = 256
staticconstexpr

Maximum permitted buffer size


The documentation for this class was generated from the following files: