From 4142678065049d652962c2349318e6fb80246e86 Mon Sep 17 00:00:00 2001 From: vinsynth <1.5vhunt@gmail.com> Date: Sat, 16 Sep 2023 02:48:42 -0400 Subject: [PATCH 1/2] Removed second division by `refdiv` --- rp2040-hal/src/pll.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rp2040-hal/src/pll.rs b/rp2040-hal/src/pll.rs index aae025d4d..351a98287 100644 --- a/rp2040-hal/src/pll.rs +++ b/rp2040-hal/src/pll.rs @@ -183,7 +183,7 @@ impl PhaseLockedLoop { let refdiv = config.refdiv; let post_div1 = config.post_div1; let post_div2 = config.post_div2; - let frequency: HertzU32 = ((ref_freq_hz / u32::from(refdiv)) * u32::from(fbdiv)) + let frequency: HertzU32 = (ref_freq_hz * u32::from(fbdiv)) / (u32::from(post_div1) * u32::from(post_div2)); Ok(PhaseLockedLoop { From b0b471c6e396269a39ca0d5725a603a74ae0cb67 Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Sat, 16 Sep 2023 08:01:23 +0000 Subject: [PATCH 2/2] Run 'cargo fmt' --- rp2040-hal/src/pll.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rp2040-hal/src/pll.rs b/rp2040-hal/src/pll.rs index 351a98287..786b60a5d 100644 --- a/rp2040-hal/src/pll.rs +++ b/rp2040-hal/src/pll.rs @@ -183,8 +183,8 @@ impl PhaseLockedLoop { let refdiv = config.refdiv; let post_div1 = config.post_div1; let post_div2 = config.post_div2; - let frequency: HertzU32 = (ref_freq_hz * u32::from(fbdiv)) - / (u32::from(post_div1) * u32::from(post_div2)); + let frequency: HertzU32 = + (ref_freq_hz * u32::from(fbdiv)) / (u32::from(post_div1) * u32::from(post_div2)); Ok(PhaseLockedLoop { state: Disabled {