reset

wayland/sgp40-air-quality-sensor/reset

Perform a soft reset using the "General Call" mode. N.B. this is not sensor specific and all devices that support the General Call mode on the on the same I²C bus will perform this.
reset
@/reset
Perform a soft reset using the "General Call" mode. N.B. this is not sensor specific and all devices that support the General Call mode on the on the same I²C bus will perform this.
DEV@/sgp40-device
An SGP40 device.
UPDpulse
Update.
reset
DEV
UPD
OK
OKpulse
Pulse on successful reset.
To use the node in your project you should have the wayland/sgp40-air-quality-sensor 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;

        auto sensor = getValue<input_DEV>(ctx);

        // Attempt to reset; if rest fails emit error
        if (!sensor->softReset()) {
            raiseError(ctx);
            return;
        }

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