Skip to content

Commit de78350

Browse files
committed
Fully migrate to defmt 1.x
1 parent 4e653a7 commit de78350

File tree

10 files changed

+26
-26
lines changed

10 files changed

+26
-26
lines changed

embedded-hal-async/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ version = "1.0.0"
1515
rust-version = "1.75"
1616

1717
[features]
18-
defmt-03 = ["dep:defmt-03", "embedded-hal/defmt-03"]
18+
defmt = ["dep:defmt", "embedded-hal/defmt"]
1919

2020
[dependencies]
2121
embedded-hal = { version = "1.0.0", path = "../embedded-hal" }
22-
defmt-03 = { package = "defmt", version = "0.3", optional = true }
22+
defmt = { package = "defmt", version = "1", optional = true }

embedded-hal-bus/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ portable-atomic = ["dep:portable-atomic"]
2727
# Enable `embedded-hal-async` support.
2828
async = ["dep:embedded-hal-async"]
2929
# Derive `defmt::Format` from `defmt` 0.3 for enums and structs. See https://github.com/knurling-rs/defmt for more info
30-
defmt-03 = ["dep:defmt-03", "embedded-hal/defmt-03", "embedded-hal-async?/defmt-03"]
30+
defmt = ["dep:defmt", "embedded-hal/defmt", "embedded-hal-async?/defmt"]
3131
# Enables additional utilities requiring a global allocator.
3232
alloc = []
3333

3434
[dependencies]
3535
embedded-hal = { version = "1.0.0", path = "../embedded-hal" }
3636
embedded-hal-async = { version = "1.0.0", path = "../embedded-hal-async", optional = true }
3737
critical-section = { version = "1.0" }
38-
defmt-03 = { package = "defmt", version = "0.3", optional = true }
38+
defmt = { package = "defmt", version = "1", optional = true }
3939
portable-atomic = {version = "1.3", default-features = false, optional = true, features = ["require-cas"]}
4040

4141
[package.metadata.docs.rs]

embedded-hal-bus/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![cfg_attr(docsrs, feature(doc_cfg))]
55

66
// needed to prevent defmt macros from breaking, since they emit code that does `defmt::blahblah`.
7-
#[cfg(feature = "defmt-03")]
7+
#[cfg(feature = "defmt")]
88
use defmt_03 as defmt;
99

1010
pub mod i2c;

embedded-hal-bus/src/spi/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ pub use rc::*;
2525

2626
pub use self::critical_section::*;
2727

28-
#[cfg(feature = "defmt-03")]
28+
#[cfg(feature = "defmt")]
2929
use crate::defmt;
3030

3131
/// Error type for [`ExclusiveDevice`] operations.
3232
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
33-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
33+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
3434
pub enum DeviceError<BUS, CS> {
3535
/// An inner SPI bus operation failed.
3636
Spi(BUS),
@@ -65,7 +65,7 @@ where
6565

6666
/// Dummy [`DelayNs`](embedded_hal::delay::DelayNs) implementation that panics on use.
6767
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
68-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
68+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
6969
pub struct NoDelay;
7070

7171
#[cold]

embedded-hal/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repository = "https://github.com/rust-embedded/embedded-hal"
1717
version = "1.0.0"
1818

1919
[features]
20-
defmt-03 = ["dep:defmt-03"]
20+
defmt = ["dep:defmt"]
2121

2222
[dependencies]
23-
defmt-03 = { package = "defmt", version = "0.3", optional = true }
23+
defmt = { package = "defmt", version = "1", optional = true }

embedded-hal/src/digital.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use core::ops::Not;
44

5-
#[cfg(feature = "defmt-03")]
5+
#[cfg(feature = "defmt")]
66
use crate::defmt;
77

88
/// Error.
@@ -27,7 +27,7 @@ impl Error for core::convert::Infallible {
2727
/// free to define more specific or additional error types. However, by providing
2828
/// a mapping to these common errors, generic code can still react to them.
2929
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
30-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
30+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
3131
#[non_exhaustive]
3232
pub enum ErrorKind {
3333
/// A different error occurred. The original error may contain more information.
@@ -82,7 +82,7 @@ impl<T: ErrorType + ?Sized> ErrorType for &mut T {
8282
/// assert_eq!(!state, PinState::High);
8383
/// ```
8484
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
85-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
85+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
8686
pub enum PinState {
8787
/// Low pin state.
8888
Low,

embedded-hal/src/i2c.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
164164
use crate::private;
165165

166-
#[cfg(feature = "defmt-03")]
166+
#[cfg(feature = "defmt")]
167167
use crate::defmt;
168168

169169
/// I2C error.
@@ -189,7 +189,7 @@ impl Error for core::convert::Infallible {
189189
/// free to define more specific or additional error types. However, by providing
190190
/// a mapping to these common I2C errors, generic code can still react to them.
191191
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
192-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
192+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
193193
#[non_exhaustive]
194194
pub enum ErrorKind {
195195
/// Bus error occurred. e.g. A START or a STOP condition is detected and is not
@@ -213,7 +213,7 @@ pub enum ErrorKind {
213213
/// response was received to an address versus a no acknowledge to a data byte.
214214
/// Where it is not possible to differentiate, `Unknown` should be indicated.
215215
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
216-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
216+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
217217
pub enum NoAcknowledgeSource {
218218
/// The device did not acknowledge its address. The device may be missing.
219219
Address,
@@ -303,7 +303,7 @@ impl AddressMode for TenBitAddress {}
303303
///
304304
/// Several operations can be combined as part of a transaction.
305305
#[derive(Debug, PartialEq, Eq)]
306-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
306+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
307307
pub enum Operation<'a> {
308308
/// Read data into the provided buffer.
309309
Read(&'a mut [u8]),

embedded-hal/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ mod private {
1717
}
1818

1919
// needed to prevent defmt macros from breaking, since they emit code that does `defmt::blahblah`.
20-
#[cfg(feature = "defmt-03")]
20+
#[cfg(feature = "defmt")]
2121
use defmt_03 as defmt;

embedded-hal/src/pwm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Pulse Width Modulation (PWM) traits.
22
3-
#[cfg(feature = "defmt-03")]
3+
#[cfg(feature = "defmt")]
44
use crate::defmt;
55

66
/// Error
@@ -26,7 +26,7 @@ impl Error for core::convert::Infallible {
2626
/// free to define more specific or additional error types. However, by providing
2727
/// a mapping to these common errors, generic code can still react to them.
2828
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
29-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
29+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
3030
#[non_exhaustive]
3131
pub enum ErrorKind {
3232
/// A different error occurred. The original error may contain more information.

embedded-hal/src/spi.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,12 @@
173173
174174
use core::fmt::Debug;
175175

176-
#[cfg(feature = "defmt-03")]
176+
#[cfg(feature = "defmt")]
177177
use crate::defmt;
178178

179179
/// Clock polarity.
180180
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
181-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
181+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
182182
pub enum Polarity {
183183
/// Clock signal low when idle.
184184
IdleLow,
@@ -188,7 +188,7 @@ pub enum Polarity {
188188

189189
/// Clock phase.
190190
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
191+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
192192
pub enum Phase {
193193
/// Data in "captured" on the first clock transition.
194194
CaptureOnFirstTransition,
@@ -198,7 +198,7 @@ pub enum Phase {
198198

199199
/// SPI mode.
200200
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
201-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
201+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
202202
pub struct Mode {
203203
/// Clock polarity.
204204
pub polarity: Polarity,
@@ -253,7 +253,7 @@ impl Error for core::convert::Infallible {
253253
/// free to define more specific or additional error types. However, by providing
254254
/// a mapping to these common SPI errors, generic code can still react to them.
255255
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
256-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
256+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
257257
#[non_exhaustive]
258258
pub enum ErrorKind {
259259
/// The peripheral receive buffer was overrun.
@@ -318,7 +318,7 @@ impl<T: ErrorType + ?Sized> ErrorType for &mut T {
318318
///
319319
/// This allows composition of SPI operations into a single bus transaction.
320320
#[derive(Debug, PartialEq, Eq)]
321-
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
321+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
322322
pub enum Operation<'a, Word: 'static> {
323323
/// Read data into the provided buffer.
324324
///

0 commit comments

Comments
 (0)