Well, #2 should work - or: spi.send(new Uint8Array(sData.buffer));
spi.send(new Uint8Array(sData.buffer));
Is it possible that the byte ordering is wrong? I'm not 100% sure but does #2 have the same result as:
for(i = 0; i < sData.length; i++) spi.send(String.fromCharCode(sData[i])+String.fromCharCode(sData[i]>>8));
The other option (faster than #1) may be:
sData.forEach(function(s) {SPI.send([s>>8,s]);});
But if #2 (or some variant) will work, that would be ideal.
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Well, #2 should work - or:
spi.send(new Uint8Array(sData.buffer));
Is it possible that the byte ordering is wrong? I'm not 100% sure but does #2 have the same result as:
The other option (faster than #1) may be:
But if #2 (or some variant) will work, that would be ideal.