tft-lcd-display-txt

bradzilla84/color-tft-lcd-driver-mcufriend-kbv/tft-lcd-display-txt

Display TXT on Display
tft-lcd-display-txt
@/tft-lcd-display-txt
Display TXT on Display
IN@/tft-lcd-device
Xnumber
X Location
Ynumber
Y Location
TXTSizenumber
TXT Size
TXTstring
TXT To Display.
Colorbradzilla84/color-rgb-hsl/rgb-color-pack
Color (From Color block)
BGColorbradzilla84/color-rgb-hsl/rgb-color-pack
Background Color (From Color block) (Used for quick erase of previous TXT)
INITpulse
Pulse to update
tft-lcd-display-txt
IN
OUT
X
Y
TXTSize
TXT
Color
BGColor
INIT
OK
OKpulse
Pulse on Complete
OUT@/tft-lcd-device
To use the node in your project you should have the bradzilla84/color-tft-lcd-driver-mcufriend-kbv 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_INIT>(ctx)){
        emitValue<output_OUT>(ctx, getValue<input_IN>(ctx));
        return;}

    auto tft = getValue<input_IN>(ctx);
    auto color = getValue<input_Color>(ctx);
    auto bgcolor = getValue<input_BGColor>(ctx);
    auto TXT = getValue<input_TXT>(ctx);
    // `length` returns the number of characters and you need an extra one to keep the
    // terminal NUL-character used in C string representation. Initialize to 0’s to ensure the last char is indeed NUL
    char TXTC[length(TXT) + 1] = { 0 };
    // move the data from XString to the plain C string
    dump(TXT, TXTC);

    tft->setCursor(getValue<input_X>(ctx), getValue<input_Y>(ctx));
    tft->setTextColor(color.Hex, bgcolor.Hex);
    tft->setTextSize(getValue<input_TXTSize>(ctx));
    tft->println(TXTC);

    emitValue<output_OUT>(ctx, getValue<input_IN>(ctx));
    emitValue<output_OK>(ctx, 1);
}