Drivers for ST7735 and ST7789V

Posted on
  • I was going to help with the drivers for ST7735 and ST7789V but in searching I see that they're referenced in the "Build config" python code.

    Does Espruino have built in support for these (and all the other) LCD screens?
    https://github.com/espruino/Espruino/blo­b/master/scripts/build_platform_config.p­y#L382

    Any advice on how to use it? I'd like to show off some code?

  • Espruino does have some code to handle those screens which I added very recently, but it's something you'll have to recompile to use - take a look at the BANGLE*.py for some examples.

    However I'm pretty sure that the driver for at least one of those displays leans heavily on Nordic's HAL layer so would need some work to run on other devices. What device were you looking at making it run on?

  • Jorgen did a driver for the ST7735 a while back. Its in this thread:

    http://forum.espruino.com/comments/12347­822/

    You can require the driver directly via https like this:

    
    
    pinMode(D5,"output");
    
    D5.set(); // Backlight On
    
    var colorPalette = new Uint16Array([0, 0xF80F, 0x001F, 0xFFFF]);
    var spi = new SPI();
    spi.setup({mosi:D19 /* sda */, sck:D18 /* scl */});
    
    var g = require("https://espruino.microcosm.app/­api/v1/files/a77b4d12f6a3b7587da5a3a70c0­2dc13ad2a3332.js").connectPaletted(color­Palette, spi, D21 /* DC */, D15 /*CS */, D2 /* RST */, function() {
      g.clear();
      g.setRotation(2);
      g.setColor(1);
      g.drawString("Hello",0,0);
      g.setColor(2);
      g.setFontVector(20);
      g.drawString("TESTING",0,10);
      g.setColor(3);
      g.setFontVector(30);
      g.drawString("TESTING",0,30);
      g.setColor(4);
      g.setFontVector(40);
      g.drawString("TESTING",0,50);
      g.flip();
    });
    
    

    Adjust the pinouts for your setup. I've used it a few times and it seems fine. Gordon was there something you found wrong about it? I noticed it wasn't on the drivers page. Maybe I missed something about it.

    The unit I have is labeled SCL and SDA, but as you can see on some forums thats just how its labelled. It is in fact SPI.

  • I don't think so - looking at the thread I'd asked if I could grab an image of it so I could add some docs for it, and didn't get a reply so it just fell off my stack of things to do.

    If you fancied submitting it as a module it'd be awesome though :)

  • Well its not my work. So I guess we'd have to ask him :)

  • Also if you look at his actual code at his link, from my impression its almost exactly like the ILI9163 module. So I'm not sure what I would do exactly to make it submissable -- it SEEMS like a module for me already, and works -- though to be fair, I've never made a module before for Espruino. :)

  • Just added - basically all you need is a .md file with an example of use and hopefully a picture: http://www.espruino.com/Writing+Modules

    If you're interested, this is what I did: https://github.com/espruino/EspruinoDocs­/commit/fb50e12ef45b22a05f3e10777ab16a74­9ce1a325

    It'll be live next time I do an update. I changed the module a bit to allow a height to be optionally specified since it looks like loads of ST7735 displays are 128x160 rather than just 128x128 - since I don't have one, please could you test it and make sure it still works?

  • Wow, great! I get the pattern now. Thanks for laying it out so clearly -- the changes in github make it really clear. I'll test it out and hopefully you'll see my first module -- one day soon :)

  • Thanks!

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

Drivers for ST7735 and ST7789V

Posted by Avatar for DamianMontero @DamianMontero

Actions