mirror of https://github.com/arendst/Tasmota.git
Prep SSD1331 driver
This commit is contained in:
parent
46d7e9392e
commit
ee1648d3e0
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -775,6 +775,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -772,6 +772,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 - CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 - CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 - DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 - CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 - DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "А"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "А"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "安"
|
||||
|
|
|
@ -776,6 +776,8 @@
|
|||
#define D_SENSOR_RA8876_CS "RA8876 CS"
|
||||
#define D_SENSOR_ST7789_CS "ST7789 CS"
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "安培"
|
||||
|
|
|
@ -629,6 +629,7 @@
|
|||
// #define USE_DISPLAY_SSD1351 // [DisplayModel 9] Enable SSD1351 module
|
||||
// #define USE_DISPLAY_RA8876 // [DisplayModel 10] [I2cDriver39] (Touch)
|
||||
// #define USE_DISPLAY_ST7789 // [DisplayModel 12] Enable ST7789 module
|
||||
// #define USE_DISPLAY_SSD1331 // [DisplayModel 14] Enable SSD1331 module
|
||||
// #define USE_RC522 // Add support for MFRC522 13.56Mhz Rfid reader (+6k code)
|
||||
// #define USE_RC522_DATA_FUNCTION // Add support for reading data block content (+0k4 code)
|
||||
// #define USE_RC522_TYPE_INFORMATION // Add support for showing card type (+0k4 code)
|
||||
|
|
|
@ -686,8 +686,9 @@ void ResponseAppendFeatures(void)
|
|||
#if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_ST7789)
|
||||
feature7 |= 0x00080000; // xdsp_12_ST7789.ino
|
||||
#endif
|
||||
|
||||
// feature7 |= 0x00100000;
|
||||
#if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_SSD1331)
|
||||
feature7 |= 0x00100000; // xdsp_14_SSD1331.ino
|
||||
#endif
|
||||
// feature7 |= 0x00200000;
|
||||
// feature7 |= 0x00400000;
|
||||
// feature7 |= 0x00800000;
|
||||
|
|
|
@ -1614,12 +1614,14 @@ void GpioInit(void)
|
|||
ValidSpiPinUsed(GPIO_SSD1351_CS) ||
|
||||
ValidSpiPinUsed(GPIO_RA8876_CS) ||
|
||||
ValidSpiPinUsed(GPIO_ST7789_DC) || // ST7789 CS may be omitted so chk DC too
|
||||
ValidSpiPinUsed(GPIO_ST7789_CS)
|
||||
ValidSpiPinUsed(GPIO_ST7789_CS) ||
|
||||
ValidSpiPinUsed(GPIO_SSD1331_CS)
|
||||
);
|
||||
bool valid_dc = (ValidSpiPinUsed(GPIO_SPI_DC) ||
|
||||
ValidSpiPinUsed(GPIO_NRF24_DC) ||
|
||||
ValidSpiPinUsed(GPIO_ILI9341_DC) ||
|
||||
ValidSpiPinUsed(GPIO_ST7789_DC)
|
||||
ValidSpiPinUsed(GPIO_ST7789_DC) ||
|
||||
ValidSpiPinUsed(GPIO_SSD1331_DC)
|
||||
);
|
||||
// If SPI_CS and/or SPI_DC is used they must be valid
|
||||
TasmotaGlobal.spi_enabled = (valid_cs && valid_dc) ? SPI_MOSI_MISO : SPI_NONE;
|
||||
|
@ -1644,7 +1646,8 @@ void GpioInit(void)
|
|||
PinUsed(GPIO_SSD1351_CS) ||
|
||||
PinUsed(GPIO_RA8876_CS) ||
|
||||
PinUsed(GPIO_ST7789_DC) || // ST7789 CS may be omitted so chk DC too
|
||||
PinUsed(GPIO_ST7789_CS)
|
||||
PinUsed(GPIO_ST7789_CS) ||
|
||||
PinUsed(GPIO_SSD1331_CS)
|
||||
) {
|
||||
uint32_t spi_mosi = (PinUsed(GPIO_SPI_CLK) && PinUsed(GPIO_SPI_MOSI)) ? SPI_MOSI : SPI_NONE;
|
||||
uint32_t spi_miso = (PinUsed(GPIO_SPI_CLK) && PinUsed(GPIO_SPI_MISO)) ? SPI_MISO : SPI_NONE;
|
||||
|
|
|
@ -310,6 +310,7 @@
|
|||
#define USE_DISPLAY_SSD1351 // [DisplayModel 9]
|
||||
#define USE_DISPLAY_RA8876 // [DisplayModel 10]
|
||||
#define USE_DISPLAY_ST7789 // [DisplayModel 12] Enable ST7789 module
|
||||
// #define USE_DISPLAY_SSD1331 // [DisplayModel 14] Enable SSD1331 module
|
||||
|
||||
#undef DEBUG_THEO // Disable debug code
|
||||
#undef USE_DEBUG_DRIVER // Disable debug code
|
||||
|
|
|
@ -141,6 +141,7 @@ enum UserSelectablePins {
|
|||
GPIO_SSD1351_CS,
|
||||
GPIO_RA8876_CS,
|
||||
GPIO_ST7789_CS, GPIO_ST7789_DC,
|
||||
GPIO_SSD1331_CS, GPIO_SSD1331_DC,
|
||||
GPIO_SENSOR_END };
|
||||
|
||||
enum ProgramSelectablePins {
|
||||
|
@ -302,6 +303,7 @@ const char kSensorNames[] PROGMEM =
|
|||
D_SENSOR_SSD1351_CS "|"
|
||||
D_SENSOR_RA8876_CS "|"
|
||||
D_SENSOR_ST7789_CS "|" D_SENSOR_ST7789_DC "|"
|
||||
D_SENSOR_SSD1331_CS "|" D_SENSOR_SSD1331_DC "|"
|
||||
;
|
||||
|
||||
const char kSensorNamesFixed[] PROGMEM =
|
||||
|
@ -403,7 +405,11 @@ const uint16_t kGpioNiceList[] PROGMEM = {
|
|||
#ifdef USE_DISPLAY_ST7789
|
||||
AGPIO(GPIO_ST7789_CS),
|
||||
AGPIO(GPIO_ST7789_DC),
|
||||
#endif //f USE_DISPLAY_ST7789
|
||||
#endif // USE_DISPLAY_ST7789
|
||||
#ifdef USE_DISPLAY_SSD1331
|
||||
AGPIO(GPIO_SSD1331_CS),
|
||||
AGPIO(GPIO_SSD1331_DC),
|
||||
#endif // USE_DISPLAY_SSD1331
|
||||
AGPIO(GPIO_BACKLIGHT), // Display backlight control
|
||||
AGPIO(GPIO_OLED_RESET), // OLED Display Reset
|
||||
#endif
|
||||
|
|
|
@ -90,8 +90,7 @@ void SSD1351_InitDriver() {
|
|||
|
||||
#ifdef USE_DISPLAY_MODES1TO5
|
||||
|
||||
void SSD1351PrintLog(void)
|
||||
{
|
||||
void SSD1351PrintLog(void) {
|
||||
disp_refresh--;
|
||||
if (!disp_refresh) {
|
||||
disp_refresh = Settings.display_refresh;
|
||||
|
@ -119,8 +118,7 @@ void SSD1351PrintLog(void)
|
|||
}
|
||||
}
|
||||
|
||||
void SSD1351Time(void)
|
||||
{
|
||||
void SSD1351Time(void) {
|
||||
char line[12];
|
||||
|
||||
renderer->clearDisplay();
|
||||
|
@ -133,8 +131,7 @@ void SSD1351Time(void)
|
|||
renderer->Updateframe();
|
||||
}
|
||||
|
||||
void SSD1351Refresh(void) // Every second
|
||||
{
|
||||
void SSD1351Refresh(void) { // Every second
|
||||
if (Settings.display_mode) { // Mode 0 is User text
|
||||
switch (Settings.display_mode) {
|
||||
case 1: // Time
|
||||
|
@ -151,12 +148,12 @@ void SSD1351Refresh(void) // Every second
|
|||
}
|
||||
|
||||
#endif // USE_DISPLAY_MODES1TO5
|
||||
/*********************************************************************************************/
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Interface
|
||||
\*********************************************************************************************/
|
||||
bool Xdsp09(uint8_t function)
|
||||
{
|
||||
|
||||
bool Xdsp09(uint8_t function) {
|
||||
bool result = false;
|
||||
|
||||
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
xdsp_14_SSD1331.ino - Display SSD1331 support for Tasmota
|
||||
|
||||
Copyright (C) 2020 Jeroen Vermeulen, Gerhard Mutz and Theo Arends
|
||||
Copyright (C) 2021 Jeroen Vermeulen, Gerhard Mutz and Theo Arends
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -35,6 +35,7 @@
|
|||
#include <Adafruit_SSD1331.h>
|
||||
#include <SPI.h>
|
||||
|
||||
bool ssd1331_init_done = false;
|
||||
extern uint8_t *buffer;
|
||||
extern uint8_t color_type;
|
||||
Adafruit_SSD1331 *ssd1331;
|
||||
|
@ -42,11 +43,10 @@ Adafruit_SSD1331 *ssd1331;
|
|||
/*********************************************************************************************/
|
||||
|
||||
void SSD1331_InitDriver() {
|
||||
if (!Settings.display_model) {
|
||||
Settings.display_model = XDSP_14;
|
||||
}
|
||||
if (PinUsed(GPIO_SSD1331_CS) && PinUsed(GPIO_SSD1331_DC) &&
|
||||
((TasmotaGlobal.soft_spi_enabled & SPI_MOSI) || (TasmotaGlobal.spi_enabled & SPI_MOSI))) {
|
||||
|
||||
if (XDSP_14 == Settings.display_model) {
|
||||
Settings.display_model = XDSP_14;
|
||||
|
||||
if (Settings.display_width != Adafruit_SSD1331::TFTWIDTH) {
|
||||
Settings.display_width = Adafruit_SSD1331::TFTWIDTH;
|
||||
|
@ -55,26 +55,30 @@ void SSD1331_InitDriver() {
|
|||
Settings.display_height = Adafruit_SSD1331::TFTHEIGHT;
|
||||
}
|
||||
|
||||
buffer=0;
|
||||
buffer = 0;
|
||||
|
||||
// default colors
|
||||
fg_color = SSD1331_WHITE;
|
||||
bg_color = SSD1331_BLACK;
|
||||
|
||||
int8_t reset = -1;
|
||||
if (PinUsed(GPIO_OLED_RESET)) {
|
||||
reset = Pin(GPIO_OLED_RESET);
|
||||
}
|
||||
|
||||
// init renderer
|
||||
if (PinUsed(GPIO_SSPI_CS) && PinUsed(GPIO_SSPI_DC) && PinUsed(GPIO_SSPI_MOSI) && PinUsed(GPIO_SSPI_SCLK) && PinUsed(GPIO_OLED_RESET)) {
|
||||
ssd1331 = new Adafruit_SSD1331(Pin(GPIO_SSPI_CS),Pin(GPIO_SSPI_DC),Pin(GPIO_SSPI_MOSI),Pin(GPIO_SSPI_SCLK),Pin(GPIO_OLED_RESET));
|
||||
} else if (PinUsed(GPIO_SPI_CS) && PinUsed(GPIO_SPI_DC)) {
|
||||
ssd1331 = new Adafruit_SSD1331(&SPI,Pin(GPIO_SPI_CS),Pin(GPIO_SPI_DC),Pin(GPIO_OLED_RESET));
|
||||
} else {
|
||||
return;
|
||||
if (TasmotaGlobal.soft_spi_enabled) {
|
||||
ssd1331 = new Adafruit_SSD1331(Pin(GPIO_SSD1331_CS), Pin(GPIO_SSD1331_DC), Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK), reset);
|
||||
}
|
||||
else if (TasmotaGlobal.spi_enabled) {
|
||||
ssd1331 = new Adafruit_SSD1331(&SPI, Pin(GPIO_SSD1331_CS), Pin(GPIO_SSD1331_DC), reset);
|
||||
}
|
||||
|
||||
delay(100);
|
||||
ssd1331->begin();
|
||||
renderer = ssd1331;
|
||||
// Rotation is currently broken, https://github.com/adafruit/Adafruit-SSD1331-OLED-Driver-Library-for-Arduino/issues/26
|
||||
renderer->DisplayInit(DISPLAY_INIT_MODE,Settings.display_size,Settings.display_rotate,Settings.display_font);
|
||||
renderer->DisplayInit(DISPLAY_INIT_MODE, Settings.display_size, Settings.display_rotate, Settings.display_font);
|
||||
renderer->dim(Settings.display_dimmer);
|
||||
|
||||
#ifdef SHOW_SPLASH
|
||||
|
@ -86,13 +90,15 @@ void SSD1331_InitDriver() {
|
|||
#endif
|
||||
|
||||
color_type = COLOR_COLOR;
|
||||
|
||||
ssd1331_init_done = true;
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR("DSP: SSD1331"));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_DISPLAY_MODES1TO5
|
||||
|
||||
void SSD1331PrintLog(bool withDateTime)
|
||||
{
|
||||
void SSD1331PrintLog(bool withDateTime) {
|
||||
disp_refresh--;
|
||||
if (!disp_refresh) {
|
||||
disp_refresh = Settings.display_refresh;
|
||||
|
@ -129,8 +135,7 @@ void SSD1331PrintLog(bool withDateTime)
|
|||
}
|
||||
}
|
||||
|
||||
void SSD1331Time(void)
|
||||
{
|
||||
void SSD1331Time(void) {
|
||||
char line[12];
|
||||
|
||||
renderer->clearDisplay();
|
||||
|
@ -142,8 +147,7 @@ void SSD1331Time(void)
|
|||
renderer->Updateframe();
|
||||
}
|
||||
|
||||
void SSD1331Refresh(void) // Every second
|
||||
{
|
||||
void SSD1331Refresh(void) { // Every second
|
||||
if (Settings.display_mode) { // Mode 0 is User text
|
||||
switch (Settings.display_mode) {
|
||||
case 1: // Time
|
||||
|
@ -162,18 +166,18 @@ void SSD1331Refresh(void) // Every second
|
|||
}
|
||||
|
||||
#endif // USE_DISPLAY_MODES1TO5
|
||||
/*********************************************************************************************/
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Interface
|
||||
\*********************************************************************************************/
|
||||
bool Xdsp14(uint8_t function)
|
||||
{
|
||||
|
||||
bool Xdsp14(uint8_t function) {
|
||||
bool result = false;
|
||||
|
||||
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
||||
SSD1331_InitDriver();
|
||||
}
|
||||
else if (XDSP_14 == Settings.display_model) {
|
||||
else if (ssd1331_init_done && (XDSP_14 == Settings.display_model)) {
|
||||
switch (function) {
|
||||
case FUNC_DISPLAY_MODEL:
|
||||
result = true;
|
||||
|
|
|
@ -241,7 +241,7 @@ a_features = [[
|
|||
"USE_EZODO","USE_EZORGB","USE_EZOPMP","USE_AS608",
|
||||
"USE_SHELLY_DIMMER","USE_RC522","USE_FTC532","USE_DISPLAY_EPAPER_42",
|
||||
"USE_DISPLAY_ILI9488","USE_DISPLAY_SSD1351","USE_DISPLAY_RA8876","USE_DISPLAY_ST7789",
|
||||
"","","","",
|
||||
"USE_DISPLAY_SSD1331","","","",
|
||||
"","","","",
|
||||
"","","",""
|
||||
]]
|
||||
|
|
Loading…
Reference in New Issue