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
b4427d68
Commit
b4427d68
authored
Feb 17, 2023
by
Bodmer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix typos in PNG examples
parent
5288630b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
14 deletions
+14
-14
examples/PNG Images/Flash_PNG/Flash_PNG.ino
examples/PNG Images/Flash_PNG/Flash_PNG.ino
+3
-3
examples/PNG Images/Flash_transparent_PNG/Flash_transparent_PNG.ino
...NG Images/Flash_transparent_PNG/Flash_transparent_PNG.ino
+2
-2
examples/PNG Images/Flash_transparent_PNG/png_support.ino
examples/PNG Images/Flash_transparent_PNG/png_support.ino
+2
-2
examples/PNG Images/LittleFS_PNG/LittleFS_PNG.ino
examples/PNG Images/LittleFS_PNG/LittleFS_PNG.ino
+3
-3
examples/PNG Images/LittleFS_PNG_DMA/LittleFS_PNG_DMA.ino
examples/PNG Images/LittleFS_PNG_DMA/LittleFS_PNG_DMA.ino
+4
-4
No files found.
examples/PNG Images/Flash_PNG/Flash_PNG.ino
View file @
b4427d68
...
...
@@ -18,7 +18,7 @@
PNG
png
;
// PNG decoder inatance
#define MAX_IMAGE_W
DI
TH 240 // Adjust for your images
#define MAX_IMAGE_W
ID
TH 240 // Adjust for your images
int16_t
xpos
=
0
;
int16_t
ypos
=
0
;
...
...
@@ -50,7 +50,7 @@ void loop()
{
int16_t
rc
=
png
.
openFLASH
((
uint8_t
*
)
panda
,
sizeof
(
panda
),
pngDraw
);
if
(
rc
==
PNG_SUCCESS
)
{
Serial
.
println
(
"Successfully png file"
);
Serial
.
println
(
"Successfully
opened
png file"
);
Serial
.
printf
(
"image specs: (%d x %d), %d bpp, pixel type: %d
\n
"
,
png
.
getWidth
(),
png
.
getHeight
(),
png
.
getBpp
(),
png
.
getPixelType
());
tft
.
startWrite
();
uint32_t
dt
=
millis
();
...
...
@@ -72,7 +72,7 @@ void loop()
// you will need to adapt this function to suit.
// Callback function to draw pixels to the display
void
pngDraw
(
PNGDRAW
*
pDraw
)
{
uint16_t
lineBuffer
[
MAX_IMAGE_W
DI
TH
];
uint16_t
lineBuffer
[
MAX_IMAGE_W
ID
TH
];
png
.
getLineAsRGB565
(
pDraw
,
lineBuffer
,
PNG_RGB565_BIG_ENDIAN
,
0xffffffff
);
tft
.
pushImage
(
xpos
,
ypos
+
pDraw
->
y
,
pDraw
->
iWidth
,
1
,
lineBuffer
);
}
examples/PNG Images/Flash_transparent_PNG/Flash_transparent_PNG.ino
View file @
b4427d68
...
...
@@ -24,7 +24,7 @@
PNG
png
;
// PNG decoder instance
#define MAX_IMAGE_W
DI
TH 240 // Sets rendering line buffer lengths, adjust for your images
#define MAX_IMAGE_W
ID
TH 240 // Sets rendering line buffer lengths, adjust for your images
// Include the TFT library - see https://github.com/Bodmer/TFT_eSPI for library information
#include "SPI.h"
...
...
@@ -60,7 +60,7 @@ void loop()
int16_t
rc
=
png
.
openFLASH
((
uint8_t
*
)
bob
,
sizeof
(
bob
),
pngDraw
);
if
(
rc
==
PNG_SUCCESS
)
{
Serial
.
println
(
"Successfully png file"
);
Serial
.
println
(
"Successfully
opened
png file"
);
pngw
=
png
.
getWidth
();
pngh
=
png
.
getHeight
();
Serial
.
printf
(
"Image metrics: (%d x %d), %d bpp, pixel type: %d
\n
"
,
pngw
,
pngh
,
png
.
getBpp
(),
png
.
getPixelType
());
...
...
examples/PNG Images/Flash_transparent_PNG/png_support.ino
View file @
b4427d68
...
...
@@ -7,8 +7,8 @@
// This function will be called during decoding of the png file to render each image
// line to the TFT. PNGdec generates the image line and a 1bpp mask.
void
pngDraw
(
PNGDRAW
*
pDraw
)
{
uint16_t
lineBuffer
[
MAX_IMAGE_W
DI
TH
];
// Line buffer for rendering
uint8_t
maskBuffer
[
1
+
MAX_IMAGE_W
DI
TH
/
8
];
// Mask buffer
uint16_t
lineBuffer
[
MAX_IMAGE_W
ID
TH
];
// Line buffer for rendering
uint8_t
maskBuffer
[
1
+
MAX_IMAGE_W
ID
TH
/
8
];
// Mask buffer
png
.
getLineAsRGB565
(
pDraw
,
lineBuffer
,
PNG_RGB565_BIG_ENDIAN
,
0xffffffff
);
...
...
examples/PNG Images/LittleFS_PNG/LittleFS_PNG.ino
View file @
b4427d68
...
...
@@ -17,7 +17,7 @@
#include <PNGdec.h>
PNG
png
;
#define MAX_IMAGE_W
DI
TH 240 // Adjust for your images
#define MAX_IMAGE_W
ID
TH 240 // Adjust for your images
int16_t
xpos
=
0
;
int16_t
ypos
=
0
;
...
...
@@ -67,7 +67,7 @@ void loop()
tft
.
startWrite
();
Serial
.
printf
(
"image specs: (%d x %d), %d bpp, pixel type: %d
\n
"
,
png
.
getWidth
(),
png
.
getHeight
(),
png
.
getBpp
(),
png
.
getPixelType
());
uint32_t
dt
=
millis
();
if
(
png
.
getWidth
()
>
MAX_IMAGE_W
DI
TH
)
{
if
(
png
.
getWidth
()
>
MAX_IMAGE_W
ID
TH
)
{
Serial
.
println
(
"Image too wide for allocated line buffer size!"
);
}
else
{
...
...
@@ -93,7 +93,7 @@ void loop()
// you will need to adapt this function to suit.
// Callback function to draw pixels to the display
void
pngDraw
(
PNGDRAW
*
pDraw
)
{
uint16_t
lineBuffer
[
MAX_IMAGE_W
DI
TH
];
uint16_t
lineBuffer
[
MAX_IMAGE_W
ID
TH
];
png
.
getLineAsRGB565
(
pDraw
,
lineBuffer
,
PNG_RGB565_BIG_ENDIAN
,
0xffffffff
);
tft
.
pushImage
(
xpos
,
ypos
+
pDraw
->
y
,
pDraw
->
iWidth
,
1
,
lineBuffer
);
}
examples/PNG Images/LittleFS_PNG_DMA/LittleFS_PNG_DMA.ino
View file @
b4427d68
...
...
@@ -22,7 +22,7 @@
#include <PNGdec.h>
PNG
png
;
#define MAX_IMAGE_W
DI
TH 240 // Adjust for your images
#define MAX_IMAGE_W
ID
TH 240 // Adjust for your images
int16_t
xpos
=
0
;
int16_t
ypos
=
0
;
...
...
@@ -73,7 +73,7 @@ void loop()
tft
.
startWrite
();
Serial
.
printf
(
"image specs: (%d x %d), %d bpp, pixel type: %d
\n
"
,
png
.
getWidth
(),
png
.
getHeight
(),
png
.
getBpp
(),
png
.
getPixelType
());
uint32_t
dt
=
millis
();
if
(
png
.
getWidth
()
>
MAX_IMAGE_W
DI
TH
)
{
if
(
png
.
getWidth
()
>
MAX_IMAGE_W
ID
TH
)
{
Serial
.
println
(
"Image too wide for allocated lin buffer!"
);
}
else
{
...
...
@@ -99,8 +99,8 @@ void loop()
// you will need to adapt this function to suit.
// Callback function to draw pixels to the display
void
pngDraw
(
PNGDRAW
*
pDraw
)
{
uint16_t
lineBuffer
[
MAX_IMAGE_W
DI
TH
];
static
uint16_t
dmaBuffer
[
MAX_IMAGE_W
DI
TH
];
// static so buffer persists after fn exit
uint16_t
lineBuffer
[
MAX_IMAGE_W
ID
TH
];
static
uint16_t
dmaBuffer
[
MAX_IMAGE_W
ID
TH
];
// static so buffer persists after fn exit
png
.
getLineAsRGB565
(
pDraw
,
lineBuffer
,
PNG_RGB565_BIG_ENDIAN
,
0xffffffff
);
tft
.
pushImageDMA
(
xpos
,
ypos
+
pDraw
->
y
,
pDraw
->
iWidth
,
1
,
lineBuffer
,
dmaBuffer
);
...
...
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