Skip to content

Merge display POC, Implement snake and pong in firmware, add more matrix APIs #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 93 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 28 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "led_matrix_fw"
version = "0.1.1"
name = "lotus_inputmodules"
version = "0.1.2-pre"

[dependencies]
cortex-m = { version = "0.7", features = ["critical-section-single-core"]}
Expand All @@ -24,9 +24,34 @@ usb-device= "0.2.9"
heapless = "0.7.9"
usbd-serial = "0.1.1"
usbd-hid = "0.5.1"
is31fl3741 = { git = "https://github.com/JohnAZoidberg/is31fl3741", branch = "all-at-once" }
fugit = "0.3.6"

# LED Matrix
is31fl3741 = { git = "https://github.com/JohnAZoidberg/is31fl3741", branch = "all-at-once", optional = true }


# B1 Display
display-interface-spi = { version = "0.4.1", optional = true }
mipidsi = { version = "0.6.0", optional = true }
embedded-graphics = { version = "0.7", optional = true }
tinybmp = { version = "0.4.0", optional = true }

[lib]
name = "lotus_input"
path = "src/lib.rs"

[[bin]]
name = "ledmatrix"
required-features = ["ledmatrix"]

[[bin]]
name = "b1display"
required-features = ["b1display"]

[features]
ledmatrix = [ "is31fl3741" ]
b1display = [ "display-interface-spi", "mipidsi", "embedded-graphics", "tinybmp" ]

# cargo build/run
[profile.dev]
codegen-units = 1
Expand Down
40 changes: 34 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Lotus LED Matrix Module
# Lotus Input Module Firmware

It's a 9x34 (306) LED matrix, controlled by RP2040 MCU and IS31FL3741A LED controller.

Connection to the host system is via USB 2.0 and currently there is a USB Serial API to control it without reflashing.
See below sections for LED Matrix and LCD Display module details.

Rust project setup based off of: https://github.com/rp-rs/rp2040-project-template

Expand Down Expand Up @@ -63,6 +61,7 @@ options:
--wpm WPM Demo
--snake Snake
--all-brightnesses Show every pixel in a different brightness
-v, --version Get device version
--serial-dev SERIAL_DEV
Change the serial dev. Probably /dev/ttyACM0 on Linux, COM0 on Windows
```
Expand Down Expand Up @@ -99,13 +98,15 @@ cargo install elf2uf2-rs --locked
Build:

```sh
cargo build
cargo build --bin ledmatrix --features=ledmatrix
cargo build --bin b1display --features=b1display
```

Generate UF2 file:

```sh
elf2uf2-rs target/thumbv6m-none-eabi/debug/led_matrix_fw led_matrix.uf2
elf2uf2-rs target/thumbv6m-none-eabi/debug/ledmatrix ledmatrix.uf2
elf2uf2-rs target/thumbv6m-none-eabi/debug/b1display b1dipslay.uf2
```

## Flashing
Expand All @@ -121,6 +122,25 @@ cargo run
Or by copying the above generated UF2 file to the partition mounted when the
module is in the bootloder.

### Check the firmware version of the device

###### In-band using `control.py`

```sh
> ./control.py --version
Device version: 0.1.2
```

###### By looking at the USB descriptor

On Linux:

```sh
> lsusb -d 32ac: -v 2> /dev/null | grep -P 'ID 32ac|bcdDevice'
Bus 003 Device 078: ID 32ac:0021 Framework Lotus B1 Display
bcdDevice 0.10
```

## Panic

On panic the RP2040 resets itself into bootloader mode.
Expand All @@ -132,3 +152,11 @@ Additionally the panic message is written to flash, which can be read as follows
sudo picotool save -r 0x15000000 0x15004000 message.bin
strings message.bin | head
```

## LED Matrix

It's a 9x34 (306) LED matrix, controlled by RP2040 MCU and IS31FL3741A LED controller.

Connection to the host system is via USB 2.0 and currently there is a USB Serial API to control it without reflashing.

## B1 Display
Binary file added assets/logo.bmp
Binary file not shown.
Loading