projects
/
pub
/
USBasp.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/USBasp.git]
/
Demos
/
Host
/
MouseHost
/
MouseHost.c
diff --git
a/Demos/Host/MouseHost/MouseHost.c
b/Demos/Host/MouseHost/MouseHost.c
index
44f20b4
..
dda4d62
100644
(file)
--- a/
Demos/Host/MouseHost/MouseHost.c
+++ b/
Demos/Host/MouseHost/MouseHost.c
@@
-184,12
+184,24
@@
void ReadNextReport(void)
USB_MouseReport_Data_t MouseReport;
\r
uint8_t LEDMask = LEDS_NO_LEDS;
\r
\r
USB_MouseReport_Data_t MouseReport;
\r
uint8_t LEDMask = LEDS_NO_LEDS;
\r
\r
- /* Select the mouse report data in pipe */
\r
- Pipe_SelectPipe(MOUSE_DATAPIPE);
\r
+ /* Select mouse data pipe */
\r
+ Pipe_SelectPipe(MOUSE_DATAPIPE);
\r
+
\r
+ #if !defined(INTERRUPT_DATA_PIPE)
\r
+ /* Unfreeze mouse 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
\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 mouse data pipe */
\r
+ Pipe_Freeze();
\r
+ #endif
\r
+
\r
+ return;
\r
+ }
\r
\r
/* Read in mouse report data */
\r
Pipe_Read_Stream_LE(&MouseReport, sizeof(MouseReport));
\r
\r
/* Read in mouse report data */
\r
Pipe_Read_Stream_LE(&MouseReport, sizeof(MouseReport));
\r
@@
-219,6
+231,11
@@
void ReadNextReport(void)
printf_P(PSTR("dX:%2d dY:%2d Button:%d\r\n"), MouseReport.X,
\r
MouseReport.Y,
\r
MouseReport.Button);
\r
printf_P(PSTR("dX:%2d dY:%2d Button:%d\r\n"), MouseReport.X,
\r
MouseReport.Y,
\r
MouseReport.Button);
\r
+
\r
+ #if !defined(INTERRUPT_DATA_PIPE)
\r
+ /* Refreeze mouse 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
@@
-303,22
+320,21
@@
TASK(USB_Mouse_Host)
break;
\r
}
\r
\r
break;
\r
}
\r
\r
+ #if defined(INTERRUPT_DATA_PIPE)
\r
+ /* Select and unfreeze mouse data pipe */
\r
+ Pipe_SelectPipe(MOUSE_DATAPIPE);
\r
+ Pipe_Unfreeze();
\r
+ #endif
\r
+
\r
puts_P(PSTR("Mouse Enumerated.\r\n"));
\r
\r
USB_HostState = HOST_STATE_Ready;
\r
break;
\r
#if !defined(INTERRUPT_DATA_PIPE)
\r
case HOST_STATE_Ready:
\r
puts_P(PSTR("Mouse Enumerated.\r\n"));
\r
\r
USB_HostState = HOST_STATE_Ready;
\r
break;
\r
#if !defined(INTERRUPT_DATA_PIPE)
\r
case HOST_STATE_Ready:
\r
- /* Select and unfreeze mouse data pipe */
\r
- Pipe_SelectPipe(MOUSE_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 mouse data pipe */
\r
- Pipe_Freeze();
\r
break;
\r
#endif
\r
}
\r
break;
\r
#endif
\r
}
\r