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
8d163618
Commit
8d163618
authored
Feb 17, 2020
by
Bodmer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add parallel TFT readRectRGB(), fix #548
parent
55e97ffe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
30 deletions
+58
-30
TFT_eSPI.cpp
TFT_eSPI.cpp
+55
-27
TFT_eSPI.h
TFT_eSPI.h
+1
-1
library.json
library.json
+1
-1
library.properties
library.properties
+1
-1
No files found.
TFT_eSPI.cpp
View file @
8d163618
...
...
@@ -650,7 +650,9 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
{
#if defined(TFT_PARALLEL_8_BIT)
readAddrWindow
(
x0
,
y0
,
1
,
1
);
// Sets CS low
CS_L
;
readAddrWindow
(
x0
,
y0
,
1
,
1
);
// Set masked pins D0- D7 to input
busDir
(
dir_mask
,
INPUT
);
...
...
@@ -663,28 +665,33 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
#if defined (ILI9341_DRIVER) | defined (ILI9488_DRIVER) // Read 3 bytes
// Read window pixel 24 bit RGB values and fill in LS bits
uint16_t
rgb
=
((
readByte
()
&
0xF8
)
<<
8
)
|
((
readByte
()
&
0xFC
)
<<
3
)
|
(
readByte
()
>>
3
);
// Read window pixel 24 bit RGB values and fill in LS bits
uint16_t
rgb
=
((
readByte
()
&
0xF8
)
<<
8
)
|
((
readByte
()
&
0xFC
)
<<
3
)
|
(
readByte
()
>>
3
);
CS_H
;
CS_H
;
// Set masked pins D0- D7 to output
busDir
(
dir_mask
,
OUTPUT
);
// Set masked pins D0- D7 to output
busDir
(
dir_mask
,
OUTPUT
);
return
rgb
;
return
rgb
;
#else // ILI9481 16 bit read
#else // ILI9481
or ILI9486
16 bit read
// Fetch the 16 bit BRG pixel
uint16_t
bgr
=
(
readByte
()
<<
8
)
|
readByte
();
// Fetch the 16 bit BRG pixel
uint16_t
bgr
=
(
readByte
()
<<
8
)
|
readByte
();
CS_H
;
CS_H
;
// Set masked pins D0- D7 to output
busDir
(
dir_mask
,
OUTPUT
);
// Set masked pins D0- D7 to output
busDir
(
dir_mask
,
OUTPUT
);
#ifdef ILI9486_DRIVER
return
bgr
;
#else
// Swap Red and Blue (could check MADCTL setting to see if this is needed)
return
(
bgr
>>
11
)
|
(
bgr
<<
11
)
|
(
bgr
&
0x7E0
);
#endif
// Swap Red and Blue (could check MADCTL setting to see if this is needed)
return
(
bgr
>>
11
)
|
(
bgr
<<
11
)
|
(
bgr
&
0x7E0
);
#endif
#else // Not TFT_PARALLEL_8_BIT
...
...
@@ -755,7 +762,9 @@ void TFT_eSPI::readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *da
#if defined(TFT_PARALLEL_8_BIT)
readAddrWindow
(
x
,
y
,
w
,
h
);
// Sets CS low
CS_L
;
readAddrWindow
(
x
,
y
,
w
,
h
);
// Set masked pins D0- D7 to input
busDir
(
dir_mask
,
INPUT
);
...
...
@@ -778,14 +787,17 @@ void TFT_eSPI::readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *da
#else // ILI9481 reads as 16 bits
// Fetch the 16 bit BRG pixels
while
(
len
--
)
{
// Read the BRG 16 bit colour
uint16_t
bgr
=
(
readByte
()
<<
8
)
|
readByte
();
// Swap Red and Blue (could check MADCTL setting to see if this is needed)
uint16_t
rgb
=
(
bgr
>>
11
)
|
(
bgr
<<
11
)
|
(
bgr
&
0x7E0
);
// Swapped byte order for compatibility with pushRect()
*
data
++
=
(
rgb
<<
8
)
|
(
rgb
>>
8
);
#ifdef ILI9486_DRIVER
// Read the RGB 16 bit colour
*
data
++
=
readByte
()
|
(
readByte
()
<<
8
);
#else
// Read the BRG 16 bit colour
uint16_t
bgr
=
(
readByte
()
<<
8
)
|
readByte
();
// Swap Red and Blue (could check MADCTL setting to see if this is needed)
uint16_t
rgb
=
(
bgr
>>
11
)
|
(
bgr
<<
11
)
|
(
bgr
&
0x7E0
);
// Swapped byte order for compatibility with pushRect()
*
data
++
=
(
rgb
<<
8
)
|
(
rgb
>>
8
);
#endif
}
#endif
...
...
@@ -798,7 +810,7 @@ void TFT_eSPI::readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *da
begin_tft_read
();
readAddrWindow
(
x
,
y
,
w
,
h
);
// Sets CS low
readAddrWindow
(
x
,
y
,
w
,
h
);
#ifdef TFT_SDA_READ
begin_SDA_Read
();
...
...
@@ -1508,7 +1520,20 @@ void TFT_eSPI::readRectRGB(int32_t x0, int32_t y0, int32_t w, int32_t h, uint8_
{
#if defined(TFT_PARALLEL_8_BIT)
// Parallel bus not supported yet
uint32_t
len
=
w
*
h
;
uint8_t
*
buf565
=
data
+
len
;
readRect
(
x0
,
y0
,
w
,
h
,
(
uint16_t
*
)
buf565
);
while
(
len
--
)
{
uint16_t
pixel565
=
(
*
buf565
++
)
<<
8
|
(
*
buf565
++
);
uint8_t
red
=
(
pixel565
&
0xF800
)
>>
8
;
red
|=
red
>>
5
;
uint8_t
green
=
(
pixel565
&
0x07E0
)
>>
3
;
green
|=
green
>>
6
;
uint8_t
blue
=
(
pixel565
&
0x001F
)
<<
3
;
blue
|=
blue
>>
5
;
*
data
++
=
red
;
*
data
++
=
green
;
*
data
++
=
blue
;
}
#else // Not TFT_PARALLEL_8_BIT
...
...
@@ -2618,9 +2643,10 @@ void TFT_eSPI::setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1)
** Function name: readAddrWindow
** Description: define an area to read a stream of pixels
***************************************************************************************/
// Chip select stays low
void
TFT_eSPI
::
readAddrWindow
(
int32_t
xs
,
int32_t
ys
,
int32_t
w
,
int32_t
h
)
{
//begin_tft_write(); // Must be called before readAddrWindow or CS set low
int32_t
xe
=
xs
+
w
-
1
;
int32_t
ye
=
ys
+
h
-
1
;
...
...
@@ -2646,6 +2672,8 @@ void TFT_eSPI::readAddrWindow(int32_t xs, int32_t ys, int32_t w, int32_t h)
DC_C
;
tft_Write_8
(
TFT_RAMRD
);
DC_D
;
//end_tft_write(); // Must be called after readAddrWindow or CS set high
}
...
...
TFT_eSPI.h
View file @
8d163618
...
...
@@ -16,7 +16,7 @@
#ifndef _TFT_eSPIH_
#define _TFT_eSPIH_
#define TFT_ESPI_VERSION "2.1.
2
"
#define TFT_ESPI_VERSION "2.1.
3
"
/***************************************************************************************
** Section 1: Load required header files
...
...
library.json
View file @
8d163618
{
"name"
:
"TFT_eSPI"
,
"version"
:
"2.1.
2
"
,
"version"
:
"2.1.
3
"
,
"keywords"
:
"Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140"
,
"description"
:
"A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32"
,
"repository"
:
...
...
library.properties
View file @
8d163618
name
=
TFT_eSPI
version
=
2.1.
2
version
=
2.1.
3
author
=
Bodmer
maintainer
=
Bodmer
sentence
=
TFT graphics library for Arduino processors with performance optimisation for 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