diff --git a/esp-hal/CHANGELOG.md b/esp-hal/CHANGELOG.md index 3da5f9506f2..d6911cdba55 100644 --- a/esp-hal/CHANGELOG.md +++ b/esp-hal/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - `Delay::new()` is now a `const` function (#1999) +- You can now create an `AnyPin` out of an `ErasedPin`. (#2072) ### Fixed diff --git a/esp-hal/src/gpio/mod.rs b/esp-hal/src/gpio/mod.rs index 4db777a39d0..71afe67043e 100644 --- a/esp-hal/src/gpio/mod.rs +++ b/esp-hal/src/gpio/mod.rs @@ -1413,7 +1413,7 @@ macro_rules! gpio { /// Pins available on this chip pub struct Pins { $( - /// GPIO pin number `$gpionum`. + #[doc = concat!("GPIO pin number ", $gpionum, ".")] pub [< gpio $gpionum >] : GpioPin<$gpionum>, )+ } @@ -1430,7 +1430,19 @@ macro_rules! gpio { match self { $( ErasedPin::[](_) => { - $crate::gpio::ErasedPin::[< Gpio $gpionum >](unsafe { GpioPin::steal() }) + ErasedPin::[< Gpio $gpionum >](unsafe { GpioPin::steal() }) + } + )+ + } + } + } + + impl $crate::gpio::CreateErasedPin for ErasedPin { + fn erased_pin(&self, _: $crate::private::Internal) -> ErasedPin { + match self { + $( + ErasedPin::[](_) => { + ErasedPin::[< Gpio $gpionum >](unsafe { GpioPin::steal() }) } )+ }