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.
Fork of USBDevice by
Diff: USBHID/USBMouse.h
- Revision:
- 25:7c72828865f3
- Parent:
- 1:80ab0d068708
--- a/USBHID/USBMouse.h Fri May 16 09:00:39 2014 +0100
+++ b/USBHID/USBMouse.h Tue Jun 03 11:30:32 2014 +0100
@@ -35,7 +35,7 @@
/* X and Y limits */
/* These values do not directly map to screen pixels */
/* Zero may be interpreted as meaning 'no movement' */
-#define X_MIN_ABS (1) /*!< Minimum value on x-axis */
+#define X_MIN_ABS (1) /*!< Minimum value on x-axis */
#define Y_MIN_ABS (1) /*!< Minimum value on y-axis */
#define X_MAX_ABS (0x7fff) /*!< Maximum value on x-axis */
#define Y_MAX_ABS (0x7fff) /*!< Maximum value on y-axis */
@@ -85,7 +85,7 @@
* uint16_t y_center = (Y_MAX_ABS - Y_MIN_ABS)/2;
* uint16_t x_screen = 0;
* uint16_t y_screen = 0;
- *
+ *
* uint32_t x_origin = x_center;
* uint32_t y_origin = y_center;
* uint32_t radius = 5000;
@@ -95,7 +95,7 @@
* {
* x_screen = x_origin + cos((double)angle*3.14/180.0)*radius;
* y_screen = y_origin + sin((double)angle*3.14/180.0)*radius;
- *
+ *
* mouse.move(x_screen, y_screen);
* angle += 3;
* wait(0.01);
@@ -107,7 +107,7 @@
class USBMouse: public USBHID
{
public:
-
+
/**
* Constructor
*
@@ -117,14 +117,14 @@
* @param product_release Your preoduct_release (default: 0x0001)
*
*/
- USBMouse(MOUSE_TYPE mouse_type = REL_MOUSE, uint16_t vendor_id = 0x1234, uint16_t product_id = 0x0001, uint16_t product_release = 0x0001):
+ USBMouse(MOUSE_TYPE mouse_type = REL_MOUSE, uint16_t vendor_id = 0x1234, uint16_t product_id = 0x0001, uint16_t product_release = 0x0001):
USBHID(0, 0, vendor_id, product_id, product_release, false)
- {
+ {
button = 0;
this->mouse_type = mouse_type;
connect();
};
-
+
/**
* Write a state of the mouse
*
@@ -135,8 +135,8 @@
* @returns true if there is no error, false otherwise
*/
bool update(int16_t x, int16_t y, uint8_t buttons, int8_t z);
-
-
+
+
/**
* Move the cursor to (x, y)
*
@@ -145,7 +145,7 @@
* @returns true if there is no error, false otherwise
*/
bool move(int16_t x, int16_t y);
-
+
/**
* Press one or several buttons
*
@@ -153,7 +153,7 @@
* @returns true if there is no error, false otherwise
*/
bool press(uint8_t button);
-
+
/**
* Release one or several buttons
*
@@ -161,22 +161,22 @@
* @returns true if there is no error, false otherwise
*/
bool release(uint8_t button);
-
+
/**
* Double click (MOUSE_LEFT)
*
* @returns true if there is no error, false otherwise
*/
bool doubleClick();
-
+
/**
* Click
*
* @param button state of the buttons ( ex: clic(MOUSE_LEFT))
* @returns true if there is no error, false otherwise
*/
- bool click(uint8_t button);
-
+ bool click(uint8_t button);
+
/**
* Scrolling
*
@@ -184,7 +184,7 @@
* @returns true if there is no error, false otherwise
*/
bool scroll(int8_t z);
-
+
/*
* To define the report descriptor. Warning: this method has to store the length of the report descriptor in reportLength.
*
@@ -199,7 +199,7 @@
* @returns pointer to the configuration descriptor
*/
virtual uint8_t * configurationDesc();
-
+
private:
MOUSE_TYPE mouse_type;
uint8_t button;
