[riot-notifications] [RIOT-OS/RIOT] drivers/periph_common: dac: add dac_play() (#13908)

benpicco notifications at github.com
Mon Nov 30 15:35:01 CET 2020


@benpicco commented on this pull request.



> + * @brief       Use a DAC to play a buffer of samples
+ *
+ *              A buffer of (audio) samples can be played on a DAC with
+ *              a given sample rate.
+ *              To supply a steady stream of samples, a double buffer is
+ *              used.
+ *              While buffer A is played on the DAC the user can fill buffer
+ *              B with the next batch of samples by calling @ref dac_dds_play
+ *              again. Once buffer A has finished playing, buffer B will
+ *              automatically be used instead.
+ *
+ *              A callback can be registered that signals when the next buffer
+ *              is ready to be filled.
+ *              Do not do the actual buffer filling inside the callback as this
+ *              is called from the timer context that is used to play the samples.
+ *              Instead, use it to wake a thread that then provides the samples

Oh it seems like that comment is misleading.
`dac_dds_play()` should absolutely be called inside the callback if the buffer is ready. What I meant is that reading the data into the buffer (e.g. from a file on SD card or generated at run-time) should not be done inside the interrupt. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/13908#discussion_r532640922
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201130/fa7cd299/attachment.htm>


More information about the notifications mailing list