drawrect

ivanmason/ra8876/drawrect

Draw a square from start points X1 Y1 to end points X2 Y2. Note the start and end points should be within active window
drawrect
@/drawrect
Draw a square from start points X1 Y1 to end points X2 Y2. Note the start and end points should be within active window
DEV@/ra8876-device
X1number
Start point X
Y1number
Start point Y
X2number
End point X
Y2number
End point Y
COLnumber
Colour in rgb565 format
UPDpulse
drawrect
DONE
DEV
X1
Y1
X2
Y2
COL
UPD
DONEpulse
To use the node in your project you should have the ivanmason/ra8876 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) {
    if (!isInputDirty<input_UPD>(ctx))
        return;

    auto tft = getValue<input_DEV>(ctx);
    int x1 = getValue<input_X1>(ctx);
    int y1 = getValue<input_Y1>(ctx);
    int x2 = getValue<input_X2>(ctx);
    int y2 = getValue<input_Y2>(ctx);
    uint16_t colour = getValue<input_COL>(ctx);

    tft->drawRect(x1,y1,x2,y2,colour);

    emitValue<output_DONE>(ctx, 1);
}