projects
/
pub
/
lufa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added new GenericHIDHost demo.
[pub/lufa.git]
/
Demos
/
Host
/
KeyboardHost
/
KeyboardHost.c
diff --git
a/Demos/Host/KeyboardHost/KeyboardHost.c
b/Demos/Host/KeyboardHost/KeyboardHost.c
index
6249e52
..
fe95c34
100644
(file)
--- a/
Demos/Host/KeyboardHost/KeyboardHost.c
+++ b/
Demos/Host/KeyboardHost/KeyboardHost.c
@@
-183,13
+183,25
@@
void ReadNextReport(void)
{
\r
USB_KeyboardReport_Data_t KeyboardReport;
\r
\r
{
\r
USB_KeyboardReport_Data_t KeyboardReport;
\r
\r
- /* Select
the keyboard report data in
pipe */
\r
+ /* Select
keyboard data
pipe */
\r
Pipe_SelectPipe(KEYBOARD_DATAPIPE);
\r
\r
Pipe_SelectPipe(KEYBOARD_DATAPIPE);
\r
\r
+ #if !defined(INTERRUPT_DATA_PIPE)
\r
+ /* Unfreeze keyboard data pipe */
\r
+ Pipe_Unfreeze();
\r
+ #endif
\r
+
\r
/* Ensure pipe contains data and is ready to be read before continuing */
\r
if (!(Pipe_ReadWriteAllowed()))
\r
/* Ensure pipe contains data and is ready to be read before continuing */
\r
if (!(Pipe_ReadWriteAllowed()))
\r
- return;
\r
+ {
\r
+ #if !defined(INTERRUPT_DATA_PIPE)
\r
+ /* Refreeze keyboard data pipe */
\r
+ Pipe_Freeze();
\r
+ #endif
\r
\r
\r
+ return;
\r
+ }
\r
+
\r
/* Read in keyboard report data */
\r
Pipe_Read_Stream_LE(&KeyboardReport, sizeof(KeyboardReport));
\r
\r
/* Read in keyboard report data */
\r
Pipe_Read_Stream_LE(&KeyboardReport, sizeof(KeyboardReport));
\r
\r
@@
-224,6
+236,11
@@
void ReadNextReport(void)
if (PressedKey)
\r
putchar(PressedKey);
\r
}
\r
if (PressedKey)
\r
putchar(PressedKey);
\r
}
\r
+
\r
+ #if !defined(INTERRUPT_DATA_PIPE)
\r
+ /* Refreeze keyboard data pipe */
\r
+ Pipe_Freeze();
\r
+ #endif
\r
}
\r
\r
/** Task to set the configuration of the attached device after it has been enumerated, and to read and process
\r
}
\r
\r
/** Task to set the configuration of the attached device after it has been enumerated, and to read and process
\r
@@
-307,22
+324,21
@@
TASK(USB_Keyboard_Host)
break;
\r
}
\r
\r
break;
\r
}
\r
\r
+ #if defined(INTERRUPT_DATA_PIPE)
\r
+ /* Select and unfreeze keyboard data pipe */
\r
+ Pipe_SelectPipe(KEYBOARD_DATAPIPE);
\r
+ Pipe_Unfreeze();
\r
+ #endif
\r
+
\r
puts_P(PSTR("Keyboard Enumerated.\r\n"));
\r
puts_P(PSTR("Keyboard Enumerated.\r\n"));
\r
-
\r
+
\r
USB_HostState = HOST_STATE_Ready;
\r
break;
\r
#if !defined(INTERRUPT_DATA_PIPE)
\r
case HOST_STATE_Ready:
\r
USB_HostState = HOST_STATE_Ready;
\r
break;
\r
#if !defined(INTERRUPT_DATA_PIPE)
\r
case HOST_STATE_Ready:
\r
- /* Select and unfreeze keyboard data pipe */
\r
- Pipe_SelectPipe(KEYBOARD_DATAPIPE);
\r
- Pipe_Unfreeze();
\r
-
\r
/* If a report has been received, read and process it */
\r
/* If a report has been received, read and process it */
\r
- if (Pipe_ReadWriteAllowed())
\r
- ReadNextReport();
\r
+ ReadNextReport();
\r
\r
\r
- /* Freeze keyboard data pipe */
\r
- Pipe_Freeze();
\r
break;
\r
#endif
\r
}
\r
break;
\r
#endif
\r
}
\r