Sparkfun Flexible OLED Display

Posted on
  • Been working on driving This guy , and was finally successful. It was driving me crazy that the D/C is 0 for command, and I kept flipping that bit! Here's the userland code for the display, the SSD1320 driver and necessary changes to the firmware will be posted as soon as I take out all the debug printf's

    var oled;
    var spi = new SPI();
    require("Font8x12").add(Graphics);
    
    function onInit() {
      const sclk = D24;
      const mosi = D23;
      const cs = D27;
      const res = D30;
      pinMode(sclk, 'output');
      digitalWrite(sclk, 0);
      pinMode(mosi, 'output');
      digitalWrite(mosi, 0);
      pinMode(cs, 'output');
      digitalWrite(cs, 1);
      pinMode(res, 'output');
      digitalWrite(res, 0);
    
      spi.setup({sck:sclk, mosi:mosi, bits:9, mode: 0, order: 'msb', baud:8000000});
      console.log("SPI");
      oled = require('SSD1320').connect(spi, res, function() {
        console.log("oled");
        oled.clear();
        oled.setColor(4);
        oled.fillRect(0,2,159,16);
        oled.setFont8x12();
        oled.setColor(15);
        oled.drawString("Hello, World", 20, 4);
        oled.setColor(9);
        oled.fillPoly([120,2,140,2,150,12,150,20,140,31]);
        oled.flip();
      }, {cs: cs});
    }
    

    1 Attachment

    • 20181003_215839.jpg
  • Wow -- Nice! That looks like one sweet display too :)

  • Very cool - it'll be great to have a library for that!

  • Here's the driver and the example: git@github.com:rmd6502/Espruino_SSD1320.git

  • Pull request created for my customizations to the SPI drivers

  • Very cool. Thanks - just added that PR.

    It is possible you might have been able to use shiftOut though? That would work on existing builds...

  • I forgot about shiftout, tbh - the only tricky bit is that shiftout is lsb-first, the display wants msb-first.

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

Sparkfun Flexible OLED Display

Posted by Avatar for rmd6502 @rmd6502

Actions