DM240415 Microchip Technology, DM240415 Datasheet - Page 24

Accessory Development Starter Kit For Android General Purpose

DM240415

Manufacturer Part Number
DM240415
Description
Accessory Development Starter Kit For Android General Purpose
Manufacturer
Microchip Technology
Series
-r
Datasheet

Specifications of DM240415

Processor To Be Evaluated
PIC24FJ256GB110-I/PT
Processor Series
PIC24F
Data Bus Width
16 bit
Interface Type
USB
Operating Supply Voltage
3.3 V
Design Resources
PIC24F ADK Schematic
Main Purpose
Reference Design, Tablet
Embedded
Yes, MCU, 16-Bit
Utilized Ic / Part
PIC24F
Primary Attributes
Android OS, Development Platform for Accessories, Arduino Compatible
Secondary Attributes
Royalty Free, No Fee Licensed Software Library
Lead Free Status / Rohs Status
 Details

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
DM240415
Manufacturer:
MICROCHIP
Quantity:
12 000
Microchip's Accessory Framework for Android(tm)
4.2.6
Receiving data from the Android device is very similar to sending data. There are two functions that are used:
AndroidAppIsReadComplete (
The AndroidAppRead (
situation where the Android device is the USB peripheral, this will initiate an IN request on the bus. If the Android device
doesn't have any information it will respond with NAKs. One key thing to know about the read function is that the buffer
passed to the read function must always be able to receive at least one packets worth of USB data. For full-speed USB
devices this is 64 bytes.
The AndroidAppIsReadComplete (
The read request will terminate if a couple of conditions occur. The first is if the total number of bytes requested has been
read. The second is if a packet with less than the maximum packet length is received. This typically indicates that fewer
bytes than requested are available and that no more packets are immediately pending. While this is true for most cases, it
may not be true for every case. If the target application is one of those exceptions, keep in mind that you may have to call
the read function multiple times in order to receive a complete transmission from the applications perspective. Remember
from the Keeping the Stack Running (
keep the stack running. This means that you shouldn't loop on the AndroidAppIsReadComplete (
function. Instead use either a state machine or booleans to indicate what you need to do.
}
while(1)
{
Receiving Data
}
if((buttonsNeedUpdate == TRUE) && (writeInProgress == FALSE))
{
}
//Keep the stack running
USBTasks();
//Do some extra stuff here
if(readInProgress == FALSE)
{
if(AndroidAppIsWriteComplete(device_handle, &errorCode, &size) == TRUE)
{
}
response_packet.command = COMMAND_UPDATE_PUSHBUTTONS;
response_packet.data = pushButtonValues;
errorCode = AndroidAppWrite(device_handle,(BYTE*)&response_packet, 2);
if( errorCode != USB_SUCCESS )
{
}
else
{
}
errorCode = AndroidAppRead(device_handle,
//If the device is attached, then lets wait for a command from the application
writeInProgress = FALSE;
if(errorCode != USB_SUCCESS)
{
}
DEBUG_ERROR("Error trying to send button update");
buttonsNeedUpdate = FALSE;
writeInProgress = TRUE;
//Error
DEBUG_ERROR("Error trying to complete write");
see page 23)() function is used to start a read request from the Android device. In the
see page 21)() and AndroidAppRead (
see page 17) section that the USBTasks() function needs to be called in order to
see page 21)() function is used to determine if a read request was completed.
(BYTE*)&command_packet,
(DWORD)sizeof(ACCESSORY_APP_PACKET));
see page 23)().
see page 21)()
19
19
4

Related parts for DM240415