• Actually I should add that because of jsvIterateCallback, shiftOut supports objects as arguments, for instance a data argument containing extra stuff like {data:0,count:512}.

    So with a tiny tweak to jsvIterateCallback your code could actually be written like this:

      shiftData = [];
      me.convertArray = function(){
        // ...
        shiftData = [];
        for(i = 0; i < 16; i++){
          shiftData.push(digitalWrite.bind(null,[Enable,Latch,Latch,D,C,B,A,Enable], 5|i<<3));
          shiftData.push(new Uint8Array(ledBuf.buffer,i*64,64));
        }
        me.scan = shiftOut.bind(null,[R1,G1,B1,R2,G2,B2],{clk:Clock}, shiftData);;
      };
    

    This would be way faster, since it's not actually executing any JS in order to do the entire scan - including toggling the data lines.

About

Avatar for Gordon @Gordon started