pflib v3.0.0-rc1-29-g3a901ac
Pretty Fine HGCROC Interaction Library
All Classes Namespaces Files Functions Variables Typedefs Pages
I2C.h
1#ifndef PFLIB_I2C_H_
2#define PFLIB_I2C_H_
3
4#include <vector>
5#include <stdint.h>
6#include "pflib/Exception.h"
7
8namespace pflib {
9
14class I2C {
15 protected:
16 I2C() { }
17 public:
18
22 virtual void set_bus_speed(int speed=100) = 0;
23
27 virtual int get_bus_speed() = 0;
28
33 virtual void write_byte(uint8_t i2c_dev_addr, uint8_t data) = 0;
34
39 virtual uint8_t read_byte(uint8_t i2c_dev_addr) = 0;
40
46 virtual std::vector<uint8_t> general_write_read(uint8_t i2c_dev_addr, const std::vector<uint8_t>& wdata, int nread=0) = 0;
47
48};
49
50
51
52}
53
54#endif // PFLIB_I2C_H_
Base class which encapsulates the I2C interface, represents a single bus.
Definition I2C.h:14
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.
virtual void set_bus_speed(int speed=100)=0
Set the speed for the bus in kbps.
This version of the fast control code interfaces with the CMS Fast control library which can be contr...
Definition Backend.cxx:3