Skip to content

Commit 24854c8

Browse files
committed
Added constructors
1 parent 11f83aa commit 24854c8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/digital/v1_compat.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ pub struct OldOutputPin<T> {
1111
pin: T,
1212
}
1313

14+
impl <T, ERR> OldOutputPin<T>
15+
where
16+
T: v2::OutputPin<Error=ERR>,
17+
ERR: core::fmt::Debug,
18+
{
19+
/// Create a new OldOutputPin wrapper around a v2::OutputPin
20+
pub fn new(pin: T) -> Self {
21+
Self{pin}
22+
}
23+
}
24+
1425
impl <T, ERR> From<T> for OldOutputPin<T>
1526
where
1627
T: v2::OutputPin<Error=ERR>,
@@ -60,6 +71,18 @@ pub struct OldInputPin<T> {
6071
pin: T,
6172
}
6273

74+
#[cfg(feature = "unproven")]
75+
impl <T, ERR> OldInputPin<T>
76+
where
77+
T: v2::OutputPin<Error=ERR>,
78+
ERR: core::fmt::Debug,
79+
{
80+
/// Create an OldInputPin wrapper around a v2::InputPin
81+
pub fn new(pin: T) -> Self {
82+
Self{pin}
83+
}
84+
}
85+
6386
#[cfg(feature = "unproven")]
6487
impl <T, ERR> From<T> for OldInputPin<T>
6588
where

0 commit comments

Comments
 (0)