Reverting changeset
This commit is contained in:
parent
3088a002c0
commit
da9ca81856
10
src/iir.rs
10
src/iir.rs
|
@ -105,14 +105,4 @@ impl IIR {
|
|||
xy[xy.len() / 2] = y0;
|
||||
y0
|
||||
}
|
||||
|
||||
pub fn update_from_adc_sample(
|
||||
&mut self,
|
||||
sample: u16,
|
||||
state: &mut IIRState,
|
||||
) -> u16 {
|
||||
let x0 = f32::from(sample as i16);
|
||||
let y0 = self.update(state, x0);
|
||||
y0 as i16 as u16 ^ 0x8000
|
||||
}
|
||||
}
|
||||
|
|
16
src/main.rs
16
src/main.rs
|
@ -742,11 +742,19 @@ const APP: () = {
|
|||
c.resources.adcs.transfer_complete_handler();
|
||||
|
||||
for (adc0, adc1) in adc0_samples.iter().zip(adc1_samples.iter()) {
|
||||
let result_adc0 = c.resources.iir_ch[0]
|
||||
.update_from_adc_sample(*adc0, &mut c.resources.iir_state[0]);
|
||||
let result_adc0 = {
|
||||
let x0 = f32::from(*adc0 as i16);
|
||||
let y0 = c.resources.iir_ch[0]
|
||||
.update(&mut c.resources.iir_state[0], x0);
|
||||
y0 as i16 as u16 ^ 0x8000
|
||||
};
|
||||
|
||||
let result_adc1 = c.resources.iir_ch[1]
|
||||
.update_from_adc_sample(*adc1, &mut c.resources.iir_state[1]);
|
||||
let result_adc1 = {
|
||||
let x1 = f32::from(*adc1 as i16);
|
||||
let y1 = c.resources.iir_ch[1]
|
||||
.update(&mut c.resources.iir_state[1], x1);
|
||||
y1 as i16 as u16 ^ 0x8000
|
||||
};
|
||||
|
||||
c.resources
|
||||
.dacs
|
||||
|
|
Loading…
Reference in New Issue