From b204c0974c04b30092e026428b9560eb64fc9a33 Mon Sep 17 00:00:00 2001 From: xoviat Date: Wed, 17 Mar 2021 21:21:48 -0500 Subject: [PATCH] cleanup misc. warnings --- embassy-stm32f4-examples/src/bin/can.rs | 4 +--- embassy-stm32f4/src/can.rs | 6 ++---- embassy-stm32f4/src/exti.rs | 1 - embassy-stm32f4/src/qei.rs | 8 +++----- embassy-stm32f4/src/serial.rs | 3 +-- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/embassy-stm32f4-examples/src/bin/can.rs b/embassy-stm32f4-examples/src/bin/can.rs index 27aef02b..701a277e 100644 --- a/embassy-stm32f4-examples/src/bin/can.rs +++ b/embassy-stm32f4-examples/src/bin/can.rs @@ -14,13 +14,11 @@ use cortex_m_rt::entry; use embassy::executor::{task, Executor}; use embassy::traits::gpio::*; use embassy::util::Forever; -use embassy_stm32f4::{can, exti, interrupt}; +use embassy_stm32f4::{can, interrupt}; use futures::pin_mut; use stm32f4xx_hal::prelude::*; use stm32f4xx_hal::{can::Can, stm32}; -static EXTI: Forever = Forever::new(); - #[task] async fn run(dp: stm32::Peripherals, _cp: cortex_m::Peripherals) { let gpioa = dp.GPIOA.split(); diff --git a/embassy-stm32f4/src/can.rs b/embassy-stm32f4/src/can.rs index a8a3ca16..7c5311a9 100644 --- a/embassy-stm32f4/src/can.rs +++ b/embassy-stm32f4/src/can.rs @@ -9,11 +9,9 @@ use bxcan::Interrupts; use core::future::Future; use embassy::interrupt::Interrupt; use embassy::util::InterruptFuture; -use embassy::util::Signal; use nb; use nb::block; -use crate::hal::prelude::*; use crate::interrupt; /// Interface to the Serial peripheral @@ -53,9 +51,9 @@ impl Can { /// Receive can frame. /// /// This method async-blocks until the frame is received. - pub fn receive<'a>(&'a mut self) -> impl Future + 'a { + pub fn receive<'a>(&'a mut self) -> impl Future + 'a { async move { - let mut frame: Option = None; + let mut frame: Option; loop { let fut = InterruptFuture::new(&mut self.rx_int); diff --git a/embassy-stm32f4/src/exti.rs b/embassy-stm32f4/src/exti.rs index 90f3ade3..660e3be3 100644 --- a/embassy-stm32f4/src/exti.rs +++ b/embassy-stm32f4/src/exti.rs @@ -2,7 +2,6 @@ use core::future::Future; use core::mem; use core::pin::Pin; -use embassy::interrupt::Interrupt; use embassy::traits::gpio::{WaitForFallingEdge, WaitForRisingEdge}; use embassy::util::InterruptFuture; diff --git a/embassy-stm32f4/src/qei.rs b/embassy-stm32f4/src/qei.rs index 1d4689e1..391c8f7c 100644 --- a/embassy-stm32f4/src/qei.rs +++ b/embassy-stm32f4/src/qei.rs @@ -1,21 +1,19 @@ use crate::interrupt; use core::future::Future; use core::pin::Pin; -use embassy::interrupt::Interrupt; use embassy::traits::qei::WaitForRotate; use embedded_hal::Direction; -use embedded_hal::Qei as THQei; use stm32f4xx_hal::pac::TIM2; -use stm32f4xx_hal::qei::{Pins, Qei as HalQei}; +use stm32f4xx_hal::{qei, qei::Pins}; pub struct Qei { - qei: HalQei, + qei: qei::Qei, int: T::Interrupt, } impl> Qei { pub fn tim2(tim: TIM2, pins: PINS, interrupt: interrupt::TIM2) -> Self { - let qei = HalQei::tim2(tim, pins); + let qei = qei::Qei::tim2(tim, pins); let tim = unsafe { &mut *(stm32f4xx_hal::stm32::TIM2::ptr() diff --git a/embassy-stm32f4/src/serial.rs b/embassy-stm32f4/src/serial.rs index 2ca82ac5..97b365a1 100644 --- a/embassy-stm32f4/src/serial.rs +++ b/embassy-stm32f4/src/serial.rs @@ -6,10 +6,9 @@ use core::future::Future; use core::marker::PhantomData; -use core::ptr; use core::sync::atomic::{self, Ordering}; -use embassy::interrupt::{Interrupt, InterruptExt}; +use embassy::interrupt::Interrupt; use embassy::traits::uart::{Error, Uart}; use embassy::util::InterruptFuture;