Microsoft MakeCode

Enhanced extension for the Pimoroni - coming soon

I’m in the middle of writing a versatile extension for the Pimoroni Scroll:bit 17x7 LED matrix for Micro:bit as shown here:

When I’ve finished I hope I can publish the extension - it could be useful for programming games on the display and for helping children have more fun with a Microbit with more than just a 5x5 display.

The original pxt-scrollbit extension is, if I may be blunt, a bit of a dog and a bit limited. What I have done so far is to eliminate the use of individual pxiel brightness in favour of speed. 144 byte transfers are required to update the entire display but if a simple on/off display is required this only requires 17 bytes, plus an additional 17 if the blink facility is also used.

My extension uses buffers (arrays) to store the pixel state and blink state and allows for two drawing modes: either the whole LED matrix must be updated using a show() command or the display (or appropriate column(s) thereof) is updated by every single plotting operation according to the value of a configurable Draw Mode flag. The extension does not read data from the display: quering pixels is done only through the buffer irrespective of whether pixel changes have yet been sent to the display. The extension is designed for speed. Each byte of the buffer is one column of the display and there is an invisible eighth row available in the buffer, plus an invisible 17th column.

I have written functions for:
-Setting the global brightness level
-Changing the Draw Mode
-Setting a pixel
-Clearing a pixel
-Querying a pixel
-Setting the blink state on/off for a pixel
-Drawing a line between two points
-clearing the display/blink buffers
-updating the whole LED display.
-Scrolling the entire image 17x7 either left/right/up/down by one pixel (which also allows the invisible row 8 and column 17 to be used).
-Scrolling text across the screen but using the frame capabilities of the driver IC to preserve and restore the previous display after the text has scrolled

I am also writing a further set of functions that could be extremely useful for writing games:

I have a function which creates a large buffer which can be used to store a pixel image of any user-defined size. The Pimoroni Scroll:bit display then acts as a window positioned on this image with an (x,y) coordinate.This means a “world” much larger than 17x7 pixels can be designed and written to the image buffer and the user can move around this with the 17x7 window with very minimal processor overheads. Furthermore, the basic 17x7 image buffer can be overlaid ontop of the scrolled world according to the state of an Overlay flag. This could be extremely useful for all sorts of games for example showing a “vehicle” image of a few pixels fixed in the centre of the screen, with the background world moving underneath it.

When it’s finished I will write a maze-drawing game with a large maze (say 32x32 cells) and make a character navigate through it using the windowed functions.

Sounds like a job for the arcade pixel editor.