You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Yes, it should work fine. All you really need are the magic initialisation codes, which seem to be covered here and here - then you can base it on another similar LCD driver's code like this one

    Try pasting this into the Web IDE:

    var exports={};
    exports.connect = function(/*=SPI*/_spi, /*=PIN*/_dc, /*=PIN*/_ce, /*=PIN*/_rst, callback) {
      var LCD = Graphics.createArrayBuffer(128,64,1,{vertical_byte:true});
      var spi = _spi;
      var dc = _dc;
      var ce = _ce;
      var rst = _rst;
      setTimeout(function() {
        digitalWrite(dc,0); // cmd
        digitalPulse(rst, 0, 10); // pulse reset low
        
        setTimeout(function() {      
          spi.write([
            0xA2, //set the LCD bias to 1/9th
            0xA0, //horizontally "normal" (not flipped)
            0xC8, //vertically "flipped" (complements the command above)
            0x23, //the internal resistor divider set to 3 (from 0..7)
            0x2F, //power control, all internal blocks ON
            0x81, //enter dynamic contrast mode
            31, // Data for the dynamic contrast mode, set to 31 (from 0..63)
            0x40, //go back to the top left of the display
            ], ce); 
          if (callback!==undefined) callback();
        }, 100);
      }, 100);
    
      LCD.flip = function () {
        for (var y=0;y<8;y++) {
          digitalWrite(dc,0); // cmd
          spi.write([0xB0|y/* page */,0x00/* col lower*/,0x10/* col upper*/],ce); 
          digitalWrite(dc,1); // data
          spi.write(new Uint8Array(this.buffer, 128*y, 128), ce);
        }
      };
      return LCD;
    };
    
    // or whatever your pins are:
    SPI1.setup({ sck:B3, mosi:B5 });
    var g = exports.connect(SPI1,B6,B7,B8, function() {
      g.clear();
      g.drawString("Hello",0,0);
      g.drawLine(0,10,84,10);
      g.flip();
    });
    
About

Avatar for Gordon @Gordon started