[Keyboard] Add converter/xmk (#18433)
This commit is contained in:
parent
d27d6f0485
commit
5922751b17
|
@ -0,0 +1,10 @@
|
|||
// Copyright 2022 Manna Harbour (@manna-harbour)
|
||||
// https://github.com/manna-harbour/xmk
|
||||
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined (XMK_DEBUG)
|
||||
#define DEBUG_MATRIX_SCAN_RATE
|
||||
#endif
|
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
"keyboard_name": "xmk",
|
||||
"manufacturer": "Manna Harbour",
|
||||
"maintainer": "manna-harbour",
|
||||
"url": "https://github.com/manna-harbour/xmk",
|
||||
"bootloader": "caterina",
|
||||
"features": {
|
||||
"virtser": true
|
||||
},
|
||||
"matrix_pins": {
|
||||
"cols": ["C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2"],
|
||||
"rows": ["D1", "D1", "D1", "D1"]
|
||||
},
|
||||
"processor": "atmega32u4",
|
||||
"usb": {
|
||||
"device_version": "1.0.0",
|
||||
"pid": "0xD465",
|
||||
"vid": "0xFEED"
|
||||
},
|
||||
"community_layouts": [
|
||||
"split_3x5_3"
|
||||
],
|
||||
"layouts": {
|
||||
"LAYOUT_split_3x5_3": {
|
||||
"layout": [
|
||||
{ "matrix": [0, 0], "x": 0, "y": 0.25 },
|
||||
{ "matrix": [0, 1], "x": 1, "y": 0.125 },
|
||||
{ "matrix": [0, 2], "x": 2, "y": 0 },
|
||||
{ "matrix": [0, 3], "x": 3, "y": 0.125 },
|
||||
{ "matrix": [0, 4], "x": 4, "y": 0.25 },
|
||||
{ "matrix": [0, 5], "x": 7, "y": 0.25 },
|
||||
{ "matrix": [0, 6], "x": 8, "y": 0.125 },
|
||||
{ "matrix": [0, 7], "x": 9, "y": 0 },
|
||||
{ "matrix": [0, 8], "x": 10, "y": 0.125 },
|
||||
{ "matrix": [0, 9], "x": 11, "y": 0.25 },
|
||||
{ "matrix": [0, 10], "x": 0, "y": 1.25 },
|
||||
{ "matrix": [0, 11], "x": 1, "y": 1.125 },
|
||||
{ "matrix": [0, 12], "x": 2, "y": 1 },
|
||||
{ "matrix": [0, 13], "x": 3, "y": 1.125 },
|
||||
{ "matrix": [0, 14], "x": 4, "y": 1.25 },
|
||||
{ "matrix": [0, 15], "x": 7, "y": 1.25 },
|
||||
{ "matrix": [0, 16], "x": 8, "y": 1.125 },
|
||||
{ "matrix": [0, 17], "x": 9, "y": 1 },
|
||||
{ "matrix": [0, 18], "x": 10, "y": 1.125 },
|
||||
{ "matrix": [0, 19], "x": 11, "y": 1.25 },
|
||||
{ "matrix": [0, 20], "x": 0, "y": 2.25 },
|
||||
{ "matrix": [0, 21], "x": 1, "y": 2.125 },
|
||||
{ "matrix": [0, 22], "x": 2, "y": 2 },
|
||||
{ "matrix": [0, 23], "x": 3, "y": 2.125 },
|
||||
{ "matrix": [0, 24], "x": 4, "y": 2.25 },
|
||||
{ "matrix": [0, 25], "x": 7, "y": 2.25 },
|
||||
{ "matrix": [0, 26], "x": 8, "y": 2.125 },
|
||||
{ "matrix": [0, 27], "x": 9, "y": 2 },
|
||||
{ "matrix": [0, 28], "x": 10, "y": 2.125 },
|
||||
{ "matrix": [0, 29], "x": 11, "y": 2.25 },
|
||||
{ "matrix": [0, 30], "x": 2.5, "y": 3.25 },
|
||||
{ "matrix": [0, 31], "x": 3.5, "y": 3.5 },
|
||||
{ "matrix": [1, 0], "x": 4.5, "y": 3.75 },
|
||||
{ "matrix": [1, 1], "x": 6.5, "y": 3.75 },
|
||||
{ "matrix": [1, 2], "x": 7.5, "y": 3.5 },
|
||||
{ "matrix": [1, 3], "x": 8.5, "y": 3.25 }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2022 Manna Harbour (@manna-harbour)
|
||||
// https://github.com/manna-harbour/xmk
|
||||
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT_split_3x5_3(
|
||||
KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT,
|
||||
KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O,
|
||||
KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH,
|
||||
KC_ESC, KC_SPC, KC_TAB, KC_ENT, KC_BSPC, KC_DEL
|
||||
)
|
||||
};
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright 2022 Manna Harbour (@manna-harbour)
|
||||
# https://github.com/manna-harbour/xmk
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
ifeq ($(strip $(XMK_DEBUG)), yes)
|
||||
CONSOLE_ENABLE = yes
|
||||
OPT_DEFS += -DXMK_DEBUG
|
||||
endif
|
|
@ -0,0 +1,30 @@
|
|||
# converter/xmk
|
||||
|
||||
`converter/xmk` is the QMK keyboard definition for [𝑥MK](https://github.com/manna-harbour/xmk).
|
||||
|
||||
* Keyboard Maintainer: [Manna Harbour](https://github.com/manna-harbour)
|
||||
* Hardware Supported: Any QMK-compatible MCU board
|
||||
* Hardware Availability: No additional hardware required
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make converter/xmk:default
|
||||
|
||||
Flashing example for this keyboard:
|
||||
|
||||
make converter/xmk:default:flash
|
||||
|
||||
To flash pre-compiled firmware to a pro-micro on Linux without using the `qmk` CLI:
|
||||
|
||||
avrdude -p atmega32u4 -c avr109 -U flash:w:converter_xmk_default.hex:i -P /dev/ttyACM0
|
||||
|
||||
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 4 ways:
|
||||
|
||||
* **Boot shell command**: Give the `boot` command to the `converter/xmk` shell, e.g. `echo "boot" > /dev/ttyACM0`
|
||||
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available
|
||||
* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
|
||||
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
|
|
@ -0,0 +1,10 @@
|
|||
# Copyright 2022 Manna Harbour (@manna-harbour)
|
||||
# https://github.com/manna-harbour/xmk
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
SRC += xmk_matrix.c
|
||||
SRC += xmk_shell.c
|
||||
CUSTOM_MATRIX = lite
|
||||
|
||||
#XMK_DEBUG = yes
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2022 Manna Harbour (@manna-harbour)
|
||||
// https://github.com/manna-harbour/xmk
|
||||
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#if defined (XMK_DEBUG)
|
||||
void keyboard_post_init_kb(void) {
|
||||
debug_enable=true;
|
||||
debug_matrix=true;
|
||||
debug_keyboard=true;
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright 2022 Manna Harbour (@manna-harbour)
|
||||
// https://github.com/manna-harbour/xmk
|
||||
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "xmk_matrix.h"
|
||||
|
||||
bool xmk_changed = false;
|
||||
matrix_row_t xmk_rows[MATRIX_ROWS];
|
||||
|
||||
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
||||
if (xmk_changed) {
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
current_matrix[row] = xmk_rows[row];
|
||||
}
|
||||
xmk_changed = false;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void xmk_matrix_key(bool press, uint8_t key) {
|
||||
dprintf("xmk_matrix_key: press: %s, key: %u\n", press?"true":"false", key);
|
||||
uint8_t row = key / MATRIX_COLS;
|
||||
if (row < MATRIX_ROWS) {
|
||||
uint8_t col = key % MATRIX_COLS;
|
||||
xmk_changed = true;
|
||||
if (press) {
|
||||
xmk_rows[row] |= (MATRIX_ROW_SHIFTER << col);
|
||||
} else {
|
||||
xmk_rows[row] &= ~(MATRIX_ROW_SHIFTER << col);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// Copyright 2022 Manna Harbour (@manna-harbour)
|
||||
// https://github.com/manna-harbour/xmk
|
||||
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
void xmk_matrix_key(bool press, uint8_t key);
|
|
@ -0,0 +1,59 @@
|
|||
// Copyright 2022 Manna Harbour (@manna-harbour)
|
||||
// https://github.com/manna-harbour/xmk
|
||||
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "xmk_matrix.h"
|
||||
|
||||
#define XMK_SHELL_LINE_LEN 64
|
||||
|
||||
#define XMK_SHELL_KEY "key "
|
||||
#define XMK_SHELL_KEY_PRESS "press "
|
||||
#define XMK_SHELL_KEY_RELEASE "release "
|
||||
#define XMK_SHELL_BOOT "boot"
|
||||
#define XMK_SHELL_RESET "reset"
|
||||
|
||||
void xmk_shell(char *line) {
|
||||
dprintf("xmk_shell: line: '%s'\n", line);
|
||||
if (strncmp(line, XMK_SHELL_KEY, strlen(XMK_SHELL_KEY)) == 0) {
|
||||
dprintf("xmk_shell: XMK_SHELL_KEY\n");
|
||||
if (strncmp(line + strlen(XMK_SHELL_KEY), XMK_SHELL_KEY_PRESS, strlen(XMK_SHELL_KEY_PRESS)) == 0) {
|
||||
uint8_t key = strtol(line + strlen(XMK_SHELL_KEY) + strlen(XMK_SHELL_KEY_PRESS), NULL, 10);
|
||||
dprintf("xmk_shell: XMK_SHELL_KEY_PRESS: key: %u\n", key);
|
||||
xmk_matrix_key(true, key);
|
||||
} else if (strncmp(line + strlen(XMK_SHELL_KEY), XMK_SHELL_KEY_RELEASE, strlen(XMK_SHELL_KEY_RELEASE)) == 0) {
|
||||
uint8_t key = strtol(line + strlen(XMK_SHELL_KEY) + strlen(XMK_SHELL_KEY_RELEASE), NULL, 10);
|
||||
dprintf("xmk_shell: XMK_SHELL_KEY_RELEASE: key: %u\n", key);
|
||||
xmk_matrix_key(false, key);
|
||||
}
|
||||
} else if (strcmp(line, XMK_SHELL_BOOT) == 0) {
|
||||
dprintf("xmk_shell: XMK_SHELL_BOOT\n");
|
||||
reset_keyboard();
|
||||
} else if (strcmp(line, XMK_SHELL_RESET) == 0) {
|
||||
dprintf("xmk_shell: XMK_SHELL_RESET\n");
|
||||
soft_reset_keyboard();
|
||||
}
|
||||
}
|
||||
|
||||
void virtser_recv(const uint8_t ch) {
|
||||
static char line[XMK_SHELL_LINE_LEN];
|
||||
static uint8_t line_index = 0;
|
||||
if (ch == '\r') {
|
||||
dprintf("virtser_recv: i: %3u, ch: %3u '\\r' \n", line_index, ch);
|
||||
line[line_index] = '\0';
|
||||
xmk_shell(line);
|
||||
line_index = 0;
|
||||
} else if (ch == '\n') {
|
||||
dprintf("virtser_recv: i: %3u, ch: %3u '\\n' \n", line_index, ch);
|
||||
} else {
|
||||
dprintf("virtser_recv: i: %3u, ch: %3u '%c'\n", line_index, ch, ch);
|
||||
if (line_index < (XMK_SHELL_LINE_LEN - 1)) {
|
||||
line[line_index] = ch;
|
||||
line_index++;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue