From 833bf317c78135492a6dec5ca3d5ee0fd6812669 Mon Sep 17 00:00:00 2001 From: mattbk Date: Thu, 25 Jan 2024 21:14:13 -0600 Subject: [PATCH] Stub out OLED changes. --- platformio.ini | 2 ++ src/main.cpp | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/platformio.ini b/platformio.ini index a2a4692..9e0a284 100644 --- a/platformio.ini +++ b/platformio.ini @@ -15,3 +15,5 @@ framework = arduino lib_deps = etherkit/Etherkit Si5351@^2.1.4 paulstoffregen/Encoder@^1.4.4 + adafruit/Adafruit GFX Library@^1.11.9 + adafruit/Adafruit SSD1306@^2.5.9 diff --git a/src/main.cpp b/src/main.cpp index 3d3b03e..4feea09 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,8 +11,18 @@ #include //#include #include +#include +#include +//----------- OLED ------------------ +#define SCREEN_WIDTH 128 // OLED display width, in pixels +#define SCREEN_HEIGHT 64 // OLED display height, in pixels + +// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) +#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) +Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); + //----------- Variables & Declarations --------------- /* * The current and desired LISTENING FREQUENCY, which is not always the frequency being output by the Si5351. @@ -315,6 +325,18 @@ char getPermission(){ } void setup(){ + Serial.begin(9600); // This program won't work unless baud is 9600...why? + + // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally + if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { + Serial.println("SSD1306 allocation failed"); + for(;;); // Don't proceed, loop forever + } + + // Clear the buffer + display.clearDisplay(); + display.drawPixel(10, 10, WHITE); + // inialize LCD, display welcome message //lcd.begin(20, 4); //delay(250);