arduino stuffs
Diffstat (limited to 'libraries/Mouse/src/Mouse.h')
-rw-r--r--libraries/Mouse/src/Mouse.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/libraries/Mouse/src/Mouse.h b/libraries/Mouse/src/Mouse.h
new file mode 100644
index 0000000..2672b5c
--- /dev/null
+++ b/libraries/Mouse/src/Mouse.h
@@ -0,0 +1,60 @@
+/*
+ Mouse.h
+
+ Copyright (c) 2015, Arduino LLC
+ Original code (pre-library): Copyright (c) 2011, Peter Barrett
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef MOUSE_h
+#define MOUSE_h
+
+#include "HID.h"
+
+#if !defined(_USING_HID)
+
+#warning "Using legacy HID core (non pluggable)"
+
+#else
+
+//================================================================================
+//================================================================================
+// Mouse
+
+#define MOUSE_LEFT 1
+#define MOUSE_RIGHT 2
+#define MOUSE_MIDDLE 4
+#define MOUSE_ALL (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)
+
+class Mouse_
+{
+private:
+ uint8_t _buttons;
+ void buttons(uint8_t b);
+public:
+ Mouse_(void);
+ void begin(void);
+ void end(void);
+ void click(uint8_t b = MOUSE_LEFT);
+ void move(signed char x, signed char y, signed char wheel = 0);
+ void press(uint8_t b = MOUSE_LEFT); // press LEFT by default
+ void release(uint8_t b = MOUSE_LEFT); // release LEFT by default
+ bool isPressed(uint8_t b = MOUSE_LEFT); // check LEFT by default
+};
+extern Mouse_ Mouse;
+
+#endif
+#endif \ No newline at end of file