• I guess I could add a read function that would pump out however many bytes were needed - as you say, 0xFF might be best. It's not a massive problem to create an array of bytes to stick into send though.

    You could always write something like:

    if (!SPI.prototype.read) SPI.prototype.read = function(n,p) { var a = new Uint8Array(n); a.fill(0xFF); return this.send(a,p); }

    and then if a read function does get added, you code should swap over gracefully.

    In terms of expecting data - I think you just have to 'know' - sometimes you can ask the device, but sometimes you'll just have to check the datasheet and figure it out.


Avatar for Gordon @Gordon started