Skip to content

Commit 8c809ad

Browse files
committed
ledmatrix: Separate firmware for 10k module
One revision has a 10k ohm resistor in front of the LEDs. This is too small, they're way too bright. So we have to limit the brightness in firmware. Signed-off-by: Daniel Schaefer <[email protected]>
1 parent 8b15137 commit 8c809ad

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

.github/workflows/firmware.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- run: cargo make --cwd b1display
3636
- run: cargo make --cwd c1minimal
3737
- run: cargo make --cwd ledmatrix build-release
38+
- run: cargo make --cwd ledmatrix build-release-10k
3839
- run: cargo make --cwd b1display build-release
3940
- run: cargo make --cwd c1minimal build-release
4041

@@ -44,6 +45,7 @@ jobs:
4445
sudo apt-get install -y libudev-dev
4546
cargo make --cwd b1display uf2
4647
cargo make --cwd c1minimal uf2
48+
cargo make --cwd ledmatrix build-release-10k-uf2
4749
cargo make --cwd ledmatrix uf2
4850
4951
- name: Convert to bin format
@@ -61,6 +63,7 @@ jobs:
6163
path: |
6264
ledmatrix.bin
6365
ledmatrix.uf2
66+
ledmatrix_10k.uf2
6467
6568
- name: Upload b1display files
6669
uses: actions/upload-artifact@v3

.github/workflows/traditional-cargo.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
- run: cargo install flip-link
3333

3434
- run: cargo build -p ledmatrix
35+
- run: cargo build -p ledmatrix --features 10k
3536
- run: cargo build -p b1display
3637
- run: cargo build -p c1minimal
3738

ledmatrix/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ edition = "2021"
33
name = "ledmatrix"
44
version = "0.1.6"
55

6+
[features]
7+
10k = []
8+
69
[dependencies]
710
cortex-m.workspace = true
811
cortex-m-rt.workspace = true

ledmatrix/Makefile.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
extend = "../Makefile.toml"
22

3+
[tasks.build-release-10k]
4+
command = "cargo"
5+
args = ["build", "--target=thumbv6m-none-eabi", "--release", "--features", "10k"]
6+
7+
[tasks.build-release-10k-uf2]
8+
command = "elf2uf2-rs"
9+
args = ["../target/thumbv6m-none-eabi/release/ledmatrix", "../target/thumbv6m-none-eabi/release/ledmatrix_10k.uf2"]
10+
dependencies = ["build-release-10k"]
11+
install_crate = "elf2uf2-rs"
12+
313
[tasks.uf2]
414
command = "elf2uf2-rs"
515
args = ["../target/thumbv6m-none-eabi/release/ledmatrix", "../target/thumbv6m-none-eabi/release/ledmatrix.uf2"]

ledmatrix/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ const MAX_CURRENT: usize = 500;
4242
/// Maximum brightness out of 255
4343
/// On HW Rev 1 from BizLink set to 94 to have just below 500mA current draw.
4444
/// BizLink HW Rev 2 has a larger current limiting resistor
45+
#[cfg(feature = "10k")]
46+
const MAX_BRIGHTNESS: u8 = 94;
47+
#[cfg(not(feature = "10k"))]
4548
const MAX_BRIGHTNESS: u8 = 255;
4649

4750
// TODO: Doesn't work yet, unless I panic right at the beginning of main

0 commit comments

Comments
 (0)