To use the node in your project you should have the ivanmason/tft-lcd-touch 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/prenticedavid/MCUFRIEND_kbv"
#pragma XOD require "https://github.com/adafruit/Adafruit-GFX-Library"
// Include C++ library:
{{#global}}
#include <Adafruit_GFX.h> // Core graphics library
#include <MCUFRIEND_kbv.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);
// Create a new object in the memory area reserved previously.
Type tft = new (state->mem) MCUFRIEND_kbv;
tft->reset();
uint16_t identifier = tft->readID();
tft->begin(identifier);
tft->setRotation(0);
tft->fillScreen(TFT_BLACK);
emitValue<output_DEV>(ctx, tft);
emitValue<output_DONE>(ctx, 1);
}