Datasheet
// Client Driver Function Pointer Table for the USB Embedded Host foundation
// *****************************************************************************
CLIENT_DRIVER_TABLE usbClientDrvTable[] =
{
{
AndroidAppInitialize,
AndroidAppEventHandler,
AndroidAppDataEventHandler,
0
}
};
For more information about the usb_config.c file, please refer to the MCHPFSUSB documentation available in the installation
found at www.microchip.com/mal.
4.2.2 Initialization
There are two main steps to initializing the firmware. The first is to initialize the USB host stack. This is done via the
USBInitialize()
function as seen below:
USBInitialize(0);
The second step that is required for the initialization is for the application to describe the accessory to the Android client
driver so that it can pass this information to the Android device when attached. This is done through the
AndroidAppStart ( see page 25)()
function. This function takes in a pointer an
ANDROID_ACCESSORY_INFORMATION ( see page 34)
structure which contains all of the information about the
accessory. An example is seen below:
//Define all of my string information here
char manufacturer[] = "Microchip Technology Inc.";
char model[] = "Basic Accessory Demo";
char description[] = "ADK - Accessory Development Starter Kit for Android (PIC24F)";
char version[] = "1.0";
char uri[] = "http://www.microchip.com/android";
char serial[] = "N/A";
//Pack all of the strings and their lengths into an
// ANDROID_ACCESSORY_INFORMATION structure
ANDROID_ACCESSORY_INFORMATION myDeviceInfo =
{
manufacturer,
sizeof(manufacturer),
model,
sizeof(model),
description,
sizeof(description),
version,
sizeof(version),
uri,
sizeof(uri),
serial,
sizeof(serial)
};
int main(void)
{
//Initialize the USB host stack
USBInitialize(0);
//Send my accessory information to the Android client driver.
AndroidAppStart(&myDeviceInfo);
//Go on with my application here...
Note that the
AndroidAppStarter()
function should be called before the Android device is attached. It is recommended
to call this function after initializing the USB Android client driver but before calling the
USBTasks()
function.
Microchip's Accessory Framework for Android(tm) 17
17
4