From 1c2d9de9c05b25e38eb7035008f76fa4e6a51a12 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Thu, 2 Feb 2023 20:14:41 +0100 Subject: [PATCH] Make xtask pass, clean up rtic Cargo.toml --- rtic-monotonics/Cargo.toml | 7 +++++++ rtic-monotonics/src/systick_monotonic.rs | 7 +++++++ rtic/Cargo.toml | 12 +++++------- rtic/ci/expected/async-timeout.run | 22 +++++++++++----------- rtic/src/lib.rs | 2 +- 5 files changed, 31 insertions(+), 19 deletions(-) diff --git a/rtic-monotonics/Cargo.toml b/rtic-monotonics/Cargo.toml index 5e6586e29a..f94a78b884 100644 --- a/rtic-monotonics/Cargo.toml +++ b/rtic-monotonics/Cargo.toml @@ -22,3 +22,10 @@ embedded-hal-async = "0.2.0-alpha.0" fugit = { version = "0.3.6", features = ["defmt"] } rtic-time = { version = "1.0.0-alpha.0", path = "../rtic-time" } atomic-polyfill = "1" + +[features] +default = ["systick_1khz"] + +systick_100hz = [] +systick_1khz = [] +systick_10khz = [] diff --git a/rtic-monotonics/src/systick_monotonic.rs b/rtic-monotonics/src/systick_monotonic.rs index fec97f2e86..24deb54747 100644 --- a/rtic-monotonics/src/systick_monotonic.rs +++ b/rtic-monotonics/src/systick_monotonic.rs @@ -8,8 +8,15 @@ use cortex_m::peripheral::SYST; use embedded_hal_async::delay::DelayUs; pub use fugit::ExtU32; +#[cfg(feature = "systick_100hz")] +const TIMER_HZ: u32 = 100; + +#[cfg(feature = "systick_1khz")] const TIMER_HZ: u32 = 1_000; +#[cfg(feature = "systick_10khz")] +const TIMER_HZ: u32 = 10_000; + /// Systick implementing `rtic_monotonic::Monotonic` which runs at 1 kHz. pub struct Systick; diff --git a/rtic/Cargo.toml b/rtic/Cargo.toml index 7bca4c1cfb..d722e65817 100644 --- a/rtic/Cargo.toml +++ b/rtic/Cargo.toml @@ -35,25 +35,23 @@ name = "rtic" [dependencies] cortex-m = "0.7.0" -rtic-macros = { path = "macros", version = "2.0.0-alpha.0" } -rtic-monotonic = "1.0.0" -rtic-core = "1.0.0" -heapless = "0.7.7" bare-metal = "1.0.0" #portable-atomic = { version = "0.3.19" } atomic-polyfill = "1" +rtic-macros = { path = "./macros", version = "2.0.0-alpha.0" } +rtic-core = "1" [build-dependencies] version_check = "0.9" [dev-dependencies] +heapless = "0.7.7" lm3s6965 = "0.1.3" cortex-m-semihosting = "0.5.0" -systick-monotonic = "1.0.0" rtic-time = { path = "../rtic-time" } rtic-channel = { path = "../rtic-channel" } -rtic-monotonics = { path = "../rtic-monotonics" } +rtic-monotonics = { path = "../rtic-monotonics", default-features = false } [dev-dependencies.futures] version = "0.3.26" @@ -94,7 +92,7 @@ overflow-checks = false lm3s6965 = { git = "https://github.com/japaric/lm3s6965" } [features] -test-critical-section = ["cortex-m/critical-section-single-core"] +test-critical-section = ["cortex-m/critical-section-single-core", "rtic-monotonics/systick_100hz"] # [[example]] # name = "pool" diff --git a/rtic/ci/expected/async-timeout.run b/rtic/ci/expected/async-timeout.run index ca929c7b4c..dea8e5d2cc 100644 --- a/rtic/ci/expected/async-timeout.run +++ b/rtic/ci/expected/async-timeout.run @@ -1,16 +1,16 @@ init -the hal takes a duration of Duration { ticks: 450 } +the hal takes a duration of Duration { ticks: 45 } timeout -the hal takes a duration of Duration { ticks: 450 } +the hal takes a duration of Duration { ticks: 45 } hal returned 5 -the hal takes a duration of Duration { ticks: 450 } +the hal takes a duration of Duration { ticks: 45 } hal returned 5 -now is Instant { ticks: 2102 }, timeout at Instant { ticks: 2602 } -the hal takes a duration of Duration { ticks: 350 } -hal returned 5 at time Instant { ticks: 2452 } -now is Instant { ticks: 3102 }, timeout at Instant { ticks: 3602 } -the hal takes a duration of Duration { ticks: 450 } -hal returned 5 at time Instant { ticks: 3552 } -now is Instant { ticks: 4102 }, timeout at Instant { ticks: 4602 } -the hal takes a duration of Duration { ticks: 550 } +now is Instant { ticks: 210 }, timeout at Instant { ticks: 260 } +the hal takes a duration of Duration { ticks: 35 } +hal returned 5 at time Instant { ticks: 245 } +now is Instant { ticks: 310 }, timeout at Instant { ticks: 360 } +the hal takes a duration of Duration { ticks: 45 } +hal returned 5 at time Instant { ticks: 355 } +now is Instant { ticks: 410 }, timeout at Instant { ticks: 460 } +the hal takes a duration of Duration { ticks: 55 } timeout diff --git a/rtic/src/lib.rs b/rtic/src/lib.rs index 860e7436ff..a193e5cf76 100644 --- a/rtic/src/lib.rs +++ b/rtic/src/lib.rs @@ -36,7 +36,7 @@ use cortex_m::{interrupt::InterruptNumber, peripheral::NVIC}; pub use rtic_core::{prelude as mutex_prelude, Exclusive, Mutex}; pub use rtic_macros::app; -pub use rtic_monotonic::{self, Monotonic}; +// pub use rtic_monotonic::{self, Monotonic}; /// module `mutex::prelude` provides `Mutex` and multi-lock variants. Recommended over `mutex_prelude` pub mod mutex {