Use bitflags to represent the font

This commit is contained in:
Savanni D'Gerinel 2025-03-05 09:25:15 -05:00
parent 132c85e99d
commit 155d2ba18e
4 changed files with 324 additions and 793 deletions

35
Cargo.lock generated
View File

@ -365,7 +365,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
dependencies = [
"annotate-snippets",
"bitflags 2.8.0",
"bitflags 2.9.0",
"cexpr",
"clang-sys",
"itertools 0.12.1",
@ -420,9 +420,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.8.0"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
dependencies = [
"serde 1.0.218",
]
@ -485,7 +485,7 @@ version = "0.18.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
"cairo-sys-rs",
"glib 0.18.5",
"libc",
@ -1815,7 +1815,7 @@ version = "0.18.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
"futures-channel",
"futures-core",
"futures-executor",
@ -1838,7 +1838,7 @@ version = "0.20.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "707b819af8059ee5395a2de9f2317d87a53dbad8846a2f089f0bb44703f37686"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
"futures-channel",
"futures-core",
"futures-executor",
@ -2837,7 +2837,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65f3a4b81b2a2d8c7f300643676202debd1b7c929dbf5c9bb89402ea11d19810"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
"cc",
"convert_case",
"cookie-factory",
@ -3142,7 +3142,7 @@ version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
"cfg-if",
"libc",
]
@ -3286,7 +3286,7 @@ version = "0.10.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e14130c6a98cd258fdcb0fb6d744152343ff729cbfcb28c656a9d12b999fbcd"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
"cfg-if",
"foreign-types",
"libc",
@ -3563,6 +3563,7 @@ dependencies = [
name = "pico-st7789"
version = "0.1.0"
dependencies = [
"bitflags 2.9.0",
"cortex-m-rt",
"embedded-alloc",
"embedded-hal 1.0.0",
@ -3632,7 +3633,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08e645ba5c45109106d56610b3ee60eb13a6f2beb8b74f8dc8186cf261788dda"
dependencies = [
"anyhow",
"bitflags 2.8.0",
"bitflags 2.9.0",
"libc",
"libspa",
"libspa-sys",
@ -3829,7 +3830,7 @@ checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50"
dependencies = [
"bit-set",
"bit-vec",
"bitflags 2.8.0",
"bitflags 2.9.0",
"lazy_static",
"num-traits",
"rand 0.8.5",
@ -4068,7 +4069,7 @@ version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82b568323e98e49e2a0899dcee453dd679fae22d69adf9b11dd508d1549b7e2f"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
]
[[package]]
@ -4299,7 +4300,7 @@ version = "0.38.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
"errno",
"libc",
"linux-raw-sys",
@ -4387,7 +4388,7 @@ version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
"core-foundation",
"core-foundation-sys",
"libc",
@ -4758,7 +4759,7 @@ checksum = "4560278f0e00ce64938540546f59f590d60beee33fffbd3b9cd47851e5fff233"
dependencies = [
"atoi",
"base64 0.22.1",
"bitflags 2.8.0",
"bitflags 2.9.0",
"byteorder",
"bytes",
"crc",
@ -4800,7 +4801,7 @@ checksum = "c5b98a57f363ed6764d5b3a12bfedf62f07aa16e1856a7ddc2a0bb190a959613"
dependencies = [
"atoi",
"base64 0.22.1",
"bitflags 2.8.0",
"bitflags 2.9.0",
"byteorder",
"crc",
"dotenvy",
@ -6035,7 +6036,7 @@ version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
]
[[package]]

View File

@ -4,6 +4,7 @@ version = "0.1.0"
edition = "2021"
[dependencies]
bitflags = "2.9.0"
cortex-m-rt = "0.7.3"
embedded-alloc = "0.6.0"
embedded-hal = "1.0.0"

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@ use rp_pico::{
};
mod drawing;
use drawing::{Canvas};
use drawing::Canvas;
mod font;
use font::{Font, Glyph, SixteenSegmentFont};
@ -31,12 +31,11 @@ const FRAMEBUF: usize = ROWS * COLUMNS * 3;
#[global_allocator]
static HEAP: Heap = Heap::empty();
#[entry]
unsafe fn main() -> ! {
{
use core::mem::MaybeUninit;
const HEAP_SIZE: usize = 16 * 1024;
const HEAP_SIZE: usize = 1024;
static mut HEAP_MEM: [MaybeUninit<u8>; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE];
unsafe { HEAP.init(HEAP_MEM.as_ptr() as usize, HEAP_SIZE) }
}
@ -126,13 +125,6 @@ unsafe fn main() -> ! {
let mut canvas = Canvas::new();
loop {
{
let display = display.acquire();
let _ = led.set_high();
timer.delay_ms(100);
display.send_buf(canvas.buf);
let _ = led.set_low();
}
/*
draw_seven_segment(0, &mut frame, 0, 0, (255, 255, 255));
@ -147,8 +139,12 @@ unsafe fn main() -> ! {
draw_seven_segment(9, &mut frame, 63, 0, (255, 255, 255));
*/
font_sixteen.glyph(' ').draw(&mut canvas, 0, 0, (255, 255, 255));
font_sixteen.glyph('0').draw(&mut canvas, 11, 0, (255, 255, 255));
font_sixteen
.glyph(' ')
.draw(&mut canvas, 0, 0, (255, 255, 255));
font_sixteen
.glyph('0')
.draw(&mut canvas, 11, 0, (255, 255, 255));
font_sixteen.glyph('1').draw(&mut canvas, 22, 0, (255, 255, 255));
font_sixteen.glyph('2').draw(&mut canvas, 33, 0, (255, 255, 255));
font_sixteen.glyph('3').draw(&mut canvas, 44, 0, (255, 255, 255));
@ -186,6 +182,14 @@ unsafe fn main() -> ! {
font_sixteen.glyph('X').draw(&mut canvas, 88, 40, (255, 255, 255));
font_sixteen.glyph('Y').draw(&mut canvas, 99, 40, (255, 255, 255));
font_sixteen.glyph('Z').draw(&mut canvas, 110, 40, (255, 255, 255));
{
let display = display.acquire();
let _ = led.set_high();
timer.delay_ms(100);
display.send_buf(canvas.buf);
let _ = led.set_low();
}
/*
for x in 80..90 {
for y in 155..165 {
@ -197,4 +201,3 @@ unsafe fn main() -> ! {
timer.delay_ms(1000);
}
}