Remove generic argument for STM32 FDCAN.

This commit is contained in:
Corey Schuhen
2024-05-26 19:54:46 +10:00
committed by Corey Schuhen
parent 34bc439f17
commit 35feb1bf23
4 changed files with 258 additions and 176 deletions

View File

@@ -9,9 +9,7 @@ use common::*;
use embassy_executor::Spawner;
use embassy_stm32::bind_interrupts;
use embassy_stm32::can::filter::Mask32;
use embassy_stm32::can::{
Can, Fifo, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, TxInterruptHandler,
};
use embassy_stm32::can::{Fifo, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, TxInterruptHandler};
use embassy_stm32::gpio::{Input, Pull};
use embassy_stm32::peripherals::CAN1;
use embassy_time::Duration;
@@ -20,6 +18,10 @@ use {defmt_rtt as _, panic_probe as _};
mod can_common;
use can_common::*;
type Can<'d> = embassy_stm32::can::Can<'d, embassy_stm32::peripherals::CAN1>;
type CanTx<'d> = embassy_stm32::can::CanTx<'d, embassy_stm32::peripherals::CAN1>;
type CanRx<'d> = embassy_stm32::can::CanRx<'d, embassy_stm32::peripherals::CAN1>;
bind_interrupts!(struct Irqs {
CAN1_RX0 => Rx0InterruptHandler<CAN1>;
CAN1_RX1 => Rx1InterruptHandler<CAN1>;

View File

@@ -8,7 +8,8 @@ pub struct TestOptions {
pub max_buffered: u8,
}
pub async fn run_can_tests<'d, T: can::Instance>(can: &mut can::Can<'d, T>, options: &TestOptions) {
pub async fn run_can_tests<'d>(can: &mut crate::Can<'d>, options: &TestOptions) {
//pub async fn run_can_tests<'d, T: can::Instance>(can: &mut can::Can<'d, T>, options: &TestOptions) {
let mut i: u8 = 0;
loop {
//let tx_frame = can::frame::Frame::new_standard(0x123, &[i, 0x12 as u8, 0x34 as u8, 0x56 as u8, 0x78 as u8, 0x9A as u8, 0xBC as u8 ]).unwrap();
@@ -79,11 +80,7 @@ pub async fn run_can_tests<'d, T: can::Instance>(can: &mut can::Can<'d, T>, opti
}
}
pub async fn run_split_can_tests<'d, T: can::Instance>(
tx: &mut can::CanTx<'d, T>,
rx: &mut can::CanRx<'d, T>,
options: &TestOptions,
) {
pub async fn run_split_can_tests<'d>(tx: &mut crate::CanTx<'d>, rx: &mut crate::CanRx<'d>, options: &TestOptions) {
for i in 0..options.max_buffered {
// Try filling up the RX FIFO0 buffers
//let tx_frame = if 0 != (i & 0x01) {

View File

@@ -15,6 +15,10 @@ use {defmt_rtt as _, panic_probe as _};
mod can_common;
use can_common::*;
type Can<'d> = can::Can<'d>;
type CanTx<'d> = can::CanTx<'d>;
type CanRx<'d> = can::CanRx<'d>;
bind_interrupts!(struct Irqs2 {
FDCAN2_IT0 => can::IT0InterruptHandler<FDCAN2>;
FDCAN2_IT1 => can::IT1InterruptHandler<FDCAN2>;