15 #include <boost/noncopyable.hpp> 17 namespace duds {
namespace hardware {
namespace interface {
56 class Smbus : boost::noncopyable {
107 virtual std::uint8_t
receiveByte(std::uint8_t cmd) = 0;
125 virtual std::uint16_t
receiveWord(std::uint8_t cmd) = 0;
148 return (result << 8) | (result >> 8);
171 virtual int receive(std::uint8_t cmd, std::uint8_t *in,
172 const int maxlen) = 0;
191 virtual void receive(std::uint8_t cmd, std::vector<std::uint8_t> &in) = 0;
242 virtual void transmitByte(std::uint8_t cmd, std::uint8_t byte) = 0;
260 virtual void transmitWord(std::uint8_t cmd, std::uint16_t word) = 0;
307 const std::uint8_t *out,
330 void transmit(std::uint8_t cmd,
const std::vector<std::uint8_t> &out) {
331 transmit(cmd, &(out[0]), out.size());
352 virtual std::uint16_t
call(std::uint8_t cmd, std::uint16_t word) = 0;
376 const std::vector<std::uint8_t> &out,
377 std::vector<std::uint8_t> &in
383 virtual int address()
const = 0;
388 #endif // #ifndef SMBUS_HPP virtual std::uint16_t call(std::uint8_t cmd, std::uint16_t word)=0
Does a process call operation.
virtual void transmitWord(std::uint8_t cmd, std::uint16_t word)=0
Sends a command byte and a data word to the device.
virtual void transmitByte(std::uint8_t byte)=0
Sends a single byte to the device.
void transmitWordBe(std::uint8_t cmd, std::uint16_t word)
Sends a command byte and a big-endian data word to the device.
virtual int address() const =0
Returns the address of the device that this object will attempt to communicate with.
Use with constructors to specify that Packet Error Checking (PEC) will not be used.
virtual std::uint16_t receiveWord(std::uint8_t cmd)=0
Sends a command byte, then reads a word, two bytes, from the device.
std::uint16_t receiveWordBe(std::uint8_t cmd)
Sends a command byte, then reads a big-endian word from the device.
An interface for communication with a SMBus device.
Use with constructors to explicitly specify that Packet Error Checking (PEC) be used.
virtual int receive(std::uint8_t cmd, std::uint8_t *in, const int maxlen)=0
Sends a command byte, then reads a block of data from the device.
virtual std::uint8_t receiveByte()=0
Read a single byte from the device without sending a command/register byte first. ...
void transmit(std::uint8_t cmd, const std::vector< std::uint8_t > &out)
Sends a command byte and a block of data to the device.
virtual void transmitBool(bool out)=0
Sends a single bit to the device.
virtual void transmit(std::uint8_t cmd, const std::uint8_t *out, const int len)=0
Sends a command byte and a block of data to the device.