Add basic Android host application to the Android Accessory Host class driver demo.
This commit is contained in:
parent
707934d9cb
commit
5a3baec455
39 changed files with 391 additions and 5 deletions
|
@ -53,7 +53,7 @@ USB_ClassInfo_AOA_Host_t AndroidDevice_AOA_Interface =
|
|||
{
|
||||
.Address = (PIPE_DIR_OUT | 2),
|
||||
.Banks = 1,
|
||||
},
|
||||
},
|
||||
.PropertyStrings =
|
||||
{
|
||||
[AOA_STRING_Manufacturer] = "Dean Camera",
|
||||
|
@ -73,7 +73,7 @@ USB_ClassInfo_AOA_Host_t AndroidDevice_AOA_Interface =
|
|||
int main(void)
|
||||
{
|
||||
SetupHardware();
|
||||
|
||||
|
||||
puts_P(PSTR(ESC_FG_CYAN "Android Accessory Host Demo running.\r\n" ESC_FG_WHITE));
|
||||
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
|
||||
|
@ -120,7 +120,12 @@ void AOAHost_Task(void)
|
|||
/* Echo received bytes from the attached device through the USART */
|
||||
int16_t ReceivedByte = AOA_Host_ReceiveByte(&AndroidDevice_AOA_Interface);
|
||||
if (!(ReceivedByte < 0))
|
||||
putchar(ReceivedByte);
|
||||
{
|
||||
/* Turn on and off LED1 based on the bytes received */
|
||||
LEDs_ChangeLEDs(LEDS_LED1, ReceivedByte ? LEDS_LED1 : LEDS_NO_LEDS);
|
||||
|
||||
putchar(ReceivedByte);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +160,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void)
|
|||
{
|
||||
puts_P(PSTR("Error Retrieving Device Descriptor.\r\n"));
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
bool NeedModeSwitch;
|
||||
|
@ -165,7 +170,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void)
|
|||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (NeedModeSwitch)
|
||||
{
|
||||
puts_P(PSTR("Not in Accessory mode, switching...\r\n"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue