To use the node in your project you should have the yzheka-m/nokia-5510-display 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/adafruit/Adafruit-PCD8544-Nokia-5110-LCD-library"
#pragma XOD require "https://github.com/adafruit/Adafruit-GFX-Library"
{{#global}}
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
{{/global}}
using Type = Adafruit_PCD8544*;
struct State {
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
if(isSettingUp()){
auto clk=getValue<input_CLK>(ctx);
auto din=getValue<input_DIN>(ctx);
auto dc=getValue<input_DC>(ctx);
auto ce=getValue<input_CE>(ctx);
auto rst=getValue<input_RST>(ctx);
Type display=new Adafruit_PCD8544(clk, din, dc, ce, rst);
display->begin();
display->display();
emitValue<output_DISPLAY>(ctx,display);
emitValue<output_WIDTH>(ctx,display->width());
emitValue<output_HEIGHT>(ctx,display->height());
}
auto display=getValue<output_DISPLAY>(ctx);
display->setContrast(getValue<input_CTR>(ctx));
if(isInputDirty<input_RST>(ctx))display->clearDisplay();
}