Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Accept ErasedPin in AnyPin
  • Loading branch information
bugadani committed Sep 4, 2024
commit 7dfacb1c35912065510701d88c1a179787943201
2 changes: 2 additions & 0 deletions esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- You can now create an `AnyPin` out of an `ErasedPin`. (#2072)

### Fixed

- Fixed an issue with DMA transfers potentially not waking up the correct async task (#2065)
Expand Down
16 changes: 14 additions & 2 deletions esp-hal/src/gpio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
)+
}
Expand All @@ -1430,7 +1430,19 @@ macro_rules! gpio {
match self {
$(
ErasedPin::[<Gpio $gpionum >](_) => {
$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::[<Gpio $gpionum >](_) => {
ErasedPin::[< Gpio $gpionum >](unsafe { GpioPin::steal() })
}
)+
}
Expand Down