40 lines
909 B
C++
40 lines
909 B
C++
#include "UIThread.h"
|
|
#include "SharedState.h"
|
|
#include <Arduino.h>
|
|
#include <Wire.h>
|
|
#include <Adafruit_GFX.h>
|
|
#include <Adafruit_SSD1306.h>
|
|
|
|
#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() {
|
|
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.
|
|
delay(100);
|
|
} |