diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8695cc9..5575c74 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,9 +8,7 @@ on: paths: [ src ] env: - RUSTC_WRAPPER: "sccache" RUSTFLAGS: "-Dwarnings" - SCCACHE_GHA_ENABLED: "true" jobs: build: @@ -36,9 +34,6 @@ jobs: target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.5 - - name: Check formatting run: cargo fmt --all --check diff --git a/Cargo.toml b/Cargo.toml index 397b82f..3193ea6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ rust-version = "1.71.1" version = "0.2.1" [dependencies] -defmt = { version = "0.3", optional = true } +defmt = { version = "1.0", optional = true } embedded-hal = { version = "1.0", optional = true } embedded-hal-async = { version = "1.0", optional = true } log = { version = "0.4", optional = true } @@ -20,9 +20,9 @@ maybe-async-cfg2 = "0.3" [features] async = ["dep:embedded-hal-async"] -core-error = [] # bump MSRV to 1.81.0 +core-error = [] # bump MSRV to 1.81.0 default = ["sync"] -defmt-03 = ["dep:defmt"] +defmt = ["dep:defmt"] not-recommended-rfs = [] sync = ["dep:embedded-hal"] diff --git a/README.md b/README.md index fb692b7..c39226d 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Distributed under the AGPLv3 License. See [LICENSE.txt](./LICENSE.txt) for more ## Features -- `defmt-03` add support for defmt Formatting of public enums and structs. +- `defmt` add support for defmt Formatting of public enums and structs. - `sync` (default) use `embedded_hal::i2c::I2c` trait to provide a sync driver. - `async` use `embedded_hal_async::i2c::I2c` trait to provide an async driver. Both `sync` and `async` can be enable at the same time, but enabling none is pointless. - `not-recommended-rfs` allow driver to use not recommended Rfs value for microamps convertions diff --git a/src/error.rs b/src/error.rs index b4ba0e6..18255d8 100644 --- a/src/error.rs +++ b/src/error.rs @@ -3,7 +3,7 @@ pub type Result = core::result::Result>; /// Driver errors. #[derive(Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "defmt-03", derive(defmt::Format))] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum Error { /// I2C bus error. I2c(E), diff --git a/src/fmt.rs b/src/fmt.rs index 1d91499..96fc26b 100644 --- a/src/fmt.rs +++ b/src/fmt.rs @@ -1,15 +1,15 @@ #![macro_use] #![allow(unused_macros)] -#[cfg(all(feature = "defmt-03", feature = "log"))] +#[cfg(all(feature = "defmt", feature = "log"))] compile_error!("You may not enable both `defmt` and `log` features."); macro_rules! assert { ($($x:tt)*) => { { - #[cfg(not(feature = "defmt-03"))] + #[cfg(not(feature = "defmt"))] ::core::assert!($($x)*); - #[cfg(feature = "defmt-03")] + #[cfg(feature = "defmt")] ::defmt::assert!($($x)*); } }; @@ -18,9 +18,9 @@ macro_rules! assert { macro_rules! assert_eq { ($($x:tt)*) => { { - #[cfg(not(feature = "defmt-03"))] + #[cfg(not(feature = "defmt"))] ::core::assert_eq!($($x)*); - #[cfg(feature = "defmt-03")] + #[cfg(feature = "defmt")] ::defmt::assert_eq!($($x)*); } }; @@ -29,9 +29,9 @@ macro_rules! assert_eq { macro_rules! assert_ne { ($($x:tt)*) => { { - #[cfg(not(feature = "defmt-03"))] + #[cfg(not(feature = "defmt"))] ::core::assert_ne!($($x)*); - #[cfg(feature = "defmt-03")] + #[cfg(feature = "defmt")] ::defmt::assert_ne!($($x)*); } }; @@ -40,9 +40,9 @@ macro_rules! assert_ne { macro_rules! debug_assert { ($($x:tt)*) => { { - #[cfg(not(feature = "defmt-03"))] + #[cfg(not(feature = "defmt"))] ::core::debug_assert!($($x)*); - #[cfg(feature = "defmt-03")] + #[cfg(feature = "defmt")] ::defmt::debug_assert!($($x)*); } }; @@ -51,9 +51,9 @@ macro_rules! debug_assert { macro_rules! debug_assert_eq { ($($x:tt)*) => { { - #[cfg(not(feature = "defmt-03"))] + #[cfg(not(feature = "defmt"))] ::core::debug_assert_eq!($($x)*); - #[cfg(feature = "defmt-03")] + #[cfg(feature = "defmt")] ::defmt::debug_assert_eq!($($x)*); } }; @@ -62,9 +62,9 @@ macro_rules! debug_assert_eq { macro_rules! debug_assert_ne { ($($x:tt)*) => { { - #[cfg(not(feature = "defmt-03"))] + #[cfg(not(feature = "defmt"))] ::core::debug_assert_ne!($($x)*); - #[cfg(feature = "defmt-03")] + #[cfg(feature = "defmt")] ::defmt::debug_assert_ne!($($x)*); } }; @@ -73,9 +73,9 @@ macro_rules! debug_assert_ne { macro_rules! todo { ($($x:tt)*) => { { - #[cfg(not(feature = "defmt-03"))] + #[cfg(not(feature = "defmt"))] ::core::todo!($($x)*); - #[cfg(feature = "defmt-03")] + #[cfg(feature = "defmt")] ::defmt::todo!($($x)*); } }; @@ -84,9 +84,9 @@ macro_rules! todo { macro_rules! unreachable { ($($x:tt)*) => { { - #[cfg(not(feature = "defmt-03"))] + #[cfg(not(feature = "defmt"))] ::core::unreachable!($($x)*); - #[cfg(feature = "defmt-03")] + #[cfg(feature = "defmt")] ::defmt::unreachable!($($x)*); } }; @@ -95,9 +95,9 @@ macro_rules! unreachable { macro_rules! panic { ($($x:tt)*) => { { - #[cfg(not(feature = "defmt-03"))] + #[cfg(not(feature = "defmt"))] ::core::panic!($($x)*); - #[cfg(feature = "defmt-03")] + #[cfg(feature = "defmt")] ::defmt::panic!($($x)*); } }; @@ -108,9 +108,9 @@ macro_rules! trace { { #[cfg(feature = "log")] ::log::trace!($s $(, $x)*); - #[cfg(feature = "defmt-03")] + #[cfg(feature = "defmt")] ::defmt::trace!($s $(, $x)*); - #[cfg(not(any(feature = "log", feature="defmt-03")))] + #[cfg(not(any(feature = "log", feature="defmt")))] let _ = ($( & $x ),*); } }; @@ -121,9 +121,9 @@ macro_rules! debug { { #[cfg(feature = "log")] ::log::debug!($s $(, $x)*); - #[cfg(feature = "defmt-03")] + #[cfg(feature = "defmt")] ::defmt::debug!($s $(, $x)*); - #[cfg(not(any(feature = "log", feature="defmt-03")))] + #[cfg(not(any(feature = "log", feature="defmt")))] let _ = ($( & $x ),*); } }; @@ -134,9 +134,9 @@ macro_rules! info { { #[cfg(feature = "log")] ::log::info!($s $(, $x)*); - #[cfg(feature = "defmt-03")] + #[cfg(feature = "defmt")] ::defmt::info!($s $(, $x)*); - #[cfg(not(any(feature = "log", feature="defmt-03")))] + #[cfg(not(any(feature = "log", feature="defmt")))] let _ = ($( & $x ),*); } }; @@ -147,9 +147,9 @@ macro_rules! warn { { #[cfg(feature = "log")] ::log::warn!($s $(, $x)*); - #[cfg(feature = "defmt-03")] + #[cfg(feature = "defmt")] ::defmt::warn!($s $(, $x)*); - #[cfg(not(any(feature = "log", feature="defmt-03")))] + #[cfg(not(any(feature = "log", feature="defmt")))] let _ = ($( & $x ),*); } }; @@ -160,22 +160,22 @@ macro_rules! error { { #[cfg(feature = "log")] ::log::error!($s $(, $x)*); - #[cfg(feature = "defmt-03")] + #[cfg(feature = "defmt")] ::defmt::error!($s $(, $x)*); - #[cfg(not(any(feature = "log", feature="defmt-03")))] + #[cfg(not(any(feature = "log", feature="defmt")))] let _ = ($( & $x ),*); } }; } -#[cfg(feature = "defmt-03")] +#[cfg(feature = "defmt")] macro_rules! unwrap { ($($x:tt)*) => { ::defmt::unwrap!($($x)*) }; } -#[cfg(not(feature = "defmt-03"))] +#[cfg(not(feature = "defmt"))] macro_rules! unwrap { ($arg:expr) => { match $crate::fmt::Try::into_result($arg) { diff --git a/src/lib.rs b/src/lib.rs index d0e5823..cc4ef06 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -43,7 +43,7 @@ const IOUT_UA_MAX: f32 = 200.0; /// An output controllable by the DS4432. This device has two. #[derive(Debug, Clone, Copy)] -#[cfg_attr(feature = "defmt-03", derive(defmt::Format))] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] #[repr(u8)] pub enum Output { Zero = 0xF8, @@ -58,7 +58,7 @@ impl From for u8 { /// The status of an output. #[derive(Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "defmt-03", derive(defmt::Format))] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum Status { /// The output is completely disabled Disable,