• Taking Gordon's code as a template, I suppose it would look something like the code below. I pulled the init sequence from u8g_dev_st7567_pi13264.c and the define statements from u8g.h.

    NOTE: The code block rendering engine turns hash marks into links. In the define statements below you'll have to remove all the forward slashes.

    // I grabbed these define statements from u8g.h in the u8glib library
    // using this command "grep -ir U8G_ESC_* utility/u8g.h"
      \#define U8G_ESC_DLY(x) 255, ((x) & 0x7f)
      \#define U8G_ESC_CS(x) 255, (0xd0 | ((x)&0x0f))
      \#define U8G_ESC_ADR(x) 255, (0xe0 | ((x)&0x0f))
      \#define U8G_ESC_RST(x) 255, (0xc0 | ((x)&0x0f))
      \#define U8G_ESC_VCC(x) 255, (0xbe | ((x)&0x01))
      \#define U8G_ESC_END 255, 254
      \#define U8G_ESC_255 255, 255
    
    var exports={};
    exports.connect = function(/*=SPI*/_spi, /*=PIN*/_dc, /*=PIN*/_ce, /*=PIN*/_rst, callback) {
      var LCD = Graphics.createArrayBuffer(128,64,1,{verĀ­tical_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([
         U8G_ESC_CS(0),    /* disable chip */
          U8G_ESC_ADR(0),   /* instruction mode */
         U8G_ESC_CS(1),    /* enable chip */
        U8G_ESC_RST(15),  /* do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
      0x0a3,		    /* 0x0a3: LCD bias 1/9 (suggested for the pi13264) */
      0x0a1,		    /* 0x0a1: ADC set to reverse (suggested for the pi13264) */
      0x0c0,            /* common output mode: set scan direction normal operation/SHL Select, 0x0c0 --> SHL = 0, normal, 0x0c8 --> SHL = 1 */
      0x040,		    /* set display start line */
      0x028 | 0x04,     /* power control: turn on voltage converter */
          U8G_ESC_DLY(50),  /* delay 50 ms */
      0x028 | 0x06,     /* power control: turn on voltage regulator */
          U8G_ESC_DLY(50),  /* delay 50 ms */
      0x028 | 0x07,     /* power control: turn on voltage follower */
         U8G_ESC_DLY(50),  /* delay 50 ms */
      0x026,		    /* set V0 voltage resistor ratio to 6 */
      0x0a6,            /* display normal, bit val 0: LCD pixel off. */
      0x0C0,		    /* set contrast */
      0x018,		    /* contrast value*/
      /*0x0ac,*/        /* indicator */
      /*0x000,*/        /* disable */
      0x0af,            /* display on */
         U8G_ESC_DLY(100), /* delay 100 ms */
      0x0a5,		    /* display all points, ST7565 */
         U8G_ESC_DLY(100), /* delay 100 ms */
          U8G_ESC_DLY(100), /* delay 100 ms */
      0x0a4,		    /* normal display */
         U8G_ESC_CS(0),    /* disable chip */
          U8G_ESC_END       /* end of sequence */
            ], 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 user56610 @user56610 started