Add support for SSD1351! (128*128 OLED)

TODO:
Implement read functions as well..
This commit is contained in:
arduino12
2021-04-26 20:40:18 +03:00
parent fa8ff798e1
commit e1161c17f4
10 changed files with 147 additions and 12 deletions
+35 -8
View File
@@ -644,6 +644,9 @@ void TFT_eSPI::init(uint8_t tc)
#elif defined (ST7789_2_DRIVER)
#include "TFT_Drivers/ST7789_2_Init.h"
#elif defined (SSD1351_DRIVER)
#include "TFT_Drivers/SSD1351_Init.h"
#elif defined (SSD1963_DRIVER)
#include "TFT_Drivers/SSD1963_Init.h"
@@ -729,6 +732,9 @@ void TFT_eSPI::setRotation(uint8_t m)
#elif defined (ST7789_2_DRIVER)
#include "TFT_Drivers/ST7789_2_Rotation.h"
#elif defined (SSD1351_DRIVER)
#include "TFT_Drivers/SSD1351_Rotation.h"
#elif defined (SSD1963_DRIVER)
#include "TFT_Drivers/SSD1963_Rotation.h"
@@ -3030,11 +3036,10 @@ void TFT_eSPI::setAddrWindow(int32_t x0, int32_t y0, int32_t w, int32_t h)
void TFT_eSPI::setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1)
{
//begin_tft_write(); // Must be called before setWindow
#if defined (ILI9225_DRIVER)
if (rotation & 0x01) { swap_coord(x0, y0); swap_coord(x1, y1); }
addr_row = 0xFFFF;
addr_col = 0xFFFF;
#if defined (ILI9225_DRIVER)
if (rotation & 0x01) { swap_coord(x0, y0); swap_coord(x1, y1); }
DC_C; tft_Write_8(TFT_CASET1);
DC_D; tft_Write_16(x0);
@@ -3054,16 +3059,24 @@ void TFT_eSPI::setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1)
// write to RAM
DC_C; tft_Write_8(TFT_RAMWR);
DC_D;
#elif defined (SSD1351_DRIVER)
if (rotation & 1) {
swap_coord(x0, y0);
swap_coord(x1, y1);
}
#else // Not ILI9225
DC_C; tft_Write_8(TFT_CASET);
DC_D; tft_Write_16C(x0, x1);
DC_C; tft_Write_8(TFT_PASET);
DC_D; tft_Write_16C(y0, y1);
DC_C; tft_Write_8(TFT_RAMWR);
DC_D;
#else
#if defined (SSD1963_DRIVER)
if ((rotation & 0x1) == 0) { swap_coord(x0, y0); swap_coord(x1, y1); }
#endif
addr_row = 0xFFFF;
addr_col = 0xFFFF;
#ifdef CGRAM_OFFSET
x0+=colstart;
x1+=colstart;
@@ -3308,7 +3321,7 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
#else
#if defined (SSD1963_DRIVER)
#if defined (SSD1351_DRIVER) || defined (SSD1963_DRIVER)
if ((rotation & 0x1) == 0) { swap_coord(x, y); }
#endif
@@ -3318,6 +3331,20 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
DC_D; tft_Write_32D(x);
DC_C; tft_Write_8(TFT_PASET);
DC_D; tft_Write_32D(y);
#elif defined (SSD1351_DRIVER)
// No need to send x if it has not changed (speeds things up)
if (addr_col != x) {
DC_C; tft_Write_8(TFT_CASET);
DC_D; tft_Write_16D(x);
addr_col = x;
}
// No need to send y if it has not changed (speeds things up)
if (addr_row != y) {
DC_C; tft_Write_8(TFT_PASET);
DC_D; tft_Write_16D(y);
addr_row = y;
}
#else
// No need to send x if it has not changed (speeds things up)
if (addr_col != x) {