lockin: let the lowpass do all filtering
This commit is contained in:
parent
07b7751dbc
commit
f050ba8e9f
@ -118,12 +118,12 @@ const APP: () = {
|
||||
.zip(Accu::new(sample_phase, sample_frequency))
|
||||
// Convert to signed, MSB align the ADC sample, update the Lockin (demodulate, filter)
|
||||
.map(|(&sample, phase)| {
|
||||
let s = (sample as i16 as i32)
|
||||
<< (15 - design_parameters::SAMPLE_BUFFER_SIZE_LOG2 + 1);
|
||||
let s = (sample as i16 as i32) << (15 + 1);
|
||||
lockin.update(s, phase, time_constant)
|
||||
})
|
||||
// Decimate
|
||||
.sum();
|
||||
.last()
|
||||
.unwrap();
|
||||
|
||||
let conf = "frequency_discriminator";
|
||||
let output = match conf {
|
||||
|
@ -101,12 +101,12 @@ const APP: () = {
|
||||
.zip(Accu::new(sample_phase, sample_frequency))
|
||||
// Convert to signed, MSB align the ADC sample, update the Lockin (demodulate, filter)
|
||||
.map(|(&sample, phase)| {
|
||||
let s = (sample as i16 as i32)
|
||||
<< (15 - design_parameters::SAMPLE_BUFFER_SIZE_LOG2 + 1);
|
||||
let s = (sample as i16 as i32) << (15 + 1);
|
||||
lockin.update(s, phase, time_constant)
|
||||
})
|
||||
// Decimate
|
||||
.sum();
|
||||
.last()
|
||||
.unwrap();
|
||||
|
||||
for value in dac_samples[1].iter_mut() {
|
||||
*value = (output.arg() >> 16) as u16 ^ 0x8000;
|
||||
|
Loading…
Reference in New Issue
Block a user