Mainmenu #28
Generated
+9
-8
@@ -306,6 +306,7 @@ dependencies = [
|
|||||||
"critical-section",
|
"critical-section",
|
||||||
"display-interface-spi",
|
"display-interface-spi",
|
||||||
"embassy-executor",
|
"embassy-executor",
|
||||||
|
"embassy-futures",
|
||||||
"embassy-time",
|
"embassy-time",
|
||||||
"embedded-graphics",
|
"embedded-graphics",
|
||||||
"embedded-graphics-core",
|
"embedded-graphics-core",
|
||||||
@@ -1530,27 +1531,27 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-core"
|
name = "futures-core"
|
||||||
version = "0.3.33"
|
version = "0.3.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7"
|
checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-sink"
|
name = "futures-sink"
|
||||||
version = "0.3.33"
|
version = "0.3.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307"
|
checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-task"
|
name = "futures-task"
|
||||||
version = "0.3.33"
|
version = "0.3.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109"
|
checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-util"
|
name = "futures-util"
|
||||||
version = "0.3.33"
|
version = "0.3.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa"
|
checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-task",
|
"futures-task",
|
||||||
|
|||||||
+1
-2
@@ -27,6 +27,7 @@ embedded-io = "0.7.1"
|
|||||||
embassy-executor = { version = "0.10.0", features = [
|
embassy-executor = { version = "0.10.0", features = [
|
||||||
] }
|
] }
|
||||||
embassy-time = { version = "0.5.1", default-features = false }
|
embassy-time = { version = "0.5.1", default-features = false }
|
||||||
|
embassy-futures = "0.1.2"
|
||||||
esp-alloc = "0.10.0"
|
esp-alloc = "0.10.0"
|
||||||
esp-hal-wifimanager = { git = "https://github.com/InvisibleUSA/esp-hal-wifimanager", default-features = false, features = [
|
esp-hal-wifimanager = { git = "https://github.com/InvisibleUSA/esp-hal-wifimanager", default-features = false, features = [
|
||||||
"ap",
|
"ap",
|
||||||
@@ -43,8 +44,6 @@ base64 = { version = "0.22", default-features = false, features = ["alloc"] }
|
|||||||
pn532 = "0.5.0"
|
pn532 = "0.5.0"
|
||||||
ndef = "0.5.0"
|
ndef = "0.5.0"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# For fine tuning these settings, please refer to https://doc.rust-lang.org/cargo/reference/profiles.html
|
# For fine tuning these settings, please refer to https://doc.rust-lang.org/cargo/reference/profiles.html
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
# The default debug profile is too slow and too big for resource-constrained devices.
|
# The default debug profile is too slow and too big for resource-constrained devices.
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
use crate::navigation::inputs::Inputs;
|
use crate::navigation::inputs::Inputs;
|
||||||
|
|
||||||
pub async fn show(_inputs: &mut Inputs) {}
|
pub const MAX_SELECTED: i8 = 3;
|
||||||
|
|
||||||
|
pub struct MainMenu {
|
||||||
|
pub selected: i8,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MainMenu {
|
||||||
|
pub async fn display(self: &Self) {}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,8 +1,35 @@
|
|||||||
use crate::navigation::inputs::Inputs;
|
use crate::navigation::inputs::Inputs;
|
||||||
|
use crate::navigation::main_menu::{MAX_SELECTED, MainMenu};
|
||||||
|
|
||||||
|
use embassy_futures::select::Either6;
|
||||||
|
use embassy_futures::select::select6;
|
||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
pub async fn run(mut inputs: Inputs) {
|
pub async fn run(mut inputs: Inputs) {
|
||||||
|
let mut state = MainMenu { selected: 0 };
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
crate::navigation::main_menu::show(&mut inputs).await
|
let selection = select6(
|
||||||
|
inputs.up.wait_for_low(),
|
||||||
|
inputs.down.wait_for_low(),
|
||||||
|
inputs.left.wait_for_low(),
|
||||||
|
inputs.right.wait_for_low(),
|
||||||
|
inputs.ok.wait_for_low(),
|
||||||
|
inputs.back.wait_for_low(),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
let value = match selection {
|
||||||
|
Either6::First(_) => (state.selected.wrapping_sub(1)) % MAX_SELECTED,
|
||||||
|
Either6::Second(_) => (state.selected.wrapping_add(1)) % MAX_SELECTED,
|
||||||
|
_ => continue, // Either6::Third(_) => ,
|
||||||
|
// Either6::Fourth(_) => (),
|
||||||
|
// Either6::Fifth(_) => (),
|
||||||
|
// Either6::Sixth(_) => (),
|
||||||
|
};
|
||||||
|
|
||||||
|
state.selected = value;
|
||||||
|
|
||||||
|
state.display().await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user