rtio_clock: cfg uses default now, info->warn

This commit is contained in:
mwojcik 2021-11-25 16:38:56 +08:00
parent 07410afe83
commit ee3b1715cb

View File

@ -24,8 +24,9 @@ pub enum RtioClock {
} }
fn get_rtio_clock_cfg(cfg: &Config) -> RtioClock { fn get_rtio_clock_cfg(cfg: &Config) -> RtioClock {
let mut res = RtioClock::Default;
if let Ok(clk) = cfg.read_str("rtio_clock") { if let Ok(clk) = cfg.read_str("rtio_clock") {
match clk.as_ref() { res = match clk.as_ref() {
"int_125" => RtioClock::Int_125, "int_125" => RtioClock::Int_125,
"int_100" => RtioClock::Int_100, "int_100" => RtioClock::Int_100,
"int_150" => RtioClock::Int_150, "int_150" => RtioClock::Int_150,
@ -37,14 +38,18 @@ fn get_rtio_clock_cfg(cfg: &Config) -> RtioClock {
"ext0_synth0_125to125" => RtioClock::Ext0_Synth0_125to125, "ext0_synth0_125to125" => RtioClock::Ext0_Synth0_125to125,
_ => { _ => {
warn!("Unrecognised rtio_clock setting. Falling back to default."); warn!("Unrecognised rtio_clock setting. Falling back to default.");
RtioClock::Int_125
}
}
}
else {
info!("error reading configuration. Falling back to default.");
RtioClock::Default RtioClock::Default
} }
};
}
else {
warn!("error reading configuration. Falling back to default.");
}
if res == RtioClock::Default {
warn!("Using default configuration - internal 125MHz RTIO clock.");
return RtioClock::Int_125;
}
res
} }