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

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

QMK Bot 3 месяцев назад
Родитель
Сommit
146d4fab83

+ 44 - 0
keyboards/troyle/macro_keys_dual/keyboard.json

@@ -0,0 +1,44 @@
+{
+    "manufacturer": "troyle",
+    "keyboard_name": "troyle/macro_keys_dual",
+    "maintainer": "troyle",
+    "development_board": "promicro",
+    "encoder": {
+        "rotary": [
+            {"pin_a": "D1", "pin_b": "D0", "resolution": 2},
+            {"pin_a": "B4", "pin_b": "B5", "resolution": 2}
+        ]
+    },
+    "features": {
+        "bootmagic": true,
+        "encoder": true,
+        "extrakey": true,
+        "mousekey": true,
+        "nkro": true
+    },
+    "matrix_pins": {
+        "direct": [
+            ["F7", "F6", "F5", "F4"],
+            ["B6", "B2", "B3", "B1"]
+        ]
+    },
+    "usb": {
+        "device_version": "1.0.0",
+        "pid": "0x0001",
+        "vid": "0x7472"
+    },
+    "layouts": {
+        "LAYOUT": {
+            "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": [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}
+            ]
+        }
+    }
+}

+ 17 - 0
keyboards/troyle/macro_keys_dual/keymaps/default/keymap.c

@@ -0,0 +1,17 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+	[0] = LAYOUT(
+		KC_P1, KC_P2, KC_P3, KC_P4,
+		KC_P5, KC_P6, KC_P7, KC_P8
+	)
+};
+
+#if defined(ENCODER_MAP_ENABLE)
+const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
+	[0] = { ENCODER_CCW_CW(KC_LEFT_BRACKET, KC_RIGHT_BRACKET), ENCODER_CCW_CW(KC_KP_PLUS, KC_KP_MINUS) }
+};
+#endif

+ 1 - 0
keyboards/troyle/macro_keys_dual/keymaps/default/rules.mk

@@ -0,0 +1 @@
+ENCODER_MAP_ENABLE = yes

+ 27 - 0
keyboards/troyle/macro_keys_dual/readme.md

@@ -0,0 +1,27 @@
+# troyle/macro_keys_dual
+
+![troyle/macro_keys_dual](https://i.imgur.com/3rrOsde.png)
+
+A pretty simple macro keyboard that can use up to 2 rotary encoders
+
+* Keyboard Maintainer: [Tom Royle](https://github.com/tom-royle)
+* Hardware Supported: Sparkfun ProMicro in the troyle-macro-keyboard v1.0 PCB
+* Hardware Availability: You will have to contact me some how :)
+
+Make example for this keyboard (after setting up your build environment):
+
+    make troyle/macro_keys_dual:default
+
+Flashing example for this keyboard:
+
+    make troyle/macro_keys_dual:default:flash
+
+See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
+
+## Bootloader
+
+Enter the bootloader in 3 ways:
+
+* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
+* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
+* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available

+ 4 - 4
tmk_core/protocol/usb_descriptor.c

@@ -202,13 +202,13 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM SharedReport[] = {
             HID_RI_USAGE_PAGE(8, 0x0C),// Consumer
             HID_RI_USAGE(16, 0x0238),  // AC Pan
 #    ifndef WHEEL_EXTENDED_REPORT
-            HID_RI_LOGICAL_MINIMUM(8, -127),
-            HID_RI_LOGICAL_MAXIMUM(8, 127),
+            HID_RI_LOGICAL_MINIMUM(8, MOUSE_REPORT_HV_MIN),
+            HID_RI_LOGICAL_MAXIMUM(8, MOUSE_REPORT_HV_MAX),
             HID_RI_REPORT_COUNT(8, 0x01),
             HID_RI_REPORT_SIZE(8, 0x08),
 #    else
-            HID_RI_LOGICAL_MINIMUM(16, -32767),
-            HID_RI_LOGICAL_MAXIMUM(16,  32767),
+            HID_RI_LOGICAL_MINIMUM(16, MOUSE_REPORT_HV_MIN),
+            HID_RI_LOGICAL_MAXIMUM(16, MOUSE_REPORT_HV_MAX),
             HID_RI_REPORT_COUNT(8, 0x01),
             HID_RI_REPORT_SIZE(8, 0x10),
 #    endif

+ 24 - 24
tmk_core/protocol/vusb/vusb.c

@@ -616,15 +616,15 @@ const PROGMEM uchar shared_hid_report[] = {
     0x09, 0x30, //     Usage (X)
     0x09, 0x31, //     Usage (Y)
 #    ifndef MOUSE_EXTENDED_REPORT
-    0x15, 0x81, //     Logical Minimum (-127)
-    0x25, 0x7F, //     Logical Maximum (127)
-    0x95, 0x02, //     Report Count (2)
-    0x75, 0x08, //     Report Size (8)
+    0x15, MOUSE_REPORT_XY_MIN, // Logical Minimum (-127)
+    0x25, MOUSE_REPORT_XY_MAX, // Logical Maximum (127)
+    0x95, 0x02,                // Report Count (2)
+    0x75, 0x08,                // Report Size (8)
 #    else
-    0x16, 0x01, 0x80, // Logical Minimum (-32767)
-    0x26, 0xFF, 0x7F, // Logical Maximum (32767)
-    0x95, 0x02,       // Report Count (2)
-    0x75, 0x10,       // Report Size (16)
+    0x16, 0x01, HID_VALUE_16(MOUSE_REPORT_XY_MIN), // Logical Minimum (-32767)
+    0x26, 0xFF, HID_VALUE_16(MOUSE_REPORT_XY_MAX), // Logical Maximum (32767)
+    0x95, 0x02,                                    // Report Count (2)
+    0x75, 0x10,                                    // Report Size (16)
 #    endif
     0x81, 0x06, //     Input (Data, Variable, Relative)
 
@@ -649,15 +649,15 @@ const PROGMEM uchar shared_hid_report[] = {
     // Vertical wheel (1 or 2 bytes)
     0x09, 0x38, //     Usage (Wheel)
 #    ifndef WHEEL_EXTENDED_REPORT
-    0x15, 0x81, //     Logical Minimum (-127)
-    0x25, 0x7F, //     Logical Maximum (127)
-    0x95, 0x01, //     Report Count (1)
-    0x75, 0x08, //     Report Size (8)
+    0x15, MOUSE_REPORT_HV_MIN, // Logical Minimum (-127)
+    0x25, MOUSE_REPORT_HV_MAX, // Logical Maximum (127)
+    0x95, 0x01,                // Report Count (1)
+    0x75, 0x08,                // Report Size (8)
 #    else
-    0x16, 0x01, 0x80, //     Logical Minimum (-32767)
-    0x26, 0xFF, 0x7F, //     Logical Maximum (32767)
-    0x95, 0x01,       //     Report Count (1)
-    0x75, 0x10,       //     Report Size (16)
+    0x16, 0x01, HID_VALUE_16(MOUSE_REPORT_HV_MIN), // Logical Minimum (-32767)
+    0x26, 0xFF, HID_VALUE_16(MOUSE_REPORT_HV_MAX), // Logical Maximum (32767)
+    0x95, 0x01,                                    // Report Count (1)
+    0x75, 0x10,                                    // Report Size (16)
 #    endif
     0x81, 0x06, //     Input (Data, Variable, Relative)
 
@@ -665,15 +665,15 @@ const PROGMEM uchar shared_hid_report[] = {
     0x05, 0x0C,       //     Usage Page (Consumer)
     0x0A, 0x38, 0x02, //     Usage (AC Pan)
 #    ifndef WHEEL_EXTENDED_REPORT
-    0x15, 0x81, //     Logical Minimum (-127)
-    0x25, 0x7F, //     Logical Maximum (127)
-    0x95, 0x01, //     Report Count (1)
-    0x75, 0x08, //     Report Size (8)
+    0x15, MOUSE_REPORT_HV_MIN, // Logical Minimum (-127)
+    0x25, MOUSE_REPORT_HV_MAX, // Logical Maximum (127)
+    0x95, 0x01,                // Report Count (1)
+    0x75, 0x08,                // Report Size (8)
 #    else
-    0x16, 0x01, 0x80, //     Logical Minimum (-32767)
-    0x26, 0xFF, 0x7F, //     Logical Maximum (32767)
-    0x95, 0x01,       //     Report Count (1)
-    0x75, 0x10,       //     Report Size (16)
+    0x16, 0x01, HID_VALUE_16(MOUSE_REPORT_HV_MIN), // Logical Minimum (-32767)
+    0x26, 0xFF, HID_VALUE_16(MOUSE_REPORT_HV_MAX), // Logical Maximum (32767)
+    0x95, 0x01,                                    // Report Count (1)
+    0x75, 0x10,                                    // Report Size (16)
 #    endif
     0x81, 0x06, //     Input (Data, Variable, Relative)