Thanks @allObjects, your post gave me a clue to look at how the graphics array is allocated and it is in a flat data area, so I now use a simple memcpy at the start of my native "flip" routine to copy it to the DMA-capable transfer buffer. Profligate use of precious memory I know... but it does mean I can use the existing Graphics and the only custom part is the flip.
I now have a little Javascript app drawing and moving 16 rects and total execution time is around 35ms, ie. 28fps. Even this was interesting as I found things like rects.forEach(r => {g.drawRect(...)}), rather than a simple for loop based on rects.length added about 5ms per redraw.
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.
Thanks @allObjects, your post gave me a clue to look at how the graphics array is allocated and it is in a flat data area, so I now use a simple
memcpy
at the start of my native "flip" routine to copy it to the DMA-capable transfer buffer. Profligate use of precious memory I know... but it does mean I can use the existingGraphics
and the only custom part is the flip.I now have a little Javascript app drawing and moving 16 rects and total execution time is around 35ms, ie. 28fps. Even this was interesting as I found things like
rects.forEach(r => {g.drawRect(...)})
, rather than a simplefor
loop based onrects.length
added about 5ms per redraw.Breadboard pic for interest...
1 Attachment