Skip to content

Commit 58caea6

Browse files
committed
Added implementation of the default toggleable trait.
1 parent 162083a commit 58caea6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/gpio.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ macro_rules! gpio {
5757
pub mod $gpiox {
5858
use core::marker::PhantomData;
5959

60-
use embedded_hal::digital::{InputPin, OutputPin, StatefulOutputPin};
60+
use embedded_hal::digital::{InputPin, OutputPin, StatefulOutputPin, toggleable};
6161
use crate::stm32::$GPIOX;
6262

6363
use crate::stm32::RCC;
@@ -119,6 +119,8 @@ macro_rules! gpio {
119119
}
120120
}
121121

122+
impl<MODE> toggleable::Default for $PXx<Output<MODE>> {}
123+
122124
impl<MODE> InputPin for $PXx<Input<MODE>> {
123125
fn is_high(&self) -> bool {
124126
!self.is_low()
@@ -411,6 +413,8 @@ macro_rules! gpio {
411413
}
412414
}
413415

416+
impl<MODE> toggleable::Default for $PXi<Output<MODE>> {}
417+
414418
impl<MODE> $PXi<Input<MODE>> {
415419
/// Erases the pin number from the type
416420
///

0 commit comments

Comments
 (0)