end-transmission

xod/i2c/end-transmission

Ends a transmission to a slave device initiated with `begin-transmission`. All bytes queued for writing with `write-byte` will flush at the moment of this node trigerring. Possible errors: — Data too long to fit in transmit buffer — Received NACK on transmit of address — Received NACK on transmit of data — Other error
end-transmission
@/end-transmission
Ends a transmission to a slave device initiated with `begin-transmission`. All bytes queued for writing with `write-byte` will flush at the moment of this node trigerring. Possible errors: — Data too long to fit in transmit buffer — Received NACK on transmit of address — Received NACK on transmit of data — Other error
I2C@/i2c
I²C interface object
SENDpulse
Triggers the transmission end. Use `DONE` output of a `write-byte` as the source of the pulse.
end-transmission
I2C
SEND
DONE
DONEpulse
Pulses when the transmission successfully completes.

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);

        if (wire->endTransmission() == 0) {
            emitValue<output_DONE>(ctx, 1);
        } else {
            raiseError(ctx);
        }
    }
}