I2C_device_Arduino 1.2.0
An I²C utility class for Arduino
Loading...
Searching...
No Matches
CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

What this library is

I2C_device_Arduino is an Arduino library providing a base abstraction class (I2C_device) for I²C device register-level access. Other NXP Arduino libraries (GPIO, LED driver, RTC, temp sensor, etc.) depend on this as a base class.

The library also includes optional SPI support via txrx(), allowing subclasses to override register access for SPI-connected devices.

Key source files

Generating documentation

doxygen Doxyfile

Output goes to docs/. The generated HTML is published via GitHub Pages.

After editing Doxyfile, run doxygen -u Doxyfile to migrate obsolete tags before committing.

API conventions

  • All register-access methods (reg_r, reg_w, read_r8, etc.) accept a bool stop parameter that controls whether a STOP condition is issued after the transaction. Default is true. Set to false to use REPEATED-START between write and read (needed for some devices).
  • rs_dis (repeated-start disable) is the internal inverse flag; repeated_start_enable(bool) sets it.
  • bit_op8 / bit_op16 perform read-modify-write on a register using a mask.
  • Static methods ping(addr) and scan(wire, stop) do not require a device instance.

Branch naming

Active branch 1-register-bits-overwriting-operation-may-need-to-be-done-without-stop-condition tracks work on making bit_op8/bit_op16 operate without an intermediate STOP condition between read and write.