The numbers in red are the lcd_spi_unbuf driver and the numbers in green are the version I wrote that directly implements drawImage. The application code for both is identical and is trying to increment and display the number every 100ms:
// display incrementing number
var pal2color = new Uint16Array([0x0000,0xF100]);
var buf2 = Graphics.createArrayBuffer(20,64,1,{msb:true});
buf2.setRotation(3);
buf2.setColor(1);
buf2.setFont("Vector",20);
var N = 0;
function drawNumber() {
buf2.drawString(N,0,0);
lcd.drawImage({width:20,height:64,bpp:1,buffer:buf2.buffer, palette:pal2color},30,50);
buf2.clear();
++N;
if (N>999) N = 0;
}
setInterval(drawNumber,100);
The drawImage based driver (green numbers) appears to be over twice as fast as the lcd_spi_inbuf version. I have cheated a bit in that I have chosen an image size that does not create a fragment. My conclusion is that I will try to combine these two drivers to give the best of both and I think that it is still important to get a solution to the original issue I mentioned of being able to write only part of a buffer to spi.
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.
Hi, I have now managed to do a comparison. See video below:
https://youtu.be/NHtWqIaIGDY
The numbers in red are the
lcd_spi_unbuf
driver and the numbers in green are the version I wrote that directly implementsdrawImage
. The application code for both is identical and is trying to increment and display the number every 100ms:The
drawImage
based driver (green numbers) appears to be over twice as fast as thelcd_spi_inbuf
version. I have cheated a bit in that I have chosen an image size that does not create a fragment. My conclusion is that I will try to combine these two drivers to give the best of both and I think that it is still important to get a solution to the original issue I mentioned of being able to write only part of a buffer to spi.You can see the full code here