Skip to content

feat(firmware): host-programmable per-pixel LED matrix framebuffer - #623

Open
hongquanli wants to merge 1 commit into
masterfrom
feat/led-matrix-programmable-firmware
Open

feat(firmware): host-programmable per-pixel LED matrix framebuffer#623
hongquanli wants to merge 1 commit into
masterfrom
feat/led-matrix-programmable-firmware

Conversation

@hongquanli

Copy link
Copy Markdown
Contributor

What

Make the LED matrix host-programmable per-pixel, so patterns (rings, DPC, custom apertures) are computed on the host instead of hard-coded in firmware. New patterns no longer require a firmware reflash.

Changes

  • ILLUMINATION_SOURCE_LED_ARRAY_PROGRAMMABLE (10) — displays a host-painted 128-LED framebuffer (led_matrix_user). It's kept separate from the live matrix so it survives the clear_matrix() that strobe-off does between acquisition frames; turning the source on copies the framebuffer into the live matrix and shows it.
  • SET_ILLUMINATION_LED_MATRIX_PIXEL (45) — write one LED into the framebuffer (no show).
  • CLEAR_ILLUMINATION_LED_MATRIX (46) — zero the framebuffer.
  • Pixel /255*MAX_INTENSITY scaling and R/G channel order match the built-in full/half patterns, so a host-painted color renders identically to the same built-in color.

Testing

  • pio run -e teensy41 builds clean; flashed to a Teensy 4.1 and exercised via the host (see companion host PR): painting a 128-LED annulus frame and displaying it in live view and acquisition.

Companion PR

Host support (protocol + Phase Contrast configurator) is in a separate host-only PR that depends on this firmware being flashed.

Add a programmable LED-matrix source so the host can drive each of the 128
LEDs individually. This moves all pattern logic (rings, DPC, custom
apertures) to the host — new patterns no longer require a firmware reflash.

- ILLUMINATION_SOURCE_LED_ARRAY_PROGRAMMABLE (10): displays a host-painted
  framebuffer (led_matrix_user), kept separate from the live matrix so it
  survives the clear_matrix() strobe-off between acquisition frames.
- SET_ILLUMINATION_LED_MATRIX_PIXEL (45): write one LED into the framebuffer
  (no show). CLEAR_ILLUMINATION_LED_MATRIX (46): zero the framebuffer.
- Pixel scaling and R/G channel order match the built-in full/half patterns,
  so a host-painted color renders identically to the same built-in color.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant