diff options
| -rw-r--r-- | embassy-stm32/src/can/bxcan.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/embassy-stm32/src/can/bxcan.rs b/embassy-stm32/src/can/bxcan.rs index 33a729ed5..cb667695a 100644 --- a/embassy-stm32/src/can/bxcan.rs +++ b/embassy-stm32/src/can/bxcan.rs | |||
| @@ -92,15 +92,13 @@ foreach_peripheral!( | |||
| 92 | const NUM_FILTER_BANKS: u8 = 14; | 92 | const NUM_FILTER_BANKS: u8 = 14; |
| 93 | } | 93 | } |
| 94 | }; | 94 | }; |
| 95 | // Only correct when CAN2 also exists… Fix on yaml level? | 95 | // CAN1 and CAN2 is a combination of master and slave instance. |
| 96 | // There are only 14 filter banks when CAN2 is not available. | 96 | // CAN1 owns the filter bank and needs to be enabled in order |
| 97 | // for CAN2 to receive messages. | ||
| 97 | (can, CAN1) => { | 98 | (can, CAN1) => { |
| 98 | unsafe impl bxcan::FilterOwner for peripherals::CAN1 { | 99 | unsafe impl bxcan::FilterOwner for peripherals::CAN1 { |
| 99 | const NUM_FILTER_BANKS: u8 = 28; | 100 | const NUM_FILTER_BANKS: u8 = 28; |
| 100 | } | 101 | } |
| 101 | }; | ||
| 102 | (can, CAN2) => { | ||
| 103 | // CAN2 is always a slave instance where CAN1 is the master instance | ||
| 104 | unsafe impl bxcan::MasterInstance for peripherals::CAN1 {} | 102 | unsafe impl bxcan::MasterInstance for peripherals::CAN1 {} |
| 105 | }; | 103 | }; |
| 106 | (can, CAN3) => { | 104 | (can, CAN3) => { |
