TFT Display with ILI9341 running

Posted on
  • I've got a small and cheap(about 5 € at banggood) TFT Display with ILI9341 up and running.
    Its based on sources from Peter Drescher.
    At least for displaying it works fine, except:

    • fillRect gets color undefined, if fillRect is called. Color is fine if vector font is used for drawString.
    • vector font in Espruino seems to be a bold font, which makes it hard to read. Bitmap font is far too small for a 2.2" display with 240*320
      There are some more options like change orientation and an SD card.
      As soon as I get it stable, I will create a module.
  • That looks like a really neat display!

    It'd be great to see the library - ILI9341 is used in the STM32F429I discovery board too, and I had a quick play with that but without much success.

    There's actually some internal support for ILI9320/25/28/31 chips when they're connected in parallel, but not for them when connected via SPI. It'd be great to get that changed as I reckon it'd bump the speed up a lot.

    wrt fillRect - can you give an example? Looking at the code, fillRect uses the foreground colour (as it doesn't take a colour argument) - I can't see any real issues there and I have used that callback for the OLED display driver and it seems to work fine...

    As for the font - we've covered that elsewhere. I think a built-in 'bitmap' class would solve this and would allow people to use icons and things as well. There's a bug for it here: https://github.com/espruino/Espruino/iss­ues/198

    Either that or maybe we could make the vector font thinner. Also, if the size of that font could be packed down, we'd have space for a different bitmap font as well.

  • drawing is done like this

      graphics.setColor(0,1,0);
      graphics.fillRect(70,70,120,100);
      graphics.setFontVector(12);
      graphics.drawString("Espruino",0,0);
    

    inside my module graphics are created like this:

                  me.graphics = Graphics.createCallback(240,320,16,{
                    setPixel:function(x,y,c){setPixel(x,y,c)­;},
                    fillRect:function(x1,y1,x2,y2,c){fillRec­t(x1,y1,x2,y2,c);}
                  });
    
    

    And fillRect is doing this:

      function fillRect(x1,y1,x2,y2,c){
    console.log(x1,y1,x2,y2,c);
    
    

    which returns this:
    70 70 120 120 undefined
    2 11 2 12 2016
    3 10 3 12 2016
    In my best understanding:
    drawing rects from drawString send color as 5th parameter
    same from fillRect does not use the color parameter

  • Ahh, thanks for the info....

    >g              
    ={
      "setPixel":function (x,y,c) { ... },
      "fillRect":function (x1,y1,x2,y2,c) { ... }
    }
    

    So fillRect gets automatically defined in Graphics, and it overloads the built-in fillRect function :( I'll fix that for 1v56.

  • just getting a white screen nothing else is displayed.Need help with the program and connections.


    1 Attachment

    • DSC_0594.jpg
  • Are you using the ILI9341 module and example code? http://www.espruino.com/ILI9341

    Also, what board are you using? It looks more like an mbed than an Espruino?

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

TFT Display with ILI9341 running

Posted by Avatar for JumJum @JumJum

Actions