Compare commits

...

26 Commits

Author SHA1 Message Date
Álvaro A. Volpato
65a0baaee2
Merge 721d129d53 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
Álvaro A. Volpato
721d129d53
Remove permanent memory data size def
Co-authored-by: Joel Challis <git@zvecr.com>
2024-10-01 17:20:31 -03:00
Álvaro A. Volpato
24452d37b6
Remove deprecated advanced PWM defs in mcuconf
Co-authored-by: Joel Challis <git@zvecr.com>
2024-10-01 17:20:16 -03:00
Álvaro A. Volpato
bc2425fa52
Omit wear leveling defs in kb.json
Co-authored-by: Joel Challis <git@zvecr.com>
2024-10-01 17:19:55 -03:00
Gondolindrim
084828e08f
Remove VIA keymap 2024-10-01 02:42:15 -03:00
Gondolindrim
b3564bb1f7
Rename info.json, delete rules.mk 2024-10-01 02:40:50 -03:00
Gondolindrim
baffc9e89d
Run formatting routine on info.json 2024-05-13 16:28:27 -03:00
Gondolindrim
c4ef2ed77d
Change HSV API to RGBLIGHT 2024-05-13 16:27:22 -03:00
Gondolindrim
656f2366c0
Fix eeprom wear leveling def 2024-05-12 23:48:35 -03:00
Gondolindrim
78ef3165a9
Remove VIA code 2024-05-12 23:43:00 -03:00
Álvaro A. Volpato
ec2ef781df
Update readme.md 2024-05-12 23:25:53 -03:00
Álvaro A. Volpato
2934573eb1
Update keyboards/typek/config.h
Co-authored-by: Ryan <fauxpark@gmail.com>
2024-05-12 23:17:04 -03:00
Gondolindrim
8b996f6d6d
Remove I2C1 def from \'mcuconf\' 2024-03-02 19:36:49 -03:00
Gondolindrim
199f5bb143
Remove PAL definition from \'halconf\' 2024-03-02 19:34:36 -03:00
Gondolindrim
d42162a500
Add nosplits layout 2024-03-02 19:28:56 -03:00
Gondolindrim
6cfe696136
Add PWM driver definition to ws2812 2024-01-10 18:27:01 -03:00
Gondolindrim
0a8439e977
Remove transparent layers from keymap defs 2024-01-10 18:18:24 -03:00
Gondolindrim
ea6ddf0fc8
Remove default features values 2024-01-10 18:17:08 -03:00
Gondolindrim
25efc8ea8e
Add LTO to build defs in info.json 2024-01-10 18:16:07 -03:00
Gondolindrim
ce5a4e6af0
Move LED MAP and EEPROM config to info.json 2024-01-10 18:13:48 -03:00
Gondolindrim
ead8350a65
Move RGB default animation to info.json 2024-01-10 18:07:27 -03:00
Gondolindrim
7bde35ee56
Move RGB animation defs to info.json 2024-01-10 18:02:00 -03:00
Gondolindrim
00a0b514eb
Clear rules.mk 2024-01-10 17:58:39 -03:00
Gondolindrim
44a5160084
First TypeK support 2024-01-09 23:03:46 -03:00
9 changed files with 419 additions and 9 deletions

33
keyboards/typek/config.h Normal file
View File

@ -0,0 +1,33 @@
/*
Copyright 2022 Gondolindrim
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define WS2812_PWM_COMPLEMENTARY_OUTPUT
#define WS2812_PWM_DRIVER PWMD1
#define WS2812_PWM_CHANNEL 3
#define WS2812_PWM_PAL_MODE 1
#define WS2812_DMA_STREAM STM32_DMA2_STREAM5
#define WS2812_DMA_CHANNEL 6
/* LED MAP
0 , 1 , 2 Three indicators
3 , 4 , 5 Three RGBs on left side
66, 67, 68 Three RGBs on right side
35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6 Left RGB wing (30 LEDs)
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65 Right RGB wing (30 LEDs)
*/

21
keyboards/typek/halconf.h Normal file
View File

@ -0,0 +1,21 @@
/* Copyright 2020 QMK
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define HAL_USE_PWM TRUE
#include_next <halconf.h>

View File

@ -0,0 +1,200 @@
{
"manufacturer": "gok",
"keyboard_name": "TypeK-S Rev. Zeta-RC2",
"maintainer": "Gondolindrim",
"bootloader": "stm32-dfu",
"build": {
"lto": true
},
"diode_direction": "COL2ROW",
"eeprom": {
"wear_leveling": {
"backing_size": 4096
}
},
"features": {
"bootmagic": true,
"console": false,
"extrakey": false,
"mousekey": false,
"nkro": true,
"rgblight": true
},
"matrix_pins": {
"cols": ["A3", "B12", "A0", "A10", "B0", "B1", "B10", "B3", "C15", "C14", "C13", "B9", "B8", "B5"],
"rows": ["A7", "A8", "A15", "A1", "A2"]
},
"processor": "STM32F411",
"rgblight": {
"animations": {
"alternating": true,
"breathing": true,
"christmas": true,
"knight": true,
"rainbow_mood": true,
"rainbow_swirl": true,
"rgb_test": true,
"snake": true,
"static_gradient": true,
"twinkle": true
},
"default": {
"animation": "rainbow_swirl",
"val": 200
},
"led_count": 69,
"led_map": [0, 1, 2, 3, 4, 5, 66, 67, 68, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65]
},
"url": "https://www.gok.design/type-k",
"usb": {
"device_version": "6.2.0",
"pid": "0x8475",
"vid": "0x7179"
},
"ws2812": {
"driver": "pwm",
"pin": "B15"
},
"layouts": {
"LAYOUT_all": {
"layout": [
{"label": "Esc", "matrix": [0, 0], "x": 0.75, "y": 0},
{"label": "`~", "matrix": [0, 1], "x": 2.5, "y": 0},
{"label": "1!", "matrix": [0, 2], "x": 3.5, "y": 0},
{"label": "2@", "matrix": [0, 3], "x": 5, "y": 0},
{"label": "3#", "matrix": [0, 4], "x": 6, "y": 0},
{"label": "4$", "matrix": [0, 5], "x": 7, "y": 0},
{"label": "5%", "matrix": [0, 6], "x": 8, "y": 0},
{"label": "7&", "matrix": [0, 7], "x": 12.75, "y": 0},
{"label": "8*", "matrix": [0, 8], "x": 13.75, "y": 0},
{"label": "9(", "matrix": [0, 9], "x": 14.75, "y": 0},
{"label": "0)", "matrix": [0, 10], "x": 15.75, "y": 0},
{"label": "-_", "matrix": [0, 11], "x": 17, "y": 0},
{"label": "=+", "matrix": [0, 12], "x": 18, "y": 0},
{"label": "\\|", "matrix": [0, 13], "x": 19, "y": 0},
{"label": "Page Up", "matrix": [1, 0], "x": 0.5, "y": 1},
{"label": "Tab", "matrix": [1, 1], "x": 2.25, "y": 1, "w": 1.5},
{"label": "Q", "matrix": [1, 2], "x": 3.75, "y": 1},
{"label": "W", "matrix": [1, 3], "x": 5.5, "y": 1},
{"label": "E", "matrix": [1, 4], "x": 6.5, "y": 1},
{"label": "R", "matrix": [1, 5], "x": 7.5, "y": 1},
{"label": "T", "matrix": [1, 6], "x": 8.5, "y": 1},
{"label": "Y", "matrix": [1, 7], "x": 12, "y": 1},
{"label": "U", "matrix": [1, 8], "x": 13, "y": 1},
{"label": "I", "matrix": [1, 9], "x": 14, "y": 1},
{"label": "O", "matrix": [1, 10], "x": 15, "y": 1},
{"label": "P", "matrix": [1, 11], "x": 16.75, "y": 1},
{"label": "[{", "matrix": [1, 12], "x": 17.75, "y": 1},
{"label": "]}", "matrix": [1, 13], "x": 18.75, "y": 1},
{"label": "Page Down", "matrix": [2, 0], "x": 0.25, "y": 2},
{"label": "Caps Lock", "matrix": [2, 1], "x": 2.25, "y": 2, "w": 1.75},
{"label": "A", "matrix": [2, 2], "x": 4, "y": 2},
{"label": "S", "matrix": [2, 3], "x": 5.75, "y": 2},
{"label": "D", "matrix": [2, 4], "x": 6.75, "y": 2},
{"label": "F", "matrix": [2, 5], "x": 7.75, "y": 2},
{"label": "G", "matrix": [2, 6], "x": 8.75, "y": 2},
{"label": "H", "matrix": [2, 7], "x": 12.25, "y": 2},
{"label": "J", "matrix": [2, 8], "x": 13.25, "y": 2},
{"label": "K", "matrix": [2, 9], "x": 14.25, "y": 2},
{"label": "L", "matrix": [2, 10], "x": 15.25, "y": 2},
{"label": ";:", "matrix": [2, 11], "x": 17.25, "y": 2},
{"label": "\"", "matrix": [2, 12], "x": 18.25, "y": 2},
{"label": "Del", "matrix": [2, 13], "x": 20, "y": 0},
{"label": "End", "matrix": [3, 0], "x": 0, "y": 3},
{"label": "Shift", "matrix": [3, 1], "x": 1.5, "y": 3, "w": 2.25},
{"label": "Z", "matrix": [3, 2], "x": 3.75, "y": 3},
{"label": "X", "matrix": [3, 3], "x": 6, "y": 3},
{"label": "C", "matrix": [3, 4], "x": 7, "y": 3},
{"label": "V", "matrix": [3, 5], "x": 8, "y": 3},
{"label": "B", "matrix": [3, 6], "x": 9, "y": 3},
{"label": "B", "matrix": [3, 7], "x": 11.75, "y": 3},
{"label": "N", "matrix": [3, 8], "x": 12.75, "y": 3},
{"label": "M", "matrix": [3, 9], "x": 13.75, "y": 3},
{"label": ",<", "matrix": [3, 10], "x": 14.75, "y": 3},
{"label": ".>", "matrix": [3, 11], "x": 17, "y": 3},
{"label": "/?", "matrix": [3, 12], "x": 18, "y": 3},
{"label": "Shift", "matrix": [3, 13], "x": 19, "y": 3, "w": 1.25},
{"label": "Control", "matrix": [4, 1], "x": 1.5, "y": 4, "w": 1.5},
{"label": "Alt", "matrix": [4, 2], "x": 6, "y": 4, "w": 1.5},
{"label": "Space", "matrix": [4, 4], "x": 7.5, "y": 4, "w": 2},
{"label": "Left GUI", "matrix": [4, 5], "x": 9.5, "y": 4},
{"label": "^6", "matrix": [4, 6], "x": 9, "y": 0},
{"label": "Space", "matrix": [4, 7], "x": 11.25, "y": 4},
{"label": "Space", "matrix": [4, 8], "x": 12.25, "y": 4, "w": 2},
{"label": "Alt", "matrix": [4, 9], "x": 14.25, "y": 4, "w": 1.5},
{"label": "Backspace", "matrix": [4, 10], "x": 19.75, "y": 1, "w": 1.5},
{"label": "Enter", "matrix": [4, 11], "x": 19.25, "y": 2, "w": 2.25},
{"label": "MO(1)", "matrix": [4, 12], "x": 20.25, "y": 3},
{"label": "Control", "matrix": [4, 13], "x": 19.25, "y": 4, "w": 1.5}
]
},
"LAYOUT_nosplits": {
"layout": [
{"label": "Esc", "matrix": [0, 0], "x": 0.75, "y": 0},
{"label": "`~", "matrix": [0, 1], "x": 2.5, "y": 0},
{"label": "1!", "matrix": [0, 2], "x": 3.5, "y": 0},
{"label": "2@", "matrix": [0, 3], "x": 5, "y": 0},
{"label": "3#", "matrix": [0, 4], "x": 6, "y": 0},
{"label": "4$", "matrix": [0, 5], "x": 7, "y": 0},
{"label": "5%", "matrix": [0, 6], "x": 8, "y": 0},
{"label": "7&", "matrix": [0, 7], "x": 12.75, "y": 0},
{"label": "8*", "matrix": [0, 8], "x": 13.75, "y": 0},
{"label": "9(", "matrix": [0, 9], "x": 14.75, "y": 0},
{"label": "0)", "matrix": [0, 10], "x": 15.75, "y": 0},
{"label": "-_", "matrix": [0, 11], "x": 17, "y": 0},
{"label": "=+", "matrix": [0, 12], "x": 18, "y": 0},
{"label": "Backspace", "matrix": [0, 13], "x": 19, "y": 0, "w": 2},
{"label": "Page Up", "matrix": [1, 0], "x": 0.5, "y": 1},
{"label": "Tab", "matrix": [1, 1], "x": 2.25, "y": 1, "w": 1.5},
{"label": "Q", "matrix": [1, 2], "x": 3.75, "y": 1},
{"label": "W", "matrix": [1, 3], "x": 5.5, "y": 1},
{"label": "E", "matrix": [1, 4], "x": 6.5, "y": 1},
{"label": "R", "matrix": [1, 5], "x": 7.5, "y": 1},
{"label": "T", "matrix": [1, 6], "x": 8.5, "y": 1},
{"label": "Y", "matrix": [1, 7], "x": 12, "y": 1},
{"label": "U", "matrix": [1, 8], "x": 13, "y": 1},
{"label": "I", "matrix": [1, 9], "x": 14, "y": 1},
{"label": "O", "matrix": [1, 10], "x": 15, "y": 1},
{"label": "P", "matrix": [1, 11], "x": 16.75, "y": 1},
{"label": "[{", "matrix": [1, 12], "x": 17.75, "y": 1},
{"label": "]}", "matrix": [1, 13], "x": 18.75, "y": 1},
{"label": "Page Down", "matrix": [2, 0], "x": 0.25, "y": 2},
{"label": "Caps Lock", "matrix": [2, 1], "x": 2.25, "y": 2, "w": 1.75},
{"label": "A", "matrix": [2, 2], "x": 4, "y": 2},
{"label": "S", "matrix": [2, 3], "x": 5.75, "y": 2},
{"label": "D", "matrix": [2, 4], "x": 6.75, "y": 2},
{"label": "F", "matrix": [2, 5], "x": 7.75, "y": 2},
{"label": "G", "matrix": [2, 6], "x": 8.75, "y": 2},
{"label": "H", "matrix": [2, 7], "x": 12.25, "y": 2},
{"label": "J", "matrix": [2, 8], "x": 13.25, "y": 2},
{"label": "K", "matrix": [2, 9], "x": 14.25, "y": 2},
{"label": "L", "matrix": [2, 10], "x": 15.25, "y": 2},
{"label": ";:", "matrix": [2, 11], "x": 17.25, "y": 2},
{"label": "\"", "matrix": [2, 12], "x": 18.25, "y": 2},
{"label": "End", "matrix": [3, 0], "x": 0, "y": 3},
{"label": "Shift", "matrix": [3, 1], "x": 1.5, "y": 3, "w": 2.25},
{"label": "Z", "matrix": [3, 2], "x": 3.75, "y": 3},
{"label": "X", "matrix": [3, 3], "x": 6, "y": 3},
{"label": "C", "matrix": [3, 4], "x": 7, "y": 3},
{"label": "V", "matrix": [3, 5], "x": 8, "y": 3},
{"label": "B", "matrix": [3, 6], "x": 9, "y": 3},
{"label": "B", "matrix": [3, 7], "x": 11.75, "y": 3},
{"label": "N", "matrix": [3, 8], "x": 12.75, "y": 3},
{"label": "M", "matrix": [3, 9], "x": 13.75, "y": 3},
{"label": ",<", "matrix": [3, 10], "x": 14.75, "y": 3},
{"label": ".>", "matrix": [3, 11], "x": 17, "y": 3},
{"label": "/?", "matrix": [3, 12], "x": 18, "y": 3},
{"label": "Shift", "matrix": [3, 13], "x": 19, "y": 3, "w": 2.25},
{"label": "Control", "matrix": [4, 1], "x": 1.5, "y": 4, "w": 1.5},
{"label": "Alt", "matrix": [4, 2], "x": 6, "y": 4, "w": 1.5},
{"label": "Space", "matrix": [4, 4], "x": 7.5, "y": 4, "w": 3},
{"label": "^6", "matrix": [4, 6], "x": 9, "y": 0},
{"label": "Space", "matrix": [4, 8], "x": 11.25, "y": 4, "w": 3},
{"label": "Alt", "matrix": [4, 9], "x": 14.25, "y": 4, "w": 1.5},
{"label": "Backspace", "matrix": [4, 10], "x": 19.75, "y": 1, "w": 1.5},
{"label": "Enter", "matrix": [4, 11], "x": 19.25, "y": 2, "w": 2.25},
{"label": "Control", "matrix": [4, 13], "x": 19.25, "y": 4, "w": 1.5}
]
}
}
}

View File

@ -0,0 +1,34 @@
/* Copyright 2023 Gondolindrim
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_all( /* Base */
KC_ESC , KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_7 , KC_8 , KC_9 , KC_0 , KC_MINS, KC_EQL, KC_BSLS,
KC_PGUP, KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_LBRC, KC_RBRC,
KC_PGDN, KC_CAPS, KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, KC_DEL ,
MO(1) , KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSFT,
KC_LCTL, KC_LALT, KC_SPC , KC_LGUI, KC_6 , KC_SPC , KC_SPC , KC_RALT, KC_BSPC, KC_ENT , MO(1) , KC_RCTL
),
[1] = LAYOUT_all(
QK_BOOT, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , KC_TRNS,
KC_HOME, KC_TRNS, KC_TRNS, KC_UP , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_END , KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
)
};

21
keyboards/typek/mcuconf.h Normal file
View File

@ -0,0 +1,21 @@
/* Copyright 2020 QMK
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include_next <mcuconf.h>
#undef STM32_PWM_USE_TIM1
#define STM32_PWM_USE_TIM1 TRUE

30
keyboards/typek/readme.md Normal file
View File

@ -0,0 +1,30 @@
# gok TypeK QMK Firmware Folder
![TK](https://i.imgur.com/0ZEbEZth.jpg)
## Introduction
This is the QMK Firmware repository for the Type K, the tented ergo by Gok. The TypeK went through GB on August, 2023. It is supported by a proprietary PCB ecosystem.
## How to flash
### Enter bootloader
The DFU state in the bootloader can be accessed in 3 ways:
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key, escape in the default keymap) and plug in the keyboard;
* **Physical reset button**: press the button on the front of the PCB, next to caps lock, for at least five seconds;
* **Keycode in layout**: Press the key mapped to `RESET`; in the default layout, that is top left key ('escape') in layer 1.
### How to compile and flash
After setting up your build environment, you can compile the Iron 165R2 default keymap by using one of the options below.
make typek:default
And use dfu-util in the command line or through a GUI like QMK toolbox to upload the firmware to the PCB. To directly flash the PCB after it is put into a DFU state, use:
make typek: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).

43
keyboards/typek/typek.c Normal file
View File

@ -0,0 +1,43 @@
/* Copyright 2023 Gondolindrim <gondolindrim@acheronproject.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
// This function gets called when caps, num, scroll change
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if (res) {
led_state.caps_lock? rgblight_setrgb_at(RGB_RED, 0) : rgblight_setrgb_at(RGB_OFF, 0);
}
return res;
}
// This function is called when layers change
layer_state_t layer_state_set_kb(layer_state_t state) {
switch(get_highest_layer(state)) {
case 1:
rgblight_setrgb_at(RGB_GREEN, 1);
break;
case 2:
rgblight_setrgb_at(RGB_BLUE, 2);
break;
default:
rgblight_setrgb_at(RGB_OFF, 1);
rgblight_setrgb_at(RGB_OFF, 2);
break;
}
return state;
}

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