qmk / qmk_firmware

Open-source keyboard firmware for Atmel AVR and Arm USB families
https://qmk.fm
GNU General Public License v2.0
18.24k stars 39.31k forks source link

[Feature Request] info.json for userspace building #20406

Open HannesHasselbring opened 1 year ago

HannesHasselbring commented 1 year ago

Feature Request Type

Description

I have a couple of handwired keyboards. I like the idea of building qmk with github userspace and a data driven keyboard configuration.

From my understanding the keymap.json could include a complete keyboard configuration, but it is not treated as such. The qmk compile command still needs the keyboard configuration folder.

My current approach is to create a info.json use qmk import-keyboard to create a keyboard directory and then compile the keyboard with an keymap.json.

Is there a better way to do it? Would you be open for a enhancement to somehow specify a data driven keyboard config? I might be able to implement needed changes in qmk_cli

HannesHasselbring commented 1 year ago

with this, probably too simple, change in line 140 file lib/python/qmk/commands.py

    kb_folder = keyboard(keyboard_filesafe)
    if not kb_folder.exists():
        from qmk.importers import import_keyboard
        import_keyboard(user_keymap['config'])

I was able to compile the following keymap.json, which passed all validations.

{
  "keyboard": "banana_macropad",
  "keymap": "hannes",
  "layout": "LAYOUT",
  "layers": [
    ["KC_1", "KC_2", "KC_3", "KC_4", "KC_5", "KC_6", "KC_7", "QK_BOOT"]
  ],
  "encoders": [[{ "ccw": "KC_KB_VOLUME_UP", "cw": "KC_KB_VOLUME_DOWN" }]],
  "config": {
    "keyboard_name": "banana_macropad",
    "url": "https://github.com/dbostian/banana",
    "maintainer": "qmk",
    "manufacturer": "3D print",
    "usb": {
      "vid": "0xFEED",
      "pid": "0x0815",
      "device_version": "0.0.1"
    },
    "processor": "atmega32u4",
    "bootloader": "caterina",
    "matrix_pins": {
      "cols": ["D1", "D0", "D4", "C6", "D7", "E6", "B4", "B5"],
      "rows": ["B2"]
    },
    "diode_direction": "COL2ROW",
    "width": 8,
    "height": 1,
    "encoder": {
      "rotary": [{ "pin_a": "F6", "pin_b": "F6" }],
      "enabled": true
    },
    "features": {
      "extrakey": true,
      "encoder": true,
      "encoder_map": true
    },
    "layouts": {
      "LAYOUT": {
        "layout": [
          { "label": "F1", "x": 0, "y": 0, "matrix": [0, 0] },
          { "label": "F2", "x": 1, "y": 0, "matrix": [0, 1] },
          { "label": "F3", "x": 2, "y": 0, "matrix": [0, 2] },
          { "label": "F4", "x": 3, "y": 0, "matrix": [0, 3] },
          { "label": "F5", "x": 4, "y": 0, "matrix": [0, 4] },
          { "label": "F6", "x": 5, "y": 0, "matrix": [0, 5] },
          { "label": "F7", "x": 6, "y": 0, "matrix": [0, 6] },
          { "label": "F8", "x": 7, "y": 0, "matrix": [0, 7] }
        ]
      }
    }
  }
}
github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged properly or other activity occurs. For maintainers: Please label with bug, in progress, on hold, discussion or to do to prevent the issue from being re-flagged.