diff --git a/embassy-stm32f4/src/serial.rs b/embassy-stm32f4/src/serial.rs index f050e0e2..2ca82ac5 100644 --- a/embassy-stm32f4/src/serial.rs +++ b/embassy-stm32f4/src/serial.rs @@ -5,6 +5,7 @@ //! are dropped correctly (e.g. not using `mem::forget()`). use core::future::Future; +use core::marker::PhantomData; use core::ptr; use core::sync::atomic::{self, Ordering}; @@ -12,15 +13,16 @@ use embassy::interrupt::{Interrupt, InterruptExt}; use embassy::traits::uart::{Error, Uart}; use embassy::util::InterruptFuture; -use crate::hal::dma; -use crate::hal::dma::config::DmaConfig; -use crate::hal::dma::traits::{PeriAddress, Stream}; -use crate::hal::dma::{MemoryToPeripheral, PeripheralToMemory, Transfer}; -use crate::hal::rcc::Clocks; -use crate::hal::serial; -use crate::hal::serial::config::{Config as SerialConfig, DmaConfig as SerialDmaConfig}; -use crate::hal::serial::Pins; -use crate::hal::serial::{Event as SerialEvent, Serial as HalSerial}; +use crate::hal::{ + dma, + dma::config::DmaConfig, + dma::traits::{Channel, DMASet, PeriAddress, Stream}, + dma::{MemoryToPeripheral, PeripheralToMemory, Transfer}, + rcc::Clocks, + serial, + serial::config::{Config as SerialConfig, DmaConfig as SerialDmaConfig}, + serial::{Event as SerialEvent, Pins, Serial as HalSerial}, +}; use crate::interrupt; use crate::pac; @@ -37,7 +39,7 @@ pub struct Serial< tx_int: TSTREAM::Interrupt, rx_int: RSTREAM::Interrupt, usart_int: USART::Interrupt, - channel: core::marker::PhantomData, + channel: PhantomData, } // static mut INSTANCE: *const Serial, Stream2> = ptr::null_mut(); @@ -45,13 +47,13 @@ pub struct Serial< impl Serial where USART: serial::Instance - + dma::traits::PeriAddress - + dma::traits::DMASet - + dma::traits::DMASet + + PeriAddress + + DMASet + + DMASet + WithInterrupt, TSTREAM: Stream + WithInterrupt, RSTREAM: Stream + WithInterrupt, - CHANNEL: dma::traits::Channel, + CHANNEL: Channel, { // Leaking futures is forbidden! pub unsafe fn new( @@ -92,14 +94,14 @@ where impl Uart for Serial where USART: serial::Instance - + dma::traits::PeriAddress - + dma::traits::DMASet - + dma::traits::DMASet + + PeriAddress + + DMASet + + DMASet + WithInterrupt + 'static, TSTREAM: Stream + WithInterrupt + 'static, RSTREAM: Stream + WithInterrupt + 'static, - CHANNEL: dma::traits::Channel + 'static, + CHANNEL: Channel + 'static, { type SendFuture<'a> = impl Future> + 'a; type ReceiveFuture<'a> = impl Future> + 'a;