static int AOA_Host_getchar_Blocking(FILE* Stream) { int16_t ReceivedByte; while ((ReceivedByte = AOA_Host_ReceiveByte((USB_ClassInfo_AOA_Host_t*)fdev_get_udata(Stream))) < 0) { if (USB_HostState == HOST_STATE_Unattached) return _FDEV_EOF; AOA_Host_USBTask((USB_ClassInfo_AOA_Host_t*)fdev_get_udata(Stream)); USB_USBTask(); } return ReceivedByte; }
/** Main program entry point. This routine configures the hardware required by the application, then * enters a loop to run the application tasks in sequence. */ 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); GlobalInterruptEnable(); for (;;) { AOAHost_Task(); AOA_Host_USBTask(&AndroidDevice_AOA_Interface); USB_USBTask(); } }