board/i2c
This is documentation for the i2c integration. Please note that this is just documentation for the interface, different boards might have different caveats for the various procedures.
type I2c = object
- This is the type of an I2c bus, the object should be passed to all i2c procedures. If your board requires runtime information to manage the i2c bus this will be kept in this object, and the below procedures won't be defined to use a static object. The board should define available i2c buses.
proc writeRegister(bus: static[I2c]; address, register, data: uint8)
- Writes a byte of data to the device with the given address, into the register.
proc readRegister(bus: static[I2c]; address, register: uint8): uint8
- Reads a byte from the device with the given address at the given register.