Make small tweaks
This commit is contained in:
parent
fbca758e1b
commit
6e61b3df5c
95
Cargo.lock
generated
95
Cargo.lock
generated
@ -68,16 +68,6 @@ version = "1.5.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cc"
|
|
||||||
version = "1.2.37"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "65193589c6404eb80b450d618eaf9a2cafaaafd57ecce47370519ef674a7bd44"
|
|
||||||
dependencies = [
|
|
||||||
"find-msvc-tools",
|
|
||||||
"shlex",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.3"
|
version = "1.0.3"
|
||||||
@ -132,43 +122,6 @@ version = "0.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "723dce4e9f25b6e6c5f35628e144794e5b459216ed7da97b7c4b66cdb3fa82ca"
|
checksum = "723dce4e9f25b6e6c5f35628e144794e5b459216ed7da97b7c4b66cdb3fa82ca"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "find-msvc-tools"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7fd99930f64d146689264c637b5af2f0233a933bef0d8570e2526bf9e083192d"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hash32"
|
|
||||||
version = "0.3.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
|
|
||||||
dependencies = [
|
|
||||||
"byteorder",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "heapless"
|
|
||||||
version = "0.8.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
|
||||||
dependencies = [
|
|
||||||
"hash32",
|
|
||||||
"stable_deref_trait",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mipidsi"
|
|
||||||
version = "0.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9ba34dcbf61182ffa6992b5a4d9b566d5a99df127fd93f6d314213347329e92f"
|
|
||||||
dependencies = [
|
|
||||||
"embedded-graphics-core",
|
|
||||||
"embedded-hal 1.0.0",
|
|
||||||
"heapless",
|
|
||||||
"nb 1.1.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nb"
|
name = "nb"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
@ -214,52 +167,6 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustc_version"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
|
||||||
dependencies = [
|
|
||||||
"semver",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver"
|
|
||||||
version = "0.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
|
||||||
dependencies = [
|
|
||||||
"semver-parser",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver-parser"
|
|
||||||
version = "0.7.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "shlex"
|
|
||||||
version = "1.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "stable_deref_trait"
|
|
||||||
version = "1.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "stackalloc"
|
|
||||||
version = "1.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "00b5b7088084b7f78305a42468c9a3693918620f0b8ec86260f1132dc0521e78"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"rustc_version",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.109"
|
version = "1.0.109"
|
||||||
@ -279,9 +186,7 @@ dependencies = [
|
|||||||
"avr-device",
|
"avr-device",
|
||||||
"embedded-graphics-core",
|
"embedded-graphics-core",
|
||||||
"embedded-hal 1.0.0",
|
"embedded-hal 1.0.0",
|
||||||
"mipidsi",
|
|
||||||
"panic-halt",
|
"panic-halt",
|
||||||
"stackalloc",
|
|
||||||
"ufmt",
|
"ufmt",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -10,9 +10,7 @@ embedded-hal = "1.0.0"
|
|||||||
atmega-hal = { git = "https://github.com/Rahix/avr-hal?tab=readme-ov-file", rev="cd3edea", version = "0.1.0", features=["atmega328p"] }
|
atmega-hal = { git = "https://github.com/Rahix/avr-hal?tab=readme-ov-file", rev="cd3edea", version = "0.1.0", features=["atmega328p"] }
|
||||||
|
|
||||||
ufmt = "0.2.0"
|
ufmt = "0.2.0"
|
||||||
mipidsi = "0.9.0"
|
|
||||||
embedded-graphics-core = "0.4.0"
|
embedded-graphics-core = "0.4.0"
|
||||||
stackalloc = { version = "1.2.1", features = ["no_std"] }
|
|
||||||
# nb = "1.1.0"
|
# nb = "1.1.0"
|
||||||
# pwm-pca9685 = "1.0.0"
|
# pwm-pca9685 = "1.0.0"
|
||||||
# infrared = "0.14.1"
|
# infrared = "0.14.1"
|
||||||
|
BIN
images/sheep.xcf
BIN
images/sheep.xcf
Binary file not shown.
25
src/qoi.rs
25
src/qoi.rs
@ -58,10 +58,12 @@ macro_rules! non_bss_statics {(
|
|||||||
// static LARGE: [u8; 1966] = *include_bytes!("../images/large.qoi");
|
// static LARGE: [u8; 1966] = *include_bytes!("../images/large.qoi");
|
||||||
// static SHEEP: [u8; 852] = *include_bytes!("../images/sheep.qoi");
|
// static SHEEP: [u8; 852] = *include_bytes!("../images/sheep.qoi");
|
||||||
|
|
||||||
non_bss_statics! {
|
// non_bss_statics! {
|
||||||
static ref SHEEP: [u8] = *include_bytes!("../images/sheep.qoi");
|
// static ref SHEEP: [u8] = *include_bytes!("../images/sheep.qoi");
|
||||||
static ref LARGE: [u8] = *include_bytes!("../images/large.qoi");
|
// // static ref LARGE: [u8] = *include_bytes!("../images/large.qoi");
|
||||||
}
|
// }
|
||||||
|
static SHEEP: [u8; 852] = *include_bytes!("../images/sheep.qoi");
|
||||||
|
static LARGE: [u8; 1966] = *include_bytes!("../images/large.qoi");
|
||||||
|
|
||||||
// const LARGE_C1: [u8; 512] = LARGE.as_chunks().0[0];
|
// const LARGE_C1: [u8; 512] = LARGE.as_chunks().0[0];
|
||||||
// const LARGE_C2: [u8; 512] = LARGE.as_chunks().0[1];
|
// const LARGE_C2: [u8; 512] = LARGE.as_chunks().0[1];
|
||||||
@ -97,8 +99,8 @@ pub fn draw_image<T: DelayNs, DCPin: PinOps, RSTPin: PinOps>(
|
|||||||
display: &mut Display<T, DCPin, RSTPin>,
|
display: &mut Display<T, DCPin, RSTPin>,
|
||||||
position: Position,
|
position: Position,
|
||||||
) -> Result<(), QoiErr> {
|
) -> Result<(), QoiErr> {
|
||||||
let a = LARGE[black_box(50)];
|
// let a = LARGE[black_box(50)];
|
||||||
ufmt::uwriteln!(serial, "Successfully read QOI header {}", a).unwrap();
|
// ufmt::uwriteln!(serial, "Successfully read QOI header {}", a).unwrap();
|
||||||
|
|
||||||
let mut iter = SHEEP.iter().map(|v| *v);
|
let mut iter = SHEEP.iter().map(|v| *v);
|
||||||
|
|
||||||
@ -216,12 +218,13 @@ impl<'a> Iterator for QoiIterator<'a> {
|
|||||||
let green = self.inner.next().unwrap();
|
let green = self.inner.next().unwrap();
|
||||||
let blue = self.inner.next().unwrap();
|
let blue = self.inner.next().unwrap();
|
||||||
let _alpha = self.inner.next().unwrap();
|
let _alpha = self.inner.next().unwrap();
|
||||||
// ufmt::uwriteln!(self.serial, "RGBA: {} {} {} {}", red, green, blue, alpha).unwrap();
|
// ufmt::uwriteln!(self.serial, "RGBA: {} {} {} {}", red, green, blue)
|
||||||
|
// .unwrap();
|
||||||
Rgb565(red, green, blue)
|
Rgb565(red, green, blue)
|
||||||
} else if byte == 0b11111110 {
|
} else if byte == 0b11111110 {
|
||||||
let red = self.inner.next().unwrap();
|
let red = self.inner.next()?;
|
||||||
let green = self.inner.next().unwrap();
|
let green = self.inner.next()?;
|
||||||
let blue = self.inner.next().unwrap();
|
let blue = self.inner.next()?;
|
||||||
// ufmt::uwriteln!(self.serial, "RGB: {} {} {}", red, green, blue).unwrap();
|
// ufmt::uwriteln!(self.serial, "RGB: {} {} {}", red, green, blue).unwrap();
|
||||||
Rgb565(red, green, blue)
|
Rgb565(red, green, blue)
|
||||||
} else {
|
} else {
|
||||||
@ -250,7 +253,7 @@ impl<'a> Iterator for QoiIterator<'a> {
|
|||||||
(self.last_pixel.2 as i8).wrapping_add(db) as u8,
|
(self.last_pixel.2 as i8).wrapping_add(db) as u8,
|
||||||
)
|
)
|
||||||
} else if tag == 2 {
|
} else if tag == 2 {
|
||||||
let second = self.inner.next().unwrap();
|
let second = self.inner.next()?;
|
||||||
let dg = data as i8 - 32;
|
let dg = data as i8 - 32;
|
||||||
let dr_dg = ((0b11110000 & second) >> 4) as i8 - 8;
|
let dr_dg = ((0b11110000 & second) >> 4) as i8 - 8;
|
||||||
let db_dg = (0b00001111 & second) as i8 - 8;
|
let db_dg = (0b00001111 & second) as i8 - 8;
|
||||||
|
Loading…
Reference in New Issue
Block a user