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
505ca81a
Commit
505ca81a
authored
Oct 11, 2020
by
Bodmer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Complete viewport update
parent
ee91f723
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
251 additions
and
236 deletions
+251
-236
Extensions/Smooth_font.cpp
Extensions/Smooth_font.cpp
+12
-9
TFT_eSPI.cpp
TFT_eSPI.cpp
+217
-202
TFT_eSPI.h
TFT_eSPI.h
+5
-2
examples/160 x 128/TFT_Char_times/TFT_Char_times.ino
examples/160 x 128/TFT_Char_times/TFT_Char_times.ino
+11
-17
examples/Sprite/Animated_dial/Animated_dial.ino
examples/Sprite/Animated_dial/Animated_dial.ino
+2
-2
examples/Sprite/Rotated_Sprite_1/Rotated_Sprite_1.ino
examples/Sprite/Rotated_Sprite_1/Rotated_Sprite_1.ino
+2
-2
library.json
library.json
+1
-1
library.properties
library.properties
+1
-1
No files found.
Extensions/Smooth_font.cpp
View file @
505ca81a
...
...
@@ -359,9 +359,13 @@ bool TFT_eSPI::getUnicodeIndex(uint16_t unicode, uint16_t *index)
// Expects file to be open
void
TFT_eSPI
::
drawGlyph
(
uint16_t
code
)
{
uint16_t
fg
=
textcolor
;
uint16_t
bg
=
textbgcolor
;
if
(
code
<
0x21
)
{
if
(
code
==
0x20
)
{
//if (fg!=bg) fillRect(cursor_x, cursor_y, gFont.spaceWidth, gFont.yAdvance, bg);
cursor_x
+=
gFont
.
spaceWidth
;
return
;
}
...
...
@@ -377,18 +381,15 @@ void TFT_eSPI::drawGlyph(uint16_t code)
uint16_t
gNum
=
0
;
bool
found
=
getUnicodeIndex
(
code
,
&
gNum
);
uint16_t
fg
=
textcolor
;
uint16_t
bg
=
textbgcolor
;
if
(
found
)
{
if
(
textwrapX
&&
(
cursor_x
+
gWidth
[
gNum
]
+
gdX
[
gNum
]
>
_width
))
if
(
textwrapX
&&
(
cursor_x
+
gWidth
[
gNum
]
+
gdX
[
gNum
]
>
width
()
))
{
cursor_y
+=
gFont
.
yAdvance
;
cursor_x
=
0
;
}
if
(
textwrapY
&&
((
cursor_y
+
gFont
.
yAdvance
)
>=
_height
))
cursor_y
=
0
;
if
(
textwrapY
&&
((
cursor_y
+
gFont
.
yAdvance
)
>=
height
()
))
cursor_y
=
0
;
if
(
cursor_x
==
0
)
cursor_x
-=
gdX
[
gNum
];
uint8_t
*
pbuffer
=
nullptr
;
...
...
@@ -402,15 +403,17 @@ void TFT_eSPI::drawGlyph(uint16_t code)
}
#endif
int16_t
xs
=
0
;
uint32_t
dl
=
0
;
uint8_t
pixel
;
int16_t
cy
=
cursor_y
+
gFont
.
maxAscent
-
gdY
[
gNum
];
int16_t
cx
=
cursor_x
+
gdX
[
gNum
];
int16_t
xs
=
cx
;
uint32_t
dl
=
0
;
uint8_t
pixel
;
startWrite
();
// Avoid slow ESP32 transaction overhead for every pixel
//if (fg!=bg) fillRect(cursor_x, cursor_y, gxAdvance[gNum], gFont.yAdvance, bg);
for
(
int
y
=
0
;
y
<
gHeight
[
gNum
];
y
++
)
{
#ifdef FONT_FS_AVAILABLE
...
...
TFT_eSPI.cpp
View file @
505ca81a
This diff is collapsed.
Click to expand it.
TFT_eSPI.h
View file @
505ca81a
...
...
@@ -16,7 +16,7 @@
#ifndef _TFT_eSPIH_
#define _TFT_eSPIH_
#define TFT_ESPI_VERSION "2.3.
0
"
#define TFT_ESPI_VERSION "2.3.
1
"
/***************************************************************************************
** Section 1: Load required header files
...
...
@@ -736,10 +736,13 @@ class TFT_eSPI : public Print {
int32_t
addr_row
,
addr_col
;
// Window position - used to minimise window commands
// Viewport variables
int32_t
_vpX
,
_vpY
,
_vpW
,
_vpH
;
int32_t
_vpX
,
_vpY
,
_vpW
,
_vpH
;
// Note: x start, y start, x end + 1, y end + 1
int32_t
_xDatum
;
int32_t
_yDatum
;
int32_t
_xWidth
;
int32_t
_yHeight
;
bool
_vpDatum
;
bool
_vpOoB
;
uint32_t
fontsloaded
;
// Bit field of fonts loaded
...
...
examples/160 x 128/TFT_Char_times/TFT_Char_times.ino
View file @
505ca81a
...
...
@@ -45,7 +45,6 @@ void loop() {
tft
.
setTextColor
(
TFT_RED
,
TFT_BLACK
);
tft
.
drawFloat
(
drawTime
/
2890.0
,
3
,
0
,
80
,
4
);
if
(
drawTime
<
100
)
tft
.
drawString
(
"Font 1 not loaded!"
,
0
,
108
,
2
);
delay
(
4000
);
tft
.
fillScreen
(
TFT_BLACK
);
...
...
@@ -60,7 +59,6 @@ void loop() {
tft
.
setTextColor
(
TFT_RED
,
TFT_BLACK
);
tft
.
drawFloat
(
drawTime
/
2890.0
,
3
,
0
,
80
,
4
);
if
(
drawTime
<
200
)
tft
.
drawString
(
"Font 2 not loaded!"
,
0
,
108
,
2
);
delay
(
4000
);
tft
.
fillScreen
(
TFT_BLACK
);
...
...
@@ -75,7 +73,6 @@ void loop() {
tft
.
setTextColor
(
TFT_RED
,
TFT_BLACK
);
tft
.
drawFloat
(
drawTime
/
2890.0
,
3
,
0
,
80
,
4
);
if
(
drawTime
<
200
)
tft
.
drawString
(
"Font 4 not loaded!"
,
0
,
108
,
2
);
delay
(
4000
);
tft
.
fillScreen
(
TFT_BLACK
);
...
...
@@ -90,7 +87,6 @@ void loop() {
tft
.
setTextColor
(
TFT_RED
,
TFT_BLACK
);
tft
.
drawFloat
(
drawTime
/
2890.0
,
3
,
0
,
80
,
4
);
if
(
drawTime
<
200
)
tft
.
drawString
(
"Font 6 not loaded!"
,
0
,
108
,
2
);
delay
(
4000
);
tft
.
fillScreen
(
TFT_BLACK
);
...
...
@@ -105,7 +101,6 @@ void loop() {
tft
.
setTextColor
(
TFT_RED
,
TFT_BLACK
);
tft
.
drawFloat
(
drawTime
/
2890.0
,
3
,
0
,
80
,
4
);
if
(
drawTime
<
200
)
tft
.
drawString
(
"Font 7 not loaded!"
,
0
,
108
,
2
);
delay
(
4000
);
tft
.
fillScreen
(
TFT_BLACK
);
...
...
@@ -120,7 +115,6 @@ void loop() {
tft
.
setTextColor
(
TFT_RED
,
TFT_BLACK
);
tft
.
drawFloat
(
drawTime
/
190.0
,
3
,
0
,
80
,
4
);
if
(
drawTime
<
200
)
tft
.
drawString
(
"Font 8 not loaded!"
,
0
,
108
,
2
);
delay
(
4000
);
}
...
...
examples/Sprite/Animated_dial/Animated_dial.ino
View file @
505ca81a
...
...
@@ -89,7 +89,7 @@ void setup() {
spr
.
setTextColor
(
TFT_WHITE
,
bg_color
);
spr
.
setTextDatum
(
MC_DATUM
);
spr
.
setTextPadding
(
spr_width
);
spr
.
drawNumber
(
0
,
spr_width
/
2
,
0
);
spr
.
drawNumber
(
0
,
spr_width
/
2
,
spr
.
fontHeight
()
/
2
);
spr
.
pushSprite
(
DIAL_CENTRE_X
-
spr_width
/
2
,
DIAL_CENTRE_Y
-
spr
.
fontHeight
()
/
2
);
// Plot the label text
...
...
@@ -203,7 +203,7 @@ void plotNeedle(int16_t angle, uint16_t ms_delay)
}
// Update the number at the centre of the dial
spr
.
drawNumber
(
old_angle
+
120
,
spr_width
/
2
,
0
);
spr
.
drawNumber
(
old_angle
+
120
,
spr_width
/
2
,
spr
.
fontHeight
()
/
2
);
spr
.
pushSprite
(
120
-
spr_width
/
2
,
120
-
spr
.
fontHeight
()
/
2
);
// Slow needle down slightly as it approaches the new position
...
...
examples/Sprite/Rotated_Sprite_1/Rotated_Sprite_1.ino
View file @
505ca81a
...
...
@@ -132,7 +132,7 @@ void loop() {
for
(
int16_t
angle
=
30
;
angle
<=
360
;
angle
+=
30
)
{
spr
.
fillSprite
(
TFT_BLACK
);
// Clear the Sprite
spr
.
drawNumber
(
num
,
20
,
15
,
4
);
// Plot number, in Sprite at
15
,15 and with font 4
spr
.
drawNumber
(
num
,
20
,
15
,
4
);
// Plot number, in Sprite at
20
,15 and with font 4
spr
.
pushRotated
(
angle
,
TFT_BLACK
);
// Plot rotated Sprite, black being transparent
num
++
;
}
...
...
@@ -143,7 +143,7 @@ void loop() {
for
(
int16_t
angle
=
-
90
;
angle
<
270
;
angle
+=
30
)
{
spr
.
fillSprite
(
TFT_BLACK
);
// Clear the Sprite
spr
.
drawNumber
(
angle
+
90
,
15
,
15
,
4
);
// Plot number, in Sprite at 15
,15 and with font 4
spr
.
drawNumber
(
angle
+
90
,
20
,
15
,
4
);
// Plot number, in Sprite at 20
,15 and with font 4
spr
.
pushRotated
(
angle
,
TFT_BLACK
);
// Plot rotated Sprite, black being transparent
num
++
;
}
...
...
library.json
View file @
505ca81a
{
"name"
:
"TFT_eSPI"
,
"version"
:
"2.3.
0
"
,
"version"
:
"2.3.
1
"
,
"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 @
505ca81a
name
=
TFT_eSPI
version
=
2.3.
0
version
=
2.3.
1
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