123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- #include "HostApplication.h"
- int main(void)
- {
- SetupHardware();
- GlobalInterruptEnable();
- for (;;)
- {
- USB_USBTask();
- }
- }
- void SetupHardware(void)
- {
-
- MCUSR &= ~(1 << WDRF);
- wdt_disable();
-
- clock_prescale_set(clock_div_1);
-
- USB_Init(USB_MODE_Host, USB_DEVICE_OPT_FULLSPEED | USB_OPT_AUTO_PLL);
- }
- void EVENT_USB_Host_DeviceAttached(void)
- {
- }
- void EVENT_USB_Host_DeviceUnattached(void)
- {
- }
- void EVENT_USB_Host_DeviceEnumerationComplete(void)
- {
- uint16_t ConfigDescriptorSize;
- uint8_t ConfigDescriptorData[512];
- if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,
- sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)
- {
- return;
- }
- if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
- {
- return;
- }
- }
- void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
- {
- USB_Disable();
- for(;;);
- }
- void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
- const uint8_t SubErrorCode)
- {
- }
- uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
- const uint16_t wIndex,
- const void** const DescriptorAddress
- #if defined(HAS_MULTIPLE_DESCRIPTOR_ADDRESS_SPACES)
- , uint8_t* const DescriptorMemorySpace
- #endif
- )
- {
- return 0;
- }
|