参数资料
型号: DM240415
厂商: Microchip Technology
文件页数: 25/63页
文件大小: 0K
描述: ACCESSORY DEVELOPMENT START KIT
设计资源: PIC24F ADK Schematic
特色产品: DM240415 Android? Accessory Starter Kit
标准包装: 1
主要目的: 参考设计,平板式
嵌入式: 是,MCU,16 位
已用 IC / 零件: PIC24F
主要属性: 机器人 OS,附件开发平台,兼容 Arduino
次要属性: 免版税,免软件库许可费
已供物品: 电路板,适配器,调试程序,电源,软件
Microchip's Accessory Framework for Android(tm)
20
if (AndroidAppIsWriteComplete(device_handle, &errorCode, &size) == TRUE)
{
writeInProgress = FALSE;
if (errorCode != USB_SUCCESS)
{
//Error
DEBUG_ERROR("Error trying to complete write");
}
}
}
if ((buttonsNeedUpdate == TRUE) && (writeInProgress == FALSE))
{
response_packet.command = COMMAND_UPDATE_PUSHBUTTONS;
response_packet.data = pushButtonValues;
errorCode = AndroidAppWrite(device_handle,(BYTE*)&response_packet, 2);
if ( errorCode != USB_SUCCESS )
{
DEBUG_ERROR("Error trying to send button update");
}
else
{
buttonsNeedUpdate = FALSE;
writeInProgress = TRUE;
}
}
}
4.2.6 Receiving Data
Receiving data from the Android device is very similar to sending data. There are two functions that are used:
see page 24)() .
see page 24)() function is used to start a read request from the Android device. In the
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.
see page 22)() function is used to determine if a read request was completed.
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
see page 18) section that the USBTasks() function needs to be called in order to
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)
see page 22)()
4
{
//Keep the stack running
USBTasks();
//Do some extra stuff here
if (readInProgress == FALSE)
{
errorCode = AndroidAppRead(device_handle,
(BYTE*)&command_packet,
(DWORD) sizeof (ACCESSORY_APP_PACKET));
//If the device is attached, then lets wait for a command from the application
20
相关PDF资料
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
相关代理商/技术参数
参数描述
DM2410-0AL1 制造商:未知厂家 制造商全称:未知厂家 功能描述:Optoelectronic
DM2410-0BL1 制造商:未知厂家 制造商全称:未知厂家 功能描述:Optoelectronic
DM2410-0CL1 制造商:未知厂家 制造商全称:未知厂家 功能描述:Optoelectronic
DM2410-0DL1 制造商:未知厂家 制造商全称:未知厂家 功能描述:Optoelectronic
DM2410-0GL1 制造商:未知厂家 制造商全称:未知厂家 功能描述:Optoelectronic