|
On Time RTOS-32 Documentation
Welcome
RTTarget-32
RTKernel-32
RTFiles-32
RTIP-32
RTPEG-32
RTUSB-32
RTUSB-32 Programming Manual
Introduction
The Universal Serial Bus
Programming with RTUSB-32
Initialization
Class Drivers
Keyboard Class Driver
Mouse Class Driver
Touch Screen Driver
Printer Class Driver
Mass Storage Class Driver
AX772/AX178 and AX172 USB-Ethernet Drivers
Audio Class Driver
Low-Level API
Using RTUSB-32 with Delphi
Demo Programs
Advanced Topics
RTUSB-32 Reference Manual
|
Mouse Class Driver
The 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.
Class Drivers
Keyboard Class Driver
Touch Screen Driver
|