aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/MouseHost/MouseHost.c
diff options
context:
space:
mode:
Diffstat (limited to 'Demos/Host/MouseHost/MouseHost.c')
-rw-r--r--Demos/Host/MouseHost/MouseHost.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/Demos/Host/MouseHost/MouseHost.c b/Demos/Host/MouseHost/MouseHost.c
index 44f20b43a..dda4d6217 100644
--- a/Demos/Host/MouseHost/MouseHost.c
+++ b/Demos/Host/MouseHost/MouseHost.c
@@ -184,12 +184,24 @@ void ReadNextReport(void)
USB_MouseReport_Data_t MouseReport;
uint8_t LEDMask = LEDS_NO_LEDS;
- /* Select the mouse report data in pipe */
- Pipe_SelectPipe(MOUSE_DATAPIPE);
+ /* Select mouse data pipe */
+ Pipe_SelectPipe(MOUSE_DATAPIPE);
+
+ #if !defined(INTERRUPT_DATA_PIPE)
+ /* Unfreeze mouse 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 mouse data pipe */
+ Pipe_Freeze();
+ #endif
+
+ return;
+ }
/* Read in mouse report data */
Pipe_Read_Stream_LE(&MouseReport, sizeof(MouseReport));
@@ -219,6 +231,11 @@ void ReadNextReport(void)
printf_P(PSTR("dX:%2d dY:%2d Button:%d\r\n"), MouseReport.X,
MouseReport.Y,
MouseReport.Button);
+
+ #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
@@ -303,22 +320,21 @@ 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:
- /* Select and unfreeze mouse data pipe */
- Pipe_SelectPipe(MOUSE_DATAPIPE);
- Pipe_Unfreeze();
-
/* If a report has been received, read and process it */
- if (Pipe_ReadWriteAllowed())
- ReadNextReport();
+ ReadNextReport();
- /* Freeze mouse data pipe */
- Pipe_Freeze();
break;
#endif
}