Update oled stuff
This commit is contained in:
parent
4f58326d4c
commit
77f0032902
4 changed files with 12 additions and 12 deletions
|
@ -4,7 +4,7 @@
|
||||||
#include "semphr.h"
|
#include "semphr.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
|
||||||
#include "oled-driver/SSD1306Interface.hpp"
|
#include "oled-driver/SSDInterface.hpp"
|
||||||
|
|
||||||
constexpr size_t OledWidth = 128;
|
constexpr size_t OledWidth = 128;
|
||||||
constexpr size_t OledPages = 4;
|
constexpr size_t OledPages = 4;
|
||||||
|
@ -16,7 +16,7 @@ extern void waitForSpiFinished();
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
//! SPI interface to a SSD1305/6 display controller.
|
//! SPI interface to a SSD1305/6 display controller.
|
||||||
class SSD1306_SPI : public SSD1306Interface
|
class SSDSpiInterface : public SSDInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void writeCommand(uint8_t cmd) override
|
void writeCommand(uint8_t cmd) override
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include "BME68x-Sensor-API/bme68x.h"
|
#include "BME68x-Sensor-API/bme68x.h"
|
||||||
#include "BSEC/bsec_interface.h"
|
#include "BSEC/bsec_interface.h"
|
||||||
#include "SSD1306_SPI.hpp"
|
#include "SSDSpiInterface.hpp"
|
||||||
#include "oled-driver/Renderer.hpp"
|
#include "oled-driver/Renderer.hpp"
|
||||||
|
|
||||||
extern QueueHandle_t spiMutex;
|
extern QueueHandle_t spiMutex;
|
||||||
|
|
16
src/main.cxx
16
src/main.cxx
|
@ -4,13 +4,13 @@
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
|
||||||
// #include "BSEC/bsec_integration.h"
|
// #include "BSEC/bsec_integration.h"
|
||||||
#include "SSD1306_SPI.hpp"
|
#include "SSDSpiInterface.hpp"
|
||||||
#include "oled-driver/Display.hpp"
|
|
||||||
#include "oled-driver/Renderer.hpp"
|
#include "oled-driver/Renderer.hpp"
|
||||||
|
#include "oled-driver/SSD1306.hpp"
|
||||||
|
|
||||||
// oled display
|
// oled display
|
||||||
SSD1306_SPI ssdSpiInterface;
|
SSDSpiInterface ssdSpiInterface;
|
||||||
Display display(ssdSpiInterface);
|
SSD1306 display(ssdSpiInterface);
|
||||||
Renderer renderer(OledWidth, OledPages, display);
|
Renderer renderer(OledWidth, OledPages, display);
|
||||||
|
|
||||||
QueueHandle_t spiMutex = xSemaphoreCreateMutex();
|
QueueHandle_t spiMutex = xSemaphoreCreateMutex();
|
||||||
|
@ -24,21 +24,21 @@ void initDisplay()
|
||||||
HAL_GPIO_WritePin(DisplayReset_GPIO_Port, DisplayReset_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(DisplayReset_GPIO_Port, DisplayReset_Pin, GPIO_PIN_SET);
|
||||||
vTaskDelay(pdMS_TO_TICKS(1));
|
vTaskDelay(pdMS_TO_TICKS(1));
|
||||||
|
|
||||||
display.setDisplayState(Display::DisplayState::Off);
|
display.setDisplayState(SSD1306::DisplayState::Off);
|
||||||
display.setMultiplexRatio(OledPages * 8 - 1);
|
display.setMultiplexRatio(OledPages * 8 - 1);
|
||||||
display.setComPinConfig(false, false);
|
display.setComPinConfig(false, false);
|
||||||
display.setContrastControl(0xFF);
|
display.setContrastControl(0xFF);
|
||||||
display.setDisplayClockDivide(0, 0x8);
|
display.setDisplayClockDivide(0, 0x8);
|
||||||
display.setSegmentRemap(true);
|
display.setSegmentRemap(true);
|
||||||
display.setComOutputMode(Display::ComMode::Remap);
|
display.setComOutputMode(SSD1306::ComMode::Remap);
|
||||||
display.setPrechargingPeriod(1, 0xF);
|
display.setPrechargingPeriod(1, 0xF);
|
||||||
display.setChargePump(true);
|
display.setChargePump(true);
|
||||||
|
|
||||||
display.setMemoryAddressingMode(Display::AddressingMode::Horizontal);
|
display.setMemoryAddressingMode(SSD1306::AddressingMode::Horizontal);
|
||||||
display.setPageAddress(0, OledPages - 1); // pages from 0 to 3
|
display.setPageAddress(0, OledPages - 1); // pages from 0 to 3
|
||||||
display.setColumnAddress(0, OledWidth - 1); // columns from 0 to 127
|
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
|
Loading…
Reference in a new issue