You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • You could also include any required SPI commands at the beginning of the sendData array, and could then use ArrayBufferViews to cut out the data you need without a copy:

    var sendData = new Uint8Array(4+256);
    sendData[0] = ...;
    sendData[1] = ...;
    sendData[2] = ...;
    sendData[3] = ...;
    // now in the loop:
    var result = SPI2.send(sendData);
    var data = new Uint8Array(sendData.buffer,4,256);

Avatar for Gordon @Gordon started