Home |
Mouse Class Driver AX772/AX178 and AX172 USB-Ethernet Drivers |
Mouse Class DriverThe mouse driver supports all USB mice using USB class 3 (HID), subclass 1 (boot device), protocol 2 (mouse). Up to four mice can be operated simultaneously; additional mice are ignored. Configuration options can be set in the global configuration structure RTUSBMouseConfig. The driver is registered using its callback USBMouse. As soon as at least one USB mouse is attached, the driver will create an internal thread to handle all mice. Any received mouse events are forwarded to the operating system's user input event queue. With On Time RTOS-32, RTTarget-32's Win32 API function WriteConsonsoleInput is used. At run-time, the mouse pointer can be forced to an absolute position using USBSetMousePos. Example (using On Time RTOS-32 and RTPEG-32):int main(void) { PegScreen * pScreen; PegPresentationManager * pPresent; RTURegisterCallback(USBKeyboard); // include USB keyboard driver RTURegisterCallback(USBMouse); // and USB mouse driver FindUSBControllers(); // start USB pScreen = CreatePegScreen_VESA_8(); pPresent = PegInitialize(pScreen, sizeof(class PegScreen)); // configure USB mouse driver RTUSBMouseConfig.MaxX = pScreen->GetXRes() - 2; RTUSBMouseConfig.MaxY = pScreen->GetYRes() - 2; // put mouse pointer on screen center USBSetMousePos(pScreen->GetXRes() / 2, pScreen->GetYRes() / 2); PegAppInitialize(pPresent); PegExecute(pPresent); return 0; } The RTUSB-32 Reference Manual contains additional information about the driver's API.
|