mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-04 13:14:46 +02:00
Allow ESP32 DC pin to be >31
This commit is contained in:
@@ -158,6 +158,9 @@ SPI3_HOST = 2
|
|||||||
#if (TFT_DC >= 0) && (TFT_DC < 32)
|
#if (TFT_DC >= 0) && (TFT_DC < 32)
|
||||||
#define DC_C GPIO.out_w1tc = (1 << TFT_DC)
|
#define DC_C GPIO.out_w1tc = (1 << TFT_DC)
|
||||||
#define DC_D GPIO.out_w1ts = (1 << TFT_DC)
|
#define DC_D GPIO.out_w1ts = (1 << TFT_DC)
|
||||||
|
#elif (TFT_DC >= 32)
|
||||||
|
#define DC_C GPIO.out1_w1tc.val = (1 << (TFT_DC- 32))
|
||||||
|
#define DC_D GPIO.out1_w1ts.val = (1 << (TFT_DC- 32))
|
||||||
#else
|
#else
|
||||||
#define DC_C
|
#define DC_C
|
||||||
#define DC_D
|
#define DC_D
|
||||||
|
@@ -143,6 +143,9 @@ SPI3_HOST = 2
|
|||||||
#if (TFT_DC >= 0) && (TFT_DC < 32)
|
#if (TFT_DC >= 0) && (TFT_DC < 32)
|
||||||
#define DC_C GPIO.out_w1tc.val = (1 << TFT_DC)
|
#define DC_C GPIO.out_w1tc.val = (1 << TFT_DC)
|
||||||
#define DC_D GPIO.out_w1ts.val = (1 << TFT_DC)
|
#define DC_D GPIO.out_w1ts.val = (1 << TFT_DC)
|
||||||
|
#elif (TFT_DC >= 32)
|
||||||
|
#define DC_C GPIO.out_w1tc.val = (1 << (TFT_DC- 32))
|
||||||
|
#define DC_D GPIO.out_w1ts.val = (1 << (TFT_DC- 32))
|
||||||
#else
|
#else
|
||||||
#define DC_C
|
#define DC_C
|
||||||
#define DC_D
|
#define DC_D
|
||||||
|
@@ -166,6 +166,9 @@ SPI3_HOST = 2
|
|||||||
#if (TFT_DC >= 0) && (TFT_DC < 32)
|
#if (TFT_DC >= 0) && (TFT_DC < 32)
|
||||||
#define DC_C GPIO.out_w1tc = (1 << TFT_DC)
|
#define DC_C GPIO.out_w1tc = (1 << TFT_DC)
|
||||||
#define DC_D GPIO.out_w1ts = (1 << TFT_DC)
|
#define DC_D GPIO.out_w1ts = (1 << TFT_DC)
|
||||||
|
#elif (TFT_DC >= 32)
|
||||||
|
#define DC_C GPIO.out1_w1tc.val = (1 << (TFT_DC- 32))
|
||||||
|
#define DC_D GPIO.out1_w1ts.val = (1 << (TFT_DC- 32))
|
||||||
#else
|
#else
|
||||||
#define DC_C
|
#define DC_C
|
||||||
#define DC_D
|
#define DC_D
|
||||||
|
@@ -1070,7 +1070,7 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
|||||||
|
|
||||||
#if defined(TFT_PARALLEL_8_BIT) || defined(RP2040_PIO_INTERFACE)
|
#if defined(TFT_PARALLEL_8_BIT) || defined(RP2040_PIO_INTERFACE)
|
||||||
|
|
||||||
if (!inTransaction) CS_L;
|
if (!inTransaction) { CS_L; } // CS_L can be multi-statement
|
||||||
|
|
||||||
readAddrWindow(x0, y0, 1, 1);
|
readAddrWindow(x0, y0, 1, 1);
|
||||||
|
|
||||||
@@ -1090,7 +1090,7 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
|||||||
// Read window pixel 24 bit RGB values and fill in LS bits
|
// Read window pixel 24 bit RGB values and fill in LS bits
|
||||||
uint16_t rgb = ((readByte() & 0xF8) << 8) | ((readByte() & 0xFC) << 3) | (readByte() >> 3);
|
uint16_t rgb = ((readByte() & 0xF8) << 8) | ((readByte() & 0xFC) << 3) | (readByte() >> 3);
|
||||||
|
|
||||||
if (!inTransaction) CS_H;
|
if (!inTransaction) { CS_H; } // CS_H can be multi-statement
|
||||||
|
|
||||||
// Set masked pins D0- D7 to output
|
// Set masked pins D0- D7 to output
|
||||||
busDir(GPIO_DIR_MASK, OUTPUT);
|
busDir(GPIO_DIR_MASK, OUTPUT);
|
||||||
@@ -1102,7 +1102,7 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
|||||||
// Fetch the 16 bit BRG pixel
|
// Fetch the 16 bit BRG pixel
|
||||||
uint16_t bgr = (readByte() << 8) | readByte();
|
uint16_t bgr = (readByte() << 8) | readByte();
|
||||||
|
|
||||||
if (!inTransaction) CS_H;
|
if (!inTransaction) { CS_H; } // CS_H can be multi-statement
|
||||||
|
|
||||||
// Set masked pins D0- D7 to output
|
// Set masked pins D0- D7 to output
|
||||||
busDir(GPIO_DIR_MASK, OUTPUT);
|
busDir(GPIO_DIR_MASK, OUTPUT);
|
||||||
|
Reference in New Issue
Block a user