Merge pull request #269 from quartiq/rj/misc

fix hal branch, cleanup code
This commit is contained in:
Robert Jördens 2021-02-15 09:00:58 +01:00 committed by GitHub
commit fcf59be684
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 17 deletions

2
Cargo.lock generated
View File

@ -1013,7 +1013,7 @@ dependencies = [
[[package]] [[package]]
name = "stm32h7xx-hal" name = "stm32h7xx-hal"
version = "0.8.0" 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 = [ dependencies = [
"bare-metal 1.0.0", "bare-metal 1.0.0",
"cast", "cast",

View File

@ -57,7 +57,7 @@ default-features = false
[dependencies.stm32h7xx-hal] [dependencies.stm32h7xx-hal]
features = ["stm32h743v", "rt", "unproven", "ethernet", "quadspi"] features = ["stm32h743v", "rt", "unproven", "ethernet", "quadspi"]
git = "https://github.com/stm32-rs/stm32h7xx-hal" git = "https://github.com/stm32-rs/stm32h7xx-hal"
branch = "dma" branch = "master"
[features] [features]
semihosting = ["panic-semihosting", "cortex-m-log/semihosting"] semihosting = ["panic-semihosting", "cortex-m-log/semihosting"]

View File

@ -7,14 +7,6 @@ pub struct Lockin {
} }
impl 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. /// Update the lockin with a sample taken at a given phase.
/// The lowpass has a gain of `1 << k`. /// The lowpass has a gain of `1 << k`.
pub fn update(&mut self, sample: i16, phase: i32, k: u8) -> Complex<i32> { pub fn update(&mut self, sample: i16, phase: i32, k: u8) -> Complex<i32> {

View File

@ -34,8 +34,6 @@ const APP: () = {
+ design_parameters::SAMPLE_BUFFER_SIZE_LOG2, + design_parameters::SAMPLE_BUFFER_SIZE_LOG2,
); );
let lockin = Lockin::new();
// Enable ADC/DAC events // Enable ADC/DAC events
stabilizer.adcs.0.start(); stabilizer.adcs.0.start();
stabilizer.adcs.1.start(); stabilizer.adcs.1.start();
@ -59,7 +57,7 @@ const APP: () = {
timestamper: stabilizer.timestamper, timestamper: stabilizer.timestamper,
pll, pll,
lockin, lockin: Lockin::default(),
} }
} }
@ -106,7 +104,8 @@ const APP: () = {
let time_constant: u8 = 6; // TODO: expose let time_constant: u8 = 6; // TODO: expose
let sample_frequency = ((pll_frequency 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) >> design_parameters::SAMPLE_BUFFER_SIZE_LOG2)
as i32) as i32)
.wrapping_mul(harmonic); .wrapping_mul(harmonic);

View File

@ -28,8 +28,6 @@ const APP: () = {
// Configure the microcontroller // Configure the microcontroller
let (mut stabilizer, _pounder) = hardware::setup(c.core, c.device); let (mut stabilizer, _pounder) = hardware::setup(c.core, c.device);
let lockin = Lockin::new();
// Enable ADC/DAC events // Enable ADC/DAC events
stabilizer.adcs.1.start(); stabilizer.adcs.1.start();
stabilizer.dacs.0.start(); stabilizer.dacs.0.start();
@ -39,7 +37,7 @@ const APP: () = {
stabilizer.adc_dac_timer.start(); stabilizer.adc_dac_timer.start();
init::LateResources { init::LateResources {
lockin, lockin: Lockin::default(),
afes: stabilizer.afes, afes: stabilizer.afes,
adc: stabilizer.adcs.1, adc: stabilizer.adcs.1,
dacs: stabilizer.dacs, dacs: stabilizer.dacs,