From d30bac7ec5c019b5b87719d823c159fef30b248c Mon Sep 17 00:00:00 2001 From: Dejvino Date: Fri, 27 Feb 2026 06:20:27 +0100 Subject: [PATCH] Display enabled --- UIThread.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/UIThread.cpp b/UIThread.cpp index 790e667..729f42f 100644 --- a/UIThread.cpp +++ b/UIThread.cpp @@ -1,12 +1,40 @@ #include "UIThread.h" #include "SharedState.h" #include +#include +#include +#include + +#define SCREEN_WIDTH 128 +#define SCREEN_HEIGHT 64 +#define OLED_RESET -1 +#define SCREEN_ADDRESS 0x3C + +// I2C Pins (GP4/GP5) +#define PIN_SDA 4 +#define PIN_SCL 5 + +Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); void setupUI() { - // This is the UI thread, running on core 0. For this example, we do nothing here. + Wire.setSDA(PIN_SDA); + Wire.setSCL(PIN_SCL); + Wire.begin(); + + if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { + Serial.println(F("SSD1306 allocation failed")); + for(;;); + } + + display.clearDisplay(); + display.setTextSize(1); + display.setTextColor(SSD1306_WHITE); + display.setCursor(0, 0); + display.println(F("Lorem ipsum dolor sit amet, consectetur adipiscing elit.")); + display.display(); } void loopUI() { - // The loop on core 0 is responsible for updating the UI. In this simple example, it does nothing. + // The loop on core 0 is responsible for updating the UI. delay(100); } \ No newline at end of file