Make rustfmt and clippy happy
@@ -7,14 +7,23 @@ use panic_rtt_target as _;
mod app {
use dwt_systick_monotonic::DwtSystick;
use rtt_target::{rprintln, rtt_init_print};
- use stm32f3xx_hal::{prelude::*, serial::{Event, Serial}};
- use stm32f3xx_hal::gpio::{self, Output, PushPull, Alternate, U};
+ use stm32f3xx_hal::{
+ gpio::{self, Output, PushPull, AF7},
+ prelude::*,
+ serial::{Event, Serial},
+ };
#[monotonic(binds = SysTick, default = true)]
type DwtMono = DwtSystick<48_000_000>;
- type SerialType = Serial<stm32f3xx_hal::pac::USART1, (gpio::Pin<gpio::Gpioa, U<9_u8>, Alternate<PushPull, 7_u8>>, gpio::Pin<gpio::Gpioa, U<10_u8>, Alternate<PushPull, 7_u8>>)>;
- type DirType = stm32f3xx_hal::gpio::Pin<gpio::Gpioe, U<13_u8>, Output<PushPull>>;
+ type SerialType = Serial<
+ stm32f3xx_hal::pac::USART1,
+ (
+ gpio::gpioa::PA9<AF7<PushPull>>,
+ gpio::gpioa::PA10<AF7<PushPull>>,
+ ),
+ >;
+ type DirType = stm32f3xx_hal::gpio::gpioe::PE13<Output<PushPull>>;
#[resources]
struct Resources {
serial: SerialType,
@@ -39,7 +48,9 @@ mod app {
// Initialize the peripherals
// DIR
let mut gpioe = cx.device.GPIOE.split(&mut rcc.ahb);
- let mut dir : DirType = gpioe.pe13.into_push_pull_output(&mut gpioe.moder, &mut gpioe.otyper);
+ let mut dir: DirType = gpioe
+ .pe13
+ .into_push_pull_output(&mut gpioe.moder, &mut gpioe.otyper);
dir.set_low().unwrap();
// SERIAL
@@ -53,14 +64,20 @@ mod app {
.into_af7_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh),
);
pins.1.internal_pull_up(&mut gpioa.pupdr, true);
- let mut serial: SerialType = Serial::usart1(cx.device.USART1, pins, 19200_u32.Bd(), clocks, &mut rcc.apb2);
+ let mut serial: SerialType = Serial::usart1(
+ cx.device.USART1,
+ pins,
+ 19200_u32.Bd(),
+ clocks,
+ &mut rcc.apb2,
+ );
serial.listen(Event::Rxne);
rprintln!("post init");
task1::spawn().unwrap();
- (init::LateResources {serial, dir}, init::Monotonics(mono))
+ (init::LateResources { dir, serial }, init::Monotonics(mono))
}
#[task(binds = USART1_EXTI25, resources = [serial, dir])]
@@ -77,7 +94,7 @@ mod app {
Ok(byte) => {
serial.write(byte).unwrap();
serial.listen(Event::Tc);
- },
+ }
Err(_error) => rprintln!("irq error"),
};
}
