From b581a016ce013e63ec482ce17f2ef0c9b2bca02e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Sun, 14 Feb 2021 17:55:01 +0100 Subject: [PATCH 1/3] lockin: redundant new --- dsp/src/lockin.rs | 8 -------- src/bin/lockin-external.rs | 4 +--- src/bin/lockin-internal.rs | 4 +--- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/dsp/src/lockin.rs b/dsp/src/lockin.rs index b2f38c1..6ebf4cb 100644 --- a/dsp/src/lockin.rs +++ b/dsp/src/lockin.rs @@ -7,14 +7,6 @@ pub struct Lockin { } impl Lockin { - /// Create a new Lockin with given IIR coefficients. - pub fn new() -> Self { - let lp = Lowpass::default(); - Self { - state: [lp.clone(), lp], - } - } - /// Update the lockin with a sample taken at a given phase. /// The lowpass has a gain of `1 << k`. pub fn update(&mut self, sample: i16, phase: i32, k: u8) -> Complex { diff --git a/src/bin/lockin-external.rs b/src/bin/lockin-external.rs index c0e6cae..9b29033 100644 --- a/src/bin/lockin-external.rs +++ b/src/bin/lockin-external.rs @@ -34,8 +34,6 @@ const APP: () = { + design_parameters::SAMPLE_BUFFER_SIZE_LOG2, ); - let lockin = Lockin::new(); - // Enable ADC/DAC events stabilizer.adcs.0.start(); stabilizer.adcs.1.start(); @@ -59,7 +57,7 @@ const APP: () = { timestamper: stabilizer.timestamper, pll, - lockin, + lockin: Lockin::default(), } } diff --git a/src/bin/lockin-internal.rs b/src/bin/lockin-internal.rs index cfa3115..c4d5bd6 100644 --- a/src/bin/lockin-internal.rs +++ b/src/bin/lockin-internal.rs @@ -28,8 +28,6 @@ const APP: () = { // Configure the microcontroller let (mut stabilizer, _pounder) = hardware::setup(c.core, c.device); - let lockin = Lockin::new(); - // Enable ADC/DAC events stabilizer.adcs.1.start(); stabilizer.dacs.0.start(); @@ -39,7 +37,7 @@ const APP: () = { stabilizer.adc_dac_timer.start(); init::LateResources { - lockin, + lockin: Lockin::default(), afes: stabilizer.afes, adc: stabilizer.adcs.1, dacs: stabilizer.dacs, From 5fc45a659b6957b8f62c43691397abfd781108bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Mon, 15 Feb 2021 08:51:19 +0100 Subject: [PATCH 2/3] lockin-external: comment style [nfc] --- src/bin/lockin-external.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/lockin-external.rs b/src/bin/lockin-external.rs index 9b29033..a454e19 100644 --- a/src/bin/lockin-external.rs +++ b/src/bin/lockin-external.rs @@ -104,7 +104,8 @@ const APP: () = { let time_constant: u8 = 6; // TODO: expose let sample_frequency = ((pll_frequency - // .wrapping_add(1 << design_parameters::SAMPLE_BUFFER_SIZE_LOG2 - 1) // half-up rounding bias + // half-up rounding bias + // .wrapping_add(1 << design_parameters::SAMPLE_BUFFER_SIZE_LOG2 - 1) >> design_parameters::SAMPLE_BUFFER_SIZE_LOG2) as i32) .wrapping_mul(harmonic); From cfc4cb382d9b075148adcbe4aa2372fadc69198f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Mon, 15 Feb 2021 08:53:55 +0100 Subject: [PATCH 3/3] dependencies: hal ref is on master now [nfc] --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 17030d2..e5a80f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1013,7 +1013,7 @@ dependencies = [ [[package]] name = "stm32h7xx-hal" version = "0.8.0" -source = "git+https://github.com/stm32-rs/stm32h7xx-hal?branch=dma#2b8a04caac566a8560f400ddd6503508f78bea77" +source = "git+https://github.com/stm32-rs/stm32h7xx-hal?branch=master#2b8a04caac566a8560f400ddd6503508f78bea77" dependencies = [ "bare-metal 1.0.0", "cast", diff --git a/Cargo.toml b/Cargo.toml index d5fc525..747243a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,7 @@ default-features = false [dependencies.stm32h7xx-hal] features = ["stm32h743v", "rt", "unproven", "ethernet", "quadspi"] git = "https://github.com/stm32-rs/stm32h7xx-hal" -branch = "dma" +branch = "master" [features] semihosting = ["panic-semihosting", "cortex-m-log/semihosting"]