fixup
This commit is contained in:
parent
0fbb3174d2
commit
cb8d53e498
@ -25,4 +25,4 @@ rustflags = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
target = "thumbv7em-none-eabi"
|
target = "thumbv7em-none-eabihf"
|
||||||
|
@ -7,21 +7,22 @@
|
|||||||
mod example_common;
|
mod example_common;
|
||||||
use example_common::{panic, *};
|
use example_common::{panic, *};
|
||||||
|
|
||||||
|
use bxcan::filter::Mask32;
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use embassy::executor::{task, Executor};
|
use embassy::executor::{task, Executor};
|
||||||
use embassy::traits::gpio::*;
|
use embassy::traits::gpio::*;
|
||||||
use embassy::util::Forever;
|
use embassy::util::Forever;
|
||||||
use embassy_stm32f4::can;
|
use embassy_stm32f4::{can, exti, interrupt};
|
||||||
use embassy_stm32f4::exti;
|
|
||||||
use embassy_stm32f4::interrupt;
|
|
||||||
use futures::pin_mut;
|
use futures::pin_mut;
|
||||||
use stm32f4xx_hal::prelude::*;
|
use stm32f4xx_hal::prelude::*;
|
||||||
use stm32f4xx_hal::stm32;
|
use stm32f4xx_hal::{can::Can, stm32};
|
||||||
|
|
||||||
static EXTI: Forever<exti::ExtiManager> = Forever::new();
|
static EXTI: Forever<exti::ExtiManager> = Forever::new();
|
||||||
|
|
||||||
#[task]
|
#[task]
|
||||||
async fn run(dp: stm32::Peripherals, _cp: cortex_m::Peripherals) {
|
async fn run(dp: stm32::Peripherals, _cp: cortex_m::Peripherals) {
|
||||||
|
let gpioa = dp.GPIOA.split();
|
||||||
|
|
||||||
let rx = gpioa.pa11.into_alternate_af9();
|
let rx = gpioa.pa11.into_alternate_af9();
|
||||||
let tx = gpioa.pa12.into_alternate_af9();
|
let tx = gpioa.pa12.into_alternate_af9();
|
||||||
let mut can = bxcan::Can::new(Can::new(dp.CAN1, (tx, rx)));
|
let mut can = bxcan::Can::new(Can::new(dp.CAN1, (tx, rx)));
|
||||||
@ -32,13 +33,7 @@ async fn run(dp: stm32::Peripherals, _cp: cortex_m::Peripherals) {
|
|||||||
// Configure filters so that can frames can be received.
|
// Configure filters so that can frames can be received.
|
||||||
can.modify_filters().enable_bank(0, Mask32::accept_all());
|
can.modify_filters().enable_bank(0, Mask32::accept_all());
|
||||||
|
|
||||||
block!(can.enable()).unwrap();
|
let mut can = can::Can::new(can, interrupt::take!(CAN1_TX), interrupt::take!(CAN1_RX0));
|
||||||
|
|
||||||
let can = can::Can::new(
|
|
||||||
can,
|
|
||||||
interrupt::take!(CAN1_TX),
|
|
||||||
interrupt::take!(CAN1_RX0),
|
|
||||||
));
|
|
||||||
|
|
||||||
let frame = can.receive().await;
|
let frame = can.receive().await;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user