Step 5: Include Application-specific Source Files, Add Required Code, and Build the Project

Last modified by Microchip on 2024/02/06 12:51

The app_button_press_task.c and app_button_press_task.h files are no longer needed as their functionality will be replaced by the radio buttons on the display. Right-click on these files and select Remove From Project.

Remove from project

Remove from project

Back to Top


Copy source files into your project's Source Files folder:

  • app_display_task.c

  • app_display_task.h

Copy them from this folder:
apps/training/solutions/audio_player/audio_player_lab5/dev_files
to this one:
apps/training/solutions/dev/audio_player/audio_player_lab5/firmware/src.

Copy source files into your project's Source Files folder

Back to Top


Add the copied source files to your project.

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

Add existing item

Select item

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

Add existing item

Select item

The files under the project should look like this:

List of files

Back to Top


As you did in the previous labs, modify the app.c and app.h files from audio_player_lab4 to replace the Button task-related API with the Display task-related API in APP_Initialize and APP_Tasks functions.

Application prototype

Application initialize

Application tasks

Also, modify app.h to include app_sdcard_audio_task.h and app_display_task.h.

Modify App.h

Back to Top


Now that you have added graphics to this lab, the SD card audio task needs to notify the display task whenever the tracks list is updated. Open the app_sdcard_audio_task.c file and add the following function call under the APP_SDCARD_AUDIO_CARD_STATE_INIT state.

SD card change

Back to Top


Save all the files before closing.

Back to Top


Now, you are ready to build the code. Click the Clean and Build rebuild-project icon icon and verify that the project builds successfully.

Back to Top