write-byte

xod/i2c/write-byte

Pushes a byte to send queue. Possible errors: — No bytes written. Probably due to buffer overflow.
write-byte
@/write-byte
Pushes a byte to send queue. Possible errors: — No bytes written. Probably due to buffer overflow.
I2C@/i2c
I²C interface object
BYTEbyte
Datum to write
SENDpulse
Pushes the `BYTE` to the send queue. Use pulse outputs from `begin-transmission` or another `write-byte` as a source signal.
write-byte
I2C
BYTE
SEND
DONE
DONEpulse
Pulses when the `BYTE` queued successfully. Send the output pulse to another `write-byte` in a chain or an `end-transmission` node.

C++ implementation

#pragma XOD evaluate_on_pin disable
#pragma XOD evaluate_on_pin enable input_SEND
#pragma XOD error_raise enable

node {
    void evaluate(Context ctx) {
        if (!isInputDirty<input_SEND>(ctx))
            return;

        auto wire = getValue<input_I2C>(ctx);
        auto written = wire->write(getValue<input_BYTE>(ctx));
        if (written != 1) {
          raiseError(ctx); // No bytes written
          return;
        }

        emitValue<output_DONE>(ctx, 1);
    }
}