From 1c36c2c933d74c2bec3a11aad109c8a1c809ac31 Mon Sep 17 00:00:00 2001 From: Bodmer Date: Sat, 27 Mar 2021 22:27:09 +0000 Subject: [PATCH] Support pseudo 16 bit See #299 --- Processors/TFT_eSPI_ESP32.c | 6 +++++- Processors/TFT_eSPI_ESP32.h | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Processors/TFT_eSPI_ESP32.c b/Processors/TFT_eSPI_ESP32.c index a0ea56e..7bf10b2 100644 --- a/Processors/TFT_eSPI_ESP32.c +++ b/Processors/TFT_eSPI_ESP32.c @@ -476,7 +476,11 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len){ #if defined (SSD1963_DRIVER) while (--len) {WR_L; WR_H; WR_L; WR_H; WR_L; WR_H;} #else - while (--len) {WR_L; WR_H; WR_L; WR_H;} + #ifdef PSEUDO_16_BIT + while (--len) {WR_L; WR_H;} + #else + while (--len) {WR_L; WR_H; WR_L; WR_H;} + #endif #endif } else while (len--) {tft_Write_16(color);} diff --git a/Processors/TFT_eSPI_ESP32.h b/Processors/TFT_eSPI_ESP32.h index 7045071..0332845 100644 --- a/Processors/TFT_eSPI_ESP32.h +++ b/Processors/TFT_eSPI_ESP32.h @@ -319,13 +319,20 @@ #else - // Write 16 bits to TFT - #define tft_Write_16(C) GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 8)); WR_H; \ - GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 0)); WR_H + #ifdef PSEUDO_16_BIT + // One write strobe for both bytes + #define tft_Write_16(C) GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 0)); WR_H + #define tft_Write_16S(C) GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 8)); WR_H + #else + // Write 16 bits to TFT + #define tft_Write_16(C) GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 8)); WR_H; \ + GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 0)); WR_H + + // 16 bit write with swapped bytes + #define tft_Write_16S(C) GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 0)); WR_H; \ + GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 8)); WR_H + #endif - // 16 bit write with swapped bytes - #define tft_Write_16S(C) GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 0)); WR_H; \ - GPIO.out_w1tc = clr_mask; GPIO.out_w1ts = set_mask((uint8_t) ((C) >> 8)); WR_H #endif // Write 32 bits to TFT