Working with probably near max speed from CPU feeding TX. Need DMA
This commit is contained in:
25
src/main.rs
25
src/main.rs
@@ -117,10 +117,17 @@ fn main() -> ! {
|
||||
// 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 processed_wave_table = [0u32; 256];
|
||||
let mut processed_wave_table = [0u32; 64];
|
||||
|
||||
for (i, w) in WAVE_TABLE.iter().enumerate() {
|
||||
processed_wave_table[i] = ((*w as i32) + 127) as u32;
|
||||
for i in 0..256 {
|
||||
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");
|
||||
@@ -129,19 +136,9 @@ fn main() -> ! {
|
||||
// PIO runs in background, independently from CPU
|
||||
loop {
|
||||
while !tx.is_full() {
|
||||
let mut out = 0;
|
||||
|
||||
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);
|
||||
let out = processed_wave_table[tick % 64];
|
||||
tick = tick.wrapping_add(1);
|
||||
// println!("{}", val);
|
||||
}
|
||||
tx.write(out);
|
||||
}
|
||||
|
||||
// pgroup.set_u32(out.rotate_left(6));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user