USB Flash Drive Audio Player Tutorial: Step 8

Step 8: Include Application Specific Source Code and Files

1

Copy the following application source files into the folder containing the project's source files:
app_thumb_drive_audio_task.c,
app_thumb_drive_audio_task.h,
app_display_task.c,
app_display_task.h,
decoder.c, and
decoder.h.
Copy them from this folder:
apps/training/middleware/thumb_drive_player/thumb_drive_player_lab/dev_files
to this one:
apps/training/middleware/dev/thumb_drive_player/thumb_drive_player_lab/firmware/src

image_86.png

2

Add app_thumb_drive_audio_task.c, app_display_task.c, and decoder.c to the Source Files/app folder (in the MPLAB X IDE Projects pane) by right-clicking and selecting Add Existing Item…

image_87.png
image_88.png

3

Add app_thumb_drive_audio_task.h, app_display_task.h, and decoder.h to the Header Files/app folder by right-clicking and selecting Add Existing Item…

image_89.png
image_90.png

The files under the project should look like this:

image_91.png

4

This step is needed to work around an issue in Harmony version 1.08. This version locates the audio decoder libraries in a demo application under the …/v1.08/apps folder. These libraries should instead be located under the …/v1.08/framework folder. It is expected that version 1.09 will address this issue.

Harmony version 1.08 provides audio decoder libraries in one of the many demo applications that are included in the Harmony download. They can be found here:
<HarmonyInstallPath>/apps/audio/universal_audio_decoders/firmware/src/audio_decoder.
Note: Harmony version 1.09 will move these libraries under the …/framework/decoder folder. If you are using a newer version, you can skip this step.

Your project needs to use the WAV decoder found in the universal_audio_decoders demo application. Let the compiler know where it can find these source files.

To include this path, right-click on thumb_drive_player_lab in the Projects pane and select Properties. In the Categories pane, select:
Conf: [pic32mz_ef_sk_meb2] > XC32 (Global Options) > xc32-gcc.

In the Option categories dropdown menu, select Preprocessing and messages.

image_92.png

Click on Include directories.

image_93.png

Browse to this path:
<HarmonyInstallPath>/apps/audio/universal_audio_decoders/firmware/src/audio_decoder.
Click OK.

image_94.png
image_95.png

5

Open app.c (double-click on the file name in the Projects pane) and add the following code to the APP_Initialize function. This code initializes the APP_THUMB_DRIVE_AUDIO and APP_DISPLAY tasks.

image_96.png

6

Add the following code to the APP_STATE_SERVICE_TASKS state to service the THUMB_DRIVE_AUDIO and DISPLAY tasks:

image_97.png

7

Open the app.h file and include this file:
app_thumb_drive_audio_task.h.
The decoder file wav.c depends on definitions present in other files and expects app.h to include those files.

image_98.png

8

Open system_config.h and include the following application specific definitions:

image_99.png

9

Save all files before closing.

10

You are now ready to build the code! Click the Clean and Build Main_Rebuild_Project.png icon and verify that the project builds successfully.


Next Step >

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.