From 44af1366056a06247b3ee0f153d5274cb4658c43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Sat, 4 Mar 2023 02:26:34 +0100 Subject: [PATCH] CFG: Align all crates to use hyphen --- rtic-monotonics/Cargo.toml | 6 +++--- rtic-monotonics/src/lib.rs | 2 +- rtic-monotonics/src/systick.rs | 8 ++++---- rtic/Cargo.toml | 4 ++-- rtic/build.rs | 6 +++--- rtic/src/export.rs | 14 +++++++------- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/rtic-monotonics/Cargo.toml b/rtic-monotonics/Cargo.toml index d60b68cb9f..c961c05997 100644 --- a/rtic-monotonics/Cargo.toml +++ b/rtic-monotonics/Cargo.toml @@ -30,9 +30,9 @@ default = [] defmt = ["fugit/defmt"] # Systick on Cortex-M, default 1 kHz -cortex_m_systick = ["dep:cortex-m"] -systick_100hz = [] -systick_10khz = [] +cortex-m-systick = ["dep:cortex-m"] +systick-100hz = [] +systick-10khz = [] # Timer peripheral on the RP2040 rp2040 = ["dep:rp2040-pac"] diff --git a/rtic-monotonics/src/lib.rs b/rtic-monotonics/src/lib.rs index 7e513f8d4c..a8068ce737 100644 --- a/rtic-monotonics/src/lib.rs +++ b/rtic-monotonics/src/lib.rs @@ -9,7 +9,7 @@ pub use rtic_time::{Monotonic, TimeoutError, TimerQueue}; -#[cfg(feature = "cortex_m_systick")] +#[cfg(feature = "cortex-m-systick")] pub mod systick; #[cfg(feature = "rp2040")] diff --git a/rtic-monotonics/src/systick.rs b/rtic-monotonics/src/systick.rs index 62d4e0c02f..691d7c764f 100644 --- a/rtic-monotonics/src/systick.rs +++ b/rtic-monotonics/src/systick.rs @@ -7,14 +7,14 @@ use core::future::Future; use cortex_m::peripheral::SYST; pub use fugit::ExtU32; -// Features should be additive, here systick_100hz gets picked if both -// `systick_100hz` and `systick_10khz` are enabled. +// Features should be additive, here systick-100hz gets picked if both +// `systick-100hz` and `systick-10khz` are enabled. cfg_if::cfg_if! { - if #[cfg(feature = "systick_100hz")] + if #[cfg(feature = "systick-100hz")] { const TIMER_HZ: u32 = 100; - } else if #[cfg(feature = "systick_10khz")] + } else if #[cfg(feature = "systick-10khz")] { const TIMER_HZ: u32 = 10_000; } else { diff --git a/rtic/Cargo.toml b/rtic/Cargo.toml index 20aa6de28e..e73b970de9 100644 --- a/rtic/Cargo.toml +++ b/rtic/Cargo.toml @@ -48,7 +48,7 @@ lm3s6965 = "0.1.3" cortex-m-semihosting = "0.5.0" rtic-time = { path = "../rtic-time" } rtic-sync = { path = "../rtic-sync" } -rtic-monotonics = { path = "../rtic-monotonics", features = ["cortex_m_systick"] } +rtic-monotonics = { path = "../rtic-monotonics", features = ["cortex-m-systick"] } [dev-dependencies.futures] version = "0.3.26" @@ -74,7 +74,7 @@ thumbv8main-backend = ["rtic-macros/cortex-m-basepri"] # riscv-esp32c3-backend = ["rtic-macros/riscv-esp32c3"] # needed for testing -test-critical-section = ["cortex-m/critical-section-single-core", "rtic-monotonics/systick_100hz"] +test-critical-section = ["cortex-m/critical-section-single-core", "rtic-monotonics/systick-100hz"] # [[example]] # name = "pool" diff --git a/rtic/build.rs b/rtic/build.rs index 178a8e3428..c88175d55a 100644 --- a/rtic/build.rs +++ b/rtic/build.rs @@ -8,14 +8,14 @@ fn main() { | target.starts_with("thumbv7em") | target.starts_with("thumbv8m.main") { - println!("cargo:rustc-cfg=cortex_m_basepri"); + println!("cargo:rustc-cfg=feature=\"cortex-m-basepri\""); } else if target.starts_with("thumbv6m") | target.starts_with("thumbv8m.base") { - println!("cargo:rustc-cfg=cortex_m_source_masking"); + println!("cargo:rustc-cfg=feature=\"cortex-m-source-masking\""); } else if target.starts_with("riscv32i") { panic!("No RISC-V support yet."); // TODO: Add feature here for risc-v targets - // println!("cargo:rustc-cfg=riscv"); + // println!("cargo:rustc-cfg=feature=\"riscv\""); } else if target.starts_with("thumb") || target.starts_with("riscv32") { panic!("Unknown target '{target}'. Need to update logic in build.rs."); } diff --git a/rtic/src/export.rs b/rtic/src/export.rs index 82132c270d..6fc97add3e 100644 --- a/rtic/src/export.rs +++ b/rtic/src/export.rs @@ -5,7 +5,7 @@ pub use atomic_polyfill as atomic; pub mod executor; #[cfg(all( - cortex_m_basepri, + feature = "cortex-m-basepri", not(any(feature = "thumbv7-backend", feature = "thumbv8main-backend")) ))] compile_error!( @@ -13,27 +13,27 @@ compile_error!( ); #[cfg(all( - cortex_m_source_masking, + feature = "cortex-m-source-masking", not(any(feature = "thumbv6-backend", feature = "thumbv8base-backend")) ))] compile_error!( "Building for Cortex-M with source masking, but 'thumbv6-backend' or 'thumbv8base-backend' backend not selected" ); -#[cfg(cortex_m_basepri)] +#[cfg(any(feature = "cortex-m-basepri"))] pub use cortex_basepri::*; -#[cfg(cortex_m_basepri)] +#[cfg(any(feature = "cortex-m-basepri"))] mod cortex_basepri; -#[cfg(cortex_m_source_masking)] +#[cfg(feature = "cortex-m-source-masking")] pub use cortex_source_mask::*; -#[cfg(cortex_m_source_masking)] +#[cfg(feature = "cortex-m-source-masking")] mod cortex_source_mask; /// Priority conversion, takes logical priorities 1..=N and converts it to NVIC priority. -#[cfg(any(cortex_m_basepri, cortex_m_source_masking))] +#[cfg(any(feature = "cortex-m-basepri", feature = "cortex-m-source-masking",))] #[inline] #[must_use] pub const fn cortex_logical2hw(logical: u8, nvic_prio_bits: u8) -> u8 {