To use the node in your project you should have the wayland/tca9548a-i2c-mux 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
#pragma XOD evaluate_on_pin disable
#pragma XOD evaluate_on_pin enable input_UPD
node {
void evaluate(Context ctx) {
// The node responds only if there is an input pulse
if (!isInputDirty<input_UPD>(ctx))
return;
uint8_t channel = getValue<input_CHAN>(ctx);
if (channel > 7) return;
auto wire = getValue<input_I2C>(ctx);
wire->beginTransmission(getValue<input_ADDR>(ctx));
wire->write(1 << channel);
wire->endTransmission();
emitValue<output_Done>(ctx, 1);
}
}