Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ARM?? Cortex?? M4 Cookbook

You're reading from  ARM?? Cortex?? M4 Cookbook

Product type Book
Published in Mar 2016
Publisher Packt
ISBN-13 9781782176503
Pages 296 pages
Edition 1st Edition
Languages
Author (1):
Dr. Mark Fisher Dr. Mark Fisher
Profile icon Dr. Mark Fisher
Toc

Table of Contents (16) Chapters close

ARM Cortex M4 Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
A Practical Introduction to ARM CORTEX C Language Programming Programming I/O Assembly Language Programming Data Conversion Multimedia Support Real-Time Signal Processing Real-Time Embedded Systems Embedded Toolchain Index

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 recipe and name the folder codecDemo_C6v1.

  2. Open the RTE manager and add Board Support for Buttons (API) and LED (API). Click Resolve and OK.

  3. Add a function named setVolume() to the codec_CS42L52.c file:

    static void setVolume(int32_t vol) {
      
    ...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime