I suggested a while ago to use the same pattern for SPI.send() as provided for SPI.write()
It tries to return a buffer of the same type as the arguments, so it's not quite as easy. It is possible though - I've just had other things on my mind and this is firmly in the 'optimisation' pile of things :)
there is no way to shovel the data from SPI directly into the buffer of the waveform (waveforms bring their own buffers), so I always have to copy
Well, there's waveform.buffer.set(dataFromSPI), which is quite fast.
I need 3 times as much memory as the received payload?
If you don't absolutely need zeros, you could just pass the waveform's buffer in?
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.
It tries to return a buffer of the same type as the arguments, so it's not quite as easy. It is possible though - I've just had other things on my mind and this is firmly in the 'optimisation' pile of things :)
Well, there's
waveform.buffer.set(dataFromSPI)
, which is quite fast.If you don't absolutely need zeros, you could just pass the waveform's buffer in?