XPoint 0.1.0
Hardware-agnostic crosspoint matrix routing library
Loading...
Searching...
No Matches
I2CInterface Class Referenceabstract

Abstract I2C bus interface. More...

#include <I2CInterface.h>

Inheritance diagram for I2CInterface:
TCA9548AInterface WireI2C

Public Member Functions

virtual ~I2CInterface ()
 
virtual void begin ()
 Initialize the I2C bus.
 
virtual void writeRegister (uint8_t addr, uint8_t reg, uint8_t val)=0
 Write one byte to a device register.
 
virtual void writeByte (uint8_t addr, uint8_t data)
 Write a single data byte to a device (no register address byte).
 

Detailed Description

Abstract I2C bus interface.

Decouples MCP23017Driver from any specific I2C implementation so the same driver code compiles and tests on both Arduino targets and host machines.

Constructor & Destructor Documentation

◆ ~I2CInterface()

virtual I2CInterface::~I2CInterface ( )
inlinevirtual

Member Function Documentation

◆ begin()

virtual void I2CInterface::begin ( )
inlinevirtual

Initialize the I2C bus.

Default no-op: safe for mock objects or buses started elsewhere. WireI2C overrides this to call Wire.begin().

Reimplemented in TCA9548AInterface, and WireI2C.

◆ writeByte()

virtual void I2CInterface::writeByte ( uint8_t  addr,
uint8_t  data 
)
inlinevirtual

Write a single data byte to a device (no register address byte).

Used by bus-multiplexer adapters such as TCA9548AInterface whose protocol is a bare one-byte control word with no register field.

Default: calls writeRegister(addr, data, 0u). Devices that ignore trailing bytes (TCA9548A latches only the first data byte) work correctly with this default. WireI2C overrides to emit exactly one data byte on the wire.

Parameters
[in]addr7-bit I2C device address.
[in]dataControl byte to write.

Reimplemented in WireI2C.

◆ writeRegister()

virtual void I2CInterface::writeRegister ( uint8_t  addr,
uint8_t  reg,
uint8_t  val 
)
pure virtual

Write one byte to a device register.

Parameters
[in]addr7-bit I2C device address.
[in]regRegister index within the device.
[in]valByte value to write.

Implemented in WireI2C, and TCA9548AInterface.


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