Add new Audio Class Driver Host demos.
[pub/USBasp.git] / Demos / Host / LowLevel / GenericHIDHost / GenericHIDHost.c
index c22d375..671fa48 100644 (file)
@@ -66,9 +66,12 @@ void SetupHardware(void)
        clock_prescale_set(clock_div_1);
 
        /* Hardware Initialization */
        clock_prescale_set(clock_div_1);
 
        /* Hardware Initialization */
-       SerialStream_Init(9600, false);
+       Serial_Init(9600, false);
        LEDs_Init();
        USB_Init();
        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
 }
 
 /** 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)
 {
 /** 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);
 
        printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"
                                 " -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);
@@ -147,7 +150,7 @@ void ReadNextReport(void)
                uint8_t ReportINData[Pipe_BytesInPipe()];
 
                /* Read in HID report data */
                uint8_t ReportINData[Pipe_BytesInPipe()];
 
                /* Read in HID report data */
-               Pipe_Read_Stream_LE(&ReportINData, sizeof(ReportINData));
+               Pipe_Read_Stream_LE(&ReportINData, sizeof(ReportINData), NULL);
 
                /* Print report data through the serial port */
                for (uint16_t CurrByte = 0; CurrByte < sizeof(ReportINData); CurrByte++)
 
                /* Print report data through the serial port */
                for (uint16_t CurrByte = 0; CurrByte < sizeof(ReportINData); CurrByte++)
@@ -195,10 +198,10 @@ void WriteNextReport(uint8_t* ReportOUTData,
 
                /* If the report index is used, send it before the report data */
                if (ReportIndex)
 
                /* If the report index is used, send it before the report data */
                if (ReportIndex)
-                 Pipe_Write_Byte(ReportIndex);
+                 Pipe_Write_8(ReportIndex);
 
                /* Write out HID report data */
 
                /* Write out HID report data */
-               Pipe_Write_Stream_LE(ReportOUTData, ReportLength);
+               Pipe_Write_Stream_LE(ReportOUTData, ReportLength, NULL);
 
                /* Clear the OUT endpoint, send last data packet */
                Pipe_ClearOUT();
 
                /* Clear the OUT endpoint, send last data packet */
                Pipe_ClearOUT();