You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Looks good - I think you actually want to leave out repeat:8 though - since what you want is to only output once per byte. [Pr1,Pr2,Pb1,Pb2,Pg1,Pg2] may be better off as [Pr2,Pb2,Pg2,Pr1,Pg1,Pb1] as well (see the 16 row comment below).

    Also scan will need to be called repeatedly for you to see anything.

    The code in the module is designed to run really quickly - so it uses a few hacks (most of which I think you picked up on!)

    what is repeat in shiftOut.bind ?­/Web/JavaScript/Reference/Global_Objects­/Function/bind

    sfnc = shiftOut.bind(null,[Pr1,Pr2,Pb1,Pb2,Pg1,­Pg2],{clk:Pclock,repeat : 8});
    sfnc(new Uint8Array(u,y*64,64));

    is the same as:

    shiftOut.([Pr1,Pr2,Pb1,Pb2,Pg1,Pg2],{clk­:Pclock,repeat : 8}, new Uint8Array(u,y*64,64));

    Except that it's significantly faster when you're calling it multiple times, since all the arguments that don't change have already been precalculated

    why do you have enable pin twice in digitalWrite ?

    There's an explanation in­bal_digitalWrite - again, it's a very fast way of pulsing the pin on and off while also setting the address pins.

    we only have 4 address bytes, how would we control 32 rows ? Seems to be a non Espruino questions, but may be you have some ideas

    :) These RGB LED arrays scan out two rows at once. That's why you have R1 and R2, G1,G2,B1,B2.

    Address 0 = row 0 and 16, 1 = 1 and 17, etc.

    I think I mentioned in my email, but it means that you'll have to precalculate a new array that contains the image of the first 16 rows plus the image in the next 16 rows shifted left by 3 bits (and then use [Pr2,Pb2,Pg2,Pr1,Pg1,Pb1]).

    However for testing the current code should work, and will drive the top or bottom 16 rows depending on what colours you use.

    should we init enable to 1 ?

    It looks like a good idea - but I doubt it'll matter too much as it'll get sorted once scan is called.


Avatar for Gordon @Gordon started