pflib v3.0.0-rc1-29-g3a901ac
Pretty Fine HGCROC Interaction Library
All Classes Namespaces Files Functions Variables Typedefs Pages
pflib::I2C Class Referenceabstract

Base class which encapsulates the I2C interface, represents a single bus. More...

#include <I2C.h>

Inheritance diagram for pflib::I2C:
[legend]

Public Member Functions

virtual void set_bus_speed (int speed=100)=0
 Set the speed for the bus in kbps.
 
virtual int get_bus_speed ()=0
 Get the speed for the bus in kbps.
 
virtual void write_byte (uint8_t i2c_dev_addr, uint8_t data)=0
 Write a single byte using the efficient interface, and wait for completion.
 
virtual uint8_t read_byte (uint8_t i2c_dev_addr)=0
 Read a single byte using the efficient interface.
 
virtual std::vector< uint8_t > general_write_read (uint8_t i2c_dev_addr, const std::vector< uint8_t > &wdata, int nread=0)=0
 Carry out a write of zero or more bytes followed a by a read of zero or more bytes.
 

Detailed Description

Base class which encapsulates the I2C interface, represents a single bus.

Member Function Documentation

◆ general_write_read()

virtual std::vector< uint8_t > pflib::I2C::general_write_read ( uint8_t i2c_dev_addr,
const std::vector< uint8_t > & wdata,
int nread = 0 )
pure virtual

Carry out a write of zero or more bytes followed a by a read of zero or more bytes.

If either write or read is zero bytes long, it is omitted.

Exceptions
pflib::Exceptionin the case of I2C communication failure

Implemented in pflib::I2C_Linux.

◆ get_bus_speed()

virtual int pflib::I2C::get_bus_speed ( )
pure virtual

Get the speed for the bus in kbps.

Implemented in pflib::I2C_Linux.

◆ read_byte()

virtual uint8_t pflib::I2C::read_byte ( uint8_t i2c_dev_addr)
pure virtual

Read a single byte using the efficient interface.

Exceptions
pflib::Exceptionin the case of I2C communication failure

Implemented in pflib::I2C_Linux.

◆ set_bus_speed()

virtual void pflib::I2C::set_bus_speed ( int speed = 100)
pure virtual

Set the speed for the bus in kbps.

Implemented in pflib::I2C_Linux.

◆ write_byte()

virtual void pflib::I2C::write_byte ( uint8_t i2c_dev_addr,
uint8_t data )
pure virtual

Write a single byte using the efficient interface, and wait for completion.

Exceptions
pflib::Exceptionin the case of I2C communication failure

Implemented in pflib::I2C_Linux.


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