From 36fc84c0b61ef4b997fe2b059f4e05e537e9e7f6 Mon Sep 17 00:00:00 2001 From: "Ashcon Mohseninia (RAND_ASH)" Date: Wed, 4 Dec 2024 19:29:32 +0100 Subject: [PATCH] feat(can): Allow the use of any GCLK with the CAN peripheral (#797) --- hal/src/peripherals/can.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hal/src/peripherals/can.rs b/hal/src/peripherals/can.rs index 2f65e4c7324..d5ca132a3ce 100644 --- a/hal/src/peripherals/can.rs +++ b/hal/src/peripherals/can.rs @@ -13,7 +13,6 @@ use crate::{ clock::v2::{ ahb::{AhbClk, AhbId}, - gclk::Gclk0Id, pclk::{Pclk, PclkId, PclkSourceId}, types::Can0, Source, @@ -49,7 +48,7 @@ impl Dependencies( - gclk0: S, + gclk: S, pclk: Pclk, ahbclk: AhbClk, rx: RX, @@ -57,27 +56,27 @@ impl Dependencies (Self, S::Inc) where - S: Source + Increment, + S: Source + Increment, { ( Self { pclk, - host_freq: gclk0.freq(), + host_freq: gclk.freq(), ahbclk, rx, tx, can, }, - gclk0.inc(), + gclk.inc(), ) } /// Destroy an instance of `Dependencies` struct. /// /// Releases all enclosed objects back to the user. #[allow(clippy::type_complexity)] - pub fn free(self, gclk0: S) -> (Pclk, HertzU32, AhbClk, RX, TX, CAN, S::Dec) + pub fn free(self, gclk: S) -> (Pclk, HertzU32, AhbClk, RX, TX, CAN, S::Dec) where - S: Source + Decrement, + S: Source + Decrement, { let Self { pclk, @@ -87,7 +86,7 @@ impl Dependencies