Live PhotoFrame Tutorial: Step 9
Step 9.1 - Analyzing application file app.h
1
Open file app.h from
apps\training\middleware\dev\web_photoframe\web_photoframe_lab\firmware\src\app.h.
This file defines application states, data, and Application Programming Interfaces (APIs).
3
The app.h file also defines the global application data structure which is used by the application.
You can find a snapshot of the application data structure below:
- fileHandle: This variable is used by the filesystem for its file operations
- state: This variable holds the current state of the application.
- drvHandle: This variable holds the driver handle.
Step 9.2 - Analyzing application file app.c
1
Open file app.c from
apps\training\middleware\dev\live_photoframe\live_photoframe_lab\firmware\src\app.c.
This file contains the application state machine and implements the functions. A brief description of the application states follows.
- APP_MOUNT_DISK: In this state, an event handler (APP_SYSFS_EventHandler) is registered with the FileSystem. This event handler is invoked if there is a "Mount" or "Unmount" of the SD Card media.
- APP_STATE_MEDIA_UNMOUNTED: The application waits for the SD Card to be successfully detected and mounted.
- APP_TCPIP_WAIT_INIT: The application waits for the TCP/IP stack to be ready.
- APP_CAMERA_INIT_RUN: The application initializes the camera driver and starts the camera module.
- APP_TCPIP_TRANSACT: The application checks to see if there is an IP change and will communicate to the USB console. Also, an LED is toggled in this state.
- APP_STATE_CAPTURE: This application state will write the frame buffer contents to a file on a key-press event.