fastwrite

robertspark/faster-digital-read-write/fastwrite

Faster outputs high or low signal on a board port. Possible errors: — Invalid port
fastwrite
@/fastwrite
Faster outputs high or low signal on a board port. Possible errors: — Invalid port
PORTport
Board port to write to
SIGboolean
State to write
UPDpulse
Triggers new write
fastwrite
PORT
SIG
UPD
DONE
DONEpulse
Fires on writing complete
To use the node in your project you should have the robertspark/faster-digital-read-write 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 require "https://github.com/robertspark/FastDigitalWrite"

{{#global}}
#include <digitalWriteFast.h>
{{/global}}

struct State {
};

{{ GENERATED_CODE }}

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

    const uint8_t port = getValue<input_PORT>(ctx);
    if (!isValidDigitalPort(port)) {
        raiseError<output_DONE>(ctx);
        return;
    }

    pinModeFast(port, OUTPUT);
    const bool val = getValue<input_SIG>(ctx);
    digitalWriteFast(port, val);
    emitValue<output_DONE>(ctx, 1);
}