LED layout

Convert a 5x5 array into a 3x9 array to match the display's circuitry.

Schematics

The schem1 discussed earlier describe the electrical layout of the LEDs, but they do not describe how it relates to the visual layout. It would be a mistake to assume that the numbers 1 to 25 have any correlation to the visual layout of the LEDs on the micro:bit as they do NOT. It just happened to be that ROW0 and COL0 intersect at an LED in the top left corner.

Reference design

To find the relationship between the electrical array and visual array, we need to look at the reference design for the micro:bit. This can be found through a link at the bottom of the micro:bit hardware page

By navigating to the github page > PDF > Schematic Print, you can find a detailed electrical schematic for the micro:bit.

In the top right, you will see an array which can be defined in Rust as follows:


# #![allow(unused_variables)]
#fn main() {
const LED_LAYOUT: [[(usize, usize); 5]; 5] = [
    [(0, 0), (1, 3), (0, 1), (1, 4), (0, 2)],
    [(2, 3), (2, 4), (2, 5), (2, 6), (2, 7)],
    [(1, 1), (0, 8), (1, 2), (2, 8), (1, 0)],
    [(0, 7), (0, 6), (0, 5), (0, 4), (0, 3)],
    [(2, 2), (1, 6), (2, 0), (1, 5), (2, 1)],
];
#}