I2cScanModule
Source:
I2cScanModule.h
I2cScanModule¶
src/core/system/I2cScanModule.h:33Inherits:
MoonModule
Scan an I2C bus and report which addresses answer, the standard detect operation in the UI.
It is the bring-up tool for any I2C peripheral: set the pins, press scan, read what is there. A fixed System module, wired by code, and passive until the button is pressed.

Public Methods¶
virtual inline void defineControls() override
: Declare the two bus pins, the scan button and the result readout.
virtual inline void onControlChanged(const char * controlName) override
: Run a scan when the button is pressed.
More info¶
How it probes¶
The platform opens a temporary bus, probes every 7-bit address, and tears it down. Its own short-lived bus means a scan never conflicts with one another driver owns. A target without a bus reports as unavailable rather than as an empty scan.
The pins¶
They default to unused, so a board with no I2C device claims no GPIO for the scanner. A board with a fixed bus sets them from its catalog entry. For an ad-hoc scan the user types them, the conventional pair being 21 and 22.
Prior art: the scan mirrors MoonLight's, and the probe range follows Linux i2c-tools.