lockin: make order generic
This commit is contained in:
parent
1f19b65584
commit
6c6c2e64a7
|
@ -724,6 +724,7 @@ dependencies = [
|
|||
"dsp",
|
||||
"embedded-hal",
|
||||
"enum-iterator",
|
||||
"generic-array 0.14.4",
|
||||
"heapless",
|
||||
"log",
|
||||
"mcp23017",
|
||||
|
|
|
@ -46,6 +46,7 @@ dsp = { path = "dsp" }
|
|||
ad9959 = { path = "ad9959" }
|
||||
smoltcp-nal = "0.1.0"
|
||||
miniconf = "0.1"
|
||||
generic-array = "0.14"
|
||||
|
||||
[patch.crates-io.miniconf]
|
||||
git = "https://github.com/quartiq/miniconf.git"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use super::{Complex, ComplexExt, Lowpass, MulScaled};
|
||||
use generic_array::typenum::U2;
|
||||
use generic_array::ArrayLength;
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct Lockin {
|
||||
state: [Lowpass<U2>; 2],
|
||||
pub struct Lockin<N: ArrayLength<i32>> {
|
||||
state: [Lowpass<N>; 2],
|
||||
}
|
||||
|
||||
impl Lockin {
|
||||
impl<N: ArrayLength<i32>> Lockin<N> {
|
||||
/// Update the lockin with a sample taken at a given phase.
|
||||
pub fn update(&mut self, sample: i32, phase: i32, k: u8) -> Complex<i32> {
|
||||
// Get the LO signal for demodulation and mix the sample;
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use stm32h7xx_hal as hal;
|
||||
|
||||
use generic_array::typenum::U4;
|
||||
use stabilizer::{hardware, hardware::design_parameters};
|
||||
|
||||
use dsp::{Accu, Complex, ComplexExt, Lockin, RPLL};
|
||||
use hardware::{
|
||||
Adc0Input, Adc1Input, Dac0Output, Dac1Output, InputStamper, AFE0, AFE1,
|
||||
|
@ -20,7 +18,7 @@ const APP: () = {
|
|||
|
||||
timestamper: InputStamper,
|
||||
pll: RPLL,
|
||||
lockin: Lockin,
|
||||
lockin: Lockin<U4>,
|
||||
}
|
||||
|
||||
#[init]
|
||||
|
@ -156,7 +154,7 @@ const APP: () = {
|
|||
|
||||
#[task(binds = ETH, priority = 1)]
|
||||
fn eth(_: eth::Context) {
|
||||
unsafe { hal::ethernet::interrupt_handler() }
|
||||
unsafe { stm32h7xx_hal::ethernet::interrupt_handler() }
|
||||
}
|
||||
|
||||
#[task(binds = SPI2, priority = 3)]
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use generic_array::typenum::U2;
|
||||
use dsp::{Accu, Complex, ComplexExt, Lockin};
|
||||
use hardware::{Adc1Input, Dac0Output, Dac1Output, AFE0, AFE1};
|
||||
use stabilizer::{hardware, hardware::design_parameters};
|
||||
|
@ -20,7 +21,7 @@ const APP: () = {
|
|||
adc: Adc1Input,
|
||||
dacs: (Dac0Output, Dac1Output),
|
||||
|
||||
lockin: Lockin,
|
||||
lockin: Lockin<U2>,
|
||||
}
|
||||
|
||||
#[init]
|
||||
|
|
Loading…
Reference in New Issue