Sets a new I²C address and stores it in the nonvolatile memory of a device.
set-i2c-address
@/set-i2c-address
Sets a new I²C address and stores it in the nonvolatile memory of a device.
IN@/octoliner-device
ADDRbyte
A new I²C address.
UPDpulse
Triggers a new address change.
OKpulse
Fires if the address change is done.
OUT@/octoliner-device
To use the node in your project you should have the amperka/octoliner library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.
C++ implementation
struct State {
};
// clang-format off
{{ GENERATED_CODE }}
// clang-format on
void evaluate(Context ctx) {
if (!isInputDirty<input_UPD>(ctx))
return;
auto state = getState(ctx);
auto octoliner = getValue<input_IN>(ctx);
uint8_t addr = getValue<input_ADDR>(ctx);
octoliner->changeAddrWithUID(addr);
octoliner->saveAddr();
emitValue<output_OUT>(ctx, octoliner);
emitValue<output_OK>(ctx, 1);
}