From 1e1a61b0d9fb068825246c6cdc09fd27ca92798b Mon Sep 17 00:00:00 2001 From: Gabriel Dobato Date: Fri, 31 May 2024 16:31:52 +0200 Subject: [PATCH] Update dependencies --- Cargo.toml | 4 ++-- examples/blinky.rs | 18 ++++++++---------- examples/usb_echo.rs | 12 ++++-------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f075d0b..d1b1c4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,13 +11,13 @@ stm32h7xx-hal = { version = "0.16.0", features = [ "rt", "usb_hs", ] } -defmt = "=0.3.7" +defmt = "=0.3.8" defmt-rtt = "0.4.1" panic-probe = { version = "0.3", features = ["print-defmt"] } [dev-dependencies] rtic = { version = "2.1.1", features = ["thumbv7-backend"] } -rtic-monotonics = { version = "1.5.0", features = ["cortex-m-systick"] } +rtic-monotonics = { version = "2.0.0", features = ["cortex-m-systick"] } static_cell = "2.1.0" usb-device = "0.3.2" usbd-serial = "0.2.2" diff --git a/examples/blinky.rs b/examples/blinky.rs index 08261c5..e13de23 100644 --- a/examples/blinky.rs +++ b/examples/blinky.rs @@ -12,7 +12,9 @@ use portenta_h7::{ led, }; use rtic::app; -use rtic_monotonics::systick::*; +use rtic_monotonics::systick::prelude::*; + +systick_monotonic!(Mono, 1000); #[app(device = portenta_h7::hal::pac, peripherals = false, dispatchers = [SPI1])] mod app { @@ -31,12 +33,8 @@ mod app { #[init] fn init(cx: init::Context) -> (Shared, Local) { info!("Init"); - let systick_mono_token = rtic_monotonics::create_systick_token!(); - Systick::start( - cx.core.SYST, - board::CORE_FREQUENCY.raw(), - systick_mono_token, - ); + + Mono::start(cx.core.SYST, board::CORE_FREQUENCY.raw()); // Get board resources let Board { @@ -66,7 +64,7 @@ mod app { async fn blink_led_red(cx: blink_led_red::Context) { loop { cx.local.led_red.toggle(); - Systick::delay(500.millis()).await; + Mono::delay(500.millis()).await; } } @@ -74,7 +72,7 @@ mod app { async fn blink_led_green(cx: blink_led_green::Context) { loop { cx.local.led_green.toggle(); - Systick::delay(1000.millis()).await; + Mono::delay(1000.millis()).await; } } @@ -82,7 +80,7 @@ mod app { async fn blink_led_blue(cx: blink_led_blue::Context) { loop { cx.local.led_blue.toggle(); - Systick::delay(1000.millis()).await; + Mono::delay(1000.millis()).await; } } } diff --git a/examples/usb_echo.rs b/examples/usb_echo.rs index a88903e..45a36c8 100644 --- a/examples/usb_echo.rs +++ b/examples/usb_echo.rs @@ -12,11 +12,13 @@ use portenta_h7::{ led::{self, Led}, }; use rtic::app; -use rtic_monotonics::systick::*; +use rtic_monotonics::systick::prelude::*; use static_cell::StaticCell; use usb_device::{class_prelude::UsbBusAllocator, prelude::*}; use usbd_serial::CdcAcmClass; +systick_monotonic!(Mono, 1000); + #[app(device = portenta_h7::hal::pac, peripherals = false)] mod app { use super::*; @@ -41,13 +43,7 @@ mod app { fn init(cx: init::Context) -> (Shared, Local) { info!("Init"); - let systick_mono_token = rtic_monotonics::create_systick_token!(); - - Systick::start( - cx.core.SYST, - board::CORE_FREQUENCY.raw(), - systick_mono_token, - ); + Mono::start(cx.core.SYST, board::CORE_FREQUENCY.raw()); // Get board resources let Board { led_blue, usb, .. } = Board::take();