pflib v3.0.0-rc1-25-gb91774e
Pretty Fine HGCROC Interaction Library
All Classes Namespaces Files Functions Variables Typedefs Pages
pflib::I2C_Linux Class Reference
Inheritance diagram for pflib::I2C_Linux:
[legend]
Collaboration diagram for pflib::I2C_Linux:
[legend]

Public Member Functions

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

Private Attributes

int handle_
 
std::string dev_
 

Member Function Documentation

◆ general_write_read()

std::vector< uint8_t > pflib::I2C_Linux::general_write_read ( uint8_t i2c_dev_addr,
const std::vector< uint8_t > & wdata,
int nread = 0 )
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

Implements pflib::I2C.

◆ get_bus_speed()

int pflib::I2C_Linux::get_bus_speed ( )
virtual

Get the speed for the bus in kbps.

Implements pflib::I2C.

◆ read_byte()

uint8_t pflib::I2C_Linux::read_byte ( uint8_t i2c_dev_addr)
virtual

Read a single byte using the efficient interface.

Exceptions
pflib::Exceptionin the case of I2C communication failure

Implements pflib::I2C.

◆ set_bus_speed()

void pflib::I2C_Linux::set_bus_speed ( int speed = 100)
virtual

Set the speed for the bus in kbps.

Implements pflib::I2C.

◆ write_byte()

void pflib::I2C_Linux::write_byte ( uint8_t i2c_dev_addr,
uint8_t data )
virtual

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

Exceptions
pflib::Exceptionin the case of I2C communication failure

Implements pflib::I2C.


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