You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Seems to work for me?


    If you're serious about getting the scanning speed up, I'd try and precalculate a Uint8Array of bytes where the 4th bit is 1, and the 1st, 2nd and 3rd are R,G and B.

    Then you can do something like:

    var p = [B8,B8,LED3,LED2,LED1];     
    var d = digitalWrite;                          
    words.forEach(function(w) {d(p,w)});

    (new versions of Espruino allow you to use forEach directly, rather than the whole [].forEach thing that was done before)

    Having said that, for the 1024 bytes (32x32) it still seems to take 247ms (and that's without the latching), which is too slow for you really. To get the speed up you might still be looking at writing some inline assembler.

    A quick test shows that you can get down to around 30ms:

    var sender = E.asm("void(int)", 
      "bx  lr");
    words = new Uint8Array(1024);

    although that's not doing anything in the assembler code itself - you'd have to write some code to set the relevant pins to the right values.


Avatar for Gordon @Gordon started