led-matrix-tui (0.1.1)

Published 2024-10-10 16:13:08 +02:00 by remo

Installation

[registry]
default = "forgejo"

[registries.forgejo]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add led-matrix-tui@0.1.1

About this package

Rust library for programming the ZHAW LED-matrix

led-matrix-rs

ZHAW LED-Matrix-Workshop spin-off using Rust instead of Python.

It provides a GUI emulator for local debugging.

The documentation is hosted here.

Usage

There is a template repository here, which gives you all the necessary boilerplate to use this library in your own application. Please read the setup steps in the readme carefully.

You can find examples to run in the directory examples.

Setup:

  1. install the Rust toolchain

  2. add the cross-compilation target: rustup target add thumbv6m-none-eabi

  3. needed to convert the firmware to a flashable format: cargo install elf2uf2-rs

  4. If you are on linux, you need a couple dependencies from your package manager to run the GUI emulator. Refer to the documentation here, it should only be a single command.

    If you can't get the GUI emulator working for some reason, there is also a simpler TUI emulator. You can use it by adding --features tui to any command you use for running examples. However, be aware that the TUI emulator has a worse user experience. The terminal cannot detect key release events, so you must press e separate button to indicate when the joystick was released.

To run the emulator:

cargo run --example $EXAMPLE

To run on hardware, first connect the LED-matrix while keeping BOOTSEL pressed, then:

cargo run --release --target thumbv6m-none-eabi --example $EXAMPLE

Contributing

There is a justfile for common development tasks. For example, run just check to make sure everything compiles. (different targets, features and documentation)

The project is split into four crates:

  • led-matrix: The main library users interact with. Located in the root directory of this repository.
  • led-matrix-core: Defines a trait LedMatrix, which defines the common capabilities of both hardware and GUI emulator. Located in crates/core.
  • led-matrix-bsp: Implements the LedMatrix trait on actual hardware. Located in crates/bsp.
  • led-matrix-gui: Implements the LedMatrix trait with a GUI emulator. Located in crates/gui.
  • led-matrix-tui: Implements the LedMatrix trait with a TUI emulator, as fallback if the GUI emulator doesn't work. Located in crates/tui.

Much of the hardware code is based on the pico_ws2812_led example of rp-pico.

Dependencies

ID Version
crossterm ^0.27.0
led-matrix-core ^0.1.0
ratatui ^0.26.2
Details
Cargo
2024-10-10 16:13:08 +02:00
9
Remo Senekowitsch <senk@zhaw.ch>
MIT
3.8 KiB
Assets (1)
Versions (2) View all
0.1.1 2024-10-10
0.1.0 2024-10-07