diff --git a/examples/dynamic_gpio.rs b/examples/dynamic_gpio.rs index c3b77175..ceb706d4 100644 --- a/examples/dynamic_gpio.rs +++ b/examples/dynamic_gpio.rs @@ -9,7 +9,7 @@ use nb::block; use cortex_m_rt::entry; use cortex_m_semihosting::hprintln; use embedded_hal::digital::v2::{InputPin, OutputPin}; -use stm32f1xx_hal::{pac, prelude::*, timer::Timer, gpio::State}; +use stm32f1xx_hal::{gpio::State, pac, prelude::*, timer::Timer}; #[entry] fn main() -> ! { diff --git a/examples/multi_mode_gpio.rs b/examples/multi_mode_gpio.rs index 6088bd62..58bcd145 100644 --- a/examples/multi_mode_gpio.rs +++ b/examples/multi_mode_gpio.rs @@ -9,7 +9,7 @@ use nb::block; use cortex_m_rt::entry; use cortex_m_semihosting::hprintln; use embedded_hal::digital::v2::{InputPin, OutputPin}; -use stm32f1xx_hal::{pac, prelude::*, timer::Timer, gpio::State}; +use stm32f1xx_hal::{gpio::State, pac, prelude::*, timer::Timer}; #[entry] fn main() -> ! { diff --git a/src/gpio.rs b/src/gpio.rs index 2516b544..b7f63d5c 100644 --- a/src/gpio.rs +++ b/src/gpio.rs @@ -96,7 +96,6 @@ pub trait ExtiPin { fn check_interrupt(&mut self) -> bool; } - pub enum Dynamic { InputFloating, InputPullUp, @@ -110,20 +109,19 @@ pub enum PinModeError { IncorrectMode, } - impl Dynamic { fn is_input(&self) -> bool { use Dynamic::*; match self { InputFloating | InputPullUp | InputPullDown | OutputOpenDrain => true, - OutputPushPull => false + OutputPushPull => false, } } fn is_output(&self) -> bool { use Dynamic::*; match self { InputFloating | InputPullUp | InputPullDown => false, - OutputPushPull | OutputOpenDrain => true + OutputPushPull | OutputOpenDrain => true, } } } @@ -134,21 +132,20 @@ pub trait PinMode { unsafe fn set_mode(cr: &mut CR) -> Self; } - // These impls are needed because a macro can not brace initialise a ty token impl Input { fn _new() -> Self { - Self {_mode: PhantomData } + Self { _mode: PhantomData } } } impl Output { fn _new() -> Self { - Self {_mode: PhantomData } + Self { _mode: PhantomData } } } impl Alternate { fn _new() -> Self { - Self {_mode: PhantomData } + Self { _mode: PhantomData } } } impl Debugger { @@ -1095,7 +1092,6 @@ macro_rules! impl_pxx { } } - impl_pxx! { (gpioa::PAx), (gpiob::PBx), @@ -1104,7 +1100,6 @@ impl_pxx! { (gpioe::PEx) } - gpio!(GPIOA, gpioa, gpioa, PAx, 0, [ PA0: (pa0, 0, Input, CRL, exticr1), PA1: (pa1, 1, Input, CRL, exticr1),