Step 7: Include Application Specific Source Code and Files
1
Copy the following application source files into the folder containing the project's source files:
app_voice_record_loop.c,
app_voice_record_loop.h,
app_voice_record_store.c,
app_voice_record_store.h,
app_sdcard_audio_task.c,
app_sdcard_audio_task.h,
decoder.c,
decoder.h,
app_display_task.c, and
app_display_task.h
from this folder:
apps/training/middleware/voice_recorder/voice_recorder_lab/dev_files
to this one:
apps/training/middleware/dev/voice_recorder/voice_recorder_lab/firmware/src.
2
Add
app_voice_record_loop.c,
app_voice_record_store.c,
app_sdcard_audio_task.c,
decoder.c, and
app_display_task.c
to the Source Files/app folder (in the MPLAB® X IDE Projects pane) by right clicking and selecting Add Existing Items…
3
Add
app_voice_record_loop.h,
app_voice_record_store.h,
app_sdcard_audio_task.h,
decoder.h, and
app_display_task.h
to the Header Files/app folder by right clicking and selecting Add Existing Item…
The files under the project should look like this:
4
This step is needed to work around an issue related to Harmony version 1.08. The I²S driver file drv_i2s_dma.c needs to be replaced. If you are using a newer version, you may skip this step.
Replace the existing Harmony I²S driver file drv_i2s_dma.c.
Copy the drv_i2s_dma.c file from this folder:
apps/training/middleware/voice_recorder/voice_recorder_lab/dev_files/i2s
to this one:
framework/driver/i2s/src/dynamic
Make sure to create a backup of the existing drv_i2s_dma.c.
5
This step is needed to work around an issue related to 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 anticipated that Harmony 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:
<Harmony install path>/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 v1.09, 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.
Click on Include directories.
Browse (click on the … button) to this path:
<Harmony install path>/apps/audio/universal_audio_decoders/firmware/src/audio_decoder and
Click OK.
6
Open the file app.c (in the MPLAB X IDE Projects pane under the Source Files/app folder) and add the following code to the APP_Initialize function:
7
Also in app.c, add the following tasks to the APP_STATE_SERVICE_TASKS state in the APP_Tasks function.
8
Add the following simple utility functions to app.c. You can locate these functions at the end of the file.
9
Declare the functions you added in the previous step to app.h.
10
Add the following enumerations to app.h. This typedef section can be found about a third of the way down from the top of the file.
11
Also, add the following members to the APP_DATA structure in app.h.
12
Open the app.h file and include this file:
app_sdcard_audio_task.h.
The decoder file wav.c depends on definitions present in other files and expects app.h to include those files.
13
Finally, open system_config.h and include the following application-specific definitions. You will find this section near the bottom of the file.
14