write-segments

amperka/segm8/write-segments

Turns on and off segments of a specific segM8 module.
write-segments
@/write-segments
Turns on and off segments of a specific segM8 module.
DEV@/segm8-device
The SegM8 device.
TMPLbyte
The custom 8-bit template. Each bit corresponds to a specific segment of the SegM8 module. The 1 bit value enables the segment and 0 disables it. Put the default value with bit literal, ex - 00000000b. In XOD you can directly put the bit value to a byte pin.
POSnumber
In a daisy chain, the ordinal SegM8 module number which segments to change. The module numbering in a daisy chain starts from 0, from left module to right.
UPDpulse
Triggers a new segment lighting
write-segments
DEV
TMPL
POS
UPD
DEV'
DONE
DONEpulse
Pulses when the segment lighting is done.
DEV'@/segm8-device
The SegM8 device.
To use the node in your project you should have the amperka/segm8 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

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    auto chain = getValue<input_DEV>(ctx);
    auto mask = getValue<input_TMPL>(ctx);
    auto position = getValue<input_POS>(ctx);

    if (isSettingUp())
        emitValue<output_DEVU0027>(ctx, chain);

    if(isInputDirty<input_UPD>(ctx)) {
        chain->writeSegments(mask, position);
        emitValue<output_DONE>(ctx, true);
    }
}