File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
8
8
## [ Unreleased]
9
9
10
- No unreleased changes yet
10
+ - gpio: remove ` ToggleableOutputPin ` , move ` toggle() ` to ` StatefulOutputPin ` .
11
11
12
12
## [ v1.0.0-rc.3] - 2023-12-14
13
13
Original file line number Diff line number Diff line change @@ -175,6 +175,12 @@ pub trait StatefulOutputPin: OutputPin {
175
175
///
176
176
/// *NOTE* this does *not* read the electrical state of the pin.
177
177
fn is_set_low ( & mut self ) -> Result < bool , Self :: Error > ;
178
+
179
+ /// Toggle pin output.
180
+ fn toggle ( & mut self ) -> Result < ( ) , Self :: Error > {
181
+ let was_low: bool = self . is_set_low ( ) ?;
182
+ self . set_state ( PinState :: from ( was_low) )
183
+ }
178
184
}
179
185
180
186
impl < T : StatefulOutputPin + ?Sized > StatefulOutputPin for & mut T {
@@ -187,15 +193,7 @@ impl<T: StatefulOutputPin + ?Sized> StatefulOutputPin for &mut T {
187
193
fn is_set_low ( & mut self ) -> Result < bool , Self :: Error > {
188
194
T :: is_set_low ( self )
189
195
}
190
- }
191
-
192
- /// Output pin that can be toggled.
193
- pub trait ToggleableOutputPin : ErrorType {
194
- /// Toggle pin output.
195
- fn toggle ( & mut self ) -> Result < ( ) , Self :: Error > ;
196
- }
197
196
198
- impl < T : ToggleableOutputPin + ?Sized > ToggleableOutputPin for & mut T {
199
197
#[ inline]
200
198
fn toggle ( & mut self ) -> Result < ( ) , Self :: Error > {
201
199
T :: toggle ( self )
You can’t perform that action at this time.
0 commit comments