void mousekey_decode(uint8_t code)
{
- if (code == MS_UP) mousekey_y -= move_unit();
- else if (code == MS_DOWN) mousekey_y += move_unit();
- else if (code == MS_LEFT) mousekey_x -= move_unit();
- else if (code == MS_RGHT) mousekey_x += move_unit();
- else if (code == MS_BTN1) mousekey_btn |= MOUSE_BTN1;
- else if (code == MS_BTN2) mousekey_btn |= MOUSE_BTN2;
- else if (code == MS_BTN3) mousekey_btn |= MOUSE_BTN3;
- else if (code == MS_BTN4) mousekey_btn |= MOUSE_BTN4;
- else if (code == MS_BTN5) mousekey_btn |= MOUSE_BTN5;
- else if (code == MS_WH_U) mousekey_v += 1;
- else if (code == MS_WH_D) mousekey_v -= 1;
- else if (code == MS_WH_L) mousekey_h -= 1;
- else if (code == MS_WH_R) mousekey_h += 1;
+ if (code == KB_MS_UP) mousekey_y -= move_unit();
+ else if (code == KB_MS_DOWN) mousekey_y += move_unit();
+ else if (code == KB_MS_LEFT) mousekey_x -= move_unit();
+ else if (code == KB_MS_RIGHT) mousekey_x += move_unit();
+ else if (code == KB_MS_BTN1) mousekey_btn |= MOUSE_BTN1;
+ else if (code == KB_MS_BTN2) mousekey_btn |= MOUSE_BTN2;
+ else if (code == KB_MS_BTN3) mousekey_btn |= MOUSE_BTN3;
+ else if (code == KB_MS_BTN4) mousekey_btn |= MOUSE_BTN4;
+ else if (code == KB_MS_BTN5) mousekey_btn |= MOUSE_BTN5;
+ else if (code == KB_MS_WH_UP) mousekey_v += 1;
+ else if (code == KB_MS_WH_DOWN) mousekey_v -= 1;
+ else if (code == KB_MS_WH_LEFT) mousekey_h -= 1;
+ else if (code == KB_MS_WH_RIGHT) mousekey_h += 1;
}
bool mousekey_changed(void)
usb_mouse_print(mousekey_x, mousekey_y, mousekey_v, mousekey_h, mousekey_btn);
- _delay_ms(MOUSEKEY_DELAY_TIME >> (mousekey_repeat < 5 ? mousekey_repeat : 4));
+ if (mousekey_x || mousekey_y || mousekey_v || mousekey_h)
+ _delay_ms(MOUSEKEY_DELAY_TIME >> (mousekey_repeat < 5 ? mousekey_repeat : 4));
mousekey_repeat++;
} else {
mousekey_repeat = 0;