Microchip's Accessory Framework for Android(tm)
17
// 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
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
25)()
function.
This
function
takes
in
a
pointer
an
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.
17
4
相关PDF资料
DM300004-2 BOARD DEMO DSPICDEM.NET 2
DM300014 BOARD DEMO DSPICDEM 1.1 GEN PURP
DM300016 BOARD DEMO DSPICDEM STARTER
DM300017 BOARD DEMO DSPICDEM STARTER
DM300020 BOARD DEV DSPICDEM MC1 MOTORCTRL
DM300021 MODULE PWR DSPICDEM MC1H HV 3PHS
DM300022 MODULE PWR DSPICDEM MC1L LV 3PHS
DM320002 BOARD EXPANSION PIC32 I/O
相关代理商/技术参数
DM2410-0AL1 制造商:未知厂家 制造商全称:未知厂家 功能描述:Optoelectronic
DM2410-0BL1 制造商:未知厂家 制造商全称:未知厂家 功能描述:Optoelectronic
DM2410-0CL1 制造商:未知厂家 制造商全称:未知厂家 功能描述:Optoelectronic
DM2410-0DL1 制造商:未知厂家 制造商全称:未知厂家 功能描述:Optoelectronic
DM2410-0GL1 制造商:未知厂家 制造商全称:未知厂家 功能描述:Optoelectronic
DM2410-0HL1 制造商:未知厂家 制造商全称:未知厂家 功能描述:Optoelectronic
DM2410-0SL1 制造商:未知厂家 制造商全称:未知厂家 功能描述:Optoelectronic
DM2410-1AL1 制造商:未知厂家 制造商全称:未知厂家 功能描述:Optoelectronic