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).

2

The application states corresponding to the state machine are as follows:

application_states.png

The application states are explained in the next section.

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:

application_ds.png
  • 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.



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.