Update oled stuff

This commit is contained in:
MG-95 2022-02-28 19:41:34 +01:00
parent 4f58326d4c
commit 77f0032902
4 changed files with 12 additions and 12 deletions

View file

@ -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

View file

@ -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;

View file

@ -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);
}
//--------------------------------------------------------------------------------------------------

@ -1 +1 @@
Subproject commit a224095e81a4728faa1311f0d717eb54959c6430
Subproject commit 95f315a0764640e542031c3307565e5b11f902ff