ra8876-device

ivanmason/ra8876/ra8876-device

No description
ra8876-device
@/ra8876-device
CSnumber
RESETnumber
BLIGHTnumber
ra8876-device
CS
RESET
BLIGHT
DEV
DONE
DONEpulse
DEV@/ra8876-device
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

#pragma XOD require "https://github.com/xlatb/ra8876"

// Include C++ library:
{{#global}}
#include <RA8876.h>
{{/global}}

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

using Type = RA8876*;

{{ GENERATED_CODE }}

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

    auto state = getState(ctx);

    const uint8_t RA8876_CS = getValue<input_CS>(ctx);
    const uint8_t RA8876_RESET = getValue<input_RESET>(ctx);
    const uint8_t RA8876_BACKLIGHT = getValue<input_BLIGHT>(ctx);

    Type tft = new (state->mem) RA8876(RA8876_CS, RA8876_RESET);

    ::pinMode(RA8876_BACKLIGHT, OUTPUT);
    ::digitalWrite(RA8876_BACKLIGHT, HIGH);

    if(!tft->init())
    {
        emitValue<output_DONE>(ctx, 0);
        return;
    }

    //tft->clearScreen(0);
    //tft->colorBarTest(true);
    
    emitValue<output_DEV>(ctx, tft);
    emitValue<output_DONE>(ctx, 1);
}