You are reading a single comment by @Owen and its replies. Click here to read the full conversation.
  • Hi,
    I think this is the working code but haven't tested it in a while. Read the comment at the top for the wiring, matrix and Glediator settings.
    Let me know if that works or not. I was using the Pico but it shouldn't matter which espruino you use.

    /**
    Glediator settings
    Driver: Glediator
    COM6
    Baud 1000000
    Colour order: GRB
    Pixel order:  HS_TL
    */
    var fps = 0,
        buf = new Uint8Array(15*15*3),
        bufIdx = 0,
        cmd = "";
    
    function onInit() {
      SPI1.setup({baud:3200000, mosi:A7});
      
      Serial1.setup(115200, {tx:B6,rx:B7});
      Serial1.on('data', function (data) {
        
        buf.set(data, bufIdx);
        bufIdx += data.length;
        
        if (data.indexOf("\1") >= 0) {
          var idx = bufIdx + data.indexOf("\1");
          var line = new Uint8Array(buf.buffer, 0, idx);
          console.log(idx);
          
          SPI1.send4bit(line, 0b0001, 0b0011);
          buf.set(new Uint8Array(buf.buffer, idx, bufIdx-idx), 0);
          bufIdx -= idx;
          fps++;
        }
      });
        
      var fps = setInterval(function() {
        console.log('fps: ' + fps);
        fps = 0;
      }, 1000);
    }
    
    onInit();
    
About

Avatar for Owen @Owen started