Nice - thanks! You could definitely improve the Sharp Memory LCD library by the look of it - I don't have time to try an actual one here, but changing this in the existing library should work:
g.flip = function () {
digitalWrite(cs,1); // CS on
spi.write([0b00000001,1]); // update, 1st row
var w = g.getWidth()>>3, h = g.getHeight();
for (var y=0;y<h;y++)
spi.write(new Uint8Array(g.buffer,y*w,w),[0,y+2]); // pad and do 2nd row
digitalWrite(cs,0); // CS off
};
Also any calls to spi.send could be spi.write - it doesn't try and read data so it never has to allocate anywhere to put the received data.
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.
Nice - thanks! You could definitely improve the Sharp Memory LCD library by the look of it - I don't have time to try an actual one here, but changing this in the existing library should work:
Also any calls to
spi.send
could bespi.write
- it doesn't try and read data so it never has to allocate anywhere to put the received data.