//***************************************************************************** // // This is the main loop that runs the application. // //***************************************************************************** int main(void) { // // Set the clocking to run from the PLL at 50MHz. // SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); /* SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); GPIOPinConfigure(GPIO_PG4_USB0EPEN); GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7); GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); */ // // // Set the system tick to fire 100 times per second. // SysTickPeriodSet(SysCtlClockGet() / SYSTICKS_PER_SECOND); SysTickIntEnable(); SysTickEnable(); // // Pass the USB library our device information, initialize the USB // controller and connect the device to the bus. // USBDHIDMouseInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice); USBDHIDMouseRemoteWakeupRequest((void *)&g_sMouseDevice); // // Drop into the main loop. // while(1) { // // Wait for USB configuration to complete. // while(!g_bConnected) { } // // Now keep processing the mouse as long as the host is connected. // while(g_bConnected) { // // If it is time to move the mouse then do so. // if(HWREGBITW(&g_ulCommands, TICK_EVENT) == 1) { HWREGBITW(&g_ulCommands, TICK_EVENT) = 0; MoveHandler(); } } } }
//**************************************************************************** // // This is the main loop that runs the application. // //**************************************************************************** void MouseMain(void) { // // Now keep processing the mouse as long as the host is connected. // if(HWREGBITW(&g_ulFlags, FLAG_CONNECTED) == 1) { // // If it is time to move the mouse then do so. // if(HWREGBITW(&g_ulFlags, FLAG_MOVE_UPDATE) == 1) { HWREGBITW(&g_ulFlags, FLAG_MOVE_UPDATE) = 0; MoveHandler(); } } }
//***************************************************************************** // // 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); // // Enable the UART. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTStdioInit(0); UARTprintf("\033[2JMouse device application\n"); // // Set the system tick to fire 100 times per second. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND); ROM_SysTickIntEnable(); ROM_SysTickEnable(); // // Set the USB stack mode to Device mode with VBUS monitoring. // USBStackModeSet(0, USB_MODE_DEVICE, 0); // // Pass the USB library our device information, initialize the USB // controller and connect the device to the bus. // USBDHIDMouseInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice); // // Drop into the main loop. // while(1) { // // Tell the user what we are doing. // UARTprintf("Waiting for host...\n"); // // Wait for USB configuration to complete. // while(!g_bConnected) { } // // Update the status. // UARTprintf("Host connected...\n"); // // Now keep processing the mouse as long as the host is connected. // while(g_bConnected) { // // If it is time to move the mouse then do so. // if(HWREGBITW(&g_ulCommands, TICK_EVENT) == 1) { HWREGBITW(&g_ulCommands, TICK_EVENT) = 0; MoveHandler(); } } // // Update the status. // UARTprintf("Host disconnected...\n"); } }
//***************************************************************************** // // 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); // // Enable the UART. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTStdioInit(0); UARTprintf("\033[2JMouse device application\n"); // Configure USB pins, according to // http://forum.stellarisiti.com/topic/353-work-around-stellaris-launchpad-usb-serial-example-not-enumerating-correctly/?p=1544 // Enable the GPIO port so we can configure it SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); // Setup the port to be in USB analog mode. Routes incoming signals to // on-chip USB PHY GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5); // // Set the system tick to fire 100 times per second. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND); ROM_SysTickIntEnable(); ROM_SysTickEnable(); // // Set the USB stack mode to Device mode with VBUS monitoring. // USBStackModeSet(0, USB_MODE_DEVICE, 0); // // Pass the USB library our device information, initialize the USB // controller and connect the device to the bus. // USBDHIDMouseInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice); // // Drop into the main loop. // while(1) { // // Tell the user what we are doing. // UARTprintf("Waiting for host...\n"); // // Wait for USB configuration to complete. // while(!g_bConnected) { } // // Update the status. // UARTprintf("Host connected...\n"); // // Now keep processing the mouse as long as the host is connected. // while(g_bConnected) { // // If it is time to move the mouse then do so. // if(HWREGBITW(&g_ulCommands, TICK_EVENT) == 1) { HWREGBITW(&g_ulCommands, TICK_EVENT) = 0; MoveHandler(); } } // // Update the status. // UARTprintf("Host disconnected...\n"); } }