aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-05-12 08:28:02 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-05-12 08:28:02 +0000
commit958a1b4e2bffdc548b34edd322d30cec5d5feacd (patch)
tree26ae804ec69ffb4f1c0e788eed9d3411b215a55c /Demos/Host
parentea743970951cbcd6d5206b3136de8c9eb90298a5 (diff)
downloadlufa-958a1b4e2bffdc548b34edd322d30cec5d5feacd.tar.gz
lufa-958a1b4e2bffdc548b34edd322d30cec5d5feacd.tar.bz2
lufa-958a1b4e2bffdc548b34edd322d30cec5d5feacd.zip
Fixed Mouse and Keyboard device demos not acting in accordance with the HID specification for idle periods (thanks to Brian Dickman).
Removed support for endpoint/pipe non-control interrupts; these did not act in the way users expected, and had many subtle issues.
Diffstat (limited to 'Demos/Host')
-rw-r--r--Demos/Host/GenericHIDHost/GenericHIDHost.c38
-rw-r--r--Demos/Host/GenericHIDHost/GenericHIDHost.txt13
-rw-r--r--Demos/Host/KeyboardHost/KeyboardHost.c48
-rw-r--r--Demos/Host/KeyboardHost/KeyboardHost.txt13
-rw-r--r--Demos/Host/MouseHost/MouseHost.c46
-rw-r--r--Demos/Host/MouseHost/MouseHost.txt13
6 files changed, 10 insertions, 161 deletions
diff --git a/Demos/Host/GenericHIDHost/GenericHIDHost.c b/Demos/Host/GenericHIDHost/GenericHIDHost.c
index 9f419ad6d..5ac4257a6 100644
--- a/Demos/Host/GenericHIDHost/GenericHIDHost.c
+++ b/Demos/Host/GenericHIDHost/GenericHIDHost.c
@@ -182,10 +182,8 @@ void ReadNextReport(void)
/* 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;
}
@@ -208,10 +206,8 @@ void ReadNextReport(void)
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
- #if !defined(INTERRUPT_DATA_PIPE)
/* Refreeze HID data IN pipe */
Pipe_Freeze();
- #endif
}
/** Writes a report to the attached device.
@@ -345,43 +341,9 @@ TASK(USB_HID_Host)
USB_HostState = HOST_STATE_Ready;
break;
- #if !defined(INTERRUPT_DATA_PIPE)
case HOST_STATE_Ready:
ReadNextReport();
break;
- #endif
}
}
-
-#if defined(INTERRUPT_DATA_PIPE)
-/** Interrupt handler for the Endpoint/Pipe interrupt vector. This interrupt fires each time an enabled
- * pipe interrupt occurs on a pipe which has had that interrupt enabled.
- */
-ISR(ENDPOINT_PIPE_vect, ISR_BLOCK)
-{
- /* Save previously selected pipe before selecting a new pipe */
- uint8_t PrevSelectedPipe = Pipe_GetCurrentPipe();
-
- /* Check to see if the HID data IN pipe has caused the interrupt */
- if (Pipe_HasPipeInterrupted(HID_DATA_IN_PIPE))
- {
- /* Clear the pipe interrupt, and select the data IN pipe */
- Pipe_ClearPipeInterrupt(HID_DATA_IN_PIPE);
- Pipe_SelectPipe(HID_DATA_IN_PIPE);
-
- /* Check to see if the pipe IN interrupt has fired */
- if (USB_INT_HasOccurred(PIPE_INT_IN) && USB_INT_IsEnabled(PIPE_INT_IN))
- {
- /* Clear interrupt flag */
- USB_INT_Clear(PIPE_INT_IN);
-
- /* Read and process the next report from the device */
- ReadNextReport();
- }
- }
-
- /* Restore previously selected pipe */
- Pipe_SelectPipe(PrevSelectedPipe);
-}
-#endif
diff --git a/Demos/Host/GenericHIDHost/GenericHIDHost.txt b/Demos/Host/GenericHIDHost/GenericHIDHost.txt
index 41174172a..d72dda103 100644
--- a/Demos/Host/GenericHIDHost/GenericHIDHost.txt
+++ b/Demos/Host/GenericHIDHost/GenericHIDHost.txt
@@ -47,16 +47,9 @@
*
* <table>
* <tr>
- * <td><b>Define Name:</b></td>
- * <td><b>Location:</b></td>
- * <td><b>Description:</b></td>
- * </tr>
- * <tr>
- * <td>INTERRUPT_DATA_ENDPOINT</td>
- * <td>Makefile CDEFS</td>
- * <td>When defined, this causes the demo to enable interrupts for the data IN pipe,
- * which services reports from the device. If not defined, the data pipe is
- * serviced via polling using the task scheduler.</td>
+ * <td>
+ * None
+ * </td>
* </tr>
* </table>
*/
diff --git a/Demos/Host/KeyboardHost/KeyboardHost.c b/Demos/Host/KeyboardHost/KeyboardHost.c
index f17f950be..628a27314 100644
--- a/Demos/Host/KeyboardHost/KeyboardHost.c
+++ b/Demos/Host/KeyboardHost/KeyboardHost.c
@@ -180,18 +180,14 @@ void ReadNextReport(void)
/* Select keyboard data pipe */
Pipe_SelectPipe(KEYBOARD_DATAPIPE);
- #if !defined(INTERRUPT_DATA_PIPE)
/* Unfreeze keyboard data pipe */
Pipe_Unfreeze();
- #endif
/* 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;
}
@@ -231,15 +227,12 @@ void ReadNextReport(void)
putchar(PressedKey);
}
}
-
-
+
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
- #if !defined(INTERRUPT_DATA_PIPE)
/* Refreeze keyboard data pipe */
Pipe_Freeze();
- #endif
}
/** Task to set the configuration of the attached device after it has been enumerated, and to read and process
@@ -329,53 +322,14 @@ TASK(USB_Keyboard_Host)
break;
}
- #if defined(INTERRUPT_DATA_PIPE)
- /* Select and unfreeze keyboard data pipe */
- Pipe_SelectPipe(KEYBOARD_DATAPIPE);
- Pipe_Unfreeze();
- #endif
-
puts_P(PSTR("Keyboard Enumerated.\r\n"));
USB_HostState = HOST_STATE_Ready;
break;
- #if !defined(INTERRUPT_DATA_PIPE)
case HOST_STATE_Ready:
/* If a report has been received, read and process it */
ReadNextReport();
break;
- #endif
}
}
-
-#if defined(INTERRUPT_DATA_PIPE)
-/** Interrupt handler for the Endpoint/Pipe interrupt vector. This interrupt fires each time an enabled
- * pipe interrupt occurs on a pipe which has had that interrupt enabled.
- */
-ISR(ENDPOINT_PIPE_vect, ISR_BLOCK)
-{
- /* Save previously selected pipe before selecting a new pipe */
- uint8_t PrevSelectedPipe = Pipe_GetCurrentPipe();
-
- /* Check to see if the keyboard data pipe has caused the interrupt */
- if (Pipe_HasPipeInterrupted(KEYBOARD_DATAPIPE))
- {
- /* Clear the pipe interrupt, and select the keyboard pipe */
- Pipe_ClearPipeInterrupt(KEYBOARD_DATAPIPE);
- Pipe_SelectPipe(KEYBOARD_DATAPIPE);
-
- /* Check to see if the pipe IN interrupt has fired */
- if (USB_INT_HasOccurred(PIPE_INT_IN) && USB_INT_IsEnabled(PIPE_INT_IN))
- {
- /* Clear interrupt flag */
- USB_INT_Clear(PIPE_INT_IN);
-
- /* Read and process the next report from the device */
- ReadNextReport();
- }
-
- /* Restore previously selected pipe */
- Pipe_SelectPipe(PrevSelectedPipe);
-}
-#endif
diff --git a/Demos/Host/KeyboardHost/KeyboardHost.txt b/Demos/Host/KeyboardHost/KeyboardHost.txt
index 455c2d28b..a3d5f717d 100644
--- a/Demos/Host/KeyboardHost/KeyboardHost.txt
+++ b/Demos/Host/KeyboardHost/KeyboardHost.txt
@@ -56,16 +56,9 @@
*
* <table>
* <tr>
- * <td><b>Define Name:</b></td>
- * <td><b>Location:</b></td>
- * <td><b>Description:</b></td>
- * </tr>
- * <tr>
- * <td>INTERRUPT_DATA_ENDPOINT</td>
- * <td>Makefile CDEFS</td>
- * <td>When defined, this causes the demo to enable interrupts for the data pipe,
- * which services reports from the device. If not defined, the data pipe is
- * serviced via polling using the task scheduler.</td>
+ * <td>
+ * None
+ * </td>
* </tr>
* </table>
*/
diff --git a/Demos/Host/MouseHost/MouseHost.c b/Demos/Host/MouseHost/MouseHost.c
index 3c858a890..77db55282 100644
--- a/Demos/Host/MouseHost/MouseHost.c
+++ b/Demos/Host/MouseHost/MouseHost.c
@@ -181,18 +181,14 @@ void ReadNextReport(void)
/* Select mouse data pipe */
Pipe_SelectPipe(MOUSE_DATAPIPE);
- #if !defined(INTERRUPT_DATA_PIPE)
/* Unfreeze keyboard data pipe */
Pipe_Unfreeze();
- #endif
/* 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;
}
@@ -230,10 +226,8 @@ void ReadNextReport(void)
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
- #if !defined(INTERRUPT_DATA_PIPE)
/* Refreeze mouse data pipe */
Pipe_Freeze();
- #endif
}
/** Task to set the configuration of the attached device after it has been enumerated, and to read and process
@@ -324,54 +318,14 @@ TASK(USB_Mouse_Host)
break;
}
- #if defined(INTERRUPT_DATA_PIPE)
- /* Select and unfreeze mouse data pipe */
- Pipe_SelectPipe(MOUSE_DATAPIPE);
- Pipe_Unfreeze();
- #endif
-
puts_P(PSTR("Mouse Enumerated.\r\n"));
USB_HostState = HOST_STATE_Ready;
break;
- #if !defined(INTERRUPT_DATA_PIPE)
case HOST_STATE_Ready:
/* If a report has been received, read and process it */
ReadNextReport();
break;
- #endif
- }
-}
-
-#if defined(INTERRUPT_DATA_PIPE)
-/** Interrupt handler for the Endpoint/Pipe interrupt vector. This interrupt fires each time an enabled
- * pipe interrupt occurs on a pipe which has had that interrupt enabled.
- */
-ISR(ENDPOINT_PIPE_vect, ISR_BLOCK)
-{
- /* Save previously selected pipe before selecting a new pipe */
- uint8_t PrevSelectedPipe = Pipe_GetCurrentPipe();
-
- /* Check to see if the mouse data pipe has caused the interrupt */
- if (Pipe_HasPipeInterrupted(MOUSE_DATAPIPE))
- {
- /* Clear the pipe interrupt, and select the mouse pipe */
- Pipe_ClearPipeInterrupt(MOUSE_DATAPIPE);
- Pipe_SelectPipe(MOUSE_DATAPIPE);
-
- /* Check to see if the pipe IN interrupt has fired */
- if (USB_INT_HasOccurred(PIPE_INT_IN) && USB_INT_IsEnabled(PIPE_INT_IN))
- {
- /* Clear interrupt flag */
- USB_INT_Clear(PIPE_INT_IN);
-
- /* Read and process the next report from the device */
- ReadNextReport();
- }
}
-
- /* Restore previously selected pipe */
- Pipe_SelectPipe(PrevSelectedPipe);
}
-#endif
diff --git a/Demos/Host/MouseHost/MouseHost.txt b/Demos/Host/MouseHost/MouseHost.txt
index 118ca9d8a..3838a7011 100644
--- a/Demos/Host/MouseHost/MouseHost.txt
+++ b/Demos/Host/MouseHost/MouseHost.txt
@@ -57,16 +57,9 @@
*
* <table>
* <tr>
- * <td><b>Define Name:</b></td>
- * <td><b>Location:</b></td>
- * <td><b>Description:</b></td>
- * </tr>
- * <tr>
- * <td>INTERRUPT_DATA_ENDPOINT</td>
- * <td>Makefile CDEFS</td>
- * <td>When defined, this causes the demo to enable interrupts for the data pipe,
- * which services reports from the device. If not defined, the data pipe is
- * serviced via polling using the task scheduler.</td>
+ * <td>
+ * None
+ * </td>
* </tr>
* </table>
*/