/* Task to set the configuration of the attached device after it has been enumerated.  */
void AndroidHost_Task(void)
/* Task to set the configuration of the attached device after it has been enumerated.  */
void AndroidHost_Task(void)
{
	if (USB_HostState != HOST_STATE_Configured)
	  return;
	Pipe_SelectPipe(ANDROID_DATA_IN_PIPE);
	Pipe_Unfreeze();
	if (Pipe_IsINReceived())
	{
		Pipe_Freeze();
		if (Pipe_IsReadWriteAllowed())
		{
			uint8_t NextReceivedByte = Pipe_Read_8();
			uint8_t LEDMask          = LEDS_NO_LEDS;
			if (NextReceivedByte & 0x01)
			  LEDMask |= LEDS_LED1;
			if (NextReceivedByte & 0x02)
			  LEDMask |= LEDS_LED2;
			if (NextReceivedByte & 0x04)
			  LEDMask |= LEDS_LED3;
			if (NextReceivedByte & 0x08)
			  LEDMask |= LEDS_LED4;
			LEDs_SetAllLEDs(LEDMask);
		}
		else
		{
			Pipe_ClearIN();
		}
	}
	Pipe_Freeze();
}