From 8633c6296ae8004a8576a38f7cecbd8614714e58 Mon Sep 17 00:00:00 2001 From: David O'Connor Date: Wed, 8 May 2024 17:50:12 -0400 Subject: [PATCH] Fixed CAN on G431 --- src/can/g4.rs | 8 ++++++-- src/spi/mod.rs | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/can/g4.rs b/src/can/g4.rs index 4d2042f..48d4d48 100644 --- a/src/can/g4.rs +++ b/src/can/g4.rs @@ -1,7 +1,9 @@ use fdcan; +#[cfg(not(feature = "g431"))] +use crate::pac::{FDCAN2, FDCAN3}; use crate::{ - pac::{FDCAN1, FDCAN2, FDCAN3, RCC}, + pac::{FDCAN1, RCC}, util::rcc_en_reset, }; @@ -47,6 +49,8 @@ macro_rules! create_cans { }; } -create_cans!(Can1, FDCAN1, FDCAN1_MESSAGE_RAM_ADDRESS); +create_cans!(Can, FDCAN1, FDCAN1_MESSAGE_RAM_ADDRESS); +#[cfg(not(feature = "g431"))] create_cans!(Can2, FDCAN2, FDCAN2_MESSAGE_RAM_ADDRESS); +#[cfg(not(feature = "g431"))] create_cans!(Can3, FDCAN3, FDCAN3_MESSAGE_RAM_ADDRESS); diff --git a/src/spi/mod.rs b/src/spi/mod.rs index 0aa1894..8e8e11b 100644 --- a/src/spi/mod.rs +++ b/src/spi/mod.rs @@ -200,6 +200,7 @@ cfg_if! { } } +#[derive(Clone)] /// Configuration data for SPI. pub struct SpiConfig { /// SPI mode associated with Polarity and Phase. Defaults to Mode0: Idle low, capture on first transition.