X-Git-Url: http://git.linex4red.de/pub/lufa.git/blobdiff_plain/ed031c1df2f5b053b9cd9f48c63e66a42b7c049e..e5e7eaee7af719cee00a8c2cb6fb4649dde0aa05:/Demos/Device/Mouse/Mouse.c diff --git a/Demos/Device/Mouse/Mouse.c b/Demos/Device/Mouse/Mouse.c index c066d424a..0959a4a12 100644 --- a/Demos/Device/Mouse/Mouse.c +++ b/Demos/Device/Mouse/Mouse.c @@ -36,21 +36,15 @@ #include "Mouse.h" -/* Project Tags, for reading out using the ButtLoad project */ -BUTTLOADTAG(ProjName, "LUFA Mouse App"); -BUTTLOADTAG(BuildTime, __TIME__); -BUTTLOADTAG(BuildDate, __DATE__); -BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING); - /* Scheduler Task List */ TASK_LIST { #if !defined(INTERRUPT_CONTROL_ENDPOINT) - { Task: USB_USBTask , TaskStatus: TASK_STOP }, + { .Task = USB_USBTask , .TaskStatus = TASK_STOP }, #endif #if !defined(INTERRUPT_DATA_ENDPOINT) - { Task: USB_Mouse_Report , TaskStatus: TASK_STOP }, + { .Task = USB_Mouse_Report , .TaskStatus = TASK_STOP }, #endif }; @@ -66,7 +60,7 @@ bool UsingReportProtocol = true; uint8_t IdleCount = 0; /** Current Idle period remaining. When the IdleCount value is set, this tracks the remaining number of idle - * milliseconds. This is seperate to the IdleCount timer and is incremented and compared as the host may request + * milliseconds. This is separate to the IdleCount timer and is incremented and compared as the host may request * the current idle period via a Get Idle HID class request, thus its value must be preserved. */ uint16_t IdleMSRemaining = 0; @@ -145,7 +139,7 @@ EVENT_HANDLER(USB_Reset) */ EVENT_HANDLER(USB_Disconnect) { - /* Stop running keyboard reporting and USB management tasks */ + /* Stop running mouse reporting and USB management tasks */ #if !defined(INTERRUPT_DATA_ENDPOINT) Scheduler_SetTaskMode(USB_Mouse_Report, TASK_STOP); #endif @@ -212,7 +206,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket) if (wLength > sizeof(MouseReportData)) wLength = sizeof(MouseReportData); - Endpoint_ClearSetupReceived(); + Endpoint_ClearSETUP(); /* Write the report data to the control endpoint */ Endpoint_Write_Control_Stream_LE(&MouseReportData, wLength); @@ -221,24 +215,24 @@ EVENT_HANDLER(USB_UnhandledControlPacket) memset(&MouseReportData, 0, sizeof(MouseReportData)); /* Finalize the stream transfer to send the last packet or clear the host abort */ - Endpoint_ClearSetupOUT(); + Endpoint_ClearOUT(); } break; case REQ_GetProtocol: if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { - Endpoint_ClearSetupReceived(); + Endpoint_ClearSETUP(); /* Write the current protocol flag to the host */ Endpoint_Write_Byte(UsingReportProtocol); /* Send the flag to the host */ - Endpoint_ClearSetupIN(); + Endpoint_ClearIN(); /* Acknowledge status stage */ - while (!(Endpoint_IsSetupOUTReceived())); - Endpoint_ClearSetupOUT(); + while (!(Endpoint_IsOUTReceived())); + Endpoint_ClearOUT(); } break; @@ -248,14 +242,14 @@ EVENT_HANDLER(USB_UnhandledControlPacket) /* Read in the wValue parameter containing the new protocol mode */ uint16_t wValue = Endpoint_Read_Word_LE(); - Endpoint_ClearSetupReceived(); + Endpoint_ClearSETUP(); /* Set or clear the flag depending on what the host indicates that the current Protocol should be */ UsingReportProtocol = (wValue != 0x0000); /* Acknowledge status stage */ - while (!(Endpoint_IsSetupINReady())); - Endpoint_ClearSetupIN(); + while (!(Endpoint_IsINReady())); + Endpoint_ClearIN(); } break; @@ -265,31 +259,31 @@ EVENT_HANDLER(USB_UnhandledControlPacket) /* Read in the wValue parameter containing the idle period */ uint16_t wValue = Endpoint_Read_Word_LE(); - Endpoint_ClearSetupReceived(); + Endpoint_ClearSETUP(); /* Get idle period in MSB */ IdleCount = (wValue >> 8); /* Acknowledge status stage */ - while (!(Endpoint_IsSetupINReady())); - Endpoint_ClearSetupIN(); + while (!(Endpoint_IsINReady())); + Endpoint_ClearIN(); } break; case REQ_GetIdle: if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { - Endpoint_ClearSetupReceived(); + Endpoint_ClearSETUP(); /* Write the current idle duration to the host */ Endpoint_Write_Byte(IdleCount); /* Send the flag to the host */ - Endpoint_ClearSetupIN(); + Endpoint_ClearIN(); /* Acknowledge status stage */ - while (!(Endpoint_IsSetupOUTReceived())); - Endpoint_ClearSetupOUT(); + while (!(Endpoint_IsOUTReceived())); + Endpoint_ClearOUT(); } break; @@ -367,13 +361,13 @@ static inline void SendNextReport(void) Endpoint_SelectEndpoint(MOUSE_EPNUM); /* Check if Mouse Endpoint Ready for Read/Write and if we should send a new report */ - if (Endpoint_ReadWriteAllowed() && SendReport) + if (Endpoint_IsReadWriteAllowed() && SendReport) { /* Write Mouse Report Data */ Endpoint_Write_Stream_LE(&MouseReportData, sizeof(MouseReportData)); /* Finalize the stream transfer to send the last packet */ - Endpoint_ClearCurrentBank(); + Endpoint_ClearIN(); } }