diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-04-16 08:50:34 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-04-16 08:50:34 +0000 |
commit | 8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c (patch) | |
tree | 65c37548f19c26de3971639067d6f290095f5843 /Demos/Device/Mouse | |
parent | ef06bfd1c0ef5272c32808e23d0fd60d2d1bca9c (diff) | |
download | lufa-8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c.tar.gz lufa-8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c.tar.bz2 lufa-8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c.zip |
Fixed GenericHIDHost demo report write routine incorrect for control type requests (thanks to Andrei Krainev).
Removed Endpoint_ClearCurrentBank() and Pipe_ClearCurrentBank() in favour of new Endpoint_ClearIN(), Endpoint_ClearOUT(), Endpoint_ClearControlIN(), Endpoint_ClearControlOUT(), Pipe_ClearIN(), Pipe_ClearOUT(), Pipe_ClearControlIN() and Pipe_ClearControlOUT() macros (done to allow for the detection of packets of zero length).
Renamed *_ReadWriteAllowed() macros to *_IsReadWriteAllowed() to remain consistent with the rest of the LUFA API.
Endpoint_IsSetupReceived() macro has been renamed to Endpoint_IsSETUPReceived(), Endpoint_ClearSetupReceived() macro has been renamed to Endpoint_ClearControlSETUP(), the Pipe_IsSetupSent() macro has been renamed to Pipe_IsSETUPSent() and the Pipe_ClearSetupSent() macro is no longer applicable and should be removed - changes made to compliment the new endpoint and pipe bank management API.
Updated all demos, bootloaders and projects to use the new endpoint and pipe management APIs (thanks to Roman Thiel).
Updated library doxygen documentation, added groups, changed documentation macro functions to real functions for clarity.
Removed old endpoint and pipe aliased read/write/discard routines which did not have an explicit endian specifier for clarity.
Removed the ButtLoadTag.h header file, as no one used for its intended purpose anyway.
Diffstat (limited to 'Demos/Device/Mouse')
-rw-r--r-- | Demos/Device/Mouse/Mouse.c | 42 | ||||
-rw-r--r-- | Demos/Device/Mouse/Mouse.h | 1 |
2 files changed, 18 insertions, 25 deletions
diff --git a/Demos/Device/Mouse/Mouse.c b/Demos/Device/Mouse/Mouse.c index 076ac5bbd..e74002b7c 100644 --- a/Demos/Device/Mouse/Mouse.c +++ b/Demos/Device/Mouse/Mouse.c @@ -36,12 +36,6 @@ #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
{
@@ -212,7 +206,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket) if (wLength > sizeof(MouseReportData))
wLength = sizeof(MouseReportData);
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* 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_ClearControlOUT();
}
break;
case REQ_GetProtocol:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* Write the current protocol flag to the host */
Endpoint_Write_Byte(UsingReportProtocol);
/* Send the flag to the host */
- Endpoint_ClearSetupIN();
+ Endpoint_ClearControlIN();
/* Acknowledge status stage */
- while (!(Endpoint_IsSetupOUTReceived()));
- Endpoint_ClearSetupOUT();
+ while (!(Endpoint_IsOUTReceived()));
+ Endpoint_ClearControlOUT();
}
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_ClearControlSETUP();
/* 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_ClearControlIN();
}
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_ClearControlSETUP();
/* Get idle period in MSB */
IdleCount = (wValue >> 8);
/* Acknowledge status stage */
- while (!(Endpoint_IsSetupINReady()));
- Endpoint_ClearSetupIN();
+ while (!(Endpoint_IsINReady()));
+ Endpoint_ClearControlIN();
}
break;
case REQ_GetIdle:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* Write the current idle duration to the host */
Endpoint_Write_Byte(IdleCount);
/* Send the flag to the host */
- Endpoint_ClearSetupIN();
+ Endpoint_ClearControlIN();
/* Acknowledge status stage */
- while (!(Endpoint_IsSetupOUTReceived()));
- Endpoint_ClearSetupOUT();
+ while (!(Endpoint_IsOUTReceived()));
+ Endpoint_ClearControlOUT();
}
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();
}
}
diff --git a/Demos/Device/Mouse/Mouse.h b/Demos/Device/Mouse/Mouse.h index c9854a8f9..714f8d6e8 100644 --- a/Demos/Device/Mouse/Mouse.h +++ b/Demos/Device/Mouse/Mouse.h @@ -47,7 +47,6 @@ #include "Descriptors.h"
#include <LUFA/Version.h> // Library Version Information
- #include <LUFA/Common/ButtLoadTag.h> // PROGMEM tags readable by the ButtLoad project
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/Board/Joystick.h> // Joystick driver
#include <LUFA/Drivers/Board/LEDs.h> // LEDs driver
|