Compare commits

...

9 Commits

Author SHA1 Message Date
suikagiken
462cbcfe00
Merge 7db83e2df8 into 9bea332a21 2024-11-21 17:54:42 +09: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
suikagiken
7db83e2df8 change to imgur link 2024-11-19 17:35:43 +09:00
suikagiken
866647326c
Update keyboards/suikagiken/suika27melo/readme.md
Co-authored-by: jack <jack@pngu.org>
2024-11-19 17:23:45 +09:00
suikagiken
c66cb38eaf
Update keyboards/suikagiken/suika27melo/readme.md
Co-authored-by: jack <jack@pngu.org>
2024-11-19 17:23:30 +09:00
suikagiken
491d71551c
Update keyboards/suikagiken/suika27melo/keyboard.json
Co-authored-by: jack <jack@pngu.org>
2024-11-19 17:23:22 +09:00
suikagiken
95dffd1dd9
Update keyboards/suikagiken/suika27melo/keyboard.json
Co-authored-by: jack <jack@pngu.org>
2024-11-19 17:23:13 +09:00
suikagiken
79959f55e3 add keyboard suika27melo 2024-11-19 00:29:19 +09:00
7 changed files with 174 additions and 9 deletions

View File

@ -0,0 +1,5 @@
// Copyright 2025 @suikagiken
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define MIDI_ADVANCED

View File

@ -0,0 +1,64 @@
{
"manufacturer": "suikagiken",
"keyboard_name": "suika27melo",
"maintainer": "suikagiken",
"processor": "atmega32u4",
"bootloader": "atmel-dfu",
"diode_direction": "COL2ROW",
"features": {
"bootmagic": true,
"command": false,
"console": false,
"extrakey": true,
"midi": true,
"mousekey": true,
"nkro": true
},
"matrix_pins": {
"cols": ["F0", "B4", "B5", "D7", "B6", "D6", "C6", "C7", "D0"],
"rows": ["F1", "F4", "D1", "D2"]
},
"url": "https://github.com/suikagiken/suika27melo",
"usb": {
"device_version": "1.1.0",
"vid": "0x4B48",
"pid": "0x0201"
},
"build": {
"debounce_type": "sym_eager_pk"
},
"debounce": 50,
"layouts": {
"LAYOUT": {
"layout": [
{"matrix":[0, 0], "x":0, "y":0},
{"matrix":[0, 1], "x":2, "y":0},
{"matrix":[0, 2], "x":3, "y":0},
{"matrix":[0, 4], "x":5, "y":0},
{"matrix":[0, 5], "x":6, "y":0},
{"matrix":[0, 6], "x":7, "y":0},
{"matrix":[2, 1], "x":9, "y":0},
{"matrix":[2, 2], "x":10, "y":0},
{"matrix":[2, 4], "x":12, "y":0},
{"matrix":[2, 5], "x":13, "y":0},
{"matrix":[2, 6], "x":14, "y":0},
{"matrix":[1, 0], "x":0, "y":1},
{"matrix":[1, 1], "x":1.5, "y":1},
{"matrix":[1, 2], "x":2.5, "y":1},
{"matrix":[1, 3], "x":3.5, "y":1},
{"matrix":[1, 4], "x":4.5, "y":1},
{"matrix":[1, 5], "x":5.5, "y":1},
{"matrix":[1, 6], "x":6.5, "y":1},
{"matrix":[1, 7], "x":7.5, "y":1},
{"matrix":[3, 1], "x":8.5, "y":1},
{"matrix":[3, 2], "x":9.5, "y":1},
{"matrix":[3, 3], "x":10.5, "y":1},
{"matrix":[3, 4], "x":11.5, "y":1},
{"matrix":[3, 5], "x":12.5, "y":1},
{"matrix":[3, 6], "x":13.5, "y":1},
{"matrix":[3, 7], "x":14.5, "y":1},
{"matrix":[3, 8], "x":15.5, "y":1}
]
}
}
}

View File

@ -0,0 +1,12 @@
{
"author": "@suikagiken",
"keyboard": "suikagiken/suika85ergo",
"keymap": "default",
"layout": "LAYOUT",
"layers": [
[
"KC_A", "KC_D", "KC_F", "KC_I", "KC_K", "KC_M", "KC_P", "KC_R", "KC_U", "KC_W", "KC_Y",
"KC_B", "KC_C", "KC_E", "KC_G", "KC_H", "KC_J", "KC_L", "KC_N", "KC_O", "KC_Q", "KC_S", "KC_T", "KC_V", "KC_X", "KC_Z", "KC_SPC"
]
]
}

View File

@ -0,0 +1,12 @@
{
"author": "@suikagiken",
"keyboard": "suikagiken/suika85ergo",
"keymap": "midi",
"layout": "LAYOUT",
"layers": [
[
"MI_OCTU", "MI_Cs1", "MI_Ds1", "MI_Fs1", "MI_Gs1", "MI_As1", "MI_Cs2", "MI_Ds2", "MI_Fs2", "MI_Gs2", "MI_As2",
"MI_OCTD", "MI_C1", "MI_D1", "MI_E1", "MI_F1", "MI_G1", "MI_A1", "MI_B1", "MI_C2", "MI_D2", "MI_E2", "MI_F2", "MI_G2", "MI_A2", "MI_B2", "MI_C2"
]
]
}

View File

@ -0,0 +1,44 @@
# suika27melo
(English Follows Japanese)
## 概要
![suika27melo1](https://i.imgur.com/iFz3c1U.jpg)
![suika27melo2](https://i.imgur.com/xR7KpVR.jpg)
suika27meloは2オクターブのピア鍵盤型マクロキーパッドです。
通常のマクロキーパッドとしても使えるほか、MIDIキーボードとしてDAWソフトの入力や演奏に使用できます。
* 制作 : すいか技研 Website: https://suikagiken.net GitHub: [suikagiken](https://github.com/suikagiken)
* 販売 : すいか技研の[booth](https://suikagiken.booth.pm/)にて販売予定です
## ビルドガイド
[こちら](https://github.com/suikagiken/suika27melo/blob/main/buildguide_1.1.md)からご覧下さい。
---
## Overview
suika27melo is a 2-octave piano shaped macro keypad.
You can use it as a normal macro keypad, or use it as a MIDI keyboard for DAW software input and musical performance.
* Keyboard Maintainer: [suikagiken](https://github.com/suikagiken)
* Hardware Availability: Available at [booth](https://suikagiken.booth.pm/) soon.
Make example for this keyboard (after setting up your build environment):
make suikagiken/suika27melo:default
Flashing example for this keyboard:
make suikagiken/suika27melo: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 (the top left key) 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. """This script automates the copying of the default keymap into your own keymap.
""" """
import re
import shutil import shutil
from milc import cli from milc import cli
@ -13,6 +14,13 @@ from qmk.keyboard import keyboard_completer, keyboard_folder
from qmk.userspace import UserspaceDefs 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(): def prompt_keyboard():
prompt = """{fg_yellow}Select Keyboard{style_reset_all} 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}. 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!') cli.log.error(f'Default keymap {{fg_cyan}}{keymap_path_default}{{fg_reset}} does not exist!')
return False 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(): if keymap_path_new.exists():
cli.log.error(f'Keymap {{fg_cyan}}{user_name}{{fg_reset}} already exists! Please choose a different name.') cli.log.error(f'Keymap {{fg_cyan}}{user_name}{{fg_reset}} already exists! Please choose a different name.')
return False return False

View File

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