From 8c23e178f3838bcdd13662a2ffefd39ec144e869 Mon Sep 17 00:00:00 2001 From: Finomnis Date: Thu, 11 Apr 2024 00:00:38 +0200 Subject: Monotonic rewrite (#874) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Rework timer_queue and monotonic architecture Goals: * make Monotonic purely internal * make Monotonic purely tick passed, no fugit involved * create a wrapper struct in the user's code via a macro that then converts the "now" from the tick based monotonic to a fugit based timestamp We need to proxy the delay functions of the timer queue anyway, so we could simply perform the conversion in those proxy functions. * Update cargo.lock * Update readme of rtic-time * CI: ESP32: Redact esp_image: Too volatile * Fixup: Changelog double entry rebase mistake --------- Co-authored-by: Henrik Tjäder --- examples/embassy-stm32g4/src/bin/blinky.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'examples/embassy-stm32g4/src') diff --git a/examples/embassy-stm32g4/src/bin/blinky.rs b/examples/embassy-stm32g4/src/bin/blinky.rs index 6855b1e..617aa66 100644 --- a/examples/embassy-stm32g4/src/bin/blinky.rs +++ b/examples/embassy-stm32g4/src/bin/blinky.rs @@ -5,9 +5,11 @@ use embassy_stm32::gpio::{Level, Output, Speed}; use rtic::app; -use rtic_monotonics::systick::*; +use rtic_monotonics::systick::prelude::*; use {defmt_rtt as _, panic_probe as _}; +systick_monotonic!(Mono, 1_000); + pub mod pac { pub use embassy_stm32::pac::Interrupt as interrupt; pub use embassy_stm32::pac::*; @@ -26,8 +28,7 @@ mod app { #[init] fn init(cx: init::Context) -> (Shared, Local) { // Initialize the systick interrupt & obtain the token to prove that we did - let systick_mono_token = rtic_monotonics::create_systick_token!(); - Systick::start(cx.core.SYST, 25_000_000, systick_mono_token); + Mono::start(cx.core.SYST, 25_000_000); let p = embassy_stm32::init(Default::default()); defmt::info!("Hello World!"); @@ -53,7 +54,7 @@ mod app { led.set_low(); } state = !state; - Systick::delay(1000.millis()).await; + Mono::delay(1000.millis()).await; } } } -- cgit v1.2.3