diff options
Diffstat (limited to 'sw/eval-clock-cw-tx/src/si_clock.rs')
-rw-r--r-- | sw/eval-clock-cw-tx/src/si_clock.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sw/eval-clock-cw-tx/src/si_clock.rs b/sw/eval-clock-cw-tx/src/si_clock.rs index a4b0e7a..6de4c25 100644 --- a/sw/eval-clock-cw-tx/src/si_clock.rs +++ b/sw/eval-clock-cw-tx/src/si_clock.rs @@ -84,12 +84,17 @@ fn set_bfo(siclock: &mut dyn Si5351, freq: u32) -> Result<(), si5351::Error> fn set_vfo(siclock: &mut dyn Si5351, freq: u32) { - let (div, mult, num, denom) = clock_settings_with_pll_calculation(freq); + if freq == 0 { + siclock.set_clock_enabled(si5351::ClockOutput::Clk0, false); + } + else { + let (div, mult, num, denom) = clock_settings_with_pll_calculation(freq); - siclock.setup_pll(si5351::PLL::B, mult, num, denom).unwrap(); - siclock.setup_multisynth_int(si5351::Multisynth::MS0, div, si5351::OutputDivider::Div1).unwrap(); - siclock.select_clock_pll(si5351::ClockOutput::Clk0, si5351::PLL::B); - siclock.set_clock_enabled(si5351::ClockOutput::Clk0, true); + siclock.setup_pll(si5351::PLL::B, mult, num, denom).unwrap(); + siclock.setup_multisynth_int(si5351::Multisynth::MS0, div, si5351::OutputDivider::Div1).unwrap(); + siclock.select_clock_pll(si5351::ClockOutput::Clk0, si5351::PLL::B); + siclock.set_clock_enabled(si5351::ClockOutput::Clk0, true); + } siclock.flush_clock_control(si5351::ClockOutput::Clk0).unwrap(); } |