/** Task to manage an enumerated USB Android Accessory device once connected, to print received data
 *  from the device to the serial port.
 */
void AOAHost_Task(void)
{
	if (USB_HostState != HOST_STATE_Configured)
	  return;

	if (AOA_Host_BytesReceived(&AndroidDevice_AOA_Interface))
	{
		/* Echo received bytes from the attached device through the USART */
		int16_t ReceivedByte = AOA_Host_ReceiveByte(&AndroidDevice_AOA_Interface);
		if (!(ReceivedByte < 0))
		  putchar(ReceivedByte);
	}
}
/** Task to manage an enumerated USB Android Accessory device once connected, to print received data
 *  from the device to the serial port.
 */
void AOAHost_Task(void)
{
	if (USB_HostState != HOST_STATE_Configured)
	  return;

	if (AOA_Host_BytesReceived(&AndroidDevice_AOA_Interface))
	{
		/* Echo received bytes from the attached device through the USART */
		int16_t ReceivedByte = AOA_Host_ReceiveByte(&AndroidDevice_AOA_Interface);
		if (!(ReceivedByte < 0))
		{
			/* Turn on and off LED1 based on the bytes received */
			LEDs_ChangeLEDs(LEDS_LED1, ReceivedByte ? LEDS_LED1 : LEDS_NO_LEDS);

			putchar(ReceivedByte);
		}
	}
}