Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:projects:crazy_mouse [2010/03/14 14:41] mikk.leinien:projects:crazy_mouse [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 95: Line 95:
  unsigned long ulAngle = 0;  unsigned long ulAngle = 0;
  char cDeltaX = 0, cDeltaY = 0;   char cDeltaX = 0, cDeltaY = 0;
 +
  //  //
-    // Set the clocking to run from the PLL at 50MHz + // Set the clocking to run from the PLL at 50MHz 
-    // + // 
-    SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | + SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | 
-                   SYSCTL_XTAL_8MHZ); + SYSCTL_XTAL_8MHZ); 
-     +
  //  //
  // Drivers configuring.  // Drivers configuring.
  //  //
  DeviceConfigure();  DeviceConfigure();
 +
  //  //
-    // Pass the USB library our device information, initialize the USB + // Pass the USB library our device information, initialize the USB 
-    // controller and connect the device to the bus. + // controller and connect the device to the bus.
-    // +
-    USBDHIDMouseInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice); +
  //  //
-    // Enable processor interrupts. + USBDHIDMouseInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice);
-    // +
-    IntMasterEnable(); +
   
-    // + // 
-    // Loop forever. + // Enable processor interrupts. 
-    // + // 
-    while (true) + IntMasterEnable();  
-   { +  
 + // 
 + // Loop forever. 
 + // 
 + while (true) 
 + {
  //  //
  // Device connected and ready ?  // Device connected and ready ?
Line 132: Line 132:
  //  //
  ulAngle += 0x1000000;  ulAngle += 0x1000000;
 +
  //  //
  // Calculate X and Y movement.  // Calculate X and Y movement.
Line 139: Line 139:
  cDeltaX = sine(ulAngle) >> 14;  cDeltaX = sine(ulAngle) >> 14;
  cDeltaY = sine(ulAngle - 0x40000000) >> 14;  cDeltaY = sine(ulAngle - 0x40000000) >> 14;
 +
  //  //
  // Keep a small break.  // Keep a small break.
  //  //
  DelayMS(5);  DelayMS(5);
 +
  //  //
  // Update mouse state.  // Update mouse state.
Line 150: Line 150:
  USBDHIDMouseStateChange((void *)&g_sMouseDevice,  USBDHIDMouseStateChange((void *)&g_sMouseDevice,
  cDeltaX, cDeltaY,  cDeltaX, cDeltaY,
- (ButtonIsPressed() ? MOUSE_REPORT_BUTTON_1 : 0)); + (ButtonIsPressed() ? MOUSE_REPORT_BUTTON_1 : 0));
  }  }
-    }+ }
 } }
 </code> </code>
en/projects/crazy_mouse.1268577708.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0