mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-04 05:04:42 +02:00
Add Setup202_SSD1351_128 and remove tft_Write_16C/D macros
This commit is contained in:
32
TFT_eSPI.cpp
32
TFT_eSPI.cpp
@@ -3038,6 +3038,7 @@ void TFT_eSPI::setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1)
|
||||
//begin_tft_write(); // Must be called before setWindow
|
||||
addr_row = 0xFFFF;
|
||||
addr_col = 0xFFFF;
|
||||
|
||||
#if defined (ILI9225_DRIVER)
|
||||
if (rotation & 0x01) { swap_coord(x0, y0); swap_coord(x1, y1); }
|
||||
|
||||
@@ -3066,23 +3067,22 @@ void TFT_eSPI::setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1)
|
||||
}
|
||||
|
||||
DC_C; tft_Write_8(TFT_CASET);
|
||||
DC_D; tft_Write_16C(x0, x1);
|
||||
DC_D; tft_Write_16(x1 | (x0 << 8));
|
||||
DC_C; tft_Write_8(TFT_PASET);
|
||||
DC_D; tft_Write_16C(y0, y1);
|
||||
DC_D; tft_Write_16(y1 | (y0 << 8));
|
||||
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
|
||||
|
||||
#if defined (SSD1963_DRIVER)
|
||||
if ((rotation & 0x1) == 0) { swap_coord(x0, y0); swap_coord(x1, y1); }
|
||||
#endif
|
||||
|
||||
#ifdef CGRAM_OFFSET
|
||||
x0+=colstart;
|
||||
x1+=colstart;
|
||||
y0+=rowstart;
|
||||
y1+=rowstart;
|
||||
#endif
|
||||
#ifdef CGRAM_OFFSET
|
||||
x0+=colstart;
|
||||
x1+=colstart;
|
||||
y0+=rowstart;
|
||||
y1+=rowstart;
|
||||
#endif
|
||||
|
||||
// Temporary solution is to include the RP2040 optimised code here
|
||||
#if defined(ARDUINO_ARCH_RP2040) && !defined(TFT_PARALLEL_8BIT)
|
||||
@@ -3118,17 +3118,15 @@ void TFT_eSPI::setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1)
|
||||
DC_D;
|
||||
|
||||
#else
|
||||
|
||||
DC_C; tft_Write_8(TFT_CASET);
|
||||
DC_D; tft_Write_32C(x0, x1);
|
||||
DC_C; tft_Write_8(TFT_PASET);
|
||||
DC_D; tft_Write_32C(y0, y1);
|
||||
DC_C; tft_Write_8(TFT_RAMWR);
|
||||
DC_D;
|
||||
//end_tft_write(); // Must be called after setWindow
|
||||
|
||||
#endif // RP2040 SPI
|
||||
#endif
|
||||
//end_tft_write(); // Must be called after setWindow
|
||||
}
|
||||
|
||||
|
||||
@@ -3335,14 +3333,14 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
|
||||
// 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);
|
||||
DC_D; tft_Write_16(x | (x << 8));
|
||||
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);
|
||||
DC_D; tft_Write_16(y | (y << 8));
|
||||
addr_row = y;
|
||||
}
|
||||
#else
|
||||
|
@@ -88,6 +88,8 @@
|
||||
|
||||
//#include <User_Setups/Setup201_WT32_SC01.h> // Setup file for ESP32 based WT32_SC01 from Seeed
|
||||
|
||||
//#include <User_Setups/Setup202_SSD1351_128.h> // Setup file for ESP32/ESP8266 based SSD1351 128x128 1.5inch OLED display
|
||||
|
||||
//#include <User_Setups/SetupX_Template.h>
|
||||
|
||||
|
||||
|
51
User_Setups/Setup202_SSD1351_128.h
Normal file
51
User_Setups/Setup202_SSD1351_128.h
Normal file
@@ -0,0 +1,51 @@
|
||||
// See SetupX_Template.h for all options available
|
||||
|
||||
#define SSD1351_DRIVER
|
||||
|
||||
|
||||
#define TFT_WIDTH 128
|
||||
#define TFT_HEIGHT 128
|
||||
|
||||
|
||||
#define SSD1351_1DOT5_INCH_128 // For 128 x 128 display
|
||||
|
||||
// Wiring:
|
||||
// +-------------+------------+-------------------------------------------------------------------+
|
||||
// | Display PCB | TFT_eSPI | Info |
|
||||
// +-------------+------------+-------------------------------------------------------------------+
|
||||
// | GND | GND (0V) | Common |
|
||||
// | VCC | 5V or 3.3V | Better to power with 5V if display PCB supports it |
|
||||
// | DIN | TFT_MOSI | SPI data |
|
||||
// | SCK | TFT_SCLK | SPI clock |
|
||||
// | DC | TFT_DC | Distinguish between a command or its data |
|
||||
// | RST | TFT_RST | Hardware reset, can connect to MCU RST pin as well |
|
||||
// | CS | TFT_CS | Chip select, Set to -1 if for manually use with multiple displays |
|
||||
// +-------------+------------+-------------------------------------------------------------------+
|
||||
#if defined(ESP32)
|
||||
#define TFT_MOSI 23
|
||||
#define TFT_SCLK 18
|
||||
#define TFT_DC 2
|
||||
#define TFT_RST 4
|
||||
#define TFT_CS 15 // Set to -1 if using more than one display and manage it in sketch
|
||||
#elif defined(ESP8266)
|
||||
//#define TFT_MOSI PIN_D5 // Can't change
|
||||
//#define TFT_SCLK PIN_D7 // Can't change
|
||||
#define TFT_DC PIN_D3
|
||||
#define TFT_RST PIN_D4
|
||||
#define TFT_CS PIN_D8
|
||||
#endif
|
||||
|
||||
|
||||
#define LOAD_GLCD // Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT6 // Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
|
||||
#define LOAD_FONT7 // 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
|
||||
#define LOAD_FONT8 // Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
|
||||
//#define LOAD_FONT8N // Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
|
||||
#define LOAD_GFXFF // FreeFonts- 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
#define SMOOTH_FONT
|
||||
|
||||
|
||||
#define SPI_FREQUENCY 20000000
|
||||
//#define SPI_FREQUENCY 40000000 // Works after shielding the wires!
|
Reference in New Issue
Block a user