From 77f003290230d71ff76dadd7f1e2318ff2f0854f Mon Sep 17 00:00:00 2001 From: MG-95 Date: Mon, 28 Feb 2022 19:41:34 +0100 Subject: [PATCH] Update oled stuff --- src/{SSD1306_SPI.hpp => SSDSpiInterface.hpp} | 4 ++-- src/bmeSPI.cxx | 2 +- src/main.cxx | 16 ++++++++-------- src/oled-driver | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) rename src/{SSD1306_SPI.hpp => SSDSpiInterface.hpp} (96%) diff --git a/src/SSD1306_SPI.hpp b/src/SSDSpiInterface.hpp similarity index 96% rename from src/SSD1306_SPI.hpp rename to src/SSDSpiInterface.hpp index 0264a4a..a0c6218 100644 --- a/src/SSD1306_SPI.hpp +++ b/src/SSDSpiInterface.hpp @@ -4,7 +4,7 @@ #include "semphr.h" #include "spi.h" -#include "oled-driver/SSD1306Interface.hpp" +#include "oled-driver/SSDInterface.hpp" constexpr size_t OledWidth = 128; constexpr size_t OledPages = 4; @@ -16,7 +16,7 @@ extern void waitForSpiFinished(); //-------------------------------------------------------------------------------------------------- //! SPI interface to a SSD1305/6 display controller. -class SSD1306_SPI : public SSD1306Interface +class SSDSpiInterface : public SSDInterface { public: void writeCommand(uint8_t cmd) override diff --git a/src/bmeSPI.cxx b/src/bmeSPI.cxx index 7918e0e..dd7b28e 100644 --- a/src/bmeSPI.cxx +++ b/src/bmeSPI.cxx @@ -10,7 +10,7 @@ #include "BME68x-Sensor-API/bme68x.h" #include "BSEC/bsec_interface.h" -#include "SSD1306_SPI.hpp" +#include "SSDSpiInterface.hpp" #include "oled-driver/Renderer.hpp" extern QueueHandle_t spiMutex; diff --git a/src/main.cxx b/src/main.cxx index f1db1b7..c56ec2e 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -4,13 +4,13 @@ #include "task.h" // #include "BSEC/bsec_integration.h" -#include "SSD1306_SPI.hpp" -#include "oled-driver/Display.hpp" +#include "SSDSpiInterface.hpp" #include "oled-driver/Renderer.hpp" +#include "oled-driver/SSD1306.hpp" // oled display -SSD1306_SPI ssdSpiInterface; -Display display(ssdSpiInterface); +SSDSpiInterface ssdSpiInterface; +SSD1306 display(ssdSpiInterface); Renderer renderer(OledWidth, OledPages, display); QueueHandle_t spiMutex = xSemaphoreCreateMutex(); @@ -24,21 +24,21 @@ void initDisplay() HAL_GPIO_WritePin(DisplayReset_GPIO_Port, DisplayReset_Pin, GPIO_PIN_SET); vTaskDelay(pdMS_TO_TICKS(1)); - display.setDisplayState(Display::DisplayState::Off); + display.setDisplayState(SSD1306::DisplayState::Off); display.setMultiplexRatio(OledPages * 8 - 1); display.setComPinConfig(false, false); display.setContrastControl(0xFF); display.setDisplayClockDivide(0, 0x8); display.setSegmentRemap(true); - display.setComOutputMode(Display::ComMode::Remap); + display.setComOutputMode(SSD1306::ComMode::Remap); display.setPrechargingPeriod(1, 0xF); display.setChargePump(true); - display.setMemoryAddressingMode(Display::AddressingMode::Horizontal); + display.setMemoryAddressingMode(SSD1306::AddressingMode::Horizontal); display.setPageAddress(0, OledPages - 1); // pages from 0 to 3 display.setColumnAddress(0, OledWidth - 1); // columns from 0 to 127 - display.setDisplayState(Display::DisplayState::On); + display.setDisplayState(SSD1306::DisplayState::On); } //-------------------------------------------------------------------------------------------------- diff --git a/src/oled-driver b/src/oled-driver index a224095..95f315a 160000 --- a/src/oled-driver +++ b/src/oled-driver @@ -1 +1 @@ -Subproject commit a224095e81a4728faa1311f0d717eb54959c6430 +Subproject commit 95f315a0764640e542031c3307565e5b11f902ff