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/Host/GenericHIDHost | |
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/Host/GenericHIDHost')
-rw-r--r-- | Demos/Host/GenericHIDHost/ConfigDescriptor.h | 1 | ||||
-rw-r--r-- | Demos/Host/GenericHIDHost/GenericHIDHost.c | 40 | ||||
-rw-r--r-- | Demos/Host/GenericHIDHost/GenericHIDHost.h | 3 |
3 files changed, 20 insertions, 24 deletions
diff --git a/Demos/Host/GenericHIDHost/ConfigDescriptor.h b/Demos/Host/GenericHIDHost/ConfigDescriptor.h index e35801a01..fac772979 100644 --- a/Demos/Host/GenericHIDHost/ConfigDescriptor.h +++ b/Demos/Host/GenericHIDHost/ConfigDescriptor.h @@ -38,7 +38,6 @@ /* Includes: */
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
- #include <LUFA/Drivers/USB/Class/ConfigDescriptor.h> // Configuration Descriptor Parser
#include "GenericHIDHost.h"
diff --git a/Demos/Host/GenericHIDHost/GenericHIDHost.c b/Demos/Host/GenericHIDHost/GenericHIDHost.c index 716f1c333..b047841f6 100644 --- a/Demos/Host/GenericHIDHost/GenericHIDHost.c +++ b/Demos/Host/GenericHIDHost/GenericHIDHost.c @@ -36,12 +36,6 @@ #include "GenericHIDHost.h"
-/* Project Tags, for reading out using the ButtLoad project */
-BUTTLOADTAG(ProjName, "LUFA GenHid Host App");
-BUTTLOADTAG(BuildTime, __TIME__);
-BUTTLOADTAG(BuildDate, __DATE__);
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
-
/* Scheduler Task List */
TASK_LIST
{
@@ -185,30 +179,34 @@ void ReadNextReport(void) Pipe_SelectPipe(HID_DATA_IN_PIPE);
Pipe_Unfreeze();
- /* Ensure pipe contains data and is ready to be read before continuing */
- if (!(Pipe_ReadWriteAllowed()))
+ /* Check to see if a packet has been received */
+ if (!(Pipe_IsINReceived()))
{
#if !defined(INTERRUPT_DATA_PIPE)
/* Refreeze HID data IN pipe */
Pipe_Freeze();
#endif
-
+
return;
}
- uint8_t ReportINData[Pipe_BytesInPipe()];
+ /* Ensure pipe contains data before trying to read from it */
+ if (Pipe_IsReadWriteAllowed())
+ {
+ uint8_t ReportINData[Pipe_BytesInPipe()];
- /* Read in HID report data */
- Pipe_Read_Stream_LE(&ReportINData, sizeof(ReportINData));
+ /* Read in HID report data */
+ Pipe_Read_Stream_LE(&ReportINData, sizeof(ReportINData));
+
+ /* Print report data through the serial port */
+ for (uint16_t CurrByte = 0; CurrByte < sizeof(ReportINData); CurrByte++)
+ printf_P(PSTR("0x%02X "), ReportINData[CurrByte]);
+
+ puts_P(PSTR("\r\n"));
+ }
/* Clear the IN endpoint, ready for next data packet */
- Pipe_ClearCurrentBank();
-
- /* Print report data through the serial port */
- for (uint16_t CurrByte = 0; CurrByte < sizeof(ReportINData); CurrByte++)
- printf_P(PSTR("0x%02X "), ReportINData[CurrByte]);
-
- puts_P(PSTR("\r\n"));
+ Pipe_ClearIN();
#if !defined(INTERRUPT_DATA_PIPE)
/* Refreeze HID data IN pipe */
@@ -235,7 +233,7 @@ void WriteNextReport(uint8_t* ReportOUTData, uint8_t ReportIndex, uint8_t Report Pipe_Unfreeze();
/* Ensure pipe is ready to be written to before continuing */
- if (!(Pipe_ReadWriteAllowed()))
+ if (!(Pipe_IsOUTReady()))
{
/* Refreeze the data OUT pipe */
Pipe_Freeze();
@@ -251,7 +249,7 @@ void WriteNextReport(uint8_t* ReportOUTData, uint8_t ReportIndex, uint8_t Report Pipe_Write_Stream_LE(ReportOUTData, ReportLength);
/* Clear the OUT endpoint, send last data packet */
- Pipe_ClearCurrentBank();
+ Pipe_ClearOUT();
/* Refreeze the data OUT pipe */
Pipe_Freeze();
diff --git a/Demos/Host/GenericHIDHost/GenericHIDHost.h b/Demos/Host/GenericHIDHost/GenericHIDHost.h index 99b4599f1..8483fa686 100644 --- a/Demos/Host/GenericHIDHost/GenericHIDHost.h +++ b/Demos/Host/GenericHIDHost/GenericHIDHost.h @@ -45,7 +45,6 @@ #include <stdio.h>
#include <LUFA/Version.h> // Library Version Information
- #include <LUFA/Common/ButtLoadTag.h> // PROGMEM tags readable by the ButtLoad project
#include <LUFA/Drivers/Misc/TerminalCodes.h> // ANSI Terminal Escape Codes
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/AT90USBXXX/Serial_Stream.h> // Serial stream driver
@@ -94,6 +93,6 @@ /* Function Prototypes: */
void UpdateStatus(uint8_t CurrentStatus);
void ReadNextReport(void);
- void WriteNextReport(uint8_t* ReportOUTData, uint16_t ReportLength);
+ void WriteNextReport(uint8_t* ReportOUTData, uint8_t ReportIndex, uint8_t ReportType, uint16_t ReportLength);
#endif
|