Skip to content

Commit ba2e82c

Browse files
committed
enum from output
1 parent 557b7f2 commit ba2e82c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/gpio/alt.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use super::{Alternate, NoPin, OpenDrain, PinMode};
1+
use super::{Alternate, NoPin, OpenDrain, Output, PinMode};
22
use crate::gpio::{self, Edge, ExtiPin};
33
use crate::pac::EXTI;
44
use crate::syscfg::SysCfg;
@@ -128,6 +128,16 @@ macro_rules! pin {
128128
}
129129
}
130130

131+
$(#[$attr])*
132+
impl<Otype> From<gpio::$PX<Output<Otype>>> for $name
133+
where
134+
Output<Otype>: PinMode
135+
{
136+
fn from(p: gpio::$PX<Output<Otype>>) -> Self {
137+
Self::$PX(p.into_mode())
138+
}
139+
}
140+
131141
$(#[$attr])*
132142
impl From<gpio::$PX<Alternate<$A $(, $Otype)?>>> for $name {
133143
fn from(p: gpio::$PX<Alternate<$A $(, $Otype)?>>) -> Self {

0 commit comments

Comments
 (0)