You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Just to add:

        t=(this.cap>65536)?E.toString(3,add>>16&­0xff,add>>8&0xff,add&0xff):E.toString(3,­add>>8&0xff,add&0xff);
        var ov=this.spi.send(t,this.cspin);
        var o=new Uint8Array(ov.buffer,(this.cap>65536?4:3­),bytes);
    

    If you send a string to SPI.send then I'm pretty sure it'll return a string rather than an ArrayBuffer, which I guess is causing the issue. Looks like the following might fix it?

        var t=(this.cap>65536)?E.toUint8Array(3,add>­>16,add>>8,add):E.toUint8Array(3,add>>8,­add);
        var ov=this.spi.send(t,this.cspin);
        var o=new Uint8Array(ov.buffer,(this.cap>65536?4:3­),bytes);
    

    toUint8Array and toString have an implicit &0xFF as they're converting to 8 bits, so you can also slim down the code a bit (done above) if you want to.

About

Avatar for Gordon @Gordon started