pflib v3.9.0-rc3-11-g2537d8f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
I2C.h
1#ifndef PFLIB_I2C_H_
2#define PFLIB_I2C_H_
3
4#include <stdint.h>
5
6#include <vector>
7
8#include "pflib/Exception.h"
9#include "pflib/logging/Logging.h"
10
11namespace pflib {
12
18class I2C {
19 protected:
20 mutable logging::logger the_log_{logging::get("I2C")};
21 I2C() {}
22
23 public:
27 virtual void set_bus_speed(int speed = 100) = 0;
28
32 virtual int get_bus_speed() = 0;
33
38 virtual void write_byte(uint8_t i2c_dev_addr, uint8_t data) = 0;
39
44 virtual uint8_t read_byte(uint8_t i2c_dev_addr) = 0;
45
53 uint8_t i2c_dev_addr, const std::vector<uint8_t>& wdata,
54 int nread = 0) = 0;
55};
56
57} // namespace pflib
58
59#endif // PFLIB_I2C_H_
Base class which encapsulates the I2C interface, represents a single bus.
Definition I2C.h:18
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.
boost::log::sources::severity_channel_logger_mt< level, std::string > logger
our logger type
Definition Logging.h:39
logger get(const std::string &name)
Gets a logger with the input name for its channel.
Definition Logging.cxx:24
This version of the fast control code interfaces with the CMS Fast control library which can be contr...
Definition Backend.cxx:3