diff options
| -rw-r--r-- | embassy-hal-internal/src/macros.rs | 2 | ||||
| -rw-r--r-- | embassy-hal-internal/src/peripheral.rs | 2 | ||||
| -rw-r--r-- | embassy-nxp/Cargo.toml | 7 | ||||
| -rw-r--r-- | embassy-rp/src/adc.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/gpio.rs | 2 |
5 files changed, 13 insertions, 2 deletions
diff --git a/embassy-hal-internal/src/macros.rs b/embassy-hal-internal/src/macros.rs index cd2bc3cab..ce72ded5c 100644 --- a/embassy-hal-internal/src/macros.rs +++ b/embassy-hal-internal/src/macros.rs | |||
| @@ -8,6 +8,8 @@ macro_rules! peripherals_definition { | |||
| 8 | $(#[$cfg])? | 8 | $(#[$cfg])? |
| 9 | #[allow(non_camel_case_types)] | 9 | #[allow(non_camel_case_types)] |
| 10 | #[doc = concat!(stringify!($name), " peripheral")] | 10 | #[doc = concat!(stringify!($name), " peripheral")] |
| 11 | #[derive(Debug)] | ||
| 12 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 11 | pub struct $name { _private: () } | 13 | pub struct $name { _private: () } |
| 12 | 14 | ||
| 13 | $(#[$cfg])? | 15 | $(#[$cfg])? |
diff --git a/embassy-hal-internal/src/peripheral.rs b/embassy-hal-internal/src/peripheral.rs index 803259bb8..b1868caf6 100644 --- a/embassy-hal-internal/src/peripheral.rs +++ b/embassy-hal-internal/src/peripheral.rs | |||
| @@ -14,6 +14,8 @@ use core::ops::Deref; | |||
| 14 | /// the driver code would be monomorphized two times. With Peri, the driver is generic | 14 | /// the driver code would be monomorphized two times. With Peri, the driver is generic |
| 15 | /// over a lifetime only. `SPI4` becomes `Peri<'static, SPI4>`, and `&mut SPI4` becomes | 15 | /// over a lifetime only. `SPI4` becomes `Peri<'static, SPI4>`, and `&mut SPI4` becomes |
| 16 | /// `Peri<'a, SPI4>`. Lifetimes don't cause monomorphization. | 16 | /// `Peri<'a, SPI4>`. Lifetimes don't cause monomorphization. |
| 17 | #[derive(Debug)] | ||
| 18 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 17 | pub struct Peri<'a, T: PeripheralType> { | 19 | pub struct Peri<'a, T: PeripheralType> { |
| 18 | inner: T, | 20 | inner: T, |
| 19 | _lifetime: PhantomData<&'a mut T>, | 21 | _lifetime: PhantomData<&'a mut T>, |
diff --git a/embassy-nxp/Cargo.toml b/embassy-nxp/Cargo.toml index cf36a67ec..031cd4aba 100644 --- a/embassy-nxp/Cargo.toml +++ b/embassy-nxp/Cargo.toml | |||
| @@ -10,8 +10,11 @@ critical-section = "1.1.2" | |||
| 10 | embassy-hal-internal = { version = "0.2.0", path = "../embassy-hal-internal", features = ["cortex-m", "prio-bits-2"] } | 10 | embassy-hal-internal = { version = "0.2.0", path = "../embassy-hal-internal", features = ["cortex-m", "prio-bits-2"] } |
| 11 | embassy-sync = { version = "0.6.2", path = "../embassy-sync" } | 11 | embassy-sync = { version = "0.6.2", path = "../embassy-sync" } |
| 12 | lpc55-pac = "0.5.0" | 12 | lpc55-pac = "0.5.0" |
| 13 | defmt = "0.3.8" | 13 | defmt = { version = "0.3.8", optional = true } |
| 14 | 14 | ||
| 15 | [features] | 15 | [features] |
| 16 | default = ["rt"] | 16 | default = ["rt"] |
| 17 | rt = ["lpc55-pac/rt"] \ No newline at end of file | 17 | rt = ["lpc55-pac/rt"] |
| 18 | |||
| 19 | ## Enable [defmt support](https://docs.rs/defmt) and enables `defmt` debug-log messages and formatting in embassy drivers. | ||
| 20 | defmt = ["dep:defmt", "embassy-hal-internal/defmt", "embassy-sync/defmt"] | ||
diff --git a/embassy-rp/src/adc.rs b/embassy-rp/src/adc.rs index ec0c8c46c..2db8e63d7 100644 --- a/embassy-rp/src/adc.rs +++ b/embassy-rp/src/adc.rs | |||
| @@ -21,6 +21,8 @@ static WAKER: AtomicWaker = AtomicWaker::new(); | |||
| 21 | #[derive(Default)] | 21 | #[derive(Default)] |
| 22 | pub struct Config {} | 22 | pub struct Config {} |
| 23 | 23 | ||
| 24 | #[derive(Debug)] | ||
| 25 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 24 | enum Source<'p> { | 26 | enum Source<'p> { |
| 25 | Pin(Peri<'p, AnyPin>), | 27 | Pin(Peri<'p, AnyPin>), |
| 26 | TempSensor(Peri<'p, ADC_TEMP_SENSOR>), | 28 | TempSensor(Peri<'p, ADC_TEMP_SENSOR>), |
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs index af0837f6a..2fb2d65c2 100644 --- a/embassy-rp/src/gpio.rs +++ b/embassy-rp/src/gpio.rs | |||
| @@ -932,6 +932,8 @@ pub trait Pin: PeripheralType + Into<AnyPin> + SealedPin + Sized + 'static { | |||
| 932 | } | 932 | } |
| 933 | 933 | ||
| 934 | /// Type-erased GPIO pin | 934 | /// Type-erased GPIO pin |
| 935 | #[derive(Debug)] | ||
| 936 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 935 | pub struct AnyPin { | 937 | pub struct AnyPin { |
| 936 | pin_bank: u8, | 938 | pin_bank: u8, |
| 937 | } | 939 | } |
