Device node for an SSD1306 based monochrome 128x64 TFT LCD connected through an I2C interface.
ssd1306-128x64-i2c-device
@/ssd1306-128x64-i2c-device
Device node for an SSD1306 based monochrome 128x64 TFT LCD connected through an I2C interface.
I2Cxod/i2c/i2c
ADDRbyte
I²C address. 3Ch by default.
DEV@/ssd1306-128x64-i2c-device
To use the node in your project you should have the xod-dev/ssd1306-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
#include <SSD1306.h>
node {
meta {
using Type = SSD1306*;
}
uint8_t mem[sizeof(SSD1306)];
uint8_t buffer[SSD1306_DISPLAY_WIDTH * SSD1306_DISPLAY_HEIGHT / 8];
void evaluate(Context ctx) {
if (!isSettingUp())
return;
auto i2c = getValue<input_I2C>(ctx);
uint8_t addr = getValue<input_ADDR>(ctx);
if (addr > 127) {
raiseError(ctx);
return;
}
Type dev = new (mem) SSD1306(i2c, addr, buffer);
dev->begin();
dev->clearScreen();
dev->sendBuffer();
emitValue<output_DEV>(ctx, dev);
}
}