Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
USBAbsMouse Class Reference
USB device: an absolute mouse. More...
#include <USBAbsMouse.h>
Inherits GenericMouse, and USBHID.
Public Member Functions | |
| USBAbsMouse () | |
| Constructor for a USBAbsMouse (an absolute mouse) | |
| virtual bool | update (int16_t x, int16_t y, uint8_t buttons, int8_t z) |
| Write a state of the mouse. | |
| bool | move (int16_t x, int16_t y) |
| Move the cursor to (x, y) | |
| bool | press (uint8_t button) |
| Press one or several buttons. | |
| bool | release (uint8_t button) |
| Release one or several buttons. | |
| bool | doubleClick () |
| Double click (MOUSE_LEFT) | |
| bool | click (uint8_t button) |
| Click. | |
| bool | scroll (int8_t z) |
| Scrolling. | |
Detailed Description
USB device: an absolute mouse.
Warning: you can only instantiate one instance of a USB device: USBMouse, USBKeyboard, USBAbsMouse, USBMouseKeyboard, or USBAbsMouseKeyboard.
Example:
#include "mbed.h" #include "USBAbsMouse.h" USBAbsMouse mouse; #define STEP (20) int main(void) { int32_t a = X_MIN; int32_t dir = STEP; while (1) { mouse.move(a, a); if (((a+dir) > X_MAX) || ((a+dir) < X_MIN)) { // Change direction dir = -dir; } a += dir; } }
Definition at line 46 of file USBAbsMouse.h.
Constructor & Destructor Documentation
| USBAbsMouse | ( | ) |
Constructor for a USBAbsMouse (an absolute mouse)
Definition at line 52 of file USBAbsMouse.h.
Member Function Documentation
| bool click | ( | uint8_t | button ) | [inherited] |
Click.
- Parameters:
-
button state of the buttons ( ex: clic(MOUSE_LEFT))
- Returns:
- true if there is no error, false otherwise
Definition at line 26 of file GenericMouse.c.
| bool doubleClick | ( | ) | [inherited] |
Double click (MOUSE_LEFT)
- Returns:
- true if there is no error, false otherwise
Definition at line 19 of file GenericMouse.c.
| bool move | ( | int16_t | x, |
| int16_t | y | ||
| ) | [inherited] |
Move the cursor to (x, y)
- Parameters:
-
x x-axis position (can be absolute or relative) y y-axis position (can be absolute or relative)
- Returns:
- true if there is no error, false otherwise
Definition at line 10 of file GenericMouse.c.
| bool press | ( | uint8_t | button ) | [inherited] |
Press one or several buttons.
- Parameters:
-
button button state (ex: press(MOUSE_LEFT))
- Returns:
- true if there is no error, false otherwise
Definition at line 33 of file GenericMouse.c.
| bool release | ( | uint8_t | button ) | [inherited] |
Release one or several buttons.
- Parameters:
-
button button state (ex: release(MOUSE_LEFT))
- Returns:
- true if there is no error, false otherwise
Definition at line 38 of file GenericMouse.c.
| bool scroll | ( | int8_t | z ) | [inherited] |
Scrolling.
- Parameters:
-
z value of the wheel (>0 to go down, <0 to go up)
- Returns:
- true if there is no error, false otherwise
Definition at line 14 of file GenericMouse.c.
| bool update | ( | int16_t | x, |
| int16_t | y, | ||
| uint8_t | buttons, | ||
| int8_t | z | ||
| ) | [virtual] |
Write a state of the mouse.
- Parameters:
-
x x absolute position y y absolute position buttons buttons state (first bit represents MOUSE_LEFT, second bit MOUSE_RIGHT and third bit MOUSE_MIDDLE) z wheel state (>0 to scroll down, <0 to scroll up)
- Returns:
- true if there is no error, false otherwise
Reimplemented from GenericMouse.
Definition at line 63 of file USBAbsMouse.c.
Generated on Fri Jul 22 2022 22:32:37 by
1.7.2