Working with probably near max speed from CPU feeding TX. Need DMA

This commit is contained in:
JP Stringham
2026-02-22 13:57:09 -05:00
parent 6751fb88ef
commit 3465353ad1

View File

@@ -117,10 +117,17 @@ fn main() -> ! {
// let pgroup = pgroup.add_pin(pins.gpio12.into_push_pull_output()); // let pgroup = pgroup.add_pin(pins.gpio12.into_push_pull_output());
// let mut pgroup = pgroup.add_pin(pins.gpio13.into_push_pull_output()); // let mut pgroup = pgroup.add_pin(pins.gpio13.into_push_pull_output());
let mut processed_wave_table = [0u32; 256]; let mut processed_wave_table = [0u32; 64];
for (i, w) in WAVE_TABLE.iter().enumerate() { for i in 0..256 {
processed_wave_table[i] = ((*w as i32) + 127) as u32; let mut packed = 0u32;
for j in 0..4 {
let val = (WAVE_TABLE[i] as i32) + 127;
let val = val as u32;
packed |= val.rotate_right(8 * j as u32);
}
processed_wave_table[i / 4] = packed;
} }
println!("alive"); println!("alive");
@@ -129,19 +136,9 @@ fn main() -> ! {
// PIO runs in background, independently from CPU // PIO runs in background, independently from CPU
loop { loop {
while !tx.is_full() { while !tx.is_full() {
let mut out = 0; let out = processed_wave_table[tick % 64];
for i in 0..4 {
let val = processed_wave_table[tick % 256];
out |= val.rotate_right(8 * i);
// out |= ((tick % 256) as u32).rotate_right(8 * i);
tick = tick.wrapping_add(1); tick = tick.wrapping_add(1);
// println!("{}", val);
}
tx.write(out); tx.write(out);
} }
// pgroup.set_u32(out.rotate_left(6));
} }
} }