Allow RP2040 to read from SPI TFT
This commit is contained in:
parent
d0ef07d7f6
commit
47895f1e7b
|
|
@ -69,12 +69,16 @@ uint8_t TFT_eSPI::tft_Read_8(void)
|
||||||
{
|
{
|
||||||
uint8_t ret = 0;
|
uint8_t ret = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
for (uint8_t i = 0; i < 8; i++) { // read results
|
for (uint8_t i = 0; i < 8; i++) { // read results
|
||||||
ret <<= 1;
|
ret <<= 1;
|
||||||
SCLK_L;
|
SCLK_L;
|
||||||
if (digitalRead(TFT_MOSI)) ret |= 1;
|
if (digitalRead(TFT_MOSI)) ret |= 1;
|
||||||
SCLK_H;
|
SCLK_H;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
ret = spi.transfer(0x00);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
TFT_eSPI.cpp
14
TFT_eSPI.cpp
|
|
@ -989,9 +989,9 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
||||||
|
|
||||||
uint16_t color = 0;
|
uint16_t color = 0;
|
||||||
|
|
||||||
begin_tft_read();
|
begin_tft_read(); // Sets CS low
|
||||||
|
|
||||||
readAddrWindow(x0, y0, 1, 1); // Sets CS low
|
readAddrWindow(x0, y0, 1, 1);
|
||||||
|
|
||||||
#ifdef TFT_SDA_READ
|
#ifdef TFT_SDA_READ
|
||||||
begin_SDA_Read();
|
begin_SDA_Read();
|
||||||
|
|
@ -3171,6 +3171,10 @@ void TFT_eSPI::readAddrWindow(int32_t xs, int32_t ys, int32_t w, int32_t h)
|
||||||
addr_col = 0xFFFF;
|
addr_col = 0xFFFF;
|
||||||
addr_row = 0xFFFF;
|
addr_row = 0xFFFF;
|
||||||
|
|
||||||
|
#if defined (SSD1963_DRIVER)
|
||||||
|
if ((rotation & 0x1) == 0) { swap_coord(xs, ys); swap_coord(xe, ye); }
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CGRAM_OFFSET
|
#ifdef CGRAM_OFFSET
|
||||||
xs += colstart;
|
xs += colstart;
|
||||||
xe += colstart;
|
xe += colstart;
|
||||||
|
|
@ -3178,12 +3182,10 @@ void TFT_eSPI::readAddrWindow(int32_t xs, int32_t ys, int32_t w, int32_t h)
|
||||||
ye += rowstart;
|
ye += rowstart;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (SSD1963_DRIVER)
|
|
||||||
if ((rotation & 0x1) == 0) { swap_coord(xs, ys); swap_coord(xe, ye); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Temporary solution is to include the RP2040 optimised code here
|
// Temporary solution is to include the RP2040 optimised code here
|
||||||
#if (defined(ARDUINO_ARCH_RP2040) || defined (ARDUINO_ARCH_MBED)) && !defined(RP2040_PIO_INTERFACE)
|
#if (defined(ARDUINO_ARCH_RP2040) || defined (ARDUINO_ARCH_MBED)) && !defined(RP2040_PIO_INTERFACE)
|
||||||
|
// Use hardware SPI port, this code does not swap from 8 to 16 bit
|
||||||
|
// to avoid the spi_set_format() call overhead
|
||||||
while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {};
|
while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {};
|
||||||
DC_C;
|
DC_C;
|
||||||
hw_write_masked(&spi_get_hw(SPI_X)->cr0, (8 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS);
|
hw_write_masked(&spi_get_hw(SPI_X)->cr0, (8 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
#ifndef _TFT_eSPIH_
|
#ifndef _TFT_eSPIH_
|
||||||
#define _TFT_eSPIH_
|
#define _TFT_eSPIH_
|
||||||
|
|
||||||
#define TFT_ESPI_VERSION "2.4.30"
|
#define TFT_ESPI_VERSION "2.4.31"
|
||||||
|
|
||||||
// Bit level feature flags
|
// Bit level feature flags
|
||||||
// Bit 0 set: viewport capability
|
// Bit 0 set: viewport capability
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "TFT_eSPI",
|
"name": "TFT_eSPI",
|
||||||
"version": "2.4.30",
|
"version": "2.4.31",
|
||||||
"keywords": "Arduino, tft, ePaper, display, Pico, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, RM68140, SSD1351, SSD1963, ILI9225, HX8357D",
|
"keywords": "Arduino, tft, ePaper, display, Pico, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, RM68140, SSD1351, SSD1963, ILI9225, HX8357D",
|
||||||
"description": "A TFT and ePaper SPI graphics library with optimisation for Raspberry Pi Pico, ESP8266, ESP32 and STM32",
|
"description": "A TFT and ePaper SPI graphics library with optimisation for Raspberry Pi Pico, ESP8266, ESP32 and STM32",
|
||||||
"repository":
|
"repository":
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
name=TFT_eSPI
|
name=TFT_eSPI
|
||||||
version=2.4.30
|
version=2.4.31
|
||||||
author=Bodmer
|
author=Bodmer
|
||||||
maintainer=Bodmer
|
maintainer=Bodmer
|
||||||
sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32
|
sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue