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

Classes

struct  Payload
 I2C Datagram payload storage. More...
 

Public Types

enum class  Port { I2C_PORT_1 , I2C_PORT_2 , NUM_I2C_PORTS }
 I2C Port definition. More...
 

Public Member Functions

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

Static Public Attributes

static constexpr size_t I2C_MAX_BUFFER_SIZE = 256
 

Private Attributes

Payload m_i2cDatagram
 

Member Enumeration Documentation

◆ Port

enum class Port
strong

I2C Port definition.

Enumerator
I2C_PORT_1 

I2C Port 1

I2C_PORT_2 

I2C Port 2

NUM_I2C_PORTS 

Number of I2C ports

Constructor & Destructor Documentation

◆ I2C()

I2C ( Payload data)
explicit

Constructs an I2C object with provided payload data.

Parameters
dataReference to payload data

Member Function Documentation

◆ deserialize()

void deserialize ( std::string &  i2cDatagramPayload)

Deserializes I2C data from payload string.

Parameters
i2cDatagramPayloadString containing serialized I2C data

◆ getBuffer()

const uint8_t * getBuffer ( ) const

Gets the I2C buffer.

Returns
Pointer to the buffer array

◆ getBufferLength()

size_t getBufferLength ( ) const

Gets the I2C buffer length.

Returns
Buffer length

◆ getI2CPort()

I2C::Port getI2CPort ( ) const

Gets the target I2C port.

Returns
Target port

◆ serialize()

std::string serialize ( const CommandCode commandCode) const

Serializes I2C data with command code for transmission.

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

◆ setBuffer()

void setBuffer ( const uint8_t *  data,
size_t  length 
)

Sets data in the I2C buffer.

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

◆ setI2CPort()

void setI2CPort ( const Port i2cPort)

Sets the target I2C port.

Parameters
i2cPortPort to set as target

Member Data Documentation

◆ I2C_MAX_BUFFER_SIZE

constexpr size_t I2C_MAX_BUFFER_SIZE = 256
staticconstexpr

Maximum permitted buffer size

◆ m_i2cDatagram

Payload m_i2cDatagram
private

Private datagram payload


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