summaryrefslogtreecommitdiff
path: root/common/mousekey.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2012-10-09 14:36:13 +0900
committertmk <nobody@nowhere>2012-10-17 15:55:37 +0900
commit373ab0e7192811944786c095facb80938c33f1d5 (patch)
treeaf609b1318ebb8e08897460af7dc894c389cea02 /common/mousekey.c
parent16ba9bda5601ebef6e4db04a5ad079af32370815 (diff)
downloadqmk_firmware-373ab0e7192811944786c095facb80938c33f1d5.tar.gz
qmk_firmware-373ab0e7192811944786c095facb80938c33f1d5.zip
Add keycode.h and remove usb_keycodes.h.
Diffstat (limited to 'common/mousekey.c')
-rw-r--r--common/mousekey.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/common/mousekey.c b/common/mousekey.c
index 222d9e4455..58a6e35bb0 100644
--- a/common/mousekey.c
+++ b/common/mousekey.c
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdint.h>
#include <util/delay.h>
-#include "usb_keycodes.h"
+#include "keycode.h"
#include "host.h"
#include "timer.h"
#include "print.h"
@@ -90,36 +90,36 @@ void mousekey_task(void)
void mousekey_on(uint8_t code)
{
- if (code == KB_MS_UP) report.y = MOUSEKEY_MOVE_INIT * -1;
- else if (code == KB_MS_DOWN) report.y = MOUSEKEY_MOVE_INIT;
- else if (code == KB_MS_LEFT) report.x = MOUSEKEY_MOVE_INIT * -1;
- else if (code == KB_MS_RIGHT) report.x = MOUSEKEY_MOVE_INIT;
- else if (code == KB_MS_WH_UP) report.v = MOUSEKEY_WHEEL_INIT;
- else if (code == KB_MS_WH_DOWN) report.v = MOUSEKEY_WHEEL_INIT * -1;
- else if (code == KB_MS_WH_LEFT) report.h = MOUSEKEY_WHEEL_INIT * -1;
- else if (code == KB_MS_WH_RIGHT) report.h = MOUSEKEY_WHEEL_INIT;
- else if (code == KB_MS_BTN1) report.buttons |= MOUSE_BTN1;
- else if (code == KB_MS_BTN2) report.buttons |= MOUSE_BTN2;
- else if (code == KB_MS_BTN3) report.buttons |= MOUSE_BTN3;
- else if (code == KB_MS_BTN4) report.buttons |= MOUSE_BTN4;
- else if (code == KB_MS_BTN5) report.buttons |= MOUSE_BTN5;
+ if (code == KC_MS_UP) report.y = MOUSEKEY_MOVE_INIT * -1;
+ else if (code == KC_MS_DOWN) report.y = MOUSEKEY_MOVE_INIT;
+ else if (code == KC_MS_LEFT) report.x = MOUSEKEY_MOVE_INIT * -1;
+ else if (code == KC_MS_RIGHT) report.x = MOUSEKEY_MOVE_INIT;
+ else if (code == KC_MS_WH_UP) report.v = MOUSEKEY_WHEEL_INIT;
+ else if (code == KC_MS_WH_DOWN) report.v = MOUSEKEY_WHEEL_INIT * -1;
+ else if (code == KC_MS_WH_LEFT) report.h = MOUSEKEY_WHEEL_INIT * -1;
+ else if (code == KC_MS_WH_RIGHT) report.h = MOUSEKEY_WHEEL_INIT;
+ else if (code == KC_MS_BTN1) report.buttons |= MOUSE_BTN1;
+ else if (code == KC_MS_BTN2) report.buttons |= MOUSE_BTN2;
+ else if (code == KC_MS_BTN3) report.buttons |= MOUSE_BTN3;
+ else if (code == KC_MS_BTN4) report.buttons |= MOUSE_BTN4;
+ else if (code == KC_MS_BTN5) report.buttons |= MOUSE_BTN5;
}
void mousekey_off(uint8_t code)
{
- if (code == KB_MS_UP && report.y < 0) report.y = 0;
- else if (code == KB_MS_DOWN && report.y > 0) report.y = 0;
- else if (code == KB_MS_LEFT && report.x < 0) report.x = 0;
- else if (code == KB_MS_RIGHT && report.x > 0) report.x = 0;
- else if (code == KB_MS_WH_UP && report.v > 0) report.v = 0;
- else if (code == KB_MS_WH_DOWN && report.v < 0) report.v = 0;
- else if (code == KB_MS_WH_LEFT && report.h < 0) report.h = 0;
- else if (code == KB_MS_WH_RIGHT && report.h > 0) report.h = 0;
- else if (code == KB_MS_BTN1) report.buttons &= ~MOUSE_BTN1;
- else if (code == KB_MS_BTN2) report.buttons &= ~MOUSE_BTN2;
- else if (code == KB_MS_BTN3) report.buttons &= ~MOUSE_BTN3;
- else if (code == KB_MS_BTN4) report.buttons &= ~MOUSE_BTN4;
- else if (code == KB_MS_BTN5) report.buttons &= ~MOUSE_BTN5;
+ if (code == KC_MS_UP && report.y < 0) report.y = 0;
+ else if (code == KC_MS_DOWN && report.y > 0) report.y = 0;
+ else if (code == KC_MS_LEFT && report.x < 0) report.x = 0;
+ else if (code == KC_MS_RIGHT && report.x > 0) report.x = 0;
+ else if (code == KC_MS_WH_UP && report.v > 0) report.v = 0;
+ else if (code == KC_MS_WH_DOWN && report.v < 0) report.v = 0;
+ else if (code == KC_MS_WH_LEFT && report.h < 0) report.h = 0;
+ else if (code == KC_MS_WH_RIGHT && report.h > 0) report.h = 0;
+ else if (code == KC_MS_BTN1) report.buttons &= ~MOUSE_BTN1;
+ else if (code == KC_MS_BTN2) report.buttons &= ~MOUSE_BTN2;
+ else if (code == KC_MS_BTN3) report.buttons &= ~MOUSE_BTN3;
+ else if (code == KC_MS_BTN4) report.buttons &= ~MOUSE_BTN4;
+ else if (code == KC_MS_BTN5) report.buttons &= ~MOUSE_BTN5;
if (report.x == 0 && report.y == 0 && report.v == 0 && report.h == 0)
mousekey_repeat = 0;