diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-05-30 10:42:53 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-05-30 10:42:53 +0000 |
| commit | e9cb9badf730032be0daa65fd725fa538fc92459 (patch) | |
| tree | 76a58b47a2717269b4f138d883d3fbde9a4c66c0 /tests | |
| parent | 50210e8cdc95c3c8bea150541cd8f15482450b1e (diff) | |
| parent | 35feb1bf230a1af7fbac6dced25ed3cce727543d (diff) | |
Merge pull request #3012 from cschuhen/feature/fdcan_no_generics
Remove generic argument for STM32 FDCAN.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/stm32/src/bin/can.rs | 8 | ||||
| -rw-r--r-- | tests/stm32/src/bin/can_common.rs | 9 | ||||
| -rw-r--r-- | tests/stm32/src/bin/fdcan.rs | 4 |
3 files changed, 12 insertions, 9 deletions
diff --git a/tests/stm32/src/bin/can.rs b/tests/stm32/src/bin/can.rs index 551764458..004b1a729 100644 --- a/tests/stm32/src/bin/can.rs +++ b/tests/stm32/src/bin/can.rs | |||
| @@ -9,9 +9,7 @@ use common::*; | |||
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_stm32::bind_interrupts; | 10 | use embassy_stm32::bind_interrupts; |
| 11 | use embassy_stm32::can::filter::Mask32; | 11 | use embassy_stm32::can::filter::Mask32; |
| 12 | use embassy_stm32::can::{ | 12 | use embassy_stm32::can::{Fifo, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, TxInterruptHandler}; |
| 13 | Can, Fifo, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, TxInterruptHandler, | ||
| 14 | }; | ||
| 15 | use embassy_stm32::gpio::{Input, Pull}; | 13 | use embassy_stm32::gpio::{Input, Pull}; |
| 16 | use embassy_stm32::peripherals::CAN1; | 14 | use embassy_stm32::peripherals::CAN1; |
| 17 | use embassy_time::Duration; | 15 | use embassy_time::Duration; |
| @@ -20,6 +18,10 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 20 | mod can_common; | 18 | mod can_common; |
| 21 | use can_common::*; | 19 | use can_common::*; |
| 22 | 20 | ||
| 21 | type Can<'d> = embassy_stm32::can::Can<'d, embassy_stm32::peripherals::CAN1>; | ||
| 22 | type CanTx<'d> = embassy_stm32::can::CanTx<'d, embassy_stm32::peripherals::CAN1>; | ||
| 23 | type CanRx<'d> = embassy_stm32::can::CanRx<'d, embassy_stm32::peripherals::CAN1>; | ||
| 24 | |||
| 23 | bind_interrupts!(struct Irqs { | 25 | bind_interrupts!(struct Irqs { |
| 24 | CAN1_RX0 => Rx0InterruptHandler<CAN1>; | 26 | CAN1_RX0 => Rx0InterruptHandler<CAN1>; |
| 25 | CAN1_RX1 => Rx1InterruptHandler<CAN1>; | 27 | CAN1_RX1 => Rx1InterruptHandler<CAN1>; |
diff --git a/tests/stm32/src/bin/can_common.rs b/tests/stm32/src/bin/can_common.rs index 4b39269cc..fbfbcdc21 100644 --- a/tests/stm32/src/bin/can_common.rs +++ b/tests/stm32/src/bin/can_common.rs | |||
| @@ -8,7 +8,8 @@ pub struct TestOptions { | |||
| 8 | pub max_buffered: u8, | 8 | pub max_buffered: u8, |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | pub async fn run_can_tests<'d, T: can::Instance>(can: &mut can::Can<'d, T>, options: &TestOptions) { | 11 | pub async fn run_can_tests<'d>(can: &mut crate::Can<'d>, options: &TestOptions) { |
| 12 | //pub async fn run_can_tests<'d, T: can::Instance>(can: &mut can::Can<'d, T>, options: &TestOptions) { | ||
| 12 | let mut i: u8 = 0; | 13 | let mut i: u8 = 0; |
| 13 | loop { | 14 | loop { |
| 14 | //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(); | 15 | //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 | |||
| 79 | } | 80 | } |
| 80 | } | 81 | } |
| 81 | 82 | ||
| 82 | pub async fn run_split_can_tests<'d, T: can::Instance>( | 83 | pub async fn run_split_can_tests<'d>(tx: &mut crate::CanTx<'d>, rx: &mut crate::CanRx<'d>, options: &TestOptions) { |
| 83 | tx: &mut can::CanTx<'d, T>, | ||
| 84 | rx: &mut can::CanRx<'d, T>, | ||
| 85 | options: &TestOptions, | ||
| 86 | ) { | ||
| 87 | for i in 0..options.max_buffered { | 84 | for i in 0..options.max_buffered { |
| 88 | // Try filling up the RX FIFO0 buffers | 85 | // Try filling up the RX FIFO0 buffers |
| 89 | //let tx_frame = if 0 != (i & 0x01) { | 86 | //let tx_frame = if 0 != (i & 0x01) { |
diff --git a/tests/stm32/src/bin/fdcan.rs b/tests/stm32/src/bin/fdcan.rs index 20bd3f7e3..8534f92e8 100644 --- a/tests/stm32/src/bin/fdcan.rs +++ b/tests/stm32/src/bin/fdcan.rs | |||
| @@ -15,6 +15,10 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 15 | mod can_common; | 15 | mod can_common; |
| 16 | use can_common::*; | 16 | use can_common::*; |
| 17 | 17 | ||
| 18 | type Can<'d> = can::Can<'d>; | ||
| 19 | type CanTx<'d> = can::CanTx<'d>; | ||
| 20 | type CanRx<'d> = can::CanRx<'d>; | ||
| 21 | |||
| 18 | bind_interrupts!(struct Irqs2 { | 22 | bind_interrupts!(struct Irqs2 { |
| 19 | FDCAN2_IT0 => can::IT0InterruptHandler<FDCAN2>; | 23 | FDCAN2_IT0 => can::IT0InterruptHandler<FDCAN2>; |
| 20 | FDCAN2_IT1 => can::IT1InterruptHandler<FDCAN2>; | 24 | FDCAN2_IT1 => can::IT1InterruptHandler<FDCAN2>; |
