summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--key_process.c16
-rw-r--r--keymap_skel.h2
-rw-r--r--layer.c2
-rw-r--r--usb_keycodes.h8
4 files changed, 13 insertions, 15 deletions
diff --git a/key_process.c b/key_process.c
index 2d4e788195..9c9ea26c4f 100644
--- a/key_process.c
+++ b/key_process.c
@@ -57,7 +57,6 @@ void proc_matrix(void) {
for (int col = 0; col < matrix_cols(); col++) {
if (!matrix_is_on(row, col)) continue;
- // TODO: clean code
uint8_t code = layer_get_keycode(row, col);
if (code == KB_NO) {
// do nothing
@@ -65,12 +64,12 @@ void proc_matrix(void) {
usb_keyboard_add_mod(code);
} else if (IS_FN(code)) {
fn_bits |= FN_BIT(code);
- } else if (IS_MOUSE(code)) {
+ }
#ifdef MOUSEKEY_ENABLE
+ else if (IS_MOUSEKEY(code)) {
mousekey_decode(code);
-#endif
}
-
+#endif
#ifdef USB_EXTRA_ENABLE
// audio control & system control
else if (code == KB_MUTE) {
@@ -94,10 +93,11 @@ void proc_matrix(void) {
_delay_ms(1000);
}
#endif
-
- // normal keys
- else {
+ // normal key
+ else if (IS_KEY(code)) {
usb_keyboard_add_key(code);
+ } else {
+ debug("ignore keycode: "); debug_hex(code); debug("\n");
}
}
}
@@ -317,12 +317,10 @@ void proc_matrix(void) {
}
#ifdef MOUSEKEY_ENABLE
- // mouse keys
mousekey_usb_send();
#endif
#ifdef PS2_MOUSE_ENABLE
- // ps2 mouse
if (ps2_mouse_read() == 0)
ps2_mouse_usb_send();
#endif
diff --git a/keymap_skel.h b/keymap_skel.h
index e4ac560eb5..300801ff62 100644
--- a/keymap_skel.h
+++ b/keymap_skel.h
@@ -10,7 +10,7 @@
uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col);
/* layer to move during press Fn key */
-int keymap_fn_layer(uint8_t fn_bits);
+uint8_t keymap_fn_layer(uint8_t fn_bits);
/* keycode to send when release Fn key without using */
uint8_t keymap_fn_keycode(uint8_t fn_bits);
diff --git a/layer.c b/layer.c
index 2d644c1a60..e9e44217b2 100644
--- a/layer.c
+++ b/layer.c
@@ -65,7 +65,7 @@ uint8_t layer_get_keycode(uint8_t row, uint8_t col)
{
uint8_t code = keymap_get_keycode(current_layer, row, col);
// normal key or mouse key
- if ((IS_KEY(code) || IS_MOUSE(code))) {
+ if ((IS_KEY(code) || IS_MOUSEKEY(code))) {
layer_used = true;
}
return code;
diff --git a/usb_keycodes.h b/usb_keycodes.h
index 87aa31ca8f..9c57598438 100644
--- a/usb_keycodes.h
+++ b/usb_keycodes.h
@@ -40,10 +40,10 @@
#define IS_KEY(code) (KB_A <= (code) && (code) <= KP_HEXADECIMAL)
#define IS_MOD(code) (KB_LCTRL <= (code) && (code) <= KB_RGUI)
#define IS_FN(code) (FN_0 <= (code) && (code) <= FN_7)
-#define IS_MOUSE(code) (MS_UP <= (code) && (code) <= MS_WH_RIGHT)
-#define IS_MOUSE_MOVE(code) (MS_UP <= (code) && (code) <= MS_RIGHT)
-#define IS_MOUSE_BUTTON(code) (MS_BTN1 <= (code) && (code) <= MS_BTN5)
-#define IS_MOUSE_WHEEL(code) (MS_WH_UP <= (code) && (code) <= MS_WH_RIGHT)
+#define IS_MOUSEKEY(code) (MS_UP <= (code) && (code) <= MS_WH_RIGHT)
+#define IS_MOUSEKEY_MOVE(code) (MS_UP <= (code) && (code) <= MS_RIGHT)
+#define IS_MOUSEKEY_BUTTON(code) (MS_BTN1 <= (code) && (code) <= MS_BTN5)
+#define IS_MOUSEKEY_WHEEL(code) (MS_WH_UP <= (code) && (code) <= MS_WH_RIGHT)
#define MOD_BIT(code) (1<<((code) & 0x07))
#define FN_BIT(code) (1<<((code) - FN_0))