//**************************************************************************** // // This is the main loop that runs the application. // //**************************************************************************** int main(void) { // // Set the clocking to run from the PLL at 50MHz. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Set the system tick to fire 100 times per second. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND); ROM_SysTickIntEnable(); ROM_SysTickEnable(); // // Pass the USB library our device information, initialize the USB // controller and connect the device to the bus. // g_psCompDevices[0].pvInstance = USBDHIDMouseCompositeInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice); g_psCompDevices[1].pvInstance = USBDCDCCompositeInit(0, (tUSBDCDCDevice *)&g_sCDCDevice); // // Set the USB stack mode to Device mode with VBUS monitoring. // USBStackModeSet(0, USB_MODE_DEVICE, 0); // // Pass the device information to the USB library and place the device // on the bus. // USBDCompositeInit(0, &g_sCompDevice, DESCRIPTOR_DATA_SIZE, g_pucDescriptorData); // // Initialize the mouse and serial devices. // MouseInit(); SerialInit(); // // Drop into the main loop. // while(1) { // // Allow the main mouse routine to run. // MouseMain(); // // Allow the main serial routine to run. // SerialMain(); } }
//***************************************************************************** // //! Initializes HID mouse device operation for a given USB controller. //! //! \param ui32Index is the index of the USB controller which is to be //! initialized for HID mouse device operation. //! \param psMouseDevice points to a structure containing parameters //! customizing the operation of the HID mouse device. //! //! An application wishing to offer a USB HID mouse interface to a USB host //! must call this function to initialize the USB controller and attach the //! mouse device to the USB bus. This function performs all required USB //! initialization. //! //! On successful completion, this function returns the \e psMouseDevice //! pointer passed to it. This must be passed on all future calls to the HID //! mouse device driver. //! //! When a host connects and configures the device, the application callback //! receives \b USB_EVENT_CONNECTED after which calls can be made to //! USBDHIDMouseStateChange() to report pointer movement and button presses //! to the host. //! //! \note The application must not make any calls to the lower level USB device //! interfaces if interacting with USB via the USB HID mouse device API. //! Doing so causes unpredictable (though almost certainly unpleasant) //! behavior. //! //! \return Returns NULL on failure or the psMouseDevice pointer on success. // //***************************************************************************** void * USBDHIDMouseInit(uint32_t ui32Index, tUSBDHIDMouseDevice *psMouseDevice) { void *pvRetcode; tUSBDHIDDevice *psHIDDevice; tConfigDescriptor *pConfigDesc; // // Check parameter validity. // ASSERT(psMouseDevice); ASSERT(psMouseDevice->ppui8StringDescriptors); ASSERT(psMouseDevice->pfnCallback); // // Get a pointer to the HID device data. // psHIDDevice = &psMouseDevice->sPrivateData.sHIDDevice; pConfigDesc = (tConfigDescriptor *)g_pui8MouseDescriptor; pConfigDesc->bmAttributes = psMouseDevice->ui8PwrAttributes; pConfigDesc->bMaxPower = (uint8_t)(psMouseDevice->ui16MaxPowermA / 2); // // Call the common initialization routine. // pvRetcode = USBDHIDMouseCompositeInit(ui32Index, psMouseDevice, 0); // // If we initialized the HID layer successfully, pass our device pointer // back as the return code, otherwise return NULL to indicate an error. // if(pvRetcode) { // // Initialize the lower layer HID driver and pass it the various // structures and descriptors necessary to declare that we are a // keyboard. // pvRetcode = USBDHIDInit(ui32Index, psHIDDevice); return((void *)psMouseDevice); } else { return((void *)0); } }
//***************************************************************************** // //! Initializes HID mouse device operation for a given USB controller. //! //! \param ulIndex is the index of the USB controller which is to be //! initialized for HID mouse device operation. //! \param psDevice points to a structure containing parameters customizing //! the operation of the HID mouse device. //! //! An application wishing to offer a USB HID mouse interface to a USB host //! must call this function to initialize the USB controller and attach the //! mouse device to the USB bus. This function performs all required USB //! initialization. //! //! On successful completion, this function will return the \e psDevice pointer //! passed to it. This must be passed on all future calls to the HID mouse //! device driver. //! //! When a host connects and configures the device, the application callback //! will receive \b USB_EVENT_CONNECTED after which calls can be made to //! USBDHIDMouseStateChange() to report pointer movement and button presses //! to the host. //! //! \note The application must not make any calls to the lower level USB device //! interfaces if interacting with USB via the USB HID mouse device API. //! Doing so will cause unpredictable (though almost certainly unpleasant) //! behavior. //! //! \return Returns NULL on failure or the psDevice pointer on success. // //***************************************************************************** void * USBDHIDMouseInit(unsigned long ulIndex, const tUSBDHIDMouseDevice *psDevice) { void *pvRetcode; tUSBDHIDDevice *psHIDDevice; // // Check parameter validity. // ASSERT(psDevice); ASSERT(psDevice->ppStringDescriptors); ASSERT(psDevice->psPrivateHIDMouseData); ASSERT(psDevice->pfnCallback); // // Get a pointer to the HID device data. // psHIDDevice = &psDevice->psPrivateHIDMouseData->sHIDDevice; // // Call the common initialization routine. // pvRetcode = USBDHIDMouseCompositeInit(ulIndex, psDevice); // // If we initialized the HID layer successfully, pass our device pointer // back as the return code, otherwise return NULL to indicate an error. // if(pvRetcode) { // // Initialize the lower layer HID driver and pass it the various // structures and descriptors necessary to declare that we are a // keyboard. // pvRetcode = USBDHIDInit(ulIndex, psHIDDevice); return((void *)psDevice); } else { return((void *)0); } }
//***************************************************************************** // // This is the main loop that runs the application. // //***************************************************************************** int main(void) { // // Turn on stacking of FPU registers if FPU is used in the ISR. // FPULazyStackingEnable(); // // Set the clocking to run from the PLL at 40MHz. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Set the system tick to fire 100 times per second. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND); ROM_SysTickIntEnable(); ROM_SysTickEnable(); // // Enable the Debug UART. // ConfigureUART(); // // Print the welcome message to the terminal. // UARTprintf("\033[2JAir Mouse Application\n"); // // Configure desired interrupt priorities. This makes certain that the DCM // is fed data at a consistent rate. Lower numbers equal higher priority. // ROM_IntPrioritySet(INT_I2C3, 0x00); ROM_IntPrioritySet(INT_GPIOB, 0x10); ROM_IntPrioritySet(FAULT_SYSTICK, 0x20); ROM_IntPrioritySet(INT_UART1, 0x60); ROM_IntPrioritySet(INT_UART0, 0x70); ROM_IntPrioritySet(INT_WTIMER5B, 0x80); // // Configure the USB D+ and D- pins. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); ROM_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_5 | GPIO_PIN_4); // // Pass the USB library our device information, initialize the USB // controller and connect the device to the bus. // USBDHIDMouseCompositeInit(0, &g_sMouseDevice, &g_psCompDevices[0]); USBDHIDKeyboardCompositeInit(0, &g_sKeyboardDevice, &g_psCompDevices[1]); // // Set the USB stack mode to Force Device mode. // USBStackModeSet(0, eUSBModeForceDevice, 0); // // Pass the device information to the USB library and place the device // on the bus. // USBDCompositeInit(0, &g_sCompDevice, DESCRIPTOR_DATA_SIZE, g_pui8DescriptorData); // // User Interface Init // ButtonsInit(); RGBInit(0); RGBEnable(); // // Initialize the motion sub system. // MotionInit(); // // Initialize the Radio Systems. // LPRFInit(); // // Drop into the main loop. // while(1) { // // Check for and handle timer tick events. // if(HWREGBITW(&g_ui32Events, USB_TICK_EVENT) == 1) { // // Clear the Tick event flag. Set in SysTick interrupt handler. // HWREGBITW(&g_ui32Events, USB_TICK_EVENT) = 0; // // Each tick period handle wired mouse and keyboard. // if(HWREGBITW(&g_ui32USBFlags, FLAG_CONNECTED) == 1) { MouseMoveHandler(); KeyboardMain(); } } // // Check for LPRF tick events. LPRF Ticks are slower since UART to // RNP is much slower data connection than the USB. // if(HWREGBITW(&g_ui32Events, LPRF_TICK_EVENT) == 1) { // // Clear the event flag. // HWREGBITW(&g_ui32Events, LPRF_TICK_EVENT) = 0; // // Perform the LPRF Main task handling // LPRFMain(); } // // Check for and handle motion events. // if((HWREGBITW(&g_ui32Events, MOTION_EVENT) == 1) || (HWREGBITW(&g_ui32Events, MOTION_ERROR_EVENT) == 1)) { // // Clear the motion event flag. Set in the Motion I2C interrupt // handler when an I2C transaction to get sensor data is complete. // HWREGBITW(&g_ui32Events, MOTION_EVENT) = 0; // // Process the motion data that has been captured // MotionMain(); } } }
//***************************************************************************** // // This is the main loop that runs the application. // //***************************************************************************** int main(void) { tRectangle sRect; // // Set the clocking to run directly from the crystal. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Set the device pinout appropriately for this board. // PinoutSet(); #ifdef DEBUG // // Open UART0 for debug output. // UARTStdioInit(0); #endif // // Set the system tick to fire 100 times per second. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND); ROM_SysTickIntEnable(); ROM_SysTickEnable(); // // Initialize the display driver. // Kitronix320x240x16_SSD2119Init(); // // Initialize the graphics context. // GrContextInit(&g_sContext, &g_sKitronix320x240x16_SSD2119); // // Fill the top 24 rows of the screen with blue to create the banner. // sRect.sXMin = 0; sRect.sYMin = 0; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMax = 23; GrContextForegroundSet(&g_sContext, ClrDarkBlue); GrRectFill(&g_sContext, &sRect); // // Put a white box around the banner. // GrContextForegroundSet(&g_sContext, ClrWhite); GrRectDraw(&g_sContext, &sRect); // // Put the application name in the middle of the banner. // GrContextFontSet(&g_sContext, g_pFontCm20); GrStringDrawCentered(&g_sContext, "boot-demo-usb", -1, GrContextDpyWidthGet(&g_sContext) / 2, 10, 0); // // Draw the buttons in their initial (unpressed)state. // UpdateDisplay(g_ucButtons, true); // // Initialize each of the device instances that will form our composite // USB device. // g_sCompDevice.psDevices[0].pvInstance = USBDHIDMouseCompositeInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice); g_sCompDevice.psDevices[1].pvInstance = USBDDFUCompositeInit(0, (tUSBDDFUDevice *)&g_sDFUDevice); // // Pass the USB library our device information, initialize the USB // controller and connect the device to the bus. // USBDCompositeInit(0, &g_sCompDevice, DESCRIPTOR_BUFFER_SIZE, g_pcDescriptorBuffer); // // Initialize the touch screen driver. // TouchScreenInit(); // // Set the touch screen event handler. // TouchScreenCallbackSet(MouseTouchHandler); // // Drop into the main loop. // while(!g_bUpdateSignalled) { // // Tell the user what we are doing. // GrContextFontSet(&g_sContext, g_pFontCmss22b); GrContextForegroundSet(&g_sContext, ClrWhite); GrStringDrawCentered(&g_sContext, " Waiting for host... ", -1, GrContextDpyWidthGet(&g_sContext) / 2, 40, true); // // Wait for USB configuration to complete. // while(!g_bConnected) { } // // Update the status. // GrStringDrawCentered(&g_sContext, " Host connected... ", -1, GrContextDpyWidthGet(&g_sContext) / 2, 40, true); // // Now keep processing the mouse as long as the host is connected and // we've not been told to prepare for a firmware upgrade. // while(g_bConnected && !g_bUpdateSignalled) { // // If it is time to check the touchscreen state then do so. // if(g_ulCommands & TOUCH_TICK_EVENT) { g_ulCommands &= ~TOUCH_TICK_EVENT; TouchHandler(); } } // // If we drop out of the previous loop, either the host has // disconnected or a firmware upgrade has been signalled. // } // // Tell the user what's going on. // GrContextFontSet(&g_sContext, g_pFontCmss22b); GrStringDrawCentered(&g_sContext, " Switching to DFU mode ", -1, GrContextDpyWidthGet(&g_sContext) / 2, 40, true); // // If we get here, a firmware upgrade has been signalled so we need to get // back into the boot loader to allow this to happen. Call the USB DFU // device class to do this for us. Note that this function never returns. // USBDDFUUpdateBegin(); }
//***************************************************************************** // // This is the main loop that runs the application. // //***************************************************************************** int main(void) { uint32_t ui32SysClock; // // Run from the PLL at 120 MHz. // ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); // // Configure the device pins. // PinoutSet(); // // Initialize the display driver. // Kentec320x240x16_SSD2119Init(ui32SysClock); // // Initialize the touch screen driver. // TouchScreenInit(ui32SysClock); // // Set the touch screen event handler. // TouchScreenCallbackSet(UITouchCallback); // // Set the system tick to fire 100 times per second. // ROM_SysTickPeriodSet(ui32SysClock / SYSTICKS_PER_SECOND); ROM_SysTickIntEnable(); ROM_SysTickEnable(); // // Initialize the USB stack for device mode. // USBStackModeSet(0, eUSBModeDevice, 0); // // Initialize the USB keyboard interface. // USBKeyboardInit(); // // Initialize the USB mouse interface. // USBMouseInit(); // // Call the composite device initialization for both the mouse and // keyboard. // USBDHIDMouseCompositeInit(0, &g_sMouseDevice, &g_psCompDevices[0]); USBDHIDKeyboardCompositeInit(0, &g_sKeyboardDevice, &g_psCompDevices[1]); // // Pass the device information to the USB library and place the device // on the bus. // USBDCompositeInit(0, &g_sCompDevice, DESCRIPTOR_DATA_SIZE, g_pui8DescriptorData); // // Initialize the user interface. // UIInit(); while(1) { // // Run the main loop for the user interface. // UIMain(); } }
//***************************************************************************** // // This is the main loop that runs the application. // //***************************************************************************** int main(void) { tRectangle sRect; // // Set the clocking to run directly from the crystal. // SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); // // Enable the USB mux GPIO. // SysCtlPeripheralEnable(USB_MUX_GPIO_PERIPH); // // The LM3S3748 board uses a USB mux that must be switched to use the // host connector and not the device connecter. // GPIOPinTypeGPIOOutput(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN); GPIOPinWrite(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN, USB_MUX_SEL_DEVICE); #ifdef DEBUG // // Configure the relevant pins such that UART0 owns them. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Open UART0 for debug output. // UARTStdioInit(0); #endif // // Initialize the pushbuttons. // ButtonsInit(); ButtonsSetAutoRepeat((LEFT_BUTTON | RIGHT_BUTTON | UP_BUTTON | DOWN_BUTTON), 0, 2); // // Set the system tick to fire 100 times per second. // SysTickPeriodSet(SysCtlClockGet() / SYSTICKS_PER_SECOND); SysTickIntEnable(); SysTickEnable(); // // Initialize the display driver. // Formike128x128x16Init(); // // Turn on the backlight. // Formike128x128x16BacklightOn(); // // Initialize the graphics context. // GrContextInit(&g_sContext, &g_sFormike128x128x16); // // Fill the top 15 rows of the screen with blue to create the banner. // sRect.sXMin = 0; sRect.sYMin = 0; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMax = 14; GrContextForegroundSet(&g_sContext, ClrDarkBlue); GrRectFill(&g_sContext, &sRect); // // Put a white box around the banner. // GrContextForegroundSet(&g_sContext, ClrWhite); GrRectDraw(&g_sContext, &sRect); // // Put the application name in the middle of the banner. // GrContextFontSet(&g_sContext, g_pFontFixed6x8); GrStringDrawCentered(&g_sContext, "boot_demo_usb", -1, GrContextDpyWidthGet(&g_sContext) / 2, 7, 0); // // Initialize each of the device instances that will form our composite // USB device. // g_sCompDevice.psDevices[0].pvInstance = USBDHIDMouseCompositeInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice); g_sCompDevice.psDevices[1].pvInstance = USBDDFUCompositeInit(0, (tUSBDDFUDevice *)&g_sDFUDevice); // // Pass the USB library our device information, initialize the USB // controller and connect the device to the bus. // USBDCompositeInit(0, &g_sCompDevice, DESCRIPTOR_BUFFER_SIZE, g_pcDescriptorBuffer); // // Drop into the main loop. // while(!g_bUpdateSignalled) { // // Fill all but the top 15 rows of the screen with black to erase the // previous status. // sRect.sXMin = 0; sRect.sYMin = 15; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMax = GrContextDpyHeightGet(&g_sContext) - 1; GrContextForegroundSet(&g_sContext, ClrBlack); GrRectFill(&g_sContext, &sRect); // // Tell the user what we are doing. // GrContextForegroundSet(&g_sContext, ClrWhite); GrStringDrawCentered(&g_sContext, "Waiting for host...", -1, GrContextDpyWidthGet(&g_sContext) / 2, 24, true); // // Wait for USB configuration to complete. // while(!g_bConnected) { } // // Update the status. // GrStringDrawCentered(&g_sContext, " Host connected... ", -1, GrContextDpyWidthGet(&g_sContext) / 2, 24, true); // // Now keep processing the mouse as long as the host is connected. // while(g_bConnected && !g_bUpdateSignalled) { // // If it is time to check the button state then do so. // if(g_ulCommands & BUTTON_TICK_EVENT) { g_ulCommands &= ~BUTTON_TICK_EVENT; ButtonHandler(); } } // // If we drop out of the previous loop, the host has disconnected so // go back and wait for a new connection. // } // // If we drop out of the main loop, the host has signalled that it wants us // to switch into DFU mode in preparation for a firmware upgrade. First, // let the user know what's going on. // GrStringDrawCentered(&g_sContext, "Entering DFU mode...", -1, GrContextDpyWidthGet(&g_sContext) / 2, 24, true); // // Call the USB DFU device class to tidy things up and transfer control to // the boot loader for us. Note that this function never returns. // USBDDFUUpdateBegin(); }
/***************************************************************************** * * This is the main loop that runs the application. * *****************************************************************************/ int main(void) { tRectangle sRect; MMUConfigAndEnable(); /* Enable USB module clock */ USB0ModuleClkConfig(); /* Enable DM timer 3 module clock */ DMTimer3ModuleClkConfig(); /* Enbale touch screen module colock */ TSCADCModuleClkConfig(); /* Enable touch screen ADC pinmux */ TSCADCPinMuxSetUp(); /* configures arm interrupt controller to generate raster interrupt */ USBInterruptEnable(); /* LCD Back light setup */ LCDBackLightEnable(); /* UPD Pin setup */ UPDNPinControl(); /* Delay timer setup */ DelayTimerSetup(); /* Configures raster to display image */ SetUpLCD(); /* Register touch scren interrupt */ TouchIntRegister(); IntSystemEnable(SYS_INT_TINT3); IntPrioritySet(SYS_INT_TINT3, 0, AINTC_HOSTINT_ROUTE_IRQ); IntSystemEnable(SYS_INT_ADC_TSC_GENINT); IntPrioritySet(SYS_INT_ADC_TSC_GENINT, 0, AINTC_HOSTINT_ROUTE_IRQ); /* Configures raster to display image and Copy palette info into buffer */ LCDInit(); GrOffScreen24BPPInit(&g_s35_480x272x24Display, g_pucBuffer, LCD_WIDTH, LCD_HEIGHT); /* Initialize a drawing context. */ GrContextInit(&g_sContext, &g_s35_480x272x24Display); /* enable End of frame interrupt */ RasterEndOfFrameIntEnable(SOC_LCDC_0_REGS); /* enable raster */ RasterEnable(SOC_LCDC_0_REGS); /* Fill the top 24 rows of the screen with blue to create the banner. */ sRect.sXMin = 0; sRect.sYMin = 0; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMax = (MAX_ROW_NUM - 1); GrContextForegroundSet(&g_sContext, ClrDarkBlue); GrRectFill(&g_sContext, &sRect); /* Put a white box around the banner. */ GrContextForegroundSet(&g_sContext, ClrWhite); GrRectDraw(&g_sContext, &sRect); /* Put the application name in the middle of the banner. */ GrContextFontSet(&g_sContext, &g_sFontCm20); GrStringDrawCentered(&g_sContext, "usb-dev-composite", -1, GrContextDpyWidthGet(&g_sContext) / 2, 10, 0); sRect.sXMin = 0; sRect.sYMin = (MAX_ROW_NUM + 1); sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMax = GrContextDpyHeightGet(&g_sContext) - BUTTON_HEIGHT - 2; GrContextForegroundSet(&g_sContext, ClrBlack); GrRectFill(&g_sContext, &sRect); /* Put a white box around the banner. */ GrContextForegroundSet(&g_sContext, ClrRed); GrRectDraw(&g_sContext, &sRect); /* Draw the buttons in their initial (unpressed)state. */ UpdateDisplay(g_ucButtons, true); /* Show the various static text elements on the color STN display. */ GrContextFontSet(&g_sContext, TEXT_FONT); GrStringDraw(&g_sContext, "Tx bytes:", -1, CDC_STR_X_POSITION, CDC_STR_Y_POSITION, false); GrStringDraw(&g_sContext, "Tx buffer:", -1, CDC_STR_X_POSITION, (CDC_STR_Y_POSITION + CDC_STR_Y_DIFF), false); GrStringDraw(&g_sContext, "Rx bytes:", -1, CDC_STR_X_POSITION, (CDC_STR_Y_POSITION + (CDC_STR_Y_DIFF * 3)), false); GrStringDraw(&g_sContext, "Rx buffer:", -1, CDC_STR_X_POSITION, (CDC_STR_Y_POSITION + (CDC_STR_Y_DIFF * 4)), false); DrawBufferMeter(&g_sContext, BUFFER_METER_X_POS, BUFFER_METER_Y_POS); DrawBufferMeter(&g_sContext, BUFFER_METER_X_POS, (BUFFER_METER_Y_POS + CDC_BUF_METER_Y_DIFF)); /* Tell the user what we are up to. */ DisplayStatus(&g_sContext, " Waiting for host... "); /* Initialize touch screen */ TouchInit(); /* Touch screen Interrupt enbale */ TouchIntEnable(); /* Touch Screen Enable */ TouchEnable(); /* Pass the USB library our device information, initialize the USB controller and connect the device to the bus. */ g_psCompDevices[0].pvInstance = USBDHIDMouseCompositeInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice); g_psCompDevices[1].pvInstance = USBDCDCCompositeInit(0, (tUSBDCDCDevice *)&g_sCDCDevice); /* Pass the device information to the USB library and place the device on the bus. */ USBDCompositeInit(0, &g_sCompDevice, DESCRIPTOR_DATA_SIZE, g_pucDescriptorData); /* Initialize the mouse and serial devices. */ SerialInit(); /* Drop into the main loop. */ while(1) { /* Allow the main serial routine to run. */ SerialMain(); /* Allow the main mouse routine to run. */ MouseMain(); } }