Repository navigation
Description
Companion to feastorg/CRUMBS#31, which does the same cleanup one layer up.
Filing here because CRUMBS cannot finish its own rename while the function it
calls is still named lw_set_slave.
NXP retired master/slave from the I²C specification in 2021 (UM10204 Rev 7).
The replacement pair is controller/target.
Counts
41 occurrences of master or slave across *.c, *.h and *.md, excluding
docs/archive/. Exactly one of them is an exported symbol:
int lw_set_slave(lw_i2c_bus *bus, uint8_t addr);
Everything else is comments, documentation and prose.
The one API change
lw_set_slave → lw_set_target. It selects a target address via the
I2C_SLAVE ioctl, so target is both the standard's word and the accurate one.
Suggest keeping lw_set_slave as a deprecated inline alias rather than a hard
break. It has nine call sites in feastorg/CRUMBS
(src/hal/linux/crumbs_i2c_linux.c, seven; src/crumbs_linux.h, two in
comments) plus internal uses here in src/Wire.cpp, tests/, examples/ and
docs/. An alias lets the two repos move independently instead of needing a
synchronised release.
The I2C_SLAVE ioctl constant itself comes from the Linux kernel headers and
obviously stays as-is.
The Arduino-compatibility nuance
include/Wire.h is deliberately an Arduino Wire look-alike, so some of its
wording mirrors Arduino's API rather than describing this library:
Wire.h:73— "Arduino-style overloads for slave mode compatibility"Wire.h:74,Wire.h:78— Linux userspace cannot do target mode
Arduino renamed too — their style guide moved to controller/peripheral — so
these can be reworded without breaking the compatibility framing. Worth a
deliberate decision rather than a blanket sweep, since the point of these
comments is to describe someone else's API.
Probably leave alone
Anything naming the kernel's i2c-slave interface or the I2C_SLAVE ioctl by
its upstream name. Renaming those makes the code harder to search against kernel
documentation.
Why now
A relicensing release is planned for CRUMBS, and a paper is being written that
fixes its terminology deliberately: device for anything on the wire,
peripheral for a device speaking CRUMBS, controller/target for the I²C
roles, and no master/slave anywhere. The library and the paper should agree,
and a reviewer is likely to read both.
Activity
CameronBrooks11 commentedon Sep 12, 2026
Correction to the "Why now" section above.
That paragraph describes the companion paper as using
devicefor anything onthe wire and
peripheralfor a device that speaks CRUMBS. The paper has sincedropped that split, because it overloads a standard term:
peripheralalreadymeans whatever answers the controller, regardless of the protocol it speaks.
Defining it as "speaks CRUMBS" invented a hierarchy the field does not use.
The paper now uses standard I²C vocabulary:
masterorslaveNothing in the grouped file lists changes.
controlleris the same word in bothvocabularies, so every recommendation in sections 1 to 4 stands as written. Only
the justification paragraph was wrong.