Skip to content

Commit

Permalink
get pin num from AnyPin
Browse files Browse the repository at this point in the history
  • Loading branch information
dragazo committed Jul 11, 2023
1 parent 026a255 commit f23d81a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ impl AnyPin {
_p: PhantomData,
}
}
/// Gets the pin number.
pub fn get_pin(&self) -> i32 {
self.pin
}
/// Gets a set of the types of pins this pin can be cast to
pub fn types(&self) -> PinTypes {
self.pin_types
Expand Down Expand Up @@ -1661,10 +1665,10 @@ macro_rules! define_all_pins {
$name: $ty::new(),
)*}
}
pub fn into_dynamic(self) -> [(u8, AnyPin); NUM_PINS] {
pub fn into_dynamic(self) -> [AnyPin; NUM_PINS] {
[$(
$(#[cfg($cond)])?
($id, self.$name.into()),
self.$name.into(),
)*]
}
}
Expand Down

0 comments on commit f23d81a

Please sign in to comment.