Merge pull request #1 from HarkonenBade/master

Added implementation of the default toggleable trait
features/pwm
Daniel Egger 5 years ago committed by GitHub
commit 705bbb3e61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,10 +30,7 @@ fn main() -> ! {
let mut delay = Delay::new(cp.SYST, clocks);
loop {
led.set_high();
delay.delay_ms(1_000_u16);
led.set_low();
led.toggle();
delay.delay_ms(1_000_u16);
}
}

@ -57,7 +57,7 @@ macro_rules! gpio {
pub mod $gpiox {
use core::marker::PhantomData;
use embedded_hal::digital::{InputPin, OutputPin, StatefulOutputPin};
use embedded_hal::digital::{InputPin, OutputPin, StatefulOutputPin, toggleable};
use crate::stm32::$GPIOX;
use crate::stm32::RCC;
@ -119,6 +119,8 @@ macro_rules! gpio {
}
}
impl<MODE> toggleable::Default for $PXx<Output<MODE>> {}
impl<MODE> InputPin for $PXx<Input<MODE>> {
fn is_high(&self) -> bool {
!self.is_low()
@ -411,6 +413,8 @@ macro_rules! gpio {
}
}
impl<MODE> toggleable::Default for $PXi<Output<MODE>> {}
impl<MODE> $PXi<Input<MODE>> {
/// Erases the pin number from the type
///

Loading…
Cancel
Save