diff options
Diffstat (limited to 'Demos/Host/KeyboardHost')
-rw-r--r-- | Demos/Host/KeyboardHost/ConfigDescriptor.c | 2 | ||||
-rw-r--r-- | Demos/Host/KeyboardHost/KeyboardHost.c | 38 | ||||
-rw-r--r-- | Demos/Host/KeyboardHost/KeyboardHost.txt | 2 |
3 files changed, 28 insertions, 14 deletions
diff --git a/Demos/Host/KeyboardHost/ConfigDescriptor.c b/Demos/Host/KeyboardHost/ConfigDescriptor.c index 9d1a630ad..14db19846 100644 --- a/Demos/Host/KeyboardHost/ConfigDescriptor.c +++ b/Demos/Host/KeyboardHost/ConfigDescriptor.c @@ -98,8 +98,6 @@ uint8_t ProcessConfigurationDescriptor(void) /* Enable the pipe IN interrupt for the data pipe */
USB_INT_Enable(PIPE_INT_IN);
#endif
-
- Pipe_Unfreeze();
/* Valid data found, return success */
return SuccessfulConfigRead;
diff --git a/Demos/Host/KeyboardHost/KeyboardHost.c b/Demos/Host/KeyboardHost/KeyboardHost.c index 6249e5291..fe95c3493 100644 --- a/Demos/Host/KeyboardHost/KeyboardHost.c +++ b/Demos/Host/KeyboardHost/KeyboardHost.c @@ -183,13 +183,25 @@ void ReadNextReport(void) {
USB_KeyboardReport_Data_t KeyboardReport;
- /* Select the keyboard report data in pipe */
+ /* Select keyboard data pipe */
Pipe_SelectPipe(KEYBOARD_DATAPIPE);
+ #if !defined(INTERRUPT_DATA_PIPE)
+ /* Unfreeze keyboard data pipe */
+ Pipe_Unfreeze();
+ #endif
+
/* Ensure pipe contains data and is ready to be read before continuing */
if (!(Pipe_ReadWriteAllowed()))
- return;
+ {
+ #if !defined(INTERRUPT_DATA_PIPE)
+ /* Refreeze keyboard data pipe */
+ Pipe_Freeze();
+ #endif
+ return;
+ }
+
/* Read in keyboard report data */
Pipe_Read_Stream_LE(&KeyboardReport, sizeof(KeyboardReport));
@@ -224,6 +236,11 @@ void ReadNextReport(void) if (PressedKey)
putchar(PressedKey);
}
+
+ #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
@@ -307,22 +324,21 @@ 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:
- /* Select and unfreeze keyboard data pipe */
- Pipe_SelectPipe(KEYBOARD_DATAPIPE);
- Pipe_Unfreeze();
-
/* If a report has been received, read and process it */
- if (Pipe_ReadWriteAllowed())
- ReadNextReport();
+ ReadNextReport();
- /* Freeze keyboard data pipe */
- Pipe_Freeze();
break;
#endif
}
diff --git a/Demos/Host/KeyboardHost/KeyboardHost.txt b/Demos/Host/KeyboardHost/KeyboardHost.txt index 6d536fb86..8abe99f23 100644 --- a/Demos/Host/KeyboardHost/KeyboardHost.txt +++ b/Demos/Host/KeyboardHost/KeyboardHost.txt @@ -36,7 +36,7 @@ * \section SSec_Description Project Description:
*
* Keyboard host demonstration application. This gives a simple reference
- * application for implementing a USB Mouse keyboard, for USB keyboards using
+ * application for implementing a USB keyboard, for USB keyboards using
* the standard keyboard HID profile.
*
* Pressed alpha-numeric, enter or space key is transmitted through the serial
|