Просмотр исходного кода

Merge remote-tracking branch 'origin/develop' into xap

QMK Bot 3 лет назад
Родитель
Сommit
b285156286

+ 19 - 8
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;

+ 50 - 0
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}
+            ]
         }
     }
 }

+ 20 - 0
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 <wakojun@gmail.com>
+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 <http://www.gnu.org/licenses/>.
+*/
+
 #include QMK_KEYBOARD_H
 
 #define _BASE 0

+ 6 - 0
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) |

+ 50 - 0
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}
+            ]
         }
     }
 }

+ 6 - 0
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) |

+ 101 - 0
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}
+            ]
         }
     }
 }

+ 7 - 0
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) |