From 1e37fc069fcf1789c9ccf211b039d933769d88d5 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Tue, 9 Aug 2022 20:12:16 +0200 Subject: [PATCH] Update the bare-metal crate to 1.0.0 The new crate version generates much cleaner code due to #[inline] annotations. This is an API break, because the CriticalSection + Mutex mechanism changes from exterior reference lifetime to interior reference lifetime management. --- Cargo.toml | 2 +- src/interrupt.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8551d533f84fd305fc64901190b3e18e68714ec1..e1627700cfaa63b5c90debc77e7fcd534c988235 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,7 @@ docsrs = ["rt", "atmega328p", "atmega32u4", "atmega2560", "attiny85", "atmega480 udebug = ["dep:ufmt"] [dependencies] -bare-metal = "0.2.5" +bare-metal = "1.0.0" vcell = "0.1.2" cfg-if = "0.1.10" ufmt = { version = "0.2.0", optional = true } diff --git a/src/interrupt.rs b/src/interrupt.rs index 2ff0041fc185975b5ca92a80921d1c420249ca8e..054da8ecebb4a34486e71e63636faa8020705ea5 100644 --- a/src/interrupt.rs +++ b/src/interrupt.rs @@ -28,7 +28,7 @@ //! }); //! ``` -pub use bare_metal::{CriticalSection, Mutex, Nr}; +pub use bare_metal::{CriticalSection, Mutex}; #[cfg(target_arch = "avr")] use core::arch::asm; @@ -215,14 +215,14 @@ pub fn is_enabled() -> bool { #[inline(always)] pub fn free(f: F) -> R where - F: FnOnce(&CriticalSection) -> R, + F: FnOnce(CriticalSection) -> R, { cfg_if::cfg_if! { if #[cfg(target_arch = "avr")] { // Disable interrupts. This is an optimization fence. let irq_flag = disable_save(); - let r = f(unsafe { &CriticalSection::new() }); + let r = f(unsafe { CriticalSection::new() }); // Restore interrupt state. This is an optimization fence. unsafe { restore(irq_flag); }