While we need the DAC to output 0..255 with "zero" in the middle, in the firmware itself we are free to use any representation we want. To simplify some of the signal processing math, we should switch to using int8_t in the wave table and the DSP math.
The
sine_wave
array is only used in theget_wave
function that converts the passed in phase (in 8.8 fixed point) to a sine wave value. All the complicated math is done on the phase and not the wave value. So, converting to int8_t doesn't improve the DSP math (at least for now). It does, however, push the +128 offset to get a reasonable DAC value all the way to the DAC writing code.
I have a prototype (b5c951a410d1), but need to check that it works.