The fixedfrequencydac object represents a 12-bit fixed-frequency digital-to-analog converter (DAC). It is only available on the imp001, imp002 and imp003. It is not available on the imp005. While the imp004m also lacks a true fixed-frequency DAC, it is nevertheless possible to use this API for audio output provided your device is running impOS™ 38 or above and is fitted with a simple filter circuit. For more details, please see the fixedfrequencydac.configure() documentation.
fixedfrequencydac is instantiated automatically by impOS at start-up as a property of the hardware object. Though the object is instantiated for you, you must configure it before use. The DAC can be configured to output on either pin 1 or 5 (imp001, imp002), or pin A or C (imp003) at a specified sample rate. The imp004m’s DAC emulation is output on pins K and D, which are specified using the object hardware.pwmpairKD. Optionally, the source buffers can be A-law compressed, in which case the data is decompressed on the fly.
When each buffer has been consumed, a nominated function is called automatically. This data-consumed callback is registered using fixedfrequencydac.configure() and must be implemented if you plan to use an imp DAC.
Consumption of the data by the DAC proceeds ‘in the background’, under interrupt. To stop the fixed-frequency DAC after a certain time, set a timer using imp.wakeup(). This is demonstrated in the examples included with the fixedfrequencydac methods.
Note The fixedfrequencydac is not currently available to versions of impOS running on the impC001.
The fixedfrequencydac object has the following member methods: