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/).
77
88## [ Unreleased]
99
10- No unreleased changes yet
10+ - gpio: remove ` ToggleableOutputPin ` , move ` toggle() ` to ` StatefulOutputPin ` .
1111
1212## [ v1.0.0-rc.3] - 2023-12-14
1313
Original file line number Diff line number Diff line change @@ -175,6 +175,12 @@ pub trait StatefulOutputPin: OutputPin {
175175 ///
176176 /// *NOTE* this does *not* read the electrical state of the pin.
177177 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+ }
178184}
179185
180186impl < T : StatefulOutputPin + ?Sized > StatefulOutputPin for & mut T {
@@ -187,15 +193,7 @@ impl<T: StatefulOutputPin + ?Sized> StatefulOutputPin for &mut T {
187193 fn is_set_low ( & mut self ) -> Result < bool , Self :: Error > {
188194 T :: is_set_low ( self )
189195 }
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- }
197196
198- impl < T : ToggleableOutputPin + ?Sized > ToggleableOutputPin for & mut T {
199197 #[ inline]
200198 fn toggle ( & mut self ) -> Result < ( ) , Self :: Error > {
201199 T :: toggle ( self )
You can’t perform that action at this time.
0 commit comments