Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TFT_eSPI
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
TFT_eSPI
Commits
0ad6de91
Commit
0ad6de91
authored
Nov 05, 2021
by
Bodmer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix RP2040 with RPi type display
RPi display requires 16 bit commands and slower DC and CS strobe timings.
parent
9d33b3ea
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
11 deletions
+33
-11
Processors/TFT_eSPI_RP2040.h
Processors/TFT_eSPI_RP2040.h
+14
-4
TFT_eSPI.cpp
TFT_eSPI.cpp
+16
-4
TFT_eSPI.h
TFT_eSPI.h
+1
-1
library.json
library.json
+1
-1
library.properties
library.properties
+1
-1
No files found.
Processors/TFT_eSPI_RP2040.h
View file @
0ad6de91
...
...
@@ -59,8 +59,13 @@
#else
//#define DC_C sio_hw->gpio_clr = (1ul << TFT_DC)
//#define DC_D sio_hw->gpio_set = (1ul << TFT_DC)
#define DC_C sio_hw->gpio_clr = (1ul << TFT_DC)
#define DC_D sio_hw->gpio_set = (1ul << TFT_DC)
#if defined (RPI_DISPLAY_TYPE)
#define DC_C digitalWrite(TFT_DC, LOW);
#define DC_D digitalWrite(TFT_DC, HIGH);
#else
#define DC_C sio_hw->gpio_clr = (1ul << TFT_DC)
#define DC_D sio_hw->gpio_set = (1ul << TFT_DC)
#endif
#endif
////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -70,8 +75,13 @@
#define CS_L // No macro allocated so it generates no code
#define CS_H // No macro allocated so it generates no code
#else
#define CS_L sio_hw->gpio_clr = (1ul << TFT_CS)
#define CS_H sio_hw->gpio_set = (1ul << TFT_CS)
#if defined (RPI_DISPLAY_TYPE)
#define CS_L digitalWrite(TFT_CS, LOW);
#define CS_H digitalWrite(TFT_CS, HIGH);
#else
#define CS_L sio_hw->gpio_clr = (1ul << TFT_CS)
#define CS_H sio_hw->gpio_set = (1ul << TFT_CS)
#endif
#endif
////////////////////////////////////////////////////////////////////////////////////////
...
...
TFT_eSPI.cpp
View file @
0ad6de91
...
...
@@ -3093,7 +3093,11 @@ void TFT_eSPI::setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1)
while
(
spi_get_hw
(
spi0
)
->
sr
&
SPI_SSPSR_BSY_BITS
)
{};
DC_C
;
#if !defined (SPI_18BIT_DRIVER)
spi_set_format
(
spi0
,
8
,
(
spi_cpol_t
)
0
,
(
spi_cpha_t
)
0
,
SPI_MSB_FIRST
);
#if defined (RPI_DISPLAY_TYPE) // RPi TFT type always needs 16 bit transfers
spi_set_format
(
spi0
,
16
,
(
spi_cpol_t
)
0
,
(
spi_cpha_t
)
0
,
SPI_MSB_FIRST
);
#else
spi_set_format
(
spi0
,
8
,
(
spi_cpol_t
)
0
,
(
spi_cpha_t
)
0
,
SPI_MSB_FIRST
);
#endif
#endif
spi_get_hw
(
spi0
)
->
dr
=
(
uint32_t
)
TFT_CASET
;
...
...
@@ -3282,7 +3286,11 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
// a busy check is not needed.
while
(
spi_get_hw
(
spi0
)
->
sr
&
SPI_SSPSR_BSY_BITS
)
{};
DC_C
;
spi_set_format
(
spi0
,
8
,
(
spi_cpol_t
)
0
,
(
spi_cpha_t
)
0
,
SPI_MSB_FIRST
);
#if defined (RPI_DISPLAY_TYPE) // RPi TFT type always needs 16 bit transfers
spi_set_format
(
spi0
,
16
,
(
spi_cpol_t
)
0
,
(
spi_cpha_t
)
0
,
SPI_MSB_FIRST
);
#else
spi_set_format
(
spi0
,
8
,
(
spi_cpol_t
)
0
,
(
spi_cpha_t
)
0
,
SPI_MSB_FIRST
);
#endif
spi_get_hw
(
spi0
)
->
dr
=
(
uint32_t
)
TFT_CASET
;
while
(
spi_get_hw
(
spi0
)
->
sr
&
SPI_SSPSR_BSY_BITS
){};
...
...
@@ -3317,8 +3325,12 @@ void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
#else
while
(
spi_get_hw
(
spi0
)
->
sr
&
SPI_SSPSR_BSY_BITS
)
{};
DC_D
;
spi_get_hw
(
spi0
)
->
dr
=
(
uint32_t
)
color
>>
8
;
spi_get_hw
(
spi0
)
->
dr
=
(
uint32_t
)
color
;
#if defined (RPI_DISPLAY_TYPE) // RPi TFT type always needs 16 bit transfers
spi_get_hw
(
spi0
)
->
dr
=
(
uint32_t
)
color
;
#else
spi_get_hw
(
spi0
)
->
dr
=
(
uint32_t
)
color
>>
8
;
spi_get_hw
(
spi0
)
->
dr
=
(
uint32_t
)
color
;
#endif
#endif
/*
// Subsequent pixel reads work OK without draining the FIFO...
...
...
TFT_eSPI.h
View file @
0ad6de91
...
...
@@ -16,7 +16,7 @@
#ifndef _TFT_eSPIH_
#define _TFT_eSPIH_
#define TFT_ESPI_VERSION "2.3.7
2
"
#define TFT_ESPI_VERSION "2.3.7
3
"
// Bit level feature flags
// Bit 0 set: viewport capability
...
...
library.json
View file @
0ad6de91
{
"name"
:
"TFT_eSPI"
,
"version"
:
"2.3.7
2
"
,
"version"
:
"2.3.7
3
"
,
"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"
,
"repository"
:
...
...
library.properties
View file @
0ad6de91
name
=
TFT_eSPI
version
=
2.3.7
2
version
=
2.3.7
3
author
=
Bodmer
maintainer
=
Bodmer
sentence
=
TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment