begin integrate interrupt

This commit is contained in:
xoviat 2020-12-31 16:59:42 -06:00
parent cc0076a0eb
commit cc8d162859
2 changed files with 7 additions and 2 deletions

View File

@ -65,8 +65,10 @@ static STATE: State = State {
impl Serial<USART1, Stream7<DMA2>, Stream2<DMA2>> { impl Serial<USART1, Stream7<DMA2>, Stream2<DMA2>> {
pub fn new( pub fn new(
rxd: PA10<Alternate<AF7>>,
txd: PA9<Alternate<AF7>>, txd: PA9<Alternate<AF7>>,
rxd: PA10<Alternate<AF7>>,
tx_int: interrupt::DMA2_STREAM2Interrupt,
rx_int: interrupt::DMA2_STREAM7Interrupt,
dma: DMA2, dma: DMA2,
usart: USART1, usart: USART1,
parity: Parity, parity: Parity,

View File

@ -9,6 +9,7 @@ use cortex_m::singleton;
use cortex_m_rt::entry; use cortex_m_rt::entry;
use embassy::executor::{task, Executor}; use embassy::executor::{task, Executor};
use embassy::util::Forever; use embassy::util::Forever;
use embassy_stm32f4::interrupt;
use embassy_stm32f4::serial; use embassy_stm32f4::serial;
use stm32f4xx_hal::stm32; use stm32f4xx_hal::stm32;
use stm32f4xx_hal::{prelude::*, serial::config}; use stm32f4xx_hal::{prelude::*, serial::config};
@ -27,8 +28,10 @@ async fn run(dp: stm32::Peripherals, cp: cortex_m::Peripherals) {
.freeze(); .freeze();
let mut serial = serial::Serial::new( let mut serial = serial::Serial::new(
gpioa.pa10.into_alternate_af7(),
gpioa.pa9.into_alternate_af7(), gpioa.pa9.into_alternate_af7(),
gpioa.pa10.into_alternate_af7(),
interrupt::take!(DMA2_STREAM2),
interrupt::take!(DMA2_STREAM7),
dp.DMA2, dp.DMA2,
dp.USART1, dp.USART1,
config::Parity::ParityNone, config::Parity::ParityNone,