From 34cf0037ea287902b1ccb0e1d252d52c97bc2e43 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 23 Oct 2019 18:28:45 +0800 Subject: [PATCH] simple-dmi: make decimation configurable --- simple-dmi.json | 4 +++- src/simple-dmi.rs | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/simple-dmi.json b/simple-dmi.json index 58410a4..77083d5 100644 --- a/simple-dmi.json +++ b/simple-dmi.json @@ -7,5 +7,7 @@ "bit_meas": 1, "refpll_ki": 4294967, - "refpll_kp": 85899345 + "refpll_kp": 85899345, + + "decimation": 200000 } diff --git a/src/simple-dmi.rs b/src/simple-dmi.rs index 2558ca2..940ec9d 100644 --- a/src/simple-dmi.rs +++ b/src/simple-dmi.rs @@ -20,7 +20,8 @@ struct Config { bit_ref: u8, bit_meas: u8, refpll_ki: i64, - refpll_kp: i64 + refpll_kp: i64, + decimation: u32 } fn read_config_from_file>(path: P) -> Result> { @@ -38,7 +39,7 @@ fn main() { config.refpll_ki, config.refpll_kp); let mut tracker = noptica::Tracker::new(); - let mut decimator = noptica::Decimator::new(200000); + let mut decimator = noptica::Decimator::new(config.decimation); noptica::sample(&config.sample_command, |rising, _falling| { refpll.tick(rising & (1 << config.bit_ref) != 0); if rising & (1 << config.bit_meas) != 0 {