peary::interface::I2CEndpoint

Inherits from peary::interface::Endpoint< I2cInterface, uint8_t, uint8_t >

Public Functions

Name
I2CEndpoint(const std::string & bus, uint8_t address)
~I2CEndpoint()
vector_t wordwrite(const uint16_t & reg, const vector_t & data)
vector_t wordread(const uint16_t reg, const unsigned int length)

Protected Functions

Name
virtual data_t write_impl(const data_t & data) overrideWrite a single byte to the I2C bus.
virtual pair_t write_impl(const pair_t & data) overrideWrite a byte to a specific register on the I2C device.
virtual vector_t write_impl(const reg_t & reg, const vector_t & data) overrideWrite multiple bytes to a specific register on the I2C device.
virtual vector_t read_impl(const unsigned int length) overrideRead multiple bytes from the I2C device.
virtual vector_t read_impl(const reg_t & reg, const unsigned int length) overrideRead multiple bytes from a specific register on the I2C device.

Additional inherited members

Public Types inherited from peary::interface::Endpoint< I2cInterface, uint8_t, uint8_t >

Name
using RegisterType reg_t
using DataType data_t
using std::pair< RegisterType, DataType > pair_t
using std::vector< DataType > vector_t

Public Functions inherited from peary::interface::Endpoint< I2cInterface, uint8_t, uint8_t >

Name
Endpoint(const Endpoint & ) =delete
Endpoint & operator=(const Endpoint & ) =delete
Endpoint(Endpoint && ) =delete
Endpoint & operator=(Endpoint && ) =delete
std::string info() constReturn human-readable endpoint information.
data_t write(const data_t & value)Write a single data word to a device which does not contain internal registers.
vector_t write(const vector_t & values)Write multiple data words to a device which does not contain internal registers.
pair_t write(const pair_t & regData)Write a single data word to a device containing internal registers.
vector_t write(const reg_t & reg, const vector_t & values)Write multiple data words to a specific register of a device containing internal registers.
std::vector< pair_t > write(const std::vector< pair_t > & regDataVec)Write multiple data words to multiple registers of a device containing internal registers.
data_t read()Read a single data word from a device which does not contain internal registers.
vector_t read(unsigned int count)Read multiple data words from a device which does not contain internal registers.
vector_t read(const reg_t & reg, unsigned int count)Read a single data word from a specific register of a device containing internal registers.

Protected Functions inherited from peary::interface::Endpoint< I2cInterface, uint8_t, uint8_t >

Name
Endpoint(const std::string & info)
virtual ~Endpoint() =default

Public Functions Documentation

function I2CEndpoint

  I2CEndpoint(
    const std::string & bus,
    uint8_t address
)
  

function ~I2CEndpoint

  ~I2CEndpoint()
  

function wordwrite

  vector_t wordwrite(
    const uint16_t & reg,
    const vector_t & data
)
  

function wordread

  vector_t wordread(
    const uint16_t reg,
    const unsigned int length
)
  

Protected Functions Documentation

function write_impl

  virtual data_t write_impl(
    const data_t & data
) override
  

Write a single byte to the I2C bus.

Parameters:

  • data The byte to write

Return: The byte read back from the device (if any)

Reimplements: peary::interface::Endpoint::write_impl

function write_impl

  virtual pair_t write_impl(
    const pair_t & data
) override
  

Write a byte to a specific register on the I2C device.

Parameters:

  • data A pair containing the register address and the byte to write

Return: A pair containing the register address and the byte read back from the device (if any)

Reimplements: peary::interface::Endpoint::write_impl

function write_impl

  virtual vector_t write_impl(
    const reg_t & reg,
    const vector_t & data
) override
  

Write multiple bytes to a specific register on the I2C device.

Parameters:

  • reg The register address to write to
  • data A vector containing the bytes to write

Return: A vector containing the bytes read back from the device (if any)

Reimplements: peary::interface::Endpoint::write_impl

function read_impl

  virtual vector_t read_impl(
    const unsigned int length
) override
  

Read multiple bytes from the I2C device.

Parameters:

  • length The number of bytes to read

Return: A vector containing the bytes read from the device

Reimplements: peary::interface::Endpoint::read_impl

function read_impl

  virtual vector_t read_impl(
    const reg_t & reg,
    const unsigned int length
) override
  

Read multiple bytes from a specific register on the I2C device.

Parameters:

  • reg The register address to read from
  • length The number of bytes to read

Return: A vector containing the bytes read from the device

Reimplements: peary::interface::Endpoint::read_impl


Updated on 2026-01-30 at 22:01:05 +0100