pflib v3.9.0-rc3-11-g2537d8f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
I2C_Linux.h
1#ifndef PFLIB_I2C_Linux_H_
2#define PFLIB_I2C_Linux_H_
3
4#include <string>
5
6#include "pflib/I2C.h"
7
8namespace pflib {
9
15class I2C_Linux : public I2C {
16 public:
17 I2C_Linux(const std::string& devfile);
18
19 ~I2C_Linux();
20
24 virtual void set_bus_speed(int speed = 100);
25
29 virtual int get_bus_speed();
30
35 void write_byte(uint8_t i2c_dev_addr, uint8_t data);
36
41 uint8_t read_byte(uint8_t i2c_dev_addr);
42
49 std::vector<uint8_t> general_write_read(uint8_t i2c_dev_addr,
50 const std::vector<uint8_t>& wdata,
51 int nread = 0);
52
53 private:
54 void obtain_control(uint8_t i2c_dev_addr);
55
56 private:
57 int handle_;
58 std::string dev_;
59};
60
61} // namespace pflib
62
63#endif // PFLIB_I2C_H_
Definition I2C_Linux.h:15
virtual void set_bus_speed(int speed=100)
Set the speed for the bus in kbps.
Definition I2C_Linux.cxx:34
uint8_t read_byte(uint8_t i2c_dev_addr)
Read a single byte using the efficient interface.
Definition I2C_Linux.cxx:77
virtual int get_bus_speed()
Get the speed for the bus in kbps.
Definition I2C_Linux.cxx:38
void write_byte(uint8_t i2c_dev_addr, uint8_t data)
Write a single byte using the efficient interface, and wait for completion.
Definition I2C_Linux.cxx:71
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.
Definition I2C_Linux.cxx:86
Base class which encapsulates the I2C interface, represents a single bus.
Definition I2C.h:18
This version of the fast control code interfaces with the CMS Fast control library which can be contr...
Definition Backend.cxx:3