Remove more BXCAN generics.

This commit is contained in:
Corey Schuhen
2024-06-02 19:40:25 +10:00
committed by Corey Schuhen
parent e61136fa4a
commit 367a22cc0e
6 changed files with 99 additions and 82 deletions

View File

@@ -18,10 +18,6 @@ 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>;
type CanRx<'d> = embassy_stm32::can::CanRx<'d>;
bind_interrupts!(struct Irqs {
CAN1_RX0 => Rx0InterruptHandler<CAN1>;
CAN1_RX1 => Rx1InterruptHandler<CAN1>;
@@ -50,7 +46,7 @@ async fn main(_spawner: Spawner) {
let rx_pin = Input::new(&mut rx, Pull::Up);
core::mem::forget(rx_pin);
let mut can = Can::new(can, rx, tx, Irqs);
let mut can = embassy_stm32::can::Can::new(can, rx, tx, Irqs);
info!("Configuring can...");

View File

@@ -8,7 +8,7 @@ pub struct TestOptions {
pub max_buffered: u8,
}
pub async fn run_can_tests<'d>(can: &mut crate::Can<'d>, options: &TestOptions) {
pub async fn run_can_tests<'d>(can: &mut can::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 {
@@ -80,7 +80,7 @@ pub async fn run_can_tests<'d>(can: &mut crate::Can<'d>, options: &TestOptions)
}
}
pub async fn run_split_can_tests<'d>(tx: &mut crate::CanTx<'d>, rx: &mut crate::CanRx<'d>, options: &TestOptions) {
pub async fn run_split_can_tests<'d>(tx: &mut can::CanTx<'d>, rx: &mut can::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,10 +15,6 @@ 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>;