summaryrefslogtreecommitdiff
path: root/usb_mouse.c
diff options
context:
space:
mode:
authortmk2010-10-24 01:17:26 +0900
committertmk2010-10-24 01:17:26 +0900
commit06eb50be07ff16e4bfb046e4773185d9bcf048e9 (patch)
tree86a8fb688282004893eedd28641f8300c9d812d1 /usb_mouse.c
parent9d7979931e0037fc5ddc77a2cb895eb055501f34 (diff)
hhkb: refactored
Diffstat (limited to 'usb_mouse.c')
-rw-r--r--usb_mouse.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/usb_mouse.c b/usb_mouse.c
index c2617a5e1..6eb47dde6 100644
--- a/usb_mouse.c
+++ b/usb_mouse.c
@@ -1,8 +1,11 @@
#include <avr/interrupt.h>
#include <util/delay.h>
#include "usb_mouse.h"
+#include "print.h"
+static bool is_sent = false;
+
// which buttons are currently pressed
uint8_t mouse_buttons=0;
@@ -60,5 +63,23 @@ int8_t usb_mouse_move(int8_t x, int8_t y, int8_t wheel, int8_t hwheel)
UEINTX = 0x3A;
SREG = intr_state;
+ is_sent = true;
return 0;
}
+
+void usb_mouse_clear(void) {
+ is_sent = false;
+}
+
+bool usb_mouse_is_sent(void) {
+ return is_sent;
+}
+
+void usb_mouse_print(int8_t mouse_x, int8_t mouse_y, int8_t wheel_v, int8_t wheel_h) {
+ print("mouse btn|x y v h: ");
+ phex(mouse_buttons); print("|");
+ phex(mouse_x); print(" ");
+ phex(mouse_y); print(" ");
+ phex(wheel_v); print(" ");
+ phex(wheel_h); print("\n");
+}