Compare commits
No commits in common. "bounce_buffer_priority" and "master" have entirely different histories.
bounce_buf
...
master
139
firmware/Cargo.lock
generated
139
firmware/Cargo.lock
generated
|
|
@ -30,7 +30,7 @@ dependencies = [
|
|||
"esp-backtrace",
|
||||
"esp-bootloader-esp-idf",
|
||||
"esp-hal",
|
||||
"esp-metadata-generated 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"esp-metadata-generated",
|
||||
"esp-println",
|
||||
"esp-radio",
|
||||
"esp-rtos",
|
||||
|
|
@ -47,7 +47,6 @@ dependencies = [
|
|||
"lazy_static",
|
||||
"log",
|
||||
"mutually_exclusive_features",
|
||||
"ouroboros",
|
||||
"panic-rtt-target",
|
||||
"password-hash 0.1.0",
|
||||
"pastey 0.2.1",
|
||||
|
|
@ -106,12 +105,6 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aliasable"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"
|
||||
|
||||
[[package]]
|
||||
name = "aligned"
|
||||
version = "0.4.3"
|
||||
|
|
@ -2036,6 +2029,8 @@ checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59"
|
|||
[[package]]
|
||||
name = "esp-alloc"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "641e43d6a60244429117ef2fa7a47182120c7561336ea01f6fb08d634f46bae1"
|
||||
dependencies = [
|
||||
"allocator-api2 0.3.1",
|
||||
"cfg-if",
|
||||
|
|
@ -2050,11 +2045,13 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "esp-backtrace"
|
||||
version = "0.18.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3318413fb566c7227387f67736cf70cd74d80a11f2bb31c7b95a9eb48d079669"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"document-features",
|
||||
"esp-config",
|
||||
"esp-metadata-generated 0.3.0",
|
||||
"esp-metadata-generated",
|
||||
"esp-println",
|
||||
"heapless 0.9.2",
|
||||
"riscv",
|
||||
|
|
@ -2065,13 +2062,15 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "esp-bootloader-esp-idf"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02a56964ab5479ac20c9cf76fa3b0d3f2233b20b5d8554e81ef5d65f63c20567"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"document-features",
|
||||
"embedded-storage",
|
||||
"esp-config",
|
||||
"esp-hal-procmacros",
|
||||
"esp-metadata-generated 0.3.0",
|
||||
"esp-metadata-generated",
|
||||
"esp-rom-sys",
|
||||
"jiff",
|
||||
"log",
|
||||
|
|
@ -2081,9 +2080,11 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "esp-config"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "102871054f8dd98202177b9890cb4b71d0c6fe1f1413b7a379a8e0841fc2473c"
|
||||
dependencies = [
|
||||
"document-features",
|
||||
"esp-metadata-generated 0.3.0",
|
||||
"esp-metadata-generated",
|
||||
"serde",
|
||||
"serde_yaml",
|
||||
"somni-expr",
|
||||
|
|
@ -2092,6 +2093,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "esp-hal"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "54786287c0a61ca0f78cb0c338a39427551d1be229103b4444591796c579e093"
|
||||
dependencies = [
|
||||
"bitfield 0.19.4",
|
||||
"bitflags 2.10.0",
|
||||
|
|
@ -2116,7 +2119,7 @@ dependencies = [
|
|||
"enumset",
|
||||
"esp-config",
|
||||
"esp-hal-procmacros",
|
||||
"esp-metadata-generated 0.3.0",
|
||||
"esp-metadata-generated",
|
||||
"esp-riscv-rt",
|
||||
"esp-rom-sys",
|
||||
"esp-sync",
|
||||
|
|
@ -2146,6 +2149,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "esp-hal-procmacros"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e025a7a7a0affdb4ff913b5c4494aef96ee03d085bf83c27453ae3a71d50da6"
|
||||
dependencies = [
|
||||
"document-features",
|
||||
"object",
|
||||
|
|
@ -2156,10 +2161,6 @@ dependencies = [
|
|||
"termcolor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "esp-metadata-generated"
|
||||
version = "0.3.0"
|
||||
|
||||
[[package]]
|
||||
name = "esp-metadata-generated"
|
||||
version = "0.3.0"
|
||||
|
|
@ -2169,22 +2170,26 @@ checksum = "9a93e39c8ad8d390d248dc7b9f4b59a873f313bf535218b8e2351356972399e3"
|
|||
[[package]]
|
||||
name = "esp-phy"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b1facf348e1e251517278fc0f5dc134e95e518251f5796cfbb532ca226a29bf"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"document-features",
|
||||
"esp-config",
|
||||
"esp-hal",
|
||||
"esp-metadata-generated 0.3.0",
|
||||
"esp-metadata-generated",
|
||||
"esp-sync",
|
||||
"esp-wifi-sys-esp32s3",
|
||||
"esp-wifi-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "esp-println"
|
||||
version = "0.16.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a30e6c9fbcc01c348d46706fef8131c7775ab84c254a3cd65d0cd3f6414d592"
|
||||
dependencies = [
|
||||
"document-features",
|
||||
"esp-metadata-generated 0.3.0",
|
||||
"esp-metadata-generated",
|
||||
"esp-sync",
|
||||
"log",
|
||||
"portable-atomic",
|
||||
|
|
@ -2193,6 +2198,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "esp-radio"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "684c4de2f8907b73c9b891fbda65286a86d34fced4b856f36a7896c211f2f265"
|
||||
dependencies = [
|
||||
"allocator-api2 0.3.1",
|
||||
"bt-hci",
|
||||
|
|
@ -2206,11 +2213,11 @@ dependencies = [
|
|||
"esp-config",
|
||||
"esp-hal",
|
||||
"esp-hal-procmacros",
|
||||
"esp-metadata-generated 0.3.0",
|
||||
"esp-metadata-generated",
|
||||
"esp-phy",
|
||||
"esp-radio-rtos-driver",
|
||||
"esp-sync",
|
||||
"esp-wifi-sys-esp32s3",
|
||||
"esp-wifi-sys",
|
||||
"heapless 0.9.2",
|
||||
"instability",
|
||||
"num-derive",
|
||||
|
|
@ -2223,10 +2230,14 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "esp-radio-rtos-driver"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "543bc31d1851afd062357e7810c1a9633f282fd3993583499a841ab497cbca6c"
|
||||
|
||||
[[package]]
|
||||
name = "esp-riscv-rt"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "502744a5b1e7268d27fd2a4e56ad45efe42ead517d6c517a6961540de949b0ee"
|
||||
dependencies = [
|
||||
"document-features",
|
||||
"riscv",
|
||||
|
|
@ -2236,15 +2247,19 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "esp-rom-sys"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd66cccc6dd2d13e9f33668a57717ab14a6d217180ec112e6be533de93e7ecbf"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"document-features",
|
||||
"esp-metadata-generated 0.3.0",
|
||||
"esp-metadata-generated",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "esp-rtos"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "162ec711c8d06e79c67b75d01595539e86b0aac209643af98ca87a12250428b3"
|
||||
dependencies = [
|
||||
"allocator-api2 0.3.1",
|
||||
"cfg-if",
|
||||
|
|
@ -2256,7 +2271,7 @@ dependencies = [
|
|||
"esp-config",
|
||||
"esp-hal",
|
||||
"esp-hal-procmacros",
|
||||
"esp-metadata-generated 0.3.0",
|
||||
"esp-metadata-generated",
|
||||
"esp-radio-rtos-driver",
|
||||
"esp-sync",
|
||||
"portable-atomic",
|
||||
|
|
@ -2265,12 +2280,14 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "esp-storage"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1495fc1f5549bdd840b52d9ceb201746200e1620d2636f46958c11e765623b80"
|
||||
dependencies = [
|
||||
"document-features",
|
||||
"embedded-storage",
|
||||
"esp-hal",
|
||||
"esp-hal-procmacros",
|
||||
"esp-metadata-generated 0.3.0",
|
||||
"esp-metadata-generated",
|
||||
"esp-rom-sys",
|
||||
"esp-sync",
|
||||
]
|
||||
|
|
@ -2278,12 +2295,14 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "esp-sync"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d44974639b4e88914f83fe60d2832c00276657d7d857628fdfc966cc7302e8a8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"document-features",
|
||||
"embassy-sync 0.6.2",
|
||||
"embassy-sync 0.7.2",
|
||||
"esp-metadata-generated 0.3.0",
|
||||
"esp-metadata-generated",
|
||||
"log",
|
||||
"riscv",
|
||||
"xtensa-lx",
|
||||
|
|
@ -2303,9 +2322,13 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "esp-wifi-sys-esp32s3"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/esp-rs/esp-wifi-sys?rev=7623c8d#7623c8d746b55cd8d9f7473359069aef381b7d3b"
|
||||
name = "esp-wifi-sys"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89b6544f6f0cb86169d1f93ba2101a8d50358a040c5043676ed86b793e09b12c"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "esp32"
|
||||
|
|
@ -3757,12 +3780,6 @@ dependencies = [
|
|||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
|
|
@ -5336,30 +5353,6 @@ dependencies = [
|
|||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ouroboros"
|
||||
version = "0.18.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e0f050db9c44b97a94723127e6be766ac5c340c48f2c4bb3ffa11713744be59"
|
||||
dependencies = [
|
||||
"aliasable",
|
||||
"ouroboros_macro",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ouroboros_macro"
|
||||
version = "0.18.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c7028bdd3d43083f6d8d4d5187680d0d3560d54df4cc9d752005268b41e64d0"
|
||||
dependencies = [
|
||||
"heck 0.4.1",
|
||||
"proc-macro2",
|
||||
"proc-macro2-diagnostics",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "p256"
|
||||
version = "0.13.2"
|
||||
|
|
@ -5768,19 +5761,6 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2-diagnostics"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
"version_check",
|
||||
"yansi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prodash"
|
||||
version = "31.0.0"
|
||||
|
|
@ -6726,7 +6706,7 @@ dependencies = [
|
|||
"bindgen",
|
||||
"cc",
|
||||
"flate2",
|
||||
"heck 0.5.0",
|
||||
"heck",
|
||||
"pkg-config",
|
||||
"regex",
|
||||
"serde_json",
|
||||
|
|
@ -6875,6 +6855,7 @@ checksum = "a0f368519fc6c85fc1afdb769fb5a51123f6158013e143656e25a3485a0d401c"
|
|||
[[package]]
|
||||
name = "spectre-api-sys"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/Limeth/spectre-api-sys?rev=9e844eb056c3dfee8286ac21ec40fa689a8b8aa2#9e844eb056c3dfee8286ac21ec40fa689a8b8aa2"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"cc",
|
||||
|
|
@ -6960,7 +6941,7 @@ version = "0.27.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7"
|
||||
dependencies = [
|
||||
"heck 0.5.0",
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
|
|
@ -8468,6 +8449,8 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"
|
|||
[[package]]
|
||||
name = "xtensa-lx"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e012d667b0aa6d2592ace8ef145a98bff3e76cca7a644f4181ecd7a916ed289b"
|
||||
dependencies = [
|
||||
"critical-section",
|
||||
]
|
||||
|
|
@ -8475,6 +8458,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "xtensa-lx-rt"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8709f037fb123fe7ff146d2bce86f9dc0dfc53045c016bfd9d703317b6502845"
|
||||
dependencies = [
|
||||
"document-features",
|
||||
"xtensa-lx",
|
||||
|
|
@ -8484,6 +8469,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "xtensa-lx-rt-proc-macros"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96fb42cd29c42f8744c74276e9f5bee7b06685bbe5b88df891516d72cb320450"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -8516,12 +8503,6 @@ dependencies = [
|
|||
"hashlink",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yansi"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"
|
||||
|
||||
[[package]]
|
||||
name = "yazi"
|
||||
version = "0.2.1"
|
||||
|
|
|
|||
|
|
@ -38,14 +38,3 @@ ACID_COMPOSE_LOCALE = "cs_CZ.UTF-8"
|
|||
# This can be substituted with a `-Zbuild-std="core,alloc"` cargo flag.
|
||||
[unstable]
|
||||
build-std = ["alloc", "core"]
|
||||
|
||||
[patch.crates-io]
|
||||
# esp-backtrace = { git = "https://github.com/Limeth/esp-hal.git", rev = "95d8c8b046e945e41294d5577528d0a1c4b03247" }
|
||||
# esp-hal = { git = "https://github.com/Limeth/esp-hal.git", rev = "95d8c8b046e945e41294d5577528d0a1c4b03247" }
|
||||
# esp-storage = { git = "https://github.com/Limeth/esp-hal.git", rev = "95d8c8b046e945e41294d5577528d0a1c4b03247" }
|
||||
# esp-alloc = { git = "https://github.com/Limeth/esp-hal.git", rev = "95d8c8b046e945e41294d5577528d0a1c4b03247" }
|
||||
# esp-println = { git = "https://github.com/Limeth/esp-hal.git", rev = "95d8c8b046e945e41294d5577528d0a1c4b03247" }
|
||||
# esp-radio = { git = "https://github.com/Limeth/esp-hal.git", rev = "95d8c8b046e945e41294d5577528d0a1c4b03247" }
|
||||
# esp-rtos = { git = "https://github.com/Limeth/esp-hal.git", rev = "95d8c8b046e945e41294d5577528d0a1c4b03247" }
|
||||
# esp-bootloader-esp-idf = { git = "https://github.com/Limeth/esp-hal.git", rev = "95d8c8b046e945e41294d5577528d0a1c4b03247" }
|
||||
# esp-sync = { git = "https://github.com/Limeth/esp-hal.git", rev = "95d8c8b046e945e41294d5577528d0a1c4b03247" }
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@ tinyvec = { version = "1.10.0", default-features = false, features = ["alloc"] }
|
|||
esp-metadata-generated = { version = "0.3.0", features = ["esp32s3"] }
|
||||
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
|
||||
indoc = "2.0.7"
|
||||
ouroboros = "0.18.5"
|
||||
|
||||
# A fork of slint with patches for `allocator_api` support.
|
||||
# Don't forget to change `slint-build` in build dependencies, if this is changed.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ use ekv::{
|
|||
};
|
||||
use embassy_embedded_hal::{adapter::BlockingAsync, flash::partition::Partition};
|
||||
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||
use embassy_sync_old::blocking_mutex::raw::CriticalSectionRawMutex as CriticalSectionRawMutexOld;
|
||||
use embedded_storage_async::nor_flash::{NorFlash, ReadNorFlash};
|
||||
use esp_hal::rng::Trng;
|
||||
use esp_storage::FlashStorage;
|
||||
|
|
@ -103,11 +102,11 @@ impl<T: NorFlash + ReadNorFlash> ekv::flash::Flash for EkvFlash<T> {
|
|||
}
|
||||
|
||||
pub struct AcidDatabase {
|
||||
db: Database<EkvFlash<PartitionAcid>, CriticalSectionRawMutexOld>,
|
||||
db: Database<EkvFlash<PartitionAcid>, esp_sync::RawMutex>,
|
||||
}
|
||||
|
||||
impl Deref for AcidDatabase {
|
||||
type Target = Database<EkvFlash<PartitionAcid>, CriticalSectionRawMutexOld>;
|
||||
type Target = Database<EkvFlash<PartitionAcid>, esp_sync::RawMutex>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.db
|
||||
|
|
@ -126,7 +125,7 @@ impl AcidDatabase {
|
|||
db_config.random_seed = Trng::try_new()
|
||||
.expect("A `TrngSource` was not initialized before constructing this `Trng`.")
|
||||
.random();
|
||||
let db = Database::<_, CriticalSectionRawMutexOld>::new(EkvFlash::new(flash), db_config);
|
||||
let db = Database::<_, esp_sync::RawMutex>::new(EkvFlash::new(flash), db_config);
|
||||
|
||||
#[cfg(feature = "format-db")]
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ use log::LevelFilter;
|
|||
|
||||
pub const LOG_LEVEL_FILTER: LevelFilter = {
|
||||
if let Some(string) = option_env!("ESP_LOG") {
|
||||
if string.eq_ignore_ascii_case("OFF") {
|
||||
LevelFilter::Off
|
||||
} else if string.eq_ignore_ascii_case("ERROR") {
|
||||
if string.eq_ignore_ascii_case("ERROR") {
|
||||
LevelFilter::Error
|
||||
} else if string.eq_ignore_ascii_case("WARN") {
|
||||
LevelFilter::Warn
|
||||
|
|
@ -59,9 +57,10 @@ fn with_formatted_log_record<R>(
|
|||
pub mod usb {
|
||||
use super::*;
|
||||
|
||||
pub fn setup_logging() {
|
||||
pub fn setup_logging() -> impl Future<Output = ()> {
|
||||
esp_println::logger::init_logger(LOG_LEVEL_FILTER);
|
||||
log::info!("Logger initialized!");
|
||||
async {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -154,7 +153,17 @@ pub mod uart {
|
|||
loop {}
|
||||
}
|
||||
|
||||
pub fn setup_logging(uart_tx: UartTx<'static, Blocking>) {
|
||||
pub fn setup_logging(
|
||||
uart: impl esp_hal::uart::Instance + 'static,
|
||||
tx: impl PeripheralOutput<'static>,
|
||||
rx: impl PeripheralInput<'static>,
|
||||
) -> impl Future<Output = ()> {
|
||||
let (uart_rx, uart_tx) = Uart::new(uart, Default::default())
|
||||
.unwrap()
|
||||
.with_tx(tx)
|
||||
.with_rx(rx)
|
||||
.split();
|
||||
|
||||
critical_section::with(|cs| {
|
||||
*ALT_LOGGER_UART.borrow(cs).borrow_mut() = Some(uart_tx);
|
||||
});
|
||||
|
|
@ -165,6 +174,7 @@ pub mod uart {
|
|||
}
|
||||
|
||||
info!("Logger initialized!");
|
||||
console::run_console(uart_rx.into_async())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -177,9 +187,10 @@ pub mod rtt {
|
|||
use panic_rtt_target as _; // Use the RTT panic handler.
|
||||
use rtt_target::ChannelMode;
|
||||
|
||||
pub fn setup_logging() {
|
||||
pub fn setup_logging() -> impl Future<Output = ()> {
|
||||
rtt_target::rtt_init_log!(LOG_LEVEL_FILTER, ChannelMode::BlockIfFull);
|
||||
log::info!("Logger initialized!");
|
||||
async {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ use core::cell::RefCell;
|
|||
use core::fmt::Write;
|
||||
use core::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use alloc::alloc::Global;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::collections::vec_deque::VecDeque;
|
||||
use alloc::format;
|
||||
|
|
@ -29,10 +28,9 @@ use alloc::string::String;
|
|||
use alloc::sync::Arc;
|
||||
use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
use cfg_if::cfg_if;
|
||||
use embassy_embedded_hal::adapter::BlockingAsync;
|
||||
use embassy_embedded_hal::flash::partition::Partition;
|
||||
use embassy_executor::{SendSpawner, Spawner, SpawnerTraceExt};
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||
use embassy_sync::channel::Channel;
|
||||
use embassy_sync::mutex::Mutex;
|
||||
|
|
@ -40,46 +38,41 @@ use embassy_sync::signal::Signal;
|
|||
use embassy_time::{Duration, Timer};
|
||||
use esp_alloc::{HeapRegion, MemoryCapability};
|
||||
use esp_bootloader_esp_idf::partitions::PartitionTable;
|
||||
use esp_hal::Blocking;
|
||||
use esp_hal::clock::CpuClock;
|
||||
use esp_hal::dma::{
|
||||
BurstConfig, DmaDescriptor, DmaTxBuf, ExternalBurstConfig, InternalBurstConfig,
|
||||
};
|
||||
use esp_hal::dma::{BurstConfig, DmaDescriptor, DmaTxBuf, ExternalBurstConfig};
|
||||
use esp_hal::efuse::Efuse;
|
||||
#[cfg(not(feature = "alt-log"))]
|
||||
use esp_hal::gpio::NoPin;
|
||||
use esp_hal::gpio::{Flex, Input, InputConfig, Level, Output, OutputConfig, Pull};
|
||||
use esp_hal::i2c::master::{I2c, I2cAddress};
|
||||
use esp_hal::interrupt::software::{SoftwareInterrupt, SoftwareInterruptControl};
|
||||
use esp_hal::interrupt::software::SoftwareInterruptControl;
|
||||
use esp_hal::lcd_cam::LcdCam;
|
||||
use esp_hal::lcd_cam::lcd::dpi::{Dpi, DpiTransfer};
|
||||
use esp_hal::lcd_cam::lcd::dpi::Dpi;
|
||||
use esp_hal::mcpwm::{McPwm, PeripheralClockConfig};
|
||||
use esp_hal::peripherals::{DMA_CH0, SPI0, SPI2};
|
||||
use esp_hal::psram::{FlashFreq, PsramConfig, PsramSize, SpiRamFreq, SpiTimingConfigCoreClock};
|
||||
use esp_hal::ram;
|
||||
use esp_hal::rng::TrngSource;
|
||||
use esp_hal::sha::ShaBackend;
|
||||
use esp_hal::spi::master::AnySpi;
|
||||
use esp_hal::system::Stack;
|
||||
use esp_hal::timer::timg::TimerGroup;
|
||||
use esp_hal::uart::{Uart, UartRx};
|
||||
use esp_hal::{Blocking, interrupt};
|
||||
use esp_rtos::embassy::{Executor, InterruptExecutor};
|
||||
use esp_rtos::embassy::Executor;
|
||||
use esp_storage::FlashStorage;
|
||||
use i_slint_core::software_renderer::TargetPixel;
|
||||
use indoc::writedoc;
|
||||
use itertools::Itertools;
|
||||
use log::{error, info, warn};
|
||||
use rmk::channel::{CONTROLLER_CHANNEL, ControllerSub};
|
||||
use rmk::config::{DeviceConfig, RmkConfig, StorageConfig, VialConfig};
|
||||
use rmk::config::{
|
||||
DeviceConfig, RmkConfig, StorageConfig,
|
||||
VialConfig,
|
||||
};
|
||||
use rmk::controller::{Controller, EventController};
|
||||
use rmk::debounce::default_debouncer::DefaultDebouncer;
|
||||
use rmk::event::ControllerEvent;
|
||||
use rmk::hid::Report;
|
||||
use rmk::input_device::Runnable;
|
||||
use rmk::join_all;
|
||||
use rmk::keyboard::Keyboard;
|
||||
use rmk::storage::async_flash_wrapper;
|
||||
use rmk::types::action::{Action, KeyAction};
|
||||
use rmk::join_all;
|
||||
use rmk::{initialize_keymap_and_storage, run_devices, run_rmk};
|
||||
use slint::platform::software_renderer::Rgb565Pixel;
|
||||
use static_cell::StaticCell;
|
||||
|
|
@ -88,8 +81,7 @@ use {esp_alloc as _, esp_backtrace as _};
|
|||
use crate::matrix::IoeMatrix;
|
||||
use crate::peripherals::st7701s::St7701s;
|
||||
use crate::proxy::create_hid_report_interceptor;
|
||||
use crate::ui::backend::SlintBackend;
|
||||
use crate::ui::dpi::{DmaBounce, DmaTxBounceBuf, Framebuffer, Swapchain, allocate_dma_buffer_in};
|
||||
use crate::ui::backend::{FramebufferPtr, SlintBackend};
|
||||
use crate::vial::{
|
||||
CustomKeycodes, VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID, VIAL_KEYBOARD_NAME, VIAL_PRODUCT_ID,
|
||||
VIAL_VENDOR_ID,
|
||||
|
|
@ -133,111 +125,11 @@ pub static PSRAM_ALLOCATOR: esp_alloc::EspHeap = esp_alloc::EspHeap::empty();
|
|||
static KEYBOARD_REPORT_PROXY: Channel<CriticalSectionRawMutex, Report, 16> = Channel::new();
|
||||
static LCD_ENABLED: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
// /// Used to signal that MCU is ready to submit the framebuffer to the LCD.
|
||||
// static SIGNAL_LCD_SUBMIT: Signal<CriticalSectionRawMutex, ()> = Signal::new();
|
||||
/// Used to signal that MCU is ready to submit the framebuffer to the LCD.
|
||||
static SIGNAL_LCD_SUBMIT: Signal<CriticalSectionRawMutex, ()> = Signal::new();
|
||||
|
||||
// /// Used to signal that the MCU is ready to render the GUI.
|
||||
// static SIGNAL_UI_RENDER: Signal<CriticalSectionRawMutex, ()> = Signal::new();
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn test_bounce_buffers_task(
|
||||
channel: DMA_CH0<'static>,
|
||||
peripheral: SPI2<'static>,
|
||||
st7701s: St7701s<'static, Blocking>,
|
||||
) {
|
||||
test_bounce_buffers(channel, peripheral, st7701s).await;
|
||||
}
|
||||
|
||||
async fn test_bounce_buffers(
|
||||
channel: DMA_CH0<'static>,
|
||||
peripheral: SPI2<'static>,
|
||||
st7701s: St7701s<'static, Blocking>,
|
||||
) {
|
||||
error!("TEST BOUNCE BUFFERS SECTION ENTERED");
|
||||
const BYTES_PER_PIXEL: usize = core::mem::size_of::<u16>();
|
||||
// Assume highest burst config setting.
|
||||
const EXTERNAL_BURST_CONFIG: ExternalBurstConfig = ExternalBurstConfig::Size32;
|
||||
const ALIGNMENT_PIXELS: usize = EXTERNAL_BURST_CONFIG as usize / BYTES_PER_PIXEL;
|
||||
// The total number of pixels demanded by the DPI, per row.
|
||||
const WIDTH_TOTAL_PIXELS: usize = 368;
|
||||
// The total number of rows demanded by the DPI, per frame.
|
||||
const HEIGHT_PIXELS: usize = 960;
|
||||
// The number of unused pixels at the start of the row.
|
||||
const FRONT_PORCH_ACTUAL_PIXELS: usize = 120;
|
||||
// The number of actually visible pixels, per row.
|
||||
const WIDTH_VISIBLE_PIXELS: usize = 240;
|
||||
// The number of pixels not stored in a bounce buffer, per row.
|
||||
// This many arbitrary pixels are sent to the DPI.
|
||||
const FRONT_PORCH_SKIPPED_PIXELS: usize =
|
||||
(FRONT_PORCH_ACTUAL_PIXELS / ALIGNMENT_PIXELS) * ALIGNMENT_PIXELS;
|
||||
const WIDTH_STORED_PIXELS: usize = WIDTH_TOTAL_PIXELS - FRONT_PORCH_SKIPPED_PIXELS;
|
||||
const VISIBLE_OFFSET_IN_BUFFER_PIXELS: usize =
|
||||
FRONT_PORCH_ACTUAL_PIXELS - FRONT_PORCH_SKIPPED_PIXELS;
|
||||
const ROWS_PER_WINDOW: usize = 16;
|
||||
let burst_config = BurstConfig {
|
||||
internal_memory: InternalBurstConfig::Enabled,
|
||||
external_memory: EXTERNAL_BURST_CONFIG,
|
||||
};
|
||||
let (swapchain_reader, mut swapchain_writer) = Swapchain {
|
||||
framebuffers: [
|
||||
Box::leak(allocate_dma_buffer_in(
|
||||
HEIGHT_PIXELS * WIDTH_STORED_PIXELS * BYTES_PER_PIXEL,
|
||||
burst_config,
|
||||
&PSRAM_ALLOCATOR,
|
||||
)),
|
||||
Box::leak(allocate_dma_buffer_in(
|
||||
HEIGHT_PIXELS * WIDTH_STORED_PIXELS * BYTES_PER_PIXEL,
|
||||
burst_config,
|
||||
&PSRAM_ALLOCATOR,
|
||||
)),
|
||||
],
|
||||
}
|
||||
.into_reader_writer();
|
||||
|
||||
{
|
||||
let write_guard = &mut swapchain_writer.write();
|
||||
let buffer_src = write_guard.cast::<Rgb565Pixel>();
|
||||
let colors = (0..WIDTH_VISIBLE_PIXELS as u8 / 2)
|
||||
.rev()
|
||||
.map(|val| Rgb565Pixel::from_rgb(0xFF, val * 2, 0))
|
||||
.collect::<Vec<_>>();
|
||||
for (index, pixel) in buffer_src.iter_mut().enumerate() {
|
||||
let mut x =
|
||||
(index % WIDTH_STORED_PIXELS) as i16 - VISIBLE_OFFSET_IN_BUFFER_PIXELS as i16;
|
||||
let mut y = (index / WIDTH_STORED_PIXELS) as i16;
|
||||
|
||||
if x < WIDTH_VISIBLE_PIXELS as i16 {
|
||||
x = core::cmp::min(x, WIDTH_VISIBLE_PIXELS as i16 - 1 - x);
|
||||
y = core::cmp::min(y, HEIGHT_PIXELS as i16 - 1 - y);
|
||||
let min = core::cmp::min(x, y);
|
||||
|
||||
*pixel = colors[min as usize % colors.len()].clone();
|
||||
continue;
|
||||
}
|
||||
|
||||
*pixel = Rgb565Pixel::default();
|
||||
}
|
||||
}
|
||||
|
||||
warn!("FRONT_PORCH_SKIPPED_PIXELS: {FRONT_PORCH_SKIPPED_PIXELS}");
|
||||
warn!("WIDTH_STORED_PIXELS: {WIDTH_STORED_PIXELS}");
|
||||
warn!("ROWS_PER_WINDOW: {ROWS_PER_WINDOW}");
|
||||
|
||||
let buf = DmaBounce::new(
|
||||
Global,
|
||||
channel,
|
||||
AnySpi::from(peripheral),
|
||||
st7701s.dpi,
|
||||
swapchain_reader,
|
||||
FRONT_PORCH_SKIPPED_PIXELS * BYTES_PER_PIXEL,
|
||||
WIDTH_STORED_PIXELS * BYTES_PER_PIXEL,
|
||||
ROWS_PER_WINDOW,
|
||||
burst_config,
|
||||
true,
|
||||
);
|
||||
buf.launch_interrupt_driven_task().await;
|
||||
error!("TEST BOUNCE BUFFERS SECTION DONE");
|
||||
}
|
||||
/// Used to signal that the MCU is ready to render the GUI.
|
||||
static SIGNAL_UI_RENDER: Signal<CriticalSectionRawMutex, ()> = Signal::new();
|
||||
|
||||
#[esp_rtos::main]
|
||||
async fn main(_spawner: Spawner) {
|
||||
|
|
@ -246,31 +138,18 @@ async fn main(_spawner: Spawner) {
|
|||
.with_psram(PsramConfig {
|
||||
size: PsramSize::AutoDetect,
|
||||
core_clock: Some(SpiTimingConfigCoreClock::SpiTimingConfigCoreClock80m),
|
||||
flash_frequency: FlashFreq::FlashFreq120m,
|
||||
ram_frequency: SpiRamFreq::Freq120m,
|
||||
flash_frequency: FlashFreq::default(),
|
||||
ram_frequency: SpiRamFreq::Freq80m,
|
||||
});
|
||||
let peripherals: esp_hal::peripherals::Peripherals = esp_hal::init(config);
|
||||
|
||||
#[allow(unused)]
|
||||
let (uart_rx, uart_tx) = {
|
||||
#[cfg(feature = "alt-log")]
|
||||
let (tx, rx) = (peripherals.GPIO12, peripherals.GPIO5);
|
||||
#[cfg(not(feature = "alt-log"))]
|
||||
let (tx, rx) = (NoPin, NoPin);
|
||||
|
||||
Uart::new(peripherals.UART2, Default::default())
|
||||
.unwrap()
|
||||
.with_tx(tx)
|
||||
.with_rx(rx)
|
||||
.split()
|
||||
};
|
||||
|
||||
#[cfg(feature = "usb-log")]
|
||||
logging::usb::setup_logging();
|
||||
let console_task = logging::usb::setup_logging();
|
||||
#[cfg(feature = "alt-log")]
|
||||
logging::uart::setup_logging(uart_tx);
|
||||
let console_task =
|
||||
logging::uart::setup_logging(peripherals.UART2, peripherals.GPIO12, peripherals.GPIO5);
|
||||
#[cfg(feature = "rtt-log")]
|
||||
logging::rtt::setup_logging();
|
||||
let console_task = logging::rtt::setup_logging();
|
||||
|
||||
// Use the internal DRAM as the heap.
|
||||
// Memory reclaimed from the esp-idf bootloader.
|
||||
|
|
@ -326,129 +205,12 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||
let software_interrupt = SoftwareInterruptControl::new(peripherals.SW_INTERRUPT);
|
||||
esp_rtos::start(timg0.timer0, software_interrupt.software_interrupt0);
|
||||
|
||||
// A task executor that is able to handle interrupts, and then return back to executing tasks.
|
||||
static EXECUTOR_CORE_0: StaticCell<InterruptExecutor<2>> = StaticCell::new();
|
||||
let executor_core_0 = InterruptExecutor::new(software_interrupt.software_interrupt2);
|
||||
let executor_core_0 = EXECUTOR_CORE_0.init(executor_core_0);
|
||||
let interrupt_core_0_spawner = executor_core_0.start(interrupt::Priority::Priority1);
|
||||
|
||||
// static EXECUTOR_CORE_1: StaticCell<InterruptExecutor<3>> = StaticCell::new();
|
||||
// let executor_core_1 = InterruptExecutor::new(software_interrupt.software_interrupt3);
|
||||
// let executor_core_1 = EXECUTOR_CORE_1.init(executor_core_1);
|
||||
// let interrupt_core_1_spawner = executor_core_1.start(interrupt::Priority::Priority2);
|
||||
esp_rtos::start(
|
||||
timg0.timer0, /*, software_interrupt.software_interrupt0 */
|
||||
);
|
||||
|
||||
info!("ESP-RTOS started!");
|
||||
|
||||
let main_task_peripherals = MainPeripherals {
|
||||
// high_priority_task_spawner: interrupt_core_1_spawner,
|
||||
uart_rx,
|
||||
software_interrupt1: software_interrupt.software_interrupt1,
|
||||
RNG: peripherals.RNG,
|
||||
ADC1: peripherals.ADC1,
|
||||
USB0: peripherals.USB0,
|
||||
FLASH: peripherals.FLASH,
|
||||
LCD_CAM: peripherals.LCD_CAM,
|
||||
DMA_CH0: peripherals.DMA_CH0,
|
||||
DMA_CH2: peripherals.DMA_CH2,
|
||||
I2C0: peripherals.I2C0,
|
||||
SPI2: peripherals.SPI2,
|
||||
CPU_CTRL: peripherals.CPU_CTRL,
|
||||
GPIO0: gpio0,
|
||||
GPIO1: peripherals.GPIO1,
|
||||
GPIO2: peripherals.GPIO2,
|
||||
GPIO3: peripherals.GPIO3,
|
||||
GPIO4: peripherals.GPIO4,
|
||||
#[cfg(not(feature = "alt-log"))]
|
||||
GPIO5: peripherals.GPIO5,
|
||||
GPIO6: peripherals.GPIO6,
|
||||
GPIO7: peripherals.GPIO7,
|
||||
GPIO8: peripherals.GPIO8,
|
||||
GPIO9: peripherals.GPIO9,
|
||||
#[cfg(not(feature = "alt-log"))]
|
||||
GPIO12: peripherals.GPIO12,
|
||||
GPIO13: peripherals.GPIO13,
|
||||
GPIO14: peripherals.GPIO14,
|
||||
GPIO15: peripherals.GPIO15,
|
||||
GPIO16: peripherals.GPIO16,
|
||||
GPIO19: peripherals.GPIO19,
|
||||
GPIO20: peripherals.GPIO20,
|
||||
GPIO34: peripherals.GPIO34,
|
||||
GPIO35: peripherals.GPIO35,
|
||||
GPIO36: peripherals.GPIO36,
|
||||
GPIO37: peripherals.GPIO37,
|
||||
GPIO38: peripherals.GPIO38,
|
||||
GPIO39: peripherals.GPIO39,
|
||||
GPIO40: peripherals.GPIO40,
|
||||
GPIO41: peripherals.GPIO41,
|
||||
GPIO42: peripherals.GPIO42,
|
||||
GPIO43: peripherals.GPIO43,
|
||||
GPIO44: peripherals.GPIO44,
|
||||
};
|
||||
|
||||
interrupt_core_0_spawner.must_spawn(main_task(main_task_peripherals));
|
||||
}
|
||||
|
||||
/// Peripherals passed to the main task.
|
||||
#[allow(non_snake_case)]
|
||||
struct MainPeripherals {
|
||||
// high_priority_task_spawner: SendSpawner,
|
||||
uart_rx: UartRx<'static, Blocking>,
|
||||
software_interrupt1: SoftwareInterrupt<'static, 1>,
|
||||
RNG: esp_hal::peripherals::RNG<'static>,
|
||||
ADC1: esp_hal::peripherals::ADC1<'static>,
|
||||
USB0: esp_hal::peripherals::USB0<'static>,
|
||||
FLASH: esp_hal::peripherals::FLASH<'static>,
|
||||
LCD_CAM: esp_hal::peripherals::LCD_CAM<'static>,
|
||||
DMA_CH0: esp_hal::peripherals::DMA_CH0<'static>,
|
||||
DMA_CH2: esp_hal::peripherals::DMA_CH2<'static>,
|
||||
I2C0: esp_hal::peripherals::I2C0<'static>,
|
||||
SPI2: esp_hal::peripherals::SPI2<'static>,
|
||||
CPU_CTRL: esp_hal::peripherals::CPU_CTRL<'static>,
|
||||
GPIO0: Output<'static>,
|
||||
GPIO1: esp_hal::peripherals::GPIO1<'static>,
|
||||
GPIO2: esp_hal::peripherals::GPIO2<'static>,
|
||||
GPIO3: esp_hal::peripherals::GPIO3<'static>,
|
||||
GPIO4: esp_hal::peripherals::GPIO4<'static>,
|
||||
#[cfg(not(feature = "alt-log"))]
|
||||
GPIO5: esp_hal::peripherals::GPIO5<'static>,
|
||||
GPIO6: esp_hal::peripherals::GPIO6<'static>,
|
||||
GPIO7: esp_hal::peripherals::GPIO7<'static>,
|
||||
GPIO8: esp_hal::peripherals::GPIO8<'static>,
|
||||
GPIO9: esp_hal::peripherals::GPIO9<'static>,
|
||||
// GPIO10: esp_hal::peripherals::GPIO10<'static>,
|
||||
#[cfg(not(feature = "alt-log"))]
|
||||
GPIO12: esp_hal::peripherals::GPIO12<'static>,
|
||||
GPIO13: esp_hal::peripherals::GPIO13<'static>,
|
||||
GPIO14: esp_hal::peripherals::GPIO14<'static>,
|
||||
GPIO15: esp_hal::peripherals::GPIO15<'static>,
|
||||
GPIO16: esp_hal::peripherals::GPIO16<'static>,
|
||||
// GPIO18: esp_hal::peripherals::GPIO18<'static>,
|
||||
GPIO19: esp_hal::peripherals::GPIO19<'static>,
|
||||
GPIO20: esp_hal::peripherals::GPIO20<'static>,
|
||||
// GPIO33: esp_hal::peripherals::GPIO33<'static>,
|
||||
GPIO34: esp_hal::peripherals::GPIO34<'static>,
|
||||
GPIO35: esp_hal::peripherals::GPIO35<'static>,
|
||||
GPIO36: esp_hal::peripherals::GPIO36<'static>,
|
||||
GPIO37: esp_hal::peripherals::GPIO37<'static>,
|
||||
GPIO38: esp_hal::peripherals::GPIO38<'static>,
|
||||
GPIO39: esp_hal::peripherals::GPIO39<'static>,
|
||||
GPIO40: esp_hal::peripherals::GPIO40<'static>,
|
||||
GPIO41: esp_hal::peripherals::GPIO41<'static>,
|
||||
GPIO42: esp_hal::peripherals::GPIO42<'static>,
|
||||
GPIO43: esp_hal::peripherals::GPIO43<'static>,
|
||||
GPIO44: esp_hal::peripherals::GPIO44<'static>,
|
||||
// GPIO45: esp_hal::peripherals::GPIO45<'static>,
|
||||
// GPIO46: esp_hal::peripherals::GPIO46<'static>,
|
||||
// GPIO47: esp_hal::peripherals::GPIO47<'static>,
|
||||
// GPIO48: esp_hal::peripherals::GPIO48<'static>,
|
||||
}
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn main_task(peripherals: MainPeripherals) {
|
||||
// let _spawner = unsafe { Spawner::for_current_executor() }.await;
|
||||
|
||||
// Enable the TRNG source, so `Trng` can be constructed.
|
||||
let _trng_source = TrngSource::new(peripherals.RNG, peripherals.ADC1);
|
||||
|
||||
|
|
@ -604,7 +366,7 @@ async fn main_task(peripherals: MainPeripherals) {
|
|||
.with_data9(peripherals.GPIO15)
|
||||
.with_data10(peripherals.GPIO16)
|
||||
// Red
|
||||
.with_data11(peripherals.GPIO0)
|
||||
.with_data11(gpio0)
|
||||
.with_data12(peripherals.GPIO1)
|
||||
.with_data13(peripherals.GPIO2)
|
||||
.with_data14(peripherals.GPIO3)
|
||||
|
|
@ -620,9 +382,6 @@ async fn main_task(peripherals: MainPeripherals) {
|
|||
|
||||
info!("ST7701S-based LCD display initialized!");
|
||||
|
||||
// test_bounce_buffers(peripherals.DMA_CH0, peripherals.SPI2, st7701s).await;
|
||||
// return;
|
||||
|
||||
// RMK config
|
||||
let vial_config = VialConfig::new(VIAL_KEYBOARD_ID, VIAL_KEYBOARD_DEF, &[(0, 0), (1, 1)]);
|
||||
let storage_config = StorageConfig {
|
||||
|
|
@ -704,48 +463,27 @@ async fn main_task(peripherals: MainPeripherals) {
|
|||
|
||||
static FRAMEBUFFER: StaticCell<Framebuffer> = StaticCell::new();
|
||||
let framebuffer = FRAMEBUFFER.init(Framebuffer::new(
|
||||
peripherals.DMA_CH0,
|
||||
peripherals.SPI2.into(),
|
||||
st7701s.dpi,
|
||||
BurstConfig {
|
||||
internal_memory: InternalBurstConfig::Enabled,
|
||||
external_memory: ExternalBurstConfig::Size32,
|
||||
},
|
||||
// The burst config (16/32/64) doesn't seem to affect the alignment of the row size.
|
||||
//
|
||||
// | | ( displayed range ) |
|
||||
// | [ pad ] [ pad ]
|
||||
// | [ DMA-transmissible range ]
|
||||
// [ DMA-t. left overscan ] | | |
|
||||
// 0 112 120 360 368 (index of u16 pixel)
|
||||
// ^ aligned ^ aligned ^ aligned
|
||||
//
|
||||
// TODO: Compute the appropriate ranges to pass to the renderer and DPI peripheral.
|
||||
// The renderer should pass the size of the `pad`ding to the GUI is parameters,
|
||||
// to align the content to the displayed range.
|
||||
112,
|
||||
368 - 112,
|
||||
360 + /* TODO: Figure out why more bytes are needed: */ 8,
|
||||
960,
|
||||
8,
|
||||
true,
|
||||
));
|
||||
|
||||
info!("Framebuffer created!");
|
||||
|
||||
// let window_size = [framebuffer.width, framebuffer.height];
|
||||
let window_size = [framebuffer.height, framebuffer.width];
|
||||
let swapchain_writer = framebuffer.swapchain.take().unwrap();
|
||||
let framebuffer_ptr = FramebufferPtr(framebuffer.as_target_pixels() as _);
|
||||
|
||||
static SECOND_CORE_STACK: StaticCell<Stack<STACK_SIZE_CORE_APP>> = StaticCell::new();
|
||||
let second_core_stack = SECOND_CORE_STACK.init(Stack::new());
|
||||
esp_rtos::start_second_core(
|
||||
peripherals.CPU_CTRL,
|
||||
// peripherals.software_interrupt0,
|
||||
peripherals.software_interrupt1,
|
||||
software_interrupt.software_interrupt0,
|
||||
software_interrupt.software_interrupt1,
|
||||
second_core_stack,
|
||||
move || {
|
||||
// static EXECUTOR: StaticCell<InterruptExecutor<2>> = StaticCell::new();
|
||||
// let exec = EXECUTOR.init(InterruptExecutor::new(
|
||||
// peripherals.software_interrupt2,
|
||||
// software_interrupt.software_interrupt2,
|
||||
// ));
|
||||
// let spawner = exec.start(Priority::Priority3);
|
||||
// spawner.must_spawn(run_renderer_task());
|
||||
|
|
@ -756,7 +494,7 @@ async fn main_task(peripherals: MainPeripherals) {
|
|||
// peripherals: RefCell::new(Some(peripherals)),
|
||||
window_size,
|
||||
window: RefCell::new(None),
|
||||
swapchain: RefCell::new(swapchain_writer),
|
||||
framebuffer: framebuffer_ptr,
|
||||
quit_event_loop: Default::default(),
|
||||
events: Arc::new(critical_section::Mutex::new(RefCell::new(VecDeque::new()))),
|
||||
};
|
||||
|
|
@ -771,27 +509,12 @@ async fn main_task(peripherals: MainPeripherals) {
|
|||
|
||||
info!("Awaiting on all tasks...");
|
||||
|
||||
framebuffer
|
||||
.bounce_buffers
|
||||
.take()
|
||||
.unwrap()
|
||||
.launch_interrupt_driven_task()
|
||||
.await;
|
||||
|
||||
// TODO: Probably want to select! instead and re-try.
|
||||
join_all![
|
||||
run_alloc_stats_reporter(),
|
||||
// We currently send the framebuffer data using the main core, which does not seem to slow
|
||||
// down the rest of the tasks too much.
|
||||
// async {
|
||||
// warn!("Waiting...");
|
||||
// Timer::after_secs(3).await;
|
||||
// warn!("Waited.");
|
||||
// framebuffer.bounce_buffers.send().await;
|
||||
// },
|
||||
// framebuffer.bounce_buffers.send(),
|
||||
// ui::dpi::run_lcd(st7701s, framebuffer),
|
||||
// lcd_task,
|
||||
run_lcd(st7701s, framebuffer),
|
||||
run_devices! (
|
||||
(matrix) => rmk::channel::EVENT_CHANNEL,
|
||||
),
|
||||
|
|
@ -807,7 +530,7 @@ async fn main_task(peripherals: MainPeripherals) {
|
|||
),
|
||||
create_hid_report_interceptor(),
|
||||
user_controller.event_loop(),
|
||||
console::run_console(peripherals.uart_rx.into_async())
|
||||
console_task
|
||||
]
|
||||
.await;
|
||||
}
|
||||
|
|
@ -882,9 +605,109 @@ impl Controller for UserController {
|
|||
}
|
||||
}
|
||||
|
||||
struct Framebuffer {
|
||||
width: u32,
|
||||
height: u32,
|
||||
dma_buf: Option<DmaTxBuf>,
|
||||
}
|
||||
|
||||
impl Framebuffer {
|
||||
pub fn new(width: u32, height: u32) -> Self {
|
||||
let buffer_len = width as usize * height as usize * core::mem::size_of::<u16>();
|
||||
// Allocate the framebuffer in the external PSRAM memory.
|
||||
// Note: We just leak this buffer.
|
||||
let buffer_ptr = unsafe {
|
||||
// ⚠️ Note: For chips that support DMA to/from PSRAM (ESP32-S3) DMA transfers to/from PSRAM
|
||||
// have extra alignment requirements. The address and size of the buffer pointed to by each
|
||||
// descriptor must be a multiple of the cache line (block) size. This is 32 bytes on ESP32-S3.
|
||||
PSRAM_ALLOCATOR.alloc_caps(
|
||||
MemoryCapability::External.into(),
|
||||
Layout::from_size_align(buffer_len, 32).unwrap(),
|
||||
)
|
||||
};
|
||||
let buffer = unsafe { core::slice::from_raw_parts_mut(buffer_ptr, buffer_len) };
|
||||
let burst_config: BurstConfig = ExternalBurstConfig::Size16.into();
|
||||
|
||||
info!(
|
||||
"PSRAM SPI burst config: max_compatible_chunk_size={}",
|
||||
burst_config.max_compatible_chunk_size()
|
||||
);
|
||||
let dma_buf_descs_len = esp_hal::dma::descriptor_count(
|
||||
buffer_len,
|
||||
burst_config.max_compatible_chunk_size(),
|
||||
false,
|
||||
);
|
||||
// Descriptors are initialized by `DmaTxBuf::new`.
|
||||
let dma_buf_descs =
|
||||
Box::leak(vec![DmaDescriptor::EMPTY; dma_buf_descs_len].into_boxed_slice());
|
||||
let dma_buf = DmaTxBuf::new(dma_buf_descs, buffer).unwrap();
|
||||
|
||||
Self {
|
||||
width,
|
||||
height,
|
||||
dma_buf: Some(dma_buf),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_target_pixels(&mut self) -> &mut [Rgb565Pixel] {
|
||||
bytemuck::cast_slice_mut::<_, Rgb565Pixel>(self.dma_buf.as_mut().unwrap().as_mut_slice())
|
||||
}
|
||||
}
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn run_lcd_task(st7701s: St7701s<'static, Blocking>, framebuffer: &'static mut Framebuffer) {
|
||||
run_lcd(st7701s, framebuffer).await
|
||||
}
|
||||
|
||||
async fn run_lcd(mut st7701s: St7701s<'static, Blocking>, framebuffer: &'static mut Framebuffer) {
|
||||
loop {
|
||||
// Timer::after(Duration::from_millis(100)).await;
|
||||
// yield_now().await;
|
||||
SIGNAL_LCD_SUBMIT.wait().await;
|
||||
|
||||
// TODO: Use bounce buffers:
|
||||
// https://docs.espressif.com/projects/esp-idf/en/v5.0/esp32s3/api-reference/peripherals/lcd.html#bounce-buffer-with-single-psram-frame-buffer
|
||||
// This can be implemented as a `DmaTxBuffer`.
|
||||
let transfer = match st7701s.dpi.send(false, framebuffer.dma_buf.take().unwrap()) {
|
||||
Err((error, result_dpi, result_dma_buf)) => {
|
||||
error!(
|
||||
"An error occurred while initiating transfer of the framebuffer to the LCD display: {error:?}"
|
||||
);
|
||||
st7701s.dpi = result_dpi;
|
||||
framebuffer.dma_buf = Some(result_dma_buf);
|
||||
continue;
|
||||
}
|
||||
Ok(transfer) => transfer,
|
||||
};
|
||||
|
||||
// This could be used to allow other tasks to be executed on the first core, but that causes
|
||||
// the flash to be accessed, which interferes with the framebuffer transfer.
|
||||
// For that reason, it is disabled, and this task blocks the first core, until the transfer
|
||||
// is complete.
|
||||
#[cfg(not(feature = "limit-fps"))]
|
||||
while !transfer.is_done() {
|
||||
// Timer::after_millis(1).await;
|
||||
rmk::embassy_futures::yield_now().await;
|
||||
}
|
||||
|
||||
let result;
|
||||
let dma_buf;
|
||||
(result, st7701s.dpi, dma_buf) = transfer.wait();
|
||||
framebuffer.dma_buf = Some(dma_buf);
|
||||
|
||||
SIGNAL_UI_RENDER.signal(());
|
||||
|
||||
if let Err(error) = result {
|
||||
error!(
|
||||
"An error occurred while transferring framebuffer to the LCD display: {error:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// // TODO: Not needed currently. If it is ever enabled, don't forget to register it in Io.
|
||||
// #[handler]
|
||||
// #[ram] // Improves performance.
|
||||
// #[ram] // TODO: Is this necessary?
|
||||
// fn interrupt_handler() {
|
||||
// // esp_println::println!(
|
||||
// // "GPIO Interrupt with priority {}",
|
||||
|
|
|
|||
|
|
@ -1273,10 +1273,7 @@ where
|
|||
// - prevent flash from being used whilst your program is running. (There's a PR to make
|
||||
// this easy to do)
|
||||
// https://github.com/esp-rs/esp-hal/pull/3024
|
||||
//
|
||||
// Adafruit would use 11 MHz.
|
||||
// I had lowered the frequency, so that `DmaBounce` could keep up.
|
||||
.with_frequency(Rate::from_mhz(5)) // From Adafruit
|
||||
.with_frequency(Rate::from_mhz(11)) // From Adafruit
|
||||
.with_clock_mode(ClockMode {
|
||||
polarity: Polarity::IdleLow, // From Adafruit
|
||||
phase: Phase::ShiftHigh, // From Adafruit
|
||||
|
|
|
|||
|
|
@ -19,17 +19,18 @@ use slint::{
|
|||
};
|
||||
use xkbcommon::xkb::{self, Keysym};
|
||||
|
||||
use crate::{
|
||||
proxy::{KEY_MESSAGE_CHANNEL, TryFromKeysym},
|
||||
ui::dpi::SwapchainWriter,
|
||||
};
|
||||
use crate::proxy::{KEY_MESSAGE_CHANNEL, TryFromKeysym};
|
||||
|
||||
use super::window_adapter::SoftwareWindowAdapter;
|
||||
|
||||
pub struct FramebufferPtr(pub *mut [Rgb565Pixel]);
|
||||
|
||||
unsafe impl Send for FramebufferPtr {}
|
||||
|
||||
pub struct SlintBackend {
|
||||
pub window_size: [u32; 2],
|
||||
pub window: RefCell<Option<Rc<SoftwareWindowAdapter>>>,
|
||||
pub swapchain: RefCell<SwapchainWriter>,
|
||||
pub framebuffer: FramebufferPtr,
|
||||
pub quit_event_loop: Arc<AtomicBool>,
|
||||
pub events: Arc<Mutex<RefCell<VecDeque<Box<dyn FnOnce() + Send>>>>>,
|
||||
}
|
||||
|
|
@ -38,8 +39,9 @@ impl slint::platform::Platform for SlintBackend {
|
|||
fn create_window_adapter(
|
||||
&self,
|
||||
) -> Result<Rc<dyn slint::platform::WindowAdapter>, slint::PlatformError> {
|
||||
let renderer =
|
||||
SoftwareRenderer::new_with_repaint_buffer_type(RepaintBufferType::SwappedBuffers);
|
||||
let renderer = SoftwareRenderer::new_with_repaint_buffer_type(
|
||||
RepaintBufferType::ReusedBuffer, /* TODO: Implement a swapchain */
|
||||
);
|
||||
renderer.set_rendering_rotation(RenderingRotation::Rotate270);
|
||||
let window = SoftwareWindowAdapter::new(renderer);
|
||||
// window.set_scale_factor(4.0);
|
||||
|
|
@ -132,10 +134,8 @@ impl slint::platform::Platform for SlintBackend {
|
|||
}
|
||||
|
||||
window.draw_if_needed(|renderer| {
|
||||
// TODO: VSYNC support.
|
||||
let mut swapchain = self.swapchain.borrow_mut();
|
||||
let mut write_guard = swapchain.write();
|
||||
let framebuffer = write_guard.cast::<Rgb565Pixel>();
|
||||
// TODO: Proper synchronization.
|
||||
let framebuffer = unsafe { &mut *self.framebuffer.0 };
|
||||
renderer.render(framebuffer, self.window_size[1] as usize);
|
||||
info!("UI rendered.");
|
||||
});
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -29,7 +29,7 @@ use spectre_api_sys::{
|
|||
#[cfg(feature = "limit-fps")]
|
||||
use crate::FRAME_DURATION_MIN;
|
||||
use crate::{
|
||||
PSRAM_ALLOCATOR,
|
||||
PSRAM_ALLOCATOR, SIGNAL_LCD_SUBMIT, SIGNAL_UI_RENDER,
|
||||
db::{
|
||||
AcidDatabase, DbKey, DbPathSpectreUserSite, DbPathSpectreUserSites, DbPathSpectreUsers,
|
||||
PartitionAcid, ReadTransactionExt,
|
||||
|
|
@ -48,7 +48,6 @@ use crate::{
|
|||
};
|
||||
|
||||
pub mod backend;
|
||||
pub mod dpi;
|
||||
pub mod messages;
|
||||
pub mod storage;
|
||||
pub mod window_adapter;
|
||||
|
|
@ -144,7 +143,11 @@ struct State {
|
|||
|
||||
impl State {
|
||||
async fn new(db: AcidDatabase, main: AppWindow) -> Rc<RefCell<Self>> {
|
||||
let users = Self::load_users(&db).await;
|
||||
let users = {
|
||||
let users = Self::load_users(&db).await;
|
||||
warn!("Users: {users:#?}");
|
||||
users
|
||||
};
|
||||
let usernames = users.users.clone().map(|user| user.username);
|
||||
|
||||
let state = Rc::new(RefCell::new(State {
|
||||
|
|
@ -373,16 +376,10 @@ impl State {
|
|||
|
||||
loop {
|
||||
slint::run_event_loop().unwrap();
|
||||
// SIGNAL_LCD_SUBMIT.signal(());
|
||||
SIGNAL_LCD_SUBMIT.signal(());
|
||||
#[cfg(feature = "limit-fps")]
|
||||
embassy_time::Timer::after(FRAME_DURATION_MIN).await;
|
||||
// let frames_skipped = FRAMES_SKIPPED.wait().await;
|
||||
|
||||
// if frames_skipped > 0 {
|
||||
// error!("Renderer missed {frames_skipped} frames.");
|
||||
// }
|
||||
|
||||
// SIGNAL_UI_RENDER.wait().await;
|
||||
SIGNAL_UI_RENDER.wait().await;
|
||||
}
|
||||
|
||||
#[expect(unreachable_code)]
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export component AppWindow inherits Window {
|
|||
in property <string> dummy_identicon_symbols: "╔╚╰═█░▒▓☺☻╗╝╯═◈◎◐◑◒◓☀☁☂☃☄★☆☎☏⎈⌂☘☢☣☕⌚⌛⏰⚡⛄⛅☔♔♕♖♗♘♙♚♛♜♝♞♟♨♩♪♫⚐⚑⚔⚖⚙⚠⌘⏎✄✆✈✉✌";
|
||||
default-font-family: "IBM Plex Mono";
|
||||
default-font-size: 16pt;
|
||||
height: 8px + 240px + 8px;
|
||||
height: 368px;
|
||||
width: 960px;
|
||||
forward-focus: focus-scope;
|
||||
in property <AppState> app-state: AppState.login;
|
||||
|
|
@ -69,9 +69,9 @@ export component AppWindow inherits Window {
|
|||
}
|
||||
vertical-box := VerticalBox {
|
||||
width: 960px;
|
||||
height: 8px + 240px + 8px;
|
||||
height: 368px;
|
||||
padding: 0px;
|
||||
padding-top: 8px;
|
||||
padding-top: 120px;
|
||||
padding-bottom: 8px;
|
||||
Rectangle {
|
||||
height: 240px;
|
||||
|
|
|
|||
Loading…
Reference in a new issue