ILI9341 display library


#1

I’m just starting out with uLisp. Purchased a teensy 4.0 and a 320x240 TFT Touchscreen, with a ILI9341 Controller Chip. I wired up the display on a breadboard and loaded up some example uLisp code to drive the display. Sort of works, I can get the plot and mandelbrot to draw out if I replace the draw-pixel function with the point function that is described in the example code, but the image overlaps on the screen. Not sure if the set rotation function is working, or if it’s something lower level.

Has anyone else successfully used this display?

Out of curiosity, how do I include the C libraries that are supplied for the display in my project? Also, is there better documentation for the uLisp graphics libraries? The page I saw seems to have missing functions.

Thanks!


#2

Hi, thanks for the questions.

The graphics extensions in the ARM version of uLisp use the Adafruit GFX library, and currently support TFTs with the ST7735 Controller Chip, as on the Adafruit PyBadge and PyGamer.

I can get the plot and mandelbrot to draw out if I replace the draw-pixel function with the point function that is described in the example code

Which example code are you referring to? Plotting to a colour TFT display?

how do I include the C libraries that are supplied for the display in my project?

You’d have to recompile uLisp with the appropriate Adafruit display drivers. It might be as simple as replacing the line:

#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735

and the subsequent few lines defining the tft object.

The page I saw seems to have missing functions.

Which functions seem to be missing?

Thanks!


#3

Hi, thanks for writing back. Sorry that my initial request was so vague.

The original example code that worked was indeed the Plotting to a colour TFT display. I was able to use it to modify some of the other code examples from other pages, including the Mandelbrot set code.

I did as you suggested and looked through the C code and found the gphsupport section where the library is brought in #include <Adafruit_GFX.h> and replaced that with the following:

//ILI9341_t3 and teensy4.0 support

#include <ILI9341_t3.h>
//#include <font_Arial.h>
//#include <font_ArialBold.h>
#define COLOR_WHITE 0xffff
#define COLOR_BLACK 0

#define TFT_DC      9
#define TFT_CS      10
#define TFT_RST    255  // 255 = unused, connect to 3.3V
#define TFT_MOSI     7
#define TFT_SCLK    14
#define TFT_MISO    12
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);

and then later in the setup section updated the following:

void initgfx () {
#if defined(gfxsupport)
  tft.begin();
  tft.setRotation(1);
  tft.fillScreen(COLOR_BLACK);
#endif
}

And guess what? It works! I can now enter in commands through the serial interface REPL and have it work full screen on the display.

As to my question about missing functions, I saw functionality for printing a single char, setting the color of strings but nothing about printing a full string. I later realized that that can be accomplished with the with-gfx wrapper function.

Thanks again for all your support. Now, to figure out how to port emacs to uLisp… :)


#4

You’re welcome, and I’m glad it all worked!


#5

Hi,in my case I erased all custom libraries related with this extend from both Documents/Arduino/libraries and User/Downloads, and after that reinstalled them through the Library Chief in Devices within the Arduino app. It looks like there was an additional library the ILI9341 required to introduce that I never found - in any case, upon installing everything, the graphicstest.ino example compiled accurately, which may be a step within the right direction. The 2.8" TFT presently runs the graphicstest illustration impeccably! In any case, the breakouttouchpaint and touchpaint cases still default to the white screen.