select-channel

wayland/tca9548a-i2c-mux/select-channel

Select multiplexer channel.
select-channel
@/select-channel
Select multiplexer channel.
I2Cxod/i2c/i2c
I²C bus.
ADDRbyte
I²C address (default = 70h).
CHANbyte
Multiplexer channel (00h - 07h).
UPDpulse
Update.
select-channel
I2C
ADDR
CHAN
UPD
Done
Donepulse
Pulse on completion.
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);
    }
}