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.
Diff: USBHID/USBMouse.h
- Revision:
- 0:3dbb22992c94
diff -r 000000000000 -r 3dbb22992c94 USBHID/USBMouse.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/USBHID/USBMouse.h Sat Jul 02 17:27:05 2011 +0000
@@ -0,0 +1,60 @@
+#include "usbhid.h"
+
+#ifndef MBED_USBMOUSE_H
+#define MBED_USBMOUSE_H
+
+/* Class: USBMouse
+ * Emulate a USB Mouse HID device
+ *
+ * Example:
+ * > #include "mbed.h"
+ * > #include "USBMouse.h"
+ * >
+ * > USBMouse mouse;
+ * >
+ * > int main() {
+ * > while(1) {
+ * > mouse.move(10, 0);
+ * > wait(2);
+ * > }
+ * > }
+ */
+class USBMouse : private usbhid {
+public:
+ /* Constructor: USBMouse
+ * Create a USB Mouse using the mbed USB Device interface
+ */
+ USBMouse();
+
+ /* Function: move
+ * Move the mouse
+ *
+ * Variables:
+ * x - Distance to move in x-axis
+ * y - Distance to move in y-axis
+ */
+ void move(int x, int y);
+
+ /* Function: scroll
+ * Scroll the scroll wheel
+ *
+ * Variables:
+ * z - Distance to scroll scroll wheel
+ */
+ void scroll(int z);
+
+ /* Function: buttons
+ * Set the state of the buttons
+ *
+ * Variables:
+ * left - set the left button as down (1) or up (0)
+ * middle - set the middle button as down (1) or up (0)
+ * right - set the right button as down (1) or up (0)
+ */
+ void buttons(int left, int middle, int right);
+
+private:
+ int _buttons;
+};
+
+#endif