Skip to content

Commit 59f33ca

Browse files
committed
Fix using InputPin instead of OutputPin
Taken from #199
1 parent b104688 commit 59f33ca

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/digital/v1_compat.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
//! v1 compatibility wrappers
2-
//!
2+
//!
33
//! This module provides wrappers to support use of v2 implementations with
4-
//! v1 consumers. v2 traits must be explicitly cast to the v1 version using
4+
//! v1 consumers. v2 traits must be explicitly cast to the v1 version using
55
//! `.into()`, and will panic on internal errors
6-
//!
6+
//!
77
//! ```
88
//! extern crate embedded_hal;
99
//! use embedded_hal::digital::{v1, v2, v1_compat::OldOutputPin};
10-
//!
10+
//!
1111
//! struct NewOutputPinImpl {}
12-
//!
12+
//!
1313
//! impl v2::OutputPin for NewOutputPinImpl {
1414
//! type Error = ();
1515
//! fn set_low(&mut self) -> Result<(), Self::Error> { Ok(()) }
1616
//! fn set_high(&mut self) -> Result<(), Self::Error>{ Ok(()) }
1717
//! }
18-
//!
18+
//!
1919
//! struct OldOutputPinConsumer<T: v1::OutputPin> {
2020
//! _pin: T,
2121
//! }
22-
//!
23-
//! impl <T>OldOutputPinConsumer<T>
22+
//!
23+
//! impl <T>OldOutputPinConsumer<T>
2424
//! where T: v1::OutputPin {
2525
//! pub fn new(pin: T) -> OldOutputPinConsumer<T> {
2626
//! OldOutputPinConsumer{ _pin: pin }
2727
//! }
2828
//! }
29-
//!
29+
//!
3030
//! fn main() {
3131
//! let pin = NewOutputPinImpl{};
3232
//! let _consumer: OldOutputPinConsumer<OldOutputPin<_>> = OldOutputPinConsumer::new(pin.into());
3333
//! }
3434
//! ```
35-
//!
35+
//!
3636
3737

3838
#[allow(deprecated)]
@@ -92,7 +92,7 @@ where
9292
/// where errors will panic.
9393
#[cfg(feature = "unproven")]
9494
#[allow(deprecated)]
95-
impl <T, E> v1::StatefulOutputPin for OldOutputPin<T>
95+
impl <T, E> v1::StatefulOutputPin for OldOutputPin<T>
9696
where
9797
T: v2::StatefulOutputPin<Error=E>,
9898
E: core::fmt::Debug,
@@ -116,7 +116,7 @@ pub struct OldInputPin<T> {
116116
#[cfg(feature = "unproven")]
117117
impl <T, E> OldInputPin<T>
118118
where
119-
T: v2::OutputPin<Error=E>,
119+
T: v2::InputPin<Error=E>,
120120
E: core::fmt::Debug,
121121
{
122122
/// Create an `OldInputPin` wrapper around a `v2::InputPin`.
@@ -191,8 +191,8 @@ mod tests {
191191
}
192192

193193
#[allow(deprecated)]
194-
impl <T>OldOutputPinConsumer<T>
195-
where T: v1::OutputPin
194+
impl <T>OldOutputPinConsumer<T>
195+
where T: v1::OutputPin
196196
{
197197
pub fn new(pin: T) -> OldOutputPinConsumer<T> {
198198
OldOutputPinConsumer{ _pin: pin }
@@ -213,7 +213,7 @@ mod tests {
213213
assert_eq!(o.inner().state, true);
214214

215215
o.set_low();
216-
assert_eq!(o.inner().state, false);
216+
assert_eq!(o.inner().state, false);
217217
}
218218

219219
#[test]
@@ -252,8 +252,8 @@ mod tests {
252252

253253
#[cfg(feature = "unproven")]
254254
#[allow(deprecated)]
255-
impl <T>OldInputPinConsumer<T>
256-
where T: v1::InputPin
255+
impl <T>OldInputPinConsumer<T>
256+
where T: v1::InputPin
257257
{
258258
pub fn new(pin: T) -> OldInputPinConsumer<T> {
259259
OldInputPinConsumer{ _pin: pin }

0 commit comments

Comments
 (0)