Merge pull request #4205 from rursprung/add-some-missing-debug-and-format-impls-for-rpi-adc
rp: add missing `Debug` and `defmt::Format` `derive`s for ADC
This commit is contained in:
commit
7358eeb49b
@ -8,6 +8,8 @@ macro_rules! peripherals_definition {
|
|||||||
$(#[$cfg])?
|
$(#[$cfg])?
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
#[doc = concat!(stringify!($name), " peripheral")]
|
#[doc = concat!(stringify!($name), " peripheral")]
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct $name { _private: () }
|
pub struct $name { _private: () }
|
||||||
|
|
||||||
$(#[$cfg])?
|
$(#[$cfg])?
|
||||||
|
|||||||
@ -14,6 +14,8 @@ use core::ops::Deref;
|
|||||||
/// the driver code would be monomorphized two times. With Peri, the driver is generic
|
/// the driver code would be monomorphized two times. With Peri, the driver is generic
|
||||||
/// over a lifetime only. `SPI4` becomes `Peri<'static, SPI4>`, and `&mut SPI4` becomes
|
/// over a lifetime only. `SPI4` becomes `Peri<'static, SPI4>`, and `&mut SPI4` becomes
|
||||||
/// `Peri<'a, SPI4>`. Lifetimes don't cause monomorphization.
|
/// `Peri<'a, SPI4>`. Lifetimes don't cause monomorphization.
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct Peri<'a, T: PeripheralType> {
|
pub struct Peri<'a, T: PeripheralType> {
|
||||||
inner: T,
|
inner: T,
|
||||||
_lifetime: PhantomData<&'a mut T>,
|
_lifetime: PhantomData<&'a mut T>,
|
||||||
|
|||||||
@ -10,8 +10,11 @@ critical-section = "1.1.2"
|
|||||||
embassy-hal-internal = { version = "0.2.0", path = "../embassy-hal-internal", features = ["cortex-m", "prio-bits-2"] }
|
embassy-hal-internal = { version = "0.2.0", path = "../embassy-hal-internal", features = ["cortex-m", "prio-bits-2"] }
|
||||||
embassy-sync = { version = "0.6.2", path = "../embassy-sync" }
|
embassy-sync = { version = "0.6.2", path = "../embassy-sync" }
|
||||||
lpc55-pac = "0.5.0"
|
lpc55-pac = "0.5.0"
|
||||||
defmt = "0.3.8"
|
defmt = { version = "0.3.8", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["rt"]
|
default = ["rt"]
|
||||||
rt = ["lpc55-pac/rt"]
|
rt = ["lpc55-pac/rt"]
|
||||||
|
|
||||||
|
## Enable [defmt support](https://docs.rs/defmt) and enables `defmt` debug-log messages and formatting in embassy drivers.
|
||||||
|
defmt = ["dep:defmt", "embassy-hal-internal/defmt", "embassy-sync/defmt"]
|
||||||
|
|||||||
@ -21,6 +21,8 @@ static WAKER: AtomicWaker = AtomicWaker::new();
|
|||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Config {}
|
pub struct Config {}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
enum Source<'p> {
|
enum Source<'p> {
|
||||||
Pin(Peri<'p, AnyPin>),
|
Pin(Peri<'p, AnyPin>),
|
||||||
TempSensor(Peri<'p, ADC_TEMP_SENSOR>),
|
TempSensor(Peri<'p, ADC_TEMP_SENSOR>),
|
||||||
|
|||||||
@ -932,6 +932,8 @@ pub trait Pin: PeripheralType + Into<AnyPin> + SealedPin + Sized + 'static {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Type-erased GPIO pin
|
/// Type-erased GPIO pin
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct AnyPin {
|
pub struct AnyPin {
|
||||||
pin_bank: u8,
|
pin_bank: u8,
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user