port by Thomas Friedrichsmeier
Compiles for and runs on a STM32F103C8T6 blue pill board, with a bunch of caveats (see below), i.e. on a board without a real DAC. Should probably run on any other board supported by Roger Clark's libmaple-based core (although this theory is untested).
twi_nonblock is not ported
The following audio modes (see MOZZI_AUDIO_MODE) are currently supported on this hardware:
The default mode is MOZZI_OUTPUT_PWM .
Standard pulse width modulated output to one (mono) or two (stereo, see MOZZI_AUDIO_CHANNELS) GPIO pins. Default pinout: PB8 (mono/left), PB9 (right channel in stereo). This mode uses two hardware timers: One for the PWM (Timer 4 when using the default pin configuration), and a second for updating the output at audio rate. The default audio resolution is 10 bits, which results in a carrier frequency of ~70kHz on a 72MHz CPU. On slower boards you will have to descrease this. The following settings may be costumized, if desired:
This mode is very similar to MOZZI_OUTPUT_PWM, but splitting output for a single channel across two GPIO pins for better resolution. For details on the required hardware setup, and configuration tradeoffs, see MOZZI_OUTPUT_2PIN_PWM . Stereo output is not available in this mode. Output is at 2*7 bits at up to 560kHz carrier frequency (but limited to 5 times audio rate).
Customizable configuration options:
See External audio output The (single) hardware timer claimed for MOZZI_OUTPUT_EXTERNAL_TIMED may be configured using "MOZZI_AUDIO_UPDATE_TIMER" (default: TIM2).