1
0
mirror of https://github.com/mcgurk/Arduino-USB-HID-RetroJoystickAdapter synced 2024-11-25 02:22:21 -05:00

Update c64_usb_mouse_2.ino

This commit is contained in:
Jarno Lehtinen 2017-06-01 16:48:45 +03:00 committed by GitHub
parent bff3f61729
commit 2f890de5d6

View File

@ -5,7 +5,7 @@
#include <usbhub.h> #include <usbhub.h>
#endif #endif
#define POTSENSE 4 //ICP1 #define POTSENSE 4 //ICP1 (Arduino Pro Micro: pin4, Arduino Uno: pin8)
#define POTX 9 ///< X-line, also OC1A #define POTX 9 ///< X-line, also OC1A
#define POTY 10 ///< Y-line, also OC1B #define POTY 10 ///< Y-line, also OC1B
@ -19,8 +19,6 @@ int16_t dy=0;
uint8_t buttons=0; uint8_t buttons=0;
uint8_t update = 0; uint8_t update = 0;
#define FIX_START 100
int32_t fix = FIX_START;
#ifdef USBHOST #ifdef USBHOST
class MouseRptParser : public MouseReportParser { class MouseRptParser : public MouseReportParser {
@ -57,7 +55,6 @@ void MouseRptParser::OnLeftButtonDown(MOUSEINFO *mi) {
#endif #endif
buttons |= 1; buttons |= 1;
update = 1; update = 1;
fix++;
}; };
void MouseRptParser::OnRightButtonUp(MOUSEINFO *mi) { void MouseRptParser::OnRightButtonUp(MOUSEINFO *mi) {
#ifdef DEBUG #ifdef DEBUG
@ -72,7 +69,6 @@ void MouseRptParser::OnRightButtonDown(MOUSEINFO *mi) {
#endif #endif
buttons |= 2; buttons |= 2;
update = 1; update = 1;
fix--;
}; };
void MouseRptParser::OnMiddleButtonUp(MOUSEINFO *mi) { void MouseRptParser::OnMiddleButtonUp(MOUSEINFO *mi) {
#ifdef DEBUG #ifdef DEBUG
@ -83,7 +79,6 @@ void MouseRptParser::OnMiddleButtonDown(MOUSEINFO *mi) {
#ifdef DEBUG #ifdef DEBUG
Serial.println("M Butt Dn"); Serial.println("M Butt Dn");
#endif #endif
fix = FIX_START;
}; };
USB Usb; USB Usb;
@ -171,6 +166,7 @@ void potmouse_movt(int16_t dx, int16_t dy, uint8_t button) {
potmouse_xcounter = (potmouse_xcounter + (dx/2)) & 0177; // modulo 128 potmouse_xcounter = (potmouse_xcounter + (dx/2)) & 0177; // modulo 128
potmouse_ycounter = (potmouse_ycounter - (dy/2)) & 0177; potmouse_ycounter = (potmouse_ycounter - (dy/2)) & 0177;
//for testing
//potmouse_xcounter = (millis()>>6) & 077; // modulo 64 //potmouse_xcounter = (millis()>>6) & 077; // modulo 64
//potmouse_ycounter = (millis()>>6) & 077; //potmouse_ycounter = (millis()>>6) & 077;