X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/1d433d4506113c95285f633e3553ff62d4cfd05d..1f1d0710f379a8b08ef646cbadb63d92c35e47fb:/Demos/Host/LowLevel/MouseHost/MouseHost.c diff --git a/Demos/Host/LowLevel/MouseHost/MouseHost.c b/Demos/Host/LowLevel/MouseHost/MouseHost.c index 25175e81f..c2c900ac7 100644 --- a/Demos/Host/LowLevel/MouseHost/MouseHost.c +++ b/Demos/Host/LowLevel/MouseHost/MouseHost.c @@ -66,9 +66,12 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and @@ -100,7 +103,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ void EVENT_USB_Host_HostError(const uint8_t ErrorCode) { - USB_ShutDown(); + USB_Disable(); printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n" " -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode); @@ -134,7 +137,7 @@ void ReadNextReport(void) /* Select mouse data pipe */ Pipe_SelectPipe(MOUSE_DATA_IN_PIPE); - /* Unfreeze keyboard data pipe */ + /* Unfreeze mouse data pipe */ Pipe_Unfreeze(); /* Check to see if a packet has been received */ @@ -153,7 +156,7 @@ void ReadNextReport(void) if (Pipe_IsReadWriteAllowed()) { /* Read in mouse report data */ - Pipe_Read_Stream_LE(&MouseReport, sizeof(MouseReport)); + Pipe_Read_Stream_LE(&MouseReport, sizeof(MouseReport), NULL); /* Alter status LEDs according to mouse X movement */ if (MouseReport.X > 0)