aboutsummaryrefslogtreecommitdiff
path: root/cores
diff options
context:
space:
mode:
authorZach Eveland <zeveland@blacklabel-development.com>2011-08-30 20:23:06 -0400
committerZach Eveland <zeveland@blacklabel-development.com>2011-08-30 20:23:06 -0400
commit90ea0707e6e3fb251b3eaf6c8682f68dd44299e1 (patch)
tree8c81d138a8ca81532d3d3f054eee03c4269c27b5 /cores
parentdf068274f4a383ce6c944168ce41f859f3bc22c9 (diff)
added Mouse press() and release()
Diffstat (limited to 'cores')
-rw-r--r--cores/arduino/HID.cpp10
-rw-r--r--cores/arduino/USBAPI.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/cores/arduino/HID.cpp b/cores/arduino/HID.cpp
index e3aadb5..16d0448 100644
--- a/cores/arduino/HID.cpp
+++ b/cores/arduino/HID.cpp
@@ -233,6 +233,16 @@ void Mouse_::buttons(uint8_t b)
}
}
+void Mouse_::press(uint8_t b)
+{
+ buttons(_buttons | b);
+}
+
+void Mouse_::release(uint8_t b)
+{
+ buttons(_buttons & ~b);
+}
+
//================================================================================
//================================================================================
// Keyboard
diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h
index 0dad176..03dddb8 100644
--- a/cores/arduino/USBAPI.h
+++ b/cores/arduino/USBAPI.h
@@ -46,6 +46,7 @@ extern Serial_ Serial;
#define MOUSE_LEFT 1
#define MOUSE_MIDDLE 2
#define MOUSE_RIGHT 4
+#define MOUSE_ALL (MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT)
class Mouse_
{
@@ -55,6 +56,8 @@ public:
void click(uint8_t b = MOUSE_LEFT);
void move(signed char x, signed char y, signed char wheel = 0);
void buttons(uint8_t b);
+ void press(uint8_t b = MOUSE_LEFT); // press LEFT by default
+ void release(uint8_t b = MOUSE_LEFT); // release LEFT by default
};
extern Mouse_ Mouse;