@@ -10,12 +10,10 @@ use embedded_hal_one::digital::blocking::{
10
10
} ;
11
11
pub use embedded_hal_one:: digital:: PinState ;
12
12
13
- impl From < PinState > for super :: PinState {
14
- fn from ( state : PinState ) -> Self {
15
- match state {
16
- PinState :: Low => Self :: Low ,
17
- PinState :: High => Self :: High ,
18
- }
13
+ fn into_state ( state : PinState ) -> super :: PinState {
14
+ match state {
15
+ PinState :: Low => super :: PinState :: Low ,
16
+ PinState :: High => super :: PinState :: High ,
19
17
}
20
18
}
21
19
@@ -93,7 +91,7 @@ impl<const P: char, const N: u8> IoPin<Self, Self> for Pin<Output<OpenDrain>, P,
93
91
Ok ( self )
94
92
}
95
93
fn into_output_pin ( mut self , state : PinState ) -> Result < Self , Self :: Error > {
96
- self . set_state ( state . into ( ) ) ;
94
+ self . set_state ( into_state ( state ) ) ;
97
95
Ok ( self )
98
96
}
99
97
}
@@ -106,7 +104,7 @@ impl<const P: char, const N: u8> IoPin<Pin<Input<Floating>, P, N>, Self>
106
104
Ok ( self . into_floating_input ( ) )
107
105
}
108
106
fn into_output_pin ( mut self , state : PinState ) -> Result < Self , Self :: Error > {
109
- self . set_state ( state . into ( ) ) ;
107
+ self . set_state ( into_state ( state ) ) ;
110
108
Ok ( self )
111
109
}
112
110
}
@@ -119,7 +117,7 @@ impl<const P: char, const N: u8> IoPin<Self, Pin<Output<OpenDrain>, P, N>>
119
117
Ok ( self )
120
118
}
121
119
fn into_output_pin ( self , state : PinState ) -> Result < Pin < Output < OpenDrain > , P , N > , Self :: Error > {
122
- Ok ( self . into_open_drain_output_in_state ( state . into ( ) ) )
120
+ Ok ( self . into_open_drain_output_in_state ( into_state ( state ) ) )
123
121
}
124
122
}
125
123
@@ -131,7 +129,7 @@ impl<const P: char, const N: u8> IoPin<Pin<Input<Floating>, P, N>, Self>
131
129
Ok ( self . into_floating_input ( ) )
132
130
}
133
131
fn into_output_pin ( mut self , state : PinState ) -> Result < Self , Self :: Error > {
134
- self . set_state ( state . into ( ) ) ;
132
+ self . set_state ( into_state ( state ) ) ;
135
133
Ok ( self )
136
134
}
137
135
}
@@ -144,7 +142,7 @@ impl<const P: char, const N: u8> IoPin<Self, Pin<Output<PushPull>, P, N>>
144
142
Ok ( self )
145
143
}
146
144
fn into_output_pin ( self , state : PinState ) -> Result < Pin < Output < PushPull > , P , N > , Self :: Error > {
147
- Ok ( self . into_push_pull_output_in_state ( state . into ( ) ) )
145
+ Ok ( self . into_push_pull_output_in_state ( into_state ( state ) ) )
148
146
}
149
147
}
150
148
@@ -156,7 +154,7 @@ impl<const P: char, const N: u8> IoPin<Pin<Input<PullUp>, P, N>, Self>
156
154
Ok ( self . into_pull_up_input ( ) )
157
155
}
158
156
fn into_output_pin ( mut self , state : PinState ) -> Result < Self , Self :: Error > {
159
- self . set_state ( state . into ( ) ) ;
157
+ self . set_state ( into_state ( state ) ) ;
160
158
Ok ( self )
161
159
}
162
160
}
@@ -169,7 +167,7 @@ impl<const P: char, const N: u8> IoPin<Self, Pin<Output<PushPull>, P, N>>
169
167
Ok ( self )
170
168
}
171
169
fn into_output_pin ( self , state : PinState ) -> Result < Pin < Output < PushPull > , P , N > , Self :: Error > {
172
- Ok ( self . into_push_pull_output_in_state ( state . into ( ) ) )
170
+ Ok ( self . into_push_pull_output_in_state ( into_state ( state ) ) )
173
171
}
174
172
}
175
173
@@ -181,7 +179,7 @@ impl<const P: char, const N: u8> IoPin<Pin<Input<PullDown>, P, N>, Self>
181
179
Ok ( self . into_pull_down_input ( ) )
182
180
}
183
181
fn into_output_pin ( mut self , state : PinState ) -> Result < Self , Self :: Error > {
184
- self . set_state ( state . into ( ) ) ;
182
+ self . set_state ( into_state ( state ) ) ;
185
183
Ok ( self )
186
184
}
187
185
}
@@ -194,7 +192,7 @@ impl<const P: char, const N: u8> IoPin<Self, Pin<Output<PushPull>, P, N>>
194
192
Ok ( self )
195
193
}
196
194
fn into_output_pin ( self , state : PinState ) -> Result < Pin < Output < PushPull > , P , N > , Self :: Error > {
197
- Ok ( self . into_push_pull_output_in_state ( state . into ( ) ) )
195
+ Ok ( self . into_push_pull_output_in_state ( into_state ( state ) ) )
198
196
}
199
197
}
200
198
0 commit comments