funkGenie is an example of a function generator running on Arduino Due. It is based on user MarkT's work on "Example of driving ADC and DAC from timer for regular sampling".
It can output sine, square, triangle and sawtooth waves. Sine and triangle are wavetable based while square and sawtooth are calculated directly. Linear interpolation is also done if necessary. It is far from perfect but does output fairly decent waveshapes up to a few kHz. At higher frequencies the shape of the wave gets less samples per cycle and will be distorted.
The code is too long to post directly here so I'm hosting it in my git repo here.
Feel free to contact me if you have improvement ideas etc.