Skip to content

Commit fd44adb

Browse files
authored
Set PLLM, PLLN and PLLP
This can be useful if we decide to set the values in order to reduce the computation time due to calculate_mnpq() function. (Clocks.freeze() computation's time reduced by approximately 1s)
1 parent af93075 commit fd44adb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/rcc.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,19 @@ impl CFGR {
638638
self.use_pll = false;
639639
return;
640640
}
641+
642+
let p_ok = (sysclk as u64)
643+
== (base_clk as u64 * self.plln as u64
644+
/ self.pllm as u64
645+
/ match self.pllp {
646+
PLLP::Div2 => 2,
647+
PLLP::Div4 => 4,
648+
PLLP::Div6 => 6,
649+
PLLP::Div8 => 8,
650+
});
651+
if p_ok && q.is_none() {
652+
return;
653+
}
641654

642655
if let Some((m, n, p, q)) = CFGR::calculate_mnpq(base_clk, FreqRequest { p, q }) {
643656
self.pllm = m as u8;

0 commit comments

Comments
 (0)