-->
Page 1 of 1

Displaying a BMP picture & using an ili9163 128x128 screen

PostPosted: Tue Apr 05, 2016 2:57 pm
by vcch
Hi !

1) Using an ili9163 screen

You only need to use ucglib, but the difficulty is to have this lib (usually not compiled in the firmware versions you find here and there). Fortunately compiling your own brew is very easy following the instructions here :

https://hub.docker.com/r/marcelstoer/nodemcu-build/

To compile the ili9163 you'll only need to modify the file ucg-config.h in app/include


2) Displaying a picture

There is apparently no easier way than

1) Converting the pic in a non compressed format using this tool
http://www.digole.com/tools/PicturetoC_ ... verter.php

Use the download data link to save the file as "avcpic" and download it onto your Esp8266

2) Using the following lines to display it line by line

This is an exemple using a 64x64, 3 bytes color information file shown on a ili9163 128x128 screen. You will lose some definition, but it is way too long to download & display the pciture if you use a 128x128.

spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, 8, 8)
disp = ucg.ili9163_18x128x128_hw_spi(1, 4,2)
node.setcpufreq(node.CPU160MHZ)
file.open("avcpic","r")
disp:begin(ucg.FONT_MODE_TRANSPARENT)
disp:clearScreen()

for x=0,127,2 do
for y=0,127,2 do
r=string.byte(file.read(1))
g=string.byte(file.read(1))
b=string.byte(file.read(1))
disp:setColor(r,g,b)
disp:drawHLine(x,y,2)
disp:drawHLine(x,y+1,2)
end
end
file.close()

Here it is !