diff options
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs index fc35c58..54f7171 100644 --- a/src/main.rs +++ b/src/main.rs @@ -89,17 +89,17 @@ impl DDS { let incr = 1.0f32 / TRIG_TABLE_LEN as f32; for i in 0..TRIG_TABLE_LEN { - let i = f32::cos(incr * i as f32 * 2.0 * PI) * 127.0; - let q = f32::sin(incr * i as f32 * 2.0 * PI) * 127.0; + let inphase = f32::cos(incr * i as f32 * 2.0 * PI) * 127.0; + let quadrature = f32::sin(incr * i as f32 * 2.0 * PI) * 127.0; match waveform { Waveform::Sine => { - trig_table_inphase.push(f32::round(i) as i8); - trig_table_quadrature.push(f32::round(q) as i8); + trig_table_inphase.push(f32::round(inphase) as i8); + trig_table_quadrature.push(f32::round(quadrature) as i8); } Waveform::Rect => { - trig_table_inphase.push(if i >= 0.0 { 127 } else { -127 }); - trig_table_quadrature.push(if q >= 0.0 { 127 } else { -127 }); + trig_table_inphase.push(if inphase >= 0.0 { 127 } else { -127 }); + trig_table_quadrature.push(if quadrature >= 0.0 { 127 } else { -127 }); } } } |