tfttouchgetpress

ivanmason/tft-lcd-touch/tfttouchgetpress

No description
tfttouchgetpress
@/tfttouchgetpress
DEV@/tft-touchscreen-device
YPport
XMport
UPDpulse
tfttouchgetpress
DEV
YP
XM
UPD
DONE
X
Y
Z
Znumber
Ynumber
Xnumber
DONEpulse
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

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    if (!isInputDirty<input_UPD>(ctx))
        return;
   
    auto ts = getValue<input_DEV>(ctx);
    TSPoint p = ts->getPoint();
    pinMode(getValue<input_XM>(ctx), OUTPUT);        //restore shared pins
    pinMode(getValue<input_YP>(ctx), OUTPUT);
    digitalWrite(getValue<input_XM>(ctx), HIGH);     //because TFT control pins
    digitalWrite(getValue<input_YP>(ctx), HIGH);
    
    int16_t x = p.x;
    int16_t y = p.y;
    int16_t z = p.z;
    
    emitValue<output_X>(ctx, x);
    emitValue<output_Y>(ctx, y);
    emitValue<output_Z>(ctx, z);
    emitValue<output_DONE>(ctx, 1);
}