tft-lcd-device

bradzilla84/color-tft-lcd-driver-mcufriend-kbv/tft-lcd-device

Setup the LCD
tft-lcd-device
@/tft-lcd-device
Setup the LCD
CSport
CS Pin
RSport
RS Pin
WRport
WR Pin
RDport
RD Pin
RSTport
RST Pin
tft-lcd-device
CS
RS
WR
RD
RST
DEV
DEV@/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

// Tell XOD where it could download the library:
#pragma XOD require "https://github.com/adafruit/Adafruit-GFX-Library"
#pragma XOD require "https://github.com/prenticedavid/MCUFRIEND_kbv"

{{#global}}
#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>
#include <stdio.h>
{{/global}}




struct State {
    uint8_t mem[sizeof(MCUFRIEND_kbv)];
};

using Type = MCUFRIEND_kbv*;

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    // It should be evaluated only once on the first (setup) transaction
    if (!isSettingUp())
        return;

    auto state = getState(ctx);
    Type tft = new (state->mem) MCUFRIEND_kbv(getValue<input_CS>(ctx),getValue<input_RS>(ctx),getValue<input_WR>(ctx),getValue<input_RD>(ctx),getValue<input_RST>(ctx));

    tft->reset();
    tft->begin(tft->readID());

    emitValue<output_DEV>(ctx, tft);
}