diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index b32ad1e222d..d6911d66f21 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -81,10 +81,10 @@ void ps2_mouse_task(void) { rcv = ps2_host_send(PS2_MOUSE_READ_DATA); if (rcv == PS2_ACK) { mouse_report.buttons = ps2_host_recv_response(); - mouse_report.x = ps2_host_recv_response() * PS2_MOUSE_X_MULTIPLIER; - mouse_report.y = ps2_host_recv_response() * PS2_MOUSE_Y_MULTIPLIER; + mouse_report.x = ps2_host_recv_response(); + mouse_report.y = ps2_host_recv_response(); # ifdef PS2_MOUSE_ENABLE_SCROLLING - mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK) * PS2_MOUSE_V_MULTIPLIER; + mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); # endif } else { if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); @@ -92,10 +92,10 @@ void ps2_mouse_task(void) { #else if (pbuf_has_data()) { mouse_report.buttons = ps2_host_recv_response(); - mouse_report.x = ps2_host_recv_response() * PS2_MOUSE_X_MULTIPLIER; - mouse_report.y = ps2_host_recv_response() * PS2_MOUSE_Y_MULTIPLIER; + mouse_report.x = ps2_host_recv_response(); + mouse_report.y = ps2_host_recv_response(); # ifdef PS2_MOUSE_ENABLE_SCROLLING - mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK) * PS2_MOUSE_V_MULTIPLIER; + mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); # endif } else { if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); @@ -168,6 +168,7 @@ void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate) { #define X_IS_OVF (mouse_report->buttons & (1 << PS2_MOUSE_X_OVFLW)) #define Y_IS_OVF (mouse_report->buttons & (1 << PS2_MOUSE_Y_OVFLW)) static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report) { +#ifndef MOUSE_EXTENDED_REPORT // PS/2 mouse data is '9-bit integer'(-256 to 255) which is comprised of sign-bit and 8-bit value. // bit: 8 7 ... 0 // sign \8-bit/ @@ -175,8 +176,18 @@ static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report) // Meanwhile USB HID mouse indicates 8bit data(-127 to 127), note that -128 is not used. // // This converts PS/2 data into HID value. Use only -127-127 out of PS/2 9-bit. + mouse_report->x *= PS2_MOUSE_X_MULTIPLIER; + mouse_report->y *= PS2_MOUSE_Y_MULTIPLIER; mouse_report->x = X_IS_NEG ? ((!X_IS_OVF && -127 <= mouse_report->x && mouse_report->x <= -1) ? mouse_report->x : -127) : ((!X_IS_OVF && 0 <= mouse_report->x && mouse_report->x <= 127) ? mouse_report->x : 127); mouse_report->y = Y_IS_NEG ? ((!Y_IS_OVF && -127 <= mouse_report->y && mouse_report->y <= -1) ? mouse_report->y : -127) : ((!Y_IS_OVF && 0 <= mouse_report->y && mouse_report->y <= 127) ? mouse_report->y : 127); +#else + // Sign extend if negative, otherwise leave positive 8-bits as-is + mouse_report->x = X_IS_NEG ? (mouse_report->x | ~0xFF) : mouse_report->x; + mouse_report->y = Y_IS_NEG ? (mouse_report->y | ~0xFF) : mouse_report->y; + mouse_report->x *= PS2_MOUSE_X_MULTIPLIER; + mouse_report->y *= PS2_MOUSE_Y_MULTIPLIER; +#endif + mouse_report->v *= PS2_MOUSE_V_MULTIPLIER; #ifdef PS2_MOUSE_INVERT_BUTTONS // swap left & right buttons @@ -197,8 +208,8 @@ static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report) #endif #ifdef PS2_MOUSE_ROTATE - int8_t x = mouse_report->x; - int8_t y = mouse_report->y; + mouse_xy_report_t x = mouse_report->x; + mouse_xy_report_t y = mouse_report->y; # if PS2_MOUSE_ROTATE == 90 mouse_report->x = y; mouse_report->y = -x; diff --git a/keyboards/handwired/dactyl_manuform/4x5/info.json b/keyboards/handwired/dactyl_manuform/4x5/info.json index bb3b3e6c2c2..5fdab01ef43 100644 --- a/keyboards/handwired/dactyl_manuform/4x5/info.json +++ b/keyboards/handwired/dactyl_manuform/4x5/info.json @@ -21,6 +21,7 @@ }, "processor": "atmega32u4", "bootloader": "caterina", + "community_layouts": ["split_3x5_3"], "layouts": { "LAYOUT": { "layout": [ @@ -84,6 +85,55 @@ {"matrix": [9, 1], "x": 8, "y": 6}, {"matrix": [9, 2], "x": 9, "y": 6} ] + }, + "LAYOUT_split_3x5_3": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0}, + {"matrix": [0, 1], "x": 1, "y": 0}, + {"matrix": [0, 2], "x": 2, "y": 0}, + {"matrix": [0, 3], "x": 3, "y": 0}, + {"matrix": [0, 4], "x": 4, "y": 0}, + + {"matrix": [5, 4], "x": 10, "y": 0}, + {"matrix": [5, 3], "x": 11, "y": 0}, + {"matrix": [5, 2], "x": 12, "y": 0}, + {"matrix": [5, 1], "x": 13, "y": 0}, + {"matrix": [5, 0], "x": 14, "y": 0}, + + {"matrix": [1, 0], "x": 0, "y": 1}, + {"matrix": [1, 1], "x": 1, "y": 1}, + {"matrix": [1, 2], "x": 2, "y": 1}, + {"matrix": [1, 3], "x": 3, "y": 1}, + {"matrix": [1, 4], "x": 4, "y": 1}, + + {"matrix": [6, 4], "x": 10, "y": 1}, + {"matrix": [6, 3], "x": 11, "y": 1}, + {"matrix": [6, 2], "x": 12, "y": 1}, + {"matrix": [6, 1], "x": 13, "y": 1}, + {"matrix": [6, 0], "x": 14, "y": 1}, + + {"matrix": [2, 0], "x": 0, "y": 2}, + {"matrix": [2, 1], "x": 1, "y": 2}, + {"matrix": [2, 2], "x": 2, "y": 2}, + {"matrix": [2, 3], "x": 3, "y": 2}, + {"matrix": [2, 4], "x": 4, "y": 2}, + + {"matrix": [7, 4], "x": 10, "y": 2}, + {"matrix": [7, 3], "x": 11, "y": 2}, + {"matrix": [7, 2], "x": 12, "y": 2}, + {"matrix": [7, 1], "x": 13, "y": 2}, + {"matrix": [7, 0], "x": 14, "y": 2}, + + {"matrix": [3, 3], "x": 3, "y": 4}, + {"matrix": [3, 4], "x": 4, "y": 4}, + + {"matrix": [8, 4], "x": 10, "y": 4}, + {"matrix": [8, 3], "x": 11, "y": 4}, + + {"matrix": [4, 4], "x": 5, "y": 5}, + + {"matrix": [9, 4], "x": 9, "y": 5} + ] } } } diff --git a/keyboards/handwired/dactyl_manuform/4x5/keymaps/default/keymap.c b/keyboards/handwired/dactyl_manuform/4x5/keymaps/default/keymap.c index 7f71f3db89e..375c2082444 100644 --- a/keyboards/handwired/dactyl_manuform/4x5/keymaps/default/keymap.c +++ b/keyboards/handwired/dactyl_manuform/4x5/keymaps/default/keymap.c @@ -1,3 +1,23 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +Copyright 2015 Jack Humbert + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + #include QMK_KEYBOARD_H #define _BASE 0 diff --git a/keyboards/handwired/dactyl_manuform/4x5/readme.md b/keyboards/handwired/dactyl_manuform/4x5/readme.md new file mode 100644 index 00000000000..b332f63f9f5 --- /dev/null +++ b/keyboards/handwired/dactyl_manuform/4x5/readme.md @@ -0,0 +1,6 @@ +## QMK Layouts + +The following layout is supported: +| Layout | Diagram | +| :---: | :---: | +| Split_3x5_3 | ![split_3x5_3](https://i.imgur.com/vxnpauX.jpg) | diff --git a/keyboards/handwired/dactyl_manuform/4x5_5/info.json b/keyboards/handwired/dactyl_manuform/4x5_5/info.json index 00bcdff9905..7ad7118ee47 100644 --- a/keyboards/handwired/dactyl_manuform/4x5_5/info.json +++ b/keyboards/handwired/dactyl_manuform/4x5_5/info.json @@ -18,6 +18,7 @@ }, "processor": "atmega32u4", "bootloader": "atmel-dfu", + "community_layouts": ["split_3x5_3"], "layouts": { "LAYOUT": { "layout": [ @@ -79,6 +80,55 @@ {"matrix": [9, 1], "x": 6, "y": 6}, {"matrix": [9, 2], "x": 7, "y": 6} ] + }, + "LAYOUT_split_3x5_3": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0}, + {"matrix": [0, 1], "x": 1, "y": 0}, + {"matrix": [0, 2], "x": 2, "y": 0}, + {"matrix": [0, 3], "x": 3, "y": 0}, + {"matrix": [0, 4], "x": 4, "y": 0}, + + {"matrix": [5, 0], "x": 6, "y": 0}, + {"matrix": [5, 1], "x": 7, "y": 0}, + {"matrix": [5, 2], "x": 8, "y": 0}, + {"matrix": [5, 3], "x": 9, "y": 0}, + {"matrix": [5, 4], "x": 10, "y": 0}, + + {"matrix": [1, 0], "x": 0, "y": 1}, + {"matrix": [1, 1], "x": 1, "y": 1}, + {"matrix": [1, 2], "x": 2, "y": 1}, + {"matrix": [1, 3], "x": 3, "y": 1}, + {"matrix": [1, 4], "x": 4, "y": 1}, + + {"matrix": [6, 0], "x": 6, "y": 1}, + {"matrix": [6, 1], "x": 7, "y": 1}, + {"matrix": [6, 2], "x": 8, "y": 1}, + {"matrix": [6, 3], "x": 9, "y": 1}, + {"matrix": [6, 4], "x": 10, "y": 1}, + + {"matrix": [2, 0], "x": 0, "y": 2}, + {"matrix": [2, 1], "x": 1, "y": 2}, + {"matrix": [2, 2], "x": 2, "y": 2}, + {"matrix": [2, 3], "x": 3, "y": 2}, + {"matrix": [2, 4], "x": 4, "y": 2}, + + {"matrix": [7, 0], "x": 6, "y": 2}, + {"matrix": [7, 1], "x": 7, "y": 2}, + {"matrix": [7, 2], "x": 8, "y": 2}, + {"matrix": [7, 3], "x": 9, "y": 2}, + {"matrix": [7, 4], "x": 10, "y": 2}, + + {"matrix": [3, 3], "x": 3, "y": 4}, + + {"matrix": [8, 1], "x": 7, "y": 4}, + + {"matrix": [3, 4], "x": 3, "y": 5}, + {"matrix": [4, 4], "x": 4, "y": 5}, + + {"matrix": [9, 0], "x": 6, "y": 5}, + {"matrix": [8, 0], "x": 7, "y": 5} + ] } } } diff --git a/keyboards/handwired/dactyl_manuform/4x5_5/readme.md b/keyboards/handwired/dactyl_manuform/4x5_5/readme.md new file mode 100644 index 00000000000..8557e66214f --- /dev/null +++ b/keyboards/handwired/dactyl_manuform/4x5_5/readme.md @@ -0,0 +1,6 @@ +## QMK Layouts + +The following layout is supported: +| Layout | Diagram | +| :---: | :---: | +| Split_3x5_3 | ![split_3x5_3](https://i.imgur.com/BHnwCkr.jpg) | diff --git a/keyboards/handwired/dactyl_manuform/4x6_5/info.json b/keyboards/handwired/dactyl_manuform/4x6_5/info.json index 63edf390aeb..b9ebd6d7df1 100644 --- a/keyboards/handwired/dactyl_manuform/4x6_5/info.json +++ b/keyboards/handwired/dactyl_manuform/4x6_5/info.json @@ -21,6 +21,7 @@ }, "processor": "atmega32u4", "bootloader": "caterina", + "community_layouts": ["split_3x6_3", "split_3x5_3"], "layouts": { "LAYOUT": { "layout": [ @@ -86,6 +87,106 @@ {"matrix": [9, 3], "x": 10, "y": 5}, {"matrix": [9, 1], "x": 11, "y": 5} ] + }, + "LAYOUT_split_3x6_3": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0}, + {"matrix": [0, 1], "x": 1, "y": 0}, + {"matrix": [0, 2], "x": 2, "y": 0}, + {"matrix": [0, 3], "x": 3, "y": 0}, + {"matrix": [0, 4], "x": 4, "y": 0}, + {"matrix": [0, 5], "x": 5, "y": 0}, + + {"matrix": [5, 0], "x": 11, "y": 0}, + {"matrix": [5, 1], "x": 12, "y": 0}, + {"matrix": [5, 2], "x": 13, "y": 0}, + {"matrix": [5, 3], "x": 14, "y": 0}, + {"matrix": [5, 4], "x": 15, "y": 0}, + {"matrix": [5, 5], "x": 16, "y": 0}, + + {"matrix": [1, 0], "x": 0, "y": 1}, + {"matrix": [1, 1], "x": 1, "y": 1}, + {"matrix": [1, 2], "x": 2, "y": 1}, + {"matrix": [1, 3], "x": 3, "y": 1}, + {"matrix": [1, 4], "x": 4, "y": 1}, + {"matrix": [1, 5], "x": 5, "y": 1}, + + {"matrix": [6, 0], "x": 11, "y": 1}, + {"matrix": [6, 1], "x": 12, "y": 1}, + {"matrix": [6, 2], "x": 13, "y": 1}, + {"matrix": [6, 3], "x": 14, "y": 1}, + {"matrix": [6, 4], "x": 15, "y": 1}, + {"matrix": [6, 5], "x": 16, "y": 1}, + + {"matrix": [2, 0], "x": 0, "y": 2}, + {"matrix": [2, 1], "x": 1, "y": 2}, + {"matrix": [2, 2], "x": 2, "y": 2}, + {"matrix": [2, 3], "x": 3, "y": 2}, + {"matrix": [2, 4], "x": 4, "y": 2}, + {"matrix": [2, 5], "x": 5, "y": 2}, + + {"matrix": [7, 0], "x": 11, "y": 2}, + {"matrix": [7, 1], "x": 12, "y": 2}, + {"matrix": [7, 2], "x": 13, "y": 2}, + {"matrix": [7, 3], "x": 14, "y": 2}, + {"matrix": [7, 4], "x": 15, "y": 2}, + {"matrix": [7, 5], "x": 16, "y": 2}, + + {"matrix": [3, 4], "x": 4, "y": 4}, + {"matrix": [4, 5], "x": 5, "y": 4}, + {"matrix": [4, 3], "x": 6, "y": 4}, + + {"matrix": [9, 2], "x": 10, "y": 4}, + {"matrix": [9, 0], "x": 11, "y": 4}, + {"matrix": [8, 1], "x": 12, "y": 4} + ] + }, + "LAYOUT_split_3x5_3": { + "layout": [ + {"matrix": [0, 1], "x": 0, "y": 0}, + {"matrix": [0, 2], "x": 1, "y": 0}, + {"matrix": [0, 3], "x": 2, "y": 0}, + {"matrix": [0, 4], "x": 3, "y": 0}, + {"matrix": [0, 5], "x": 4, "y": 0}, + + {"matrix": [5, 0], "x": 10, "y": 0}, + {"matrix": [5, 1], "x": 11, "y": 0}, + {"matrix": [5, 2], "x": 12, "y": 0}, + {"matrix": [5, 3], "x": 13, "y": 0}, + {"matrix": [5, 4], "x": 14, "y": 0}, + + {"matrix": [1, 1], "x": 0, "y": 1}, + {"matrix": [1, 2], "x": 1, "y": 1}, + {"matrix": [1, 3], "x": 2, "y": 1}, + {"matrix": [1, 4], "x": 3, "y": 1}, + {"matrix": [1, 5], "x": 4, "y": 1}, + + {"matrix": [6, 0], "x": 10, "y": 1}, + {"matrix": [6, 1], "x": 11, "y": 1}, + {"matrix": [6, 2], "x": 12, "y": 1}, + {"matrix": [6, 3], "x": 13, "y": 1}, + {"matrix": [6, 4], "x": 14, "y": 1}, + + {"matrix": [2, 1], "x": 0, "y": 2}, + {"matrix": [2, 2], "x": 1, "y": 2}, + {"matrix": [2, 3], "x": 2, "y": 2}, + {"matrix": [2, 4], "x": 3, "y": 2}, + {"matrix": [2, 5], "x": 4, "y": 2}, + + {"matrix": [7, 0], "x": 10, "y": 2}, + {"matrix": [7, 1], "x": 11, "y": 2}, + {"matrix": [7, 2], "x": 12, "y": 2}, + {"matrix": [7, 3], "x": 13, "y": 2}, + {"matrix": [7, 4], "x": 14, "y": 2}, + + {"matrix": [3, 4], "x": 4, "y": 3}, + {"matrix": [4, 5], "x": 5, "y": 3}, + {"matrix": [4, 3], "x": 6, "y": 3}, + + {"matrix": [9, 2], "x": 8, "y": 3}, + {"matrix": [9, 0], "x": 9, "y": 3}, + {"matrix": [8, 1], "x": 10, "y": 3} + ] } } } diff --git a/keyboards/handwired/dactyl_manuform/4x6_5/readme.md b/keyboards/handwired/dactyl_manuform/4x6_5/readme.md new file mode 100644 index 00000000000..b6db0923830 --- /dev/null +++ b/keyboards/handwired/dactyl_manuform/4x6_5/readme.md @@ -0,0 +1,7 @@ +## QMK Layouts + +The following layouts are supported: +| Layout | Diagram | +| :---: | :---: | +| Split_3x6_3 | ![split_3x6_3](https://i.imgur.com/0XmjFw9.jpg) | +| Split_3x5_3 | ![split_3x5_3](https://i.imgur.com/DYdFDKj.jpg) |