Create a Web-Enabled Digital Photo Frame: Step 9
Adding Application Code for Web Photo Frame
Generate Web Server Source Files
The web server is hosted inside the Flash memory (NVM), from address 0xD100000.
The file system source files and folder can be found in the folder firmware\src\website_files\.
These need to be converted into C code. The TCP/IP Stack comes with a utility for this called MPFS generator.
Create Web Server Files Using TCP/IP MPFS Generator
The web server .c file that is holding the Flash representation of the Microchip File System can be generated using the utility that comes with the net package in MPLAB® Harmony.
Launch Tool
Execute the following file: Harmony\v3\net\utilities\mpfs_generator\mpfs_net.jar.
Update Folders
Configure the source folder to point to the firmware\src\website_files and the target folder to the src folder of the project, pic32mzef_web_photo_frame\firmware\src.
Code generation consists of creating the following files into the project:
- http_net_print.c
- http_net_print.h
- mpfs_net_img.c
Increase Buffers
Because the web server uses dynamic variables processing to send the image file to the browser, the buffers need to be increased to speed up the loading of the images. To do so, after the code has been generated, open the http_net_print.h file and change the buffer size to 1500 bytes:
Copy Image Files to SD Card
Add Web Photo Frame Application Code
Add the missing .c file to MPLAB X Project Virtual Folder called Source Files.
- app_file_handler.c
Add the missing .h files to MPLAB X Project Virtual Folder called Header Files.
- app_file_handler.h
Generate Graphics Source Code, Build and Program
Click Generate in the Composer.
The console should output success messages.
Leave the composer open.
Go to MPLAB X IDE and click Generate from the Resource Management tab.
Then build and program.