X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/aa640330a1b9421a16e425f5e0043a08558fb9bf..b2bdfe437762a9a88b4de1cada7f794b255b0d97:/Demos/Host/ClassDriver/MouseHost/MouseHost.c diff --git a/Demos/Host/ClassDriver/MouseHost/MouseHost.c b/Demos/Host/ClassDriver/MouseHost/MouseHost.c index 926776f23..7d241afa3 100644 --- a/Demos/Host/ClassDriver/MouseHost/MouseHost.c +++ b/Demos/Host/ClassDriver/MouseHost/MouseHost.c @@ -1,21 +1,21 @@ /* LUFA Library - Copyright (C) Dean Camera, 2009. + Copyright (C) Dean Camera, 2010. dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ /* - Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, and distribute this software - and its documentation for any purpose and without fee is hereby - granted, provided that the above copyright notice appear in all - copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -45,7 +45,10 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface = .Config = { .DataINPipeNumber = 1, + .DataINPipeDoubleBank = false, + .DataOUTPipeNumber = 2, + .DataOUTPipeDoubleBank = false, .HIDInterfaceProtocol = HID_BOOT_MOUSE_PROTOCOL, }, @@ -53,7 +56,7 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface = /** Main program entry point. This routine configures the hardware required by the application, then - * starts the scheduler to run the application tasks. + * enters a loop to run the application tasks in sequence. */ int main(void) { @@ -73,8 +76,8 @@ int main(void) uint16_t ConfigDescriptorSize; uint8_t ConfigDescriptorData[512]; - if (USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData, - sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful) + if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData, + sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful) { printf("Error Retrieving Configuration Descriptor.\r\n"); LEDs_SetAllLEDs(LEDMASK_USB_ERROR); @@ -99,7 +102,7 @@ int main(void) break; } - if (USB_HID_Host_SetBootProtocol(&Mouse_HID_Interface) != 0) + if (HID_Host_SetBootProtocol(&Mouse_HID_Interface) != 0) { printf("Could not Set Boot Protocol Mode.\r\n"); LEDs_SetAllLEDs(LEDMASK_USB_ERROR); @@ -113,31 +116,24 @@ int main(void) case HOST_STATE_Configured: if (HID_Host_IsReportReceived(&Mouse_HID_Interface)) { - USB_MouseReport_Data_t MouseReport; - uint8_t ReportID = 0; uint8_t LEDMask = LEDS_NO_LEDS; - /* Receive next boot protocol mouse report from the device */ - HID_Host_ReceiveReport(&Mouse_HID_Interface, false, &ReportID, &MouseReport); + USB_MouseReport_Data_t MouseReport; + HID_Host_ReceiveReport(&Mouse_HID_Interface, &MouseReport); - /* Print mouse report data through the serial port */ printf_P(PSTR("dX:%2d dY:%2d Button:%d\r\n"), MouseReport.X, MouseReport.Y, MouseReport.Button); - - /* Alter status LEDs according to mouse X movement */ if (MouseReport.X > 0) LEDMask |= LEDS_LED1; else if (MouseReport.X < 0) LEDMask |= LEDS_LED2; - /* Alter status LEDs according to mouse Y movement */ if (MouseReport.Y > 0) LEDMask |= LEDS_LED3; else if (MouseReport.Y < 0) LEDMask |= LEDS_LED4; - /* Alter status LEDs according to mouse button position */ if (MouseReport.Button) LEDMask = LEDS_ALL_LEDS;