# I2C

I2C bus communication devices.

## Instrument and Abstract Driver

| [`I2CInterface`](https://dev.nominal.io/instro/ref/instruments/instro.i2c.I2CInterface.md#instro.i2c.I2CInterface "instro.i2c.I2CInterface") | I2C interface supporting register-based and command-based devices. |
| --- | --- |
| [`I2CDriverBase`](https://dev.nominal.io/instro/ref/instruments/instro.i2c.I2CDriverBase.md#instro.i2c.I2CDriverBase "instro.i2c.I2CDriverBase") | Vendor I2C-adapter driver contract. |

## Vendor Drivers

| Vendor | Model | Description |
| --- | --- | --- |
| Total Phase | [`Aardvark`](https://dev.nominal.io/instro/ref/instruments/instro.i2c.drivers.totalphase.aardvark.Aardvark.md#instro.i2c.drivers.totalphase.aardvark.Aardvark "instro.i2c.drivers.totalphase.aardvark.Aardvark") | Total Phase Aardvark I2C/SPI host adapter. |

## Types & Configuration

| [`SystemDefinition`](https://dev.nominal.io/instro/ref/instruments/instro.i2c.types.SystemDefinition.md#instro.i2c.types.SystemDefinition "instro.i2c.types.SystemDefinition") | Top-level container of all I2C device definitions, passed to `I2CInterface`. |
| --- | --- |
| [`RegisterDevice`](https://dev.nominal.io/instro/ref/instruments/instro.i2c.types.RegisterDevice.md#instro.i2c.types.RegisterDevice "instro.i2c.types.RegisterDevice") | Register-based I2C device (e.g. a GPIO expander). |
| [`CommandDevice`](https://dev.nominal.io/instro/ref/instruments/instro.i2c.types.CommandDevice.md#instro.i2c.types.CommandDevice "instro.i2c.types.CommandDevice") | Command-based I2C device (e.g. an ADC). |
| [`RegisterDef`](https://dev.nominal.io/instro/ref/instruments/instro.i2c.types.RegisterDef.md#instro.i2c.types.RegisterDef "instro.i2c.types.RegisterDef") | I2C register: address, data format, power-on default, byte order, and named bit fields. |
| [`CommandDef`](https://dev.nominal.io/instro/ref/instruments/instro.i2c.types.CommandDef.md#instro.i2c.types.CommandDef "instro.i2c.types.CommandDef") | A named command enum whose members are OR'd together when sent. |
| [`FieldDef`](https://dev.nominal.io/instro/ref/instruments/instro.i2c.types.FieldDef.md#instro.i2c.types.FieldDef "instro.i2c.types.FieldDef") | A contiguous bit field within a register (e.g. `FieldDef("mode", lsb=3, width_bits=2)` for bits [4:3]). |
| [`DataFormat`](https://dev.nominal.io/instro/ref/instruments/instro.i2c.types.DataFormat.md#instro.i2c.types.DataFormat "instro.i2c.types.DataFormat") | How to extract logical data from an I2C transfer and convert to physical units. |
| [`ScalingFunction`](https://dev.nominal.io/instro/ref/instruments/instro.i2c.types.ScalingFunction.md#instro.i2c.types.ScalingFunction "instro.i2c.types.ScalingFunction") | Convert between raw register integers and physical units (forward and inverse). |
| [`LinearScaling`](https://dev.nominal.io/instro/ref/instruments/instro.i2c.types.LinearScaling.md#instro.i2c.types.LinearScaling "instro.i2c.types.LinearScaling") | Linear scaling: `physical = offset + gain * raw`. |
| [`CustomScaling`](https://dev.nominal.io/instro/ref/instruments/instro.i2c.types.CustomScaling.md#instro.i2c.types.CustomScaling "instro.i2c.types.CustomScaling") | User-defined scaling. |

---

Errors raised by these methods are documented in [Exceptions](https://dev.nominal.io/instro/ref/library/exceptions.md).
