You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Thanks! So does the LED matrix that you have actually hold its contents - or does it have to be scanned out repeatedly?

    You could do something like this to write all 3 colours and the clock in one instruction (instead of your for (var k loop):

    var words = new Uint32Array(bytes.buffer,y/*byte offset*/,(z-y)/4 /*length*/);
    [].forEach.call(words, function(col) {
      digitalWrite([B8,B8,B5,B6,B7], 8 | ((((col&0x808080)*0b100000010000001)>>21­)&7));
    });
    

    It should be a lot faster as you're effectively getting Espruino to iterate over the array.

    I don't have a display to test with, but it should work (although the offset/length for Uint32Array could be wrong).

    The craziness with multiply+shift is because I'm trying to extract 3 bit colour from the 24 bit image. I guess ideally you'd use the built-in graphics library which will do 4 bit colour, so you could use 3 bits of those 4 bits and make your life a lot easier.

About

Avatar for Gordon @Gordon started