resue simulator for embedded examples

This commit is contained in:
Robin Mueller
2026-09-25 10:03:08 +02:00
parent e9477beb62
commit 857a29a6fe
21 changed files with 162 additions and 148 deletions
+1 -1
View File
@@ -13,4 +13,4 @@ postcard = { version = "1", features = ["alloc"] }
thiserror = { version = "2", default-features = false }
bitbybit = "2"
arbitrary-int = "2"
hashbrown = { version = "0.17", features = ["serde"] }
heapless = { version = "0.9", features = ["serde"] }
+7 -4
View File
@@ -1,5 +1,3 @@
use hashbrown::HashMap;
use strum::IntoEnumIterator as _;
#[bitbybit::bitfield(u16, debug, default = 0x0)]
@@ -76,7 +74,10 @@ impl crate::EventId for Event {
}
}
pub type SwitchMapBinary = HashMap<SwitchId, SwitchStateBinary>;
pub const MAX_NUM_OF_SWITCHES: usize = 16;
pub type SwitchMapBinary =
heapless::index_map::FnvIndexMap<SwitchId, SwitchStateBinary, MAX_NUM_OF_SWITCHES>;
pub struct SwitchMapBinaryWrapper(pub SwitchMapBinary);
@@ -84,7 +85,9 @@ impl Default for SwitchMapBinaryWrapper {
fn default() -> Self {
let mut switch_map = SwitchMapBinary::default();
for entry in SwitchId::iter() {
switch_map.insert(entry, SwitchStateBinary::Off);
switch_map
.insert(entry, SwitchStateBinary::Off)
.expect("switch map capacity exceeded");
}
Self(switch_map)
}