From cf0288fb6a246a1b58e3ddc8fa68eaa36de01fc9 Mon Sep 17 00:00:00 2001 From: Rahix Date: Wed, 30 Apr 2025 01:46:12 +0200 Subject: [PATCH] Enable critical-section by default The new svd2rust code needs `critical-section` for implementing the `Peripherals::take()` function. This means almost all uses of `avr-device` will need it as well. Rename the `critical-section-impl` feature to just `critical-section` and make it a part of the crate's default features. --- Cargo.toml | 4 +++- examples/atmega328p/Cargo.toml | 2 +- src/interrupt.rs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 05f6a47..b570103 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,7 +82,9 @@ avr64du32 = ["device-selected"] avr64du28 = ["device-selected"] rt = ["avr-device-macros"] -critical-section-impl = ["critical-section/restore-state-u8"] +critical-section = ["critical-section/restore-state-u8"] + +default = ["critical-section"] # Unfortunately, we can only build documentation for a subset of the supported # MCUs on docs.rs. If you think a very popular chip is missing from the list, diff --git a/examples/atmega328p/Cargo.toml b/examples/atmega328p/Cargo.toml index d5943f6..2075a19 100644 --- a/examples/atmega328p/Cargo.toml +++ b/examples/atmega328p/Cargo.toml @@ -20,7 +20,7 @@ embedded-hal = "0.2.3" [dependencies.avr-device] version = "0.7" path = "../.." -features = ["atmega328p", "rt", "critical-section-impl"] +features = ["atmega328p", "rt"] # Configure the build for minimal size - AVRs have very little program memory [profile.dev] diff --git a/src/interrupt.rs b/src/interrupt.rs index 6a3f5d3..91db205 100644 --- a/src/interrupt.rs +++ b/src/interrupt.rs @@ -235,7 +235,7 @@ where } } -#[cfg(feature = "critical-section-impl")] +#[cfg(feature = "critical-section")] mod cs { use critical_section::RawRestoreState;