This looks like a fantastic library. So glad I found it.
I’m a bit of a C++ / Android noob, so before I go too far, can someone tell me if it supports the ILI9486 chip (480 x 320)?
I’m also having trouble understanding how to get the examples to work in my Arduino environment. I also use Visual Studio with the excellent Arduino Extensions.
Any help would be appreciated.
Happy Father’s Day!
@dslocum I do not think we have a driver for that chip at the moment. However, LittlevGL can work with any display. So if you have an existing driver, it can easily be adapted to work with LittlevGL. It just needs to provide a way of setting a pixel to a specific color.
Cool! Thanks for the prompt reply!
Being a noob, I’m a bit confused by your term “driver”. I generally think of drivers as Windows DLLs - separate pre-compiled run-time libraries. Are you saying that the lvGL “drivers” are like DLLs, or are they part of a compile?
Is lvGL built off any of the Adafruit_GUI libraries? Could the two co-exist?
Is there support for the ILI9341? If so, and if there’s source, I might have a look and see if I can convert it. Maybe too big an undertaking… :-/
Embedded systems rarely use runtime libraries because they are too inefficient to store and work with, but yes - our drivers are sort of like DLLs, but they are compiled directly into the executable.
Is lvGL built off any of the Adafruit_GUI libraries? Could the two co-exist?
I generally think of drivers as Windows DLLs - separate pre-compiled run-time libraries. Are you saying that the lvGL “drivers” are like DLLs, or are they part of a compile?
Theoretically, anything which provides an interface for setting a single pixel on the screen will work with LittlevGL.
Is there support for the ILI9341?
Yes. Support is available for several different chips, but I’m not familiar with exactly which repositories they are in. @kisvegabor can tell you.
Cool - and thanks again! If I may be so bold as to ask for a bit more help…
I have a Teensy 3.2 and a ILI9341 display available. I’d love to get some example code working in one of my environments (Arduino or VS), but the sample code that I’ve downloaded doesn’t quite “mesh” with the way my environments work. I’d like to understand, but would simply be happy to be able to compile and run a “Hello World” example on a ILI9341.
If I may be so bold as to ask for a bit more help…
Ask as much as you want - we’re all friendly here 
You probably want the https://github.com/littlevgl/lv_arduino repository (which should work with the Arduino IDE), but I don’t think it has a driver for the ILI9341 at the moment. Unfortunately I don’t have an Arduino so I can’t tell you much about how that works.
the sample code that I’ve downloaded doesn’t quite “mesh” with the way my environments work.
That’s because most of us develop on Linux, and use a more widespread set of development tools (make
, gcc
, etc. - not sure if you’ve heard of those).
Personally, since you are somewhat new to this, I suggest you start by getting an already-ported GUI working on your hardware first. After that, we can quickly get LittlevGL working, faster than if you start from scratch.
Thanks. That github link is dead. Got another?
Yeah, I’m REALLY green to Linux - I’m a Windoz dev. I’ve got some years doing small client WinForms in VB and C#, but this is a completely new skill for me - and I appreciate your willingness to help!
Personally, since you are somewhat new to this, I suggest you start by getting an already-ported GUI working on your hardware first. After that, we can quickly get LittlevGL working, faster than if you start from scratch.
Can you expand on this please? Not sure what other “Already-ported” GUI you are referring to, as my goal is to have the capabilities of lvGL available.
Corrected the link in my earlier post, I wrote it incorrectly.
See if you can find a GUI that already has support for your platform (you mentioned Adafruit). Get that working first, then you can get LittlevGL working. That is the easier route for those with less experience.
At the very least, get a function working where you can set a pixel on the screen. That is the bare minimum necessary for LittlevGL.
I’ve already got the Adafruit_GUI working on my ILI9486 display (Waveshare). I’ve been (frustrated) building a proper “windowing” GUI, but I have some minor windowing and button Click events happening - but NOT how I’d like them.
My biggest downfall is understanding how to set up Menus of numerous Button objects. Could use some help.
@dslocum Can you show me what the driver interface looks like for the Adafruit GUI?
Uh… Sorry - not sure what you mean. (I’m a dolt)
There is some place inside the code where it needs to actually talk to the display (i.e. write pixel at X/Y coordinate). Can you find that?
Yes, here’s the implementation for the ILI9341 (the ILI9486 is the same):
– code –
void ILI9341_t3::drawPixel(int16_t x, int16_t y, uint16_t color) {
if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return;
SPI.beginTransaction(SPISettings(SPICLOCK, MSBFIRST, SPI_MODE0));
setAddr(x, y, x, y);
writecommand_cont(ILI9341_RAMWR);
writedata16_last(color);
SPI.endTransaction();
}
– / code –
It would seem that relying on a single draw_pixel routine would be inefficient, so here’s what they use for drawing a fast horizontal line, for example:
– code –
void ILI9341_t3::drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
{
// Rudimentary clipping
if((x >= _width) || (y >= _height) || (y < 0)) return;
if(x < 0) { w += x; x = 0; }
if((x+w-1) >= _width) w = _width-x;
SPI.beginTransaction(SPISettings(SPICLOCK, MSBFIRST, SPI_MODE0));
setAddr(x, y, x+w-1, y);
writecommand_cont(ILI9341_RAMWR);
while (w-- > 1) {
writedata16_cont(color);
}
writedata16_last(color);
SPI.endTransaction();
}
– / code –
FYI - This library has been modified by Paul Stoffregen for MUCH better speed that the original Adafruit.
Can you please download https://github.com/Bodmer/TFT_eSPI library and get working some of given examples with your TFT? When your’e done with working example, we can continue with lvgl…
I apologize for the very noob questions. I’m much more familiar with MS Visual Studio ways of organizing things, so I’m not sure where the Arduino IDE (and this project) wants things to reside.
I’ve DLed and unzipped into my Arduino folder, then navigated to “…\Documents\Arduino\TFT_eSPI-master\examples\480 x 320\TFT_graphicstest_one_lib”. I then open “TFT_graphicstest_one_lib.ino” and try to compile, but get:
"C:\Users\dsloc\Documents\Arduino\TFT_eSPI-master\examples\480 x 320\TFT_graphicstest_one_lib\TFT_graphicstest_one_lib.ino:17:22: fatal error: TFT_eSPI.h: No such file or directory
#include “TFT_eSPI.h”
If I copy that file into the folder with the .INO, it complains about missing :
#include <User_Setup_Select.h>. If I copy that into the folder it still complains.
Clearly, there’s a basic concept about this IDE that I don’t grok.
So if you are a noob then you have to read some documentation, right? Arduino IDE is tool for beginners so there is a lot of documentation. How to install additional libraries is described here https://www.arduino.cc/en/Guide/Libraries . I strongly suggest using portable installation so you have comfortable access to the libreries folder. TFT_eSPI library is listed in the Library manager so installing the need library is just click on the Install button.
Thanks. I’ve been using the Arduino IDE for a while and have built several projects with good success, so I guess I’m not a complete noob. I do read docs, but sometimes it’s difficult to find the problems if you don’t know the right questions!
Trying my best to learn.
Using the Library Manager, I’ve installed the TFT-eSPI library. When I load one of the .INO demo projects and try to compile, I’m now missing <pgmspace.h>.
“C:\Users\dsloc\Documents\Arduino\libraries\TFT_eSPI/Fonts/glcdfont.c:6:22: fatal error: pgmspace.h: No such file or directory
#include <pgmspace.h>”
Is that supposed to come in the library package? I can only find a few instances on my machine, and they seem to be CPU related. Should I need this for a Teensy 3.2 or 3.6 build?
Thanks for your help and patience.
pgmspace.h is platform-specific library for accessing PROGMEM elements. Every Arduino compatible core has its own implementation of pgmspace.h - so maybe you have to ask author of your Core, or consult the documentation of the core.
I grabbed a copy from the Teensy Github and put it in the root of the TFT_eSPI library folders. So I’m past that.
Now get:
In file included from C:\Users\dsloc\Documents\Arduino\libraries\TFT_eSPI\examples\480 x 320\TFT_Print_Test\TFT_Print_Test.ino:16:0:
C:\Users\dsloc\Documents\Arduino\libraries\TFT_eSPI/TFT_eSPI.h:120:18: fatal error: FS.h: No such file or directory
#include <FS.h>