//***************************************************************************** // // 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. // //***************************************************************************** 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"); } }
//***************************************************************************** // // 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"); } }
int main(void) { tRectangle sRect; unsigned int i = 0; unsigned char *src = (unsigned char *) palette_32b; unsigned char *dest = (unsigned char *) (g_pucBuffer+4); 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(); // //Enbale USB interrupts // USBInterruptEnable(); // //Switch ON LCD back light // LCDBackLightEnable(); // //UDP Pin control // 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); RasterDMAFBConfig(SOC_LCDC_0_REGS, (unsigned int)(g_pucBuffer+PALETTE_OFFSET), (unsigned int)(g_pucBuffer+PALETTE_OFFSET) + sizeof(g_pucBuffer) - 2 - PALETTE_OFFSET, FRAME_BUFFER_0); RasterDMAFBConfig(SOC_LCDC_0_REGS, (unsigned int)(g_pucBuffer+PALETTE_OFFSET), (unsigned int)(g_pucBuffer+PALETTE_OFFSET) + sizeof(g_pucBuffer) - 2 - PALETTE_OFFSET, FRAME_BUFFER_1); src = (unsigned char *) palette_32b; dest = (unsigned char *) (g_pucBuffer+PALETTE_OFFSET); // Copy palette info into buffer for( i = PALETTE_OFFSET; i < (PALETTE_SIZE+PALETTE_OFFSET); i++) { *dest++ = *src++; } 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 = 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_sFontCm20); GrStringDrawCentered(&g_sContext, "usb-dev-mouse", -1, GrContextDpyWidthGet(&g_sContext) / 2, 10, 0); // // Fill the top 24 rows of the screen with blue to create the banner. // sRect.sXMin = 0; sRect.sYMin = 25; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMax = GrContextDpyHeightGet(&g_sContext) - BUTTON_HEIGHT - 2; GrContextForegroundSet(&g_sContext, ClrDarkGray); 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); // //Initialize touch screen // TouchInit(); // //Touch screen Interrupt enbale // TouchIntEnable(); // //Touch Screen Enable // TouchEnable(); // // Initialize the mouse // USBDHIDMouseInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice); // // Drop into the main loop. // while(1) { // // Wait for USB configuration to complete. // while(!bConnected) { } // //Wait till someone touches the screen // while(!g_iTouch) { g_iTouch = TouchDetect(); } // //Loop here as long as someone moving the finger/stylus on the touch screen // do { // //If so, read the x and Y vlaue and give it to touch handler // TouchCoOrdGet(&g_lScreenX, &g_lScreenY); // //Call touch handler // TouchHandler(); }while(TouchDetect()); // //Touch is released // g_released = 1; // //Reset the button status // g_ucButtons = 0; // //Call the touch handler to update the release status // TouchHandler(); // //Reset the touch flag // g_iTouch = 0; } }