Compare commits

...

4 Commits

Author SHA1 Message Date
GustawXYZ
e7f9712aba
Merge 70471ecc87 into 9bea332a21 2024-11-20 22:22:13 -08:00
Ryan
9bea332a21
qmk via2json: Improve macro parsing (#24345) 2024-11-21 17:20:05 +11:00
Ryan
8cbcdcac62
qmk new-keymap: validate keymap name (#23420) 2024-11-21 17:18:51 +11:00
Gustaw
70471ecc87 Add dactyl_manuform_pi_pico
Adds new keyboard under handwired/dactyl_manuform_pi_pico

It is a mashup of alcor_datyl nad dactyl_manuform(5x6):
a dactyl_manuform running on Pi Pico micro controller
2024-09-15 21:41:23 +02:00
6 changed files with 270 additions and 9 deletions

View File

@ -0,0 +1,9 @@
// Copyright 2023 Gustaw.xyz (@Gustaw.xyz)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 200U
#define SERIAL_USART_FULL_DUPLEX
#define SERIAL_USART_TX_PIN GP9
#define SERIAL_USART_RX_PIN GP8

View File

@ -0,0 +1,127 @@
{
"manufacturer": "GustawXYZ",
"keyboard_name": "dactyl_manuform_pi_pico",
"maintainer": "GustawXYZ",
"bootloader": "rp2040",
"processor": "RP2040",
"url": "https://github.com/GustawXYZ/dactyl_manuform_pi_pico",
"usb": {
"device_version": "1.0.0",
"pid": "0x0000",
"vid": "0xFEED"
},
"features": {
"bootmagic": true,
"command": false,
"console": false,
"extrakey": true,
"mousekey": true,
"nkro": true
},
"split": {
"enabled": true,
"handedness": {
"pin": "GP22"
},
"serial": {
"driver": "vendor"
},
"transport": {
"watchdog": true
}
},
"diode_direction": "COL2ROW",
"matrix_pins": {
"cols": ["GP10", "GP11", "GP12", "GP13", "GP14", "GP15"],
"rows": ["GP21", "GP20", "GP19", "GP18", "GP17", "GP16"]
},
"ws2812": {
"pin": "GP22",
"driver": "vendor"
},
"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": [0, 4], "x": 4, "y": 0},
{"matrix": [0, 5], "x": 5, "y": 0},
{"matrix": [6, 0], "x": 11, "y": 0},
{"matrix": [6, 1], "x": 12, "y": 0},
{"matrix": [6, 2], "x": 13, "y": 0},
{"matrix": [6, 3], "x": 14, "y": 0},
{"matrix": [6, 4], "x": 15, "y": 0},
{"matrix": [6, 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": [7, 0], "x": 11, "y": 1},
{"matrix": [7, 1], "x": 12, "y": 1},
{"matrix": [7, 2], "x": 13, "y": 1},
{"matrix": [7, 3], "x": 14, "y": 1},
{"matrix": [7, 4], "x": 15, "y": 1},
{"matrix": [7, 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": [8, 0], "x": 11, "y": 2},
{"matrix": [8, 1], "x": 12, "y": 2},
{"matrix": [8, 2], "x": 13, "y": 2},
{"matrix": [8, 3], "x": 14, "y": 2},
{"matrix": [8, 4], "x": 15, "y": 2},
{"matrix": [8, 5], "x": 16, "y": 2},
{"matrix": [3, 0], "x": 0, "y": 3},
{"matrix": [3, 1], "x": 1, "y": 3},
{"matrix": [3, 2], "x": 2, "y": 3},
{"matrix": [3, 3], "x": 3, "y": 3},
{"matrix": [3, 4], "x": 4, "y": 3},
{"matrix": [3, 5], "x": 5, "y": 3},
{"matrix": [9, 0], "x": 11, "y": 3},
{"matrix": [9, 1], "x": 12, "y": 3},
{"matrix": [9, 2], "x": 13, "y": 3},
{"matrix": [9, 3], "x": 14, "y": 3},
{"matrix": [9, 4], "x": 15, "y": 3},
{"matrix": [9, 5], "x": 16, "y": 3},
{"matrix": [4, 2], "x": 2, "y": 4},
{"matrix": [4, 3], "x": 3, "y": 4},
{"matrix": [10, 2], "x": 13, "y": 4},
{"matrix": [10, 3], "x": 14, "y": 4},
{"matrix": [4, 4], "x": 4, "y": 5},
{"matrix": [4, 5], "x": 5, "y": 5},
{"matrix": [10, 0], "x": 11, "y": 5},
{"matrix": [10, 1], "x": 12, "y": 5},
{"matrix": [5, 4], "x": 6, "y": 6},
{"matrix": [5, 5], "x": 7, "y": 6},
{"matrix": [11, 0], "x": 9, "y": 6},
{"matrix": [11, 1], "x": 10, "y": 6},
{"matrix": [5, 2], "x": 6, "y": 7},
{"matrix": [5, 3], "x": 7, "y": 7},
{"matrix": [11, 2], "x": 9, "y": 7},
{"matrix": [11, 3], "x": 10, "y": 7}
]
}
}
}

View File

@ -0,0 +1,65 @@
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
enum layers {
_QWERTY,
_NUMPAD,
_ARROWS,
_MOUSE,
_GAMING,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
LALT(KC_LSFT), LALT(KC_SPC), LALT(KC_SPC), LGUI(KC_LALT),
KC_SPC, TT(1), TT(2), LALT(KC_ENTER),
KC_LCTL, KC_LGUI, KC_LGUI, KC_LCTL,
KC_LALT, TT(3), KC_DEL, KC_LALT),
[_NUMPAD] = LAYOUT(
KC_PWR, LSFT(KC_1), LSFT(KC_2), LSFT(KC_3), LSFT(KC_4), LSFT(KC_5), KC_HOME, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_LPRN,
KC_CAPS_LOCK, LSFT(KC_BSLS), KC_BSLS, LSFT(KC_LBRC), LSFT(KC_RBRC), KC_TRNS, KC_END, LSFT(KC_7), LSFT(KC_8), LSFT(KC_9), LCTL(KC_EQUAL), LGUI(KC_EQUAL),
TO(0), LSFT(KC_EQUAL), KC_MINUS, KC_9, KC_0, KC_GRAVE, KC_BSLS, LSFT(KC_4), LSFT(KC_5), LSFT(KC_6), LCTL(KC_MINUS), LGUI(KC_MINUS),
KC_TRNS, KC_EQUAL, LSFT(KC_MINUS), KC_LBRC, KC_RBRC, KC_GRAVE, LSFT(KC_BSLS), LSFT(KC_1), LSFT(KC_2), LSFT(KC_3), KC_COMMA, KC_CALC,
KC_TRNS, KC_TRNS, LSFT(KC_0), KC_TRNS,
KC_TRNS, KC_TRNS, TO(4), LSFT(KC_0),
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
[_ARROWS] = LAYOUT(
KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
KC_TRNS, KC_KP_SLASH, KC_7, KC_8, KC_9, KC_MINUS, LCTL(KC_LEFT), LCTL(KC_DOWN), LCTL(KC_UP), LCTL(KC_RGHT), KC_TRNS, KC_DELETE,
TO(0), KC_KP_PLUS, KC_4, KC_5, KC_6, KC_DOT, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_END, KC_PSCR,
KC_UNDS, KC_KP_MINUS, KC_1, KC_2, KC_3, KC_COMMA, KC_HOME, KC_MPLY, KC_MPRV, KC_MNXT, KC_MUTE, KC_INS,
KC_KP_DOT, KC_0, KC_VOLD, KC_VOLU,
KC_0, TO(4), KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
[_MOUSE] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, EH_LEFT, EH_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, QK_BOOT,
LCTL(LGUI(KC_Q)), KC_F1, LGUI(KC_7), LGUI(KC_8), LGUI(KC_9), KC_F4, KC_F7, SGUI(KC_7), SGUI(KC_8), SGUI(KC_9), KC_F10, KC_TRNS,
KC_ACL2, KC_F2, LGUI(KC_4), LGUI(KC_5), LGUI(KC_6), KC_F5, KC_F8, SGUI(KC_4), SGUI(KC_5), SGUI(KC_6), KC_F11, KC_TRNS,
KC_PWR, KC_F3, LGUI(KC_1), LGUI(KC_2), LGUI(KC_3), KC_F6, KC_F9, SGUI(KC_1), SGUI(KC_2), SGUI(KC_3), KC_F12, KC_TRNS,
KC_TRNS, LGUI(KC_0), SGUI(KC_0), KC_TRNS,
LGUI(KC_0), KC_TRNS, KC_TRNS, SGUI(KC_0),
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
[_GAMING] = LAYOUT(
KC_6, KC_1, KC_2, KC_3, KC_4, KC_5, KC_HOME, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_LPRN,
KC_7, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_END, KC_P7, KC_P8, KC_P9, KC_PPLS, KC_BSPC,
TO(0), KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_LT, KC_P4, KC_P5, KC_P6, KC_PEQL, KC_RPRN,
KC_8, KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_GT, KC_P1, KC_P2, KC_P3, KC_PCMM, KC_CALC,
KC_9, KC_0, KC_P0, KC_PDOT,
KC_SPC, LT(2,KC_ENT), KC_TRNS, KC_ENTER,
KC_G, KC_M, KC_TRNS, KC_TRNS,
KC_LALT, KC_ESC, KC_TRNS, TO(_QWERTY))
};

View File

@ -0,0 +1,32 @@
# dactyl_manuform_pi_pico
![dactyl_manuform_pi_pico](https://i.imgur.com/T9b74bI.jpg)
This is a dactyl_manuform 5x6 running Rasrberry Pi Pico.
It's based on alcor_dactyl but with more reasonable GPIO layout for Pi Pico
and clasic dactyl_manuform layout (pinkies have only 4 rows).
Build instructions: https://github.com/GustawXYZ/dactyl_manuform_pi_pico/
* Keyboard Maintainer: [Gustaw.xyz](https://github.com/Gustaw.xyz)
* Hardware Supported: Raspberry Pi Pico and other RP2040
* Hardware Availability: https://www.raspberrypi.com/products/raspberry-pi-pico/
* 3D Print model: https://github.com/abstracthat/dactyl-manuform
Make example for this keyboard (after setting up your build environment):
make dactyl_manuform_pi_pico:default
Flashing example for this keyboard:
make dactyl_manuform_pi_pico: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

View File

@ -1,5 +1,6 @@
"""This script automates the copying of the default keymap into your own keymap.
"""
import re
import shutil
from milc import cli
@ -13,6 +14,13 @@ from qmk.keyboard import keyboard_completer, keyboard_folder
from qmk.userspace import UserspaceDefs
def validate_keymap_name(name):
"""Returns True if the given keymap name contains only a-z, 0-9 and underscore characters.
"""
regex = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9_]+$')
return bool(regex.match(name))
def prompt_keyboard():
prompt = """{fg_yellow}Select Keyboard{style_reset_all}
If you`re unsure you can view a full list of supported keyboards with {fg_yellow}qmk list-keyboards{style_reset_all}.
@ -60,6 +68,10 @@ def new_keymap(cli):
cli.log.error(f'Default keymap {{fg_cyan}}{keymap_path_default}{{fg_reset}} does not exist!')
return False
if not validate_keymap_name(user_name):
cli.log.error('Keymap names must contain only {fg_cyan}a-z{fg_reset}, {fg_cyan}0-9{fg_reset} and {fg_cyan}_{fg_reset}! Please choose a different name.')
return False
if keymap_path_new.exists():
cli.log.error(f'Keymap {{fg_cyan}}{user_name}{{fg_reset}} already exists! Please choose a different name.')
return False

View File

@ -29,6 +29,7 @@ def _convert_macros(via_macros):
if len(via_macros) == 0:
return list()
split_regex = re.compile(r'(}\,)|(\,{)')
macro_group_regex = re.compile(r'({.+?})')
macros = list()
for via_macro in via_macros:
# Split VIA macro to its elements
@ -38,13 +39,28 @@ def _convert_macros(via_macros):
macro_data = list()
for m in macro:
if '{' in m or '}' in m:
# Found keycode(s)
keycodes = m.split(',')
# Remove whitespaces and curly braces from around keycodes
keycodes = list(map(lambda s: s.strip(' {}'), keycodes))
# Remove the KC prefix
keycodes = list(map(lambda s: s.replace('KC_', ''), keycodes))
macro_data.append({"action": "tap", "keycodes": keycodes})
# Split macro groups
macro_groups = macro_group_regex.findall(m)
for macro_group in macro_groups:
# Remove whitespaces and curly braces from around group
macro_group = macro_group.strip(' {}')
macro_action = 'tap'
macro_keycodes = []
if macro_group[0] == '+':
macro_action = 'down'
macro_keycodes.append(macro_group[1:])
elif macro_group[0] == '-':
macro_action = 'up'
macro_keycodes.append(macro_group[1:])
else:
macro_keycodes.extend(macro_group.split(',') if ',' in macro_group else [macro_group])
# Remove the KC prefixes
macro_keycodes = list(map(lambda s: s.replace('KC_', ''), macro_keycodes))
macro_data.append({"action": macro_action, "keycodes": macro_keycodes})
else:
# Found text
macro_data.append(m)
@ -54,13 +70,13 @@ def _convert_macros(via_macros):
def _fix_macro_keys(keymap_data):
macro_no = re.compile(r'MACRO0?([0-9]{1,2})')
macro_no = re.compile(r'MACRO0?\(([0-9]{1,2})\)')
for i in range(0, len(keymap_data)):
for j in range(0, len(keymap_data[i])):
kc = keymap_data[i][j]
m = macro_no.match(kc)
if m:
keymap_data[i][j] = f'MACRO_{m.group(1)}'
keymap_data[i][j] = f'MC_{m.group(1)}'
return keymap_data