How to use the audio codec

Listening to the beep generated by codecDemo_c6v0 gets very annoying after a couple of minutes, so we will try and improve matters by adding a couple of functions that will enable us to change and mute the volume. We'll also modify the code to use the beep generator to play a tune. We're limited to a fairly simple tune because the beep generator only generates audio frequencies across two octave major scales. For those who are musically minded, we define the mapping between notes (pitch) and beep frequencies, and the beep ON time (see section 6.21 of the data sheet) as well, in the codec_CS42L52.h header file. We call this recipe codecDemo_c6v1.

How to do it…

Follow the outlined steps to use the audio codec:

  1. Clone the previous ...

Get ARM® Cortex® M4 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.