Skip to main content

Module plain

Module plain 

Source
Expand description

Bitplane framebuffer for a 16-bit plain HUB75 interface.

This module provides a framebuffer that stores colour data as separate bit-planes rather than the threshold-based frames used by crate::plain::DmaFrameBuffer. Each plane holds one bit of every colour channel, giving PLANES planes total (typically 8 for full 8-bit colour). Row addressing, latch, OE, and colour data are all packed into each 16-bit word – no external latch circuit is required.

§Hardware Requirements

Requires a parallel output peripheral capable of clocking 16 bits (though only 15 are actually used) at a time. The data is structured to directly match the HUB75 connector signals, so no external latch or address-decode hardware is needed.

§HUB75 Signal Bit Mapping

Each 16-bit Entry represents the logic levels driven onto the HUB75 bus during a single pixel-clock cycle:

15 ─ (spare)
14 ─ B2       Blue  – lower half of the panel
13 ─ G2       Green – lower half of the panel
12 ─ R2       Red   – lower half of the panel
11 ─ B1       Blue  – upper half of the panel
10 ─ G1       Green – upper half of the panel
 9 ─ R1       Red   – upper half of the panel
 8 ─ OE       Output-Enable / Blank
 7 ─ (spare)
 6 ─ (spare)
 5 ─ LAT      Latch / STB
4-0 ─ A..E    Row address lines

The pixel clock is generated by the peripheral that owns the DMA stream and is not part of the 16-bit word stored in the framebuffer.

§Bitplane BCM Rendering

The framebuffer is organised into PLANES bit-planes. Plane 0 carries the MSB (bit 7) of each colour channel, plane 1 carries bit 6, and so on down to plane 7 which carries the LSB (bit 0).

To produce correct brightness via Binary Code Modulation, configure the DMA descriptor chain so that each plane’s data is output (scanned) a number of times equal to its bit-weight:

plane 0 (bit 7) → output 2^7 = 128 times
plane 1 (bit 6) → output 2^6 =  64 times
plane 2 (bit 5) → output 2^5 =  32 times
  …
plane 7 (bit 0) → output 2^0 =   1 time

That is, each plane is scanned 2^(7 - plane_index) times. The weighted repetition counts sum to 255, reproducing the full 8-bit intensity range. See https://www.batsocks.co.uk/readme/art_bcm_1.htm for background on BCM.

§Memory Usage

Memory scales linearly with PLANES: the buffer contains PLANES copies of the row data (one per bit-plane). Unlike the threshold-based crate::plain::DmaFrameBuffer whose frame count grows as 2^BITS - 1, this layout uses exactly PLANES planes regardless of colour depth.

Each row is COLS 16-bit entries, so total size is PLANES * NROWS * COLS * 2 bytes.

Structs§

DmaFrameBuffer
The entire BCM Frame Buffer (per-plane storage).
Row
A single BCM row payload for 16-bit plain output.