Ability to pass a buffer of data to the SPI hardware interface #695
Description
Today, the architecture of Espruino when it comes to SPI hardware support is to take the array of data passed in by the JavaScript programmer through a call such as:
SPI1.send(myArrayOfData)
And invoke the board specific function called jshSPISend()
for each byte contained within the data. Concerns have been raised that because jshSPISend()
is only seeing one byte at a time, there is a latency (maybe small, maybe not so small) between sending one byte and the next.
One possible solution to this might be the presentation of the array of data directly to jshSPISend()
with the contract that it send all the data as efficiently as possible.
For example, if an array of 300 bytes were supplied where each triple of bytes was a Red/Green/Blue for an LED then 100 LEDs could be lit from one call to jshSPISend()
. Perhaps the board has hardware support to take an arbitrary sized buffer of data as input and send that through SPI without any further assistance?