I notice in your solution you're writing pixels as what's basically 0x00rgbrgb. Do you see anything wrong with doing 0x0rgb0rgb? It just makes it a slightly more flexible as then the function could be used for overlapping graphics of any number of bits per pixel. As it is I'd be allocating 4bpp, but shifting by 3bpp.
To shift out you'd use [R1,G1,B1,undefined,R2,G2,B2] rather than [R1,G1,B1,R2,G2,B2]. It's not perfect but IMO it'd make it less of a single-use piece of functionality.
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.
I notice in your solution you're writing pixels as what's basically
0x00rgbrgb
. Do you see anything wrong with doing0x0rgb0rgb
? It just makes it a slightly more flexible as then the function could be used for overlapping graphics of any number of bits per pixel. As it is I'd be allocating 4bpp, but shifting by 3bpp.To shift out you'd use
[R1,G1,B1,undefined,R2,G2,B2]
rather than[R1,G1,B1,R2,G2,B2]
. It's not perfect but IMO it'd make it less of a single-use piece of functionality.