Display enabled
This commit is contained in:
parent
659926986b
commit
d30bac7ec5
32
UIThread.cpp
32
UIThread.cpp
@ -1,12 +1,40 @@
|
|||||||
#include "UIThread.h"
|
#include "UIThread.h"
|
||||||
#include "SharedState.h"
|
#include "SharedState.h"
|
||||||
#include <Arduino.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() {
|
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() {
|
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);
|
delay(100);
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user