Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
058737f116 | ||
|
|
c9a06965c9 | ||
|
|
2c9ffd4739 | ||
|
|
2013f63134 | ||
|
|
32661df8cd | ||
|
|
661f4aaa8a | ||
|
|
27f9f3196d | ||
|
|
89446bafb8 | ||
|
|
2bcac45650 |
No files matched your search
@@ -167,6 +167,17 @@ Creates a keymap.c from a QMK Configurator export.
|
|||||||
qmk json2c [-o OUTPUT] filename
|
qmk json2c [-o OUTPUT] filename
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## `qmk c2json`
|
||||||
|
|
||||||
|
Creates a keymap.json from a keymap.c.
|
||||||
|
**Note:** Parsing C source files is not easy, therefore this subcommand may not work your keymap. In some cases not using the C pre-processor helps.
|
||||||
|
|
||||||
|
**Usage**:
|
||||||
|
|
||||||
|
```
|
||||||
|
qmk c2json [--no-cpp] [-o OUTPUT] filename
|
||||||
|
```
|
||||||
|
|
||||||
## `qmk list-keyboards`
|
## `qmk list-keyboards`
|
||||||
|
|
||||||
This command lists all the keyboards currently defined in `qmk_firmware`
|
This command lists all the keyboards currently defined in `qmk_firmware`
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ When developing your keyboard, keep in mind that all warnings will be treated as
|
|||||||
|
|
||||||
## Copyright Blurb
|
## Copyright Blurb
|
||||||
|
|
||||||
If you're adapting your keyboard's setup from another project, but not using the same code, but sure to update the copyright header at the top of the files to show your name, in this format:
|
If you're adapting your keyboard's setup from another project, but not using the same code, be sure to update the copyright header at the top of the files to show your name, in this format:
|
||||||
|
|
||||||
Copyright 2017 Your Name <your@email.com>
|
Copyright 2017 Your Name <your@email.com>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
#include "audio.h"
|
||||||
|
|
||||||
|
/* THIS FILE WAS GENERATED AND IS EXPERIMENTAL!
|
||||||
|
*
|
||||||
|
* This file was generated by qmk-compile-json. You may or may not want to
|
||||||
|
* edit it directly.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[0] = LAYOUT(KC_ENTER)
|
||||||
|
};
|
||||||
|
|
||||||
|
void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
|
if (index == 0) {
|
||||||
|
if (clockwise) {
|
||||||
|
tap_code(KC_UP);
|
||||||
|
} else {
|
||||||
|
tap_code(KC_DOWN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"documentation": "This file is a keymap.json file for handwired/onekey/pytest"
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2020 QMK Community, Daniel Reibl <[email protected]>
|
Copyright 2020 QMK Community, Janos Daniel Reibl <[email protected]> @riblee
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -22,3 +22,5 @@ BACKLIGHT_DRIVER = software
|
|||||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||||
BLUETOOTH_ENABLE = no # Enable Bluetooth
|
BLUETOOTH_ENABLE = no # Enable Bluetooth
|
||||||
AUDIO_ENABLE = no # Audio output
|
AUDIO_ENABLE = no # Audio output
|
||||||
|
|
||||||
|
LAYOUTS = ortho_5x12
|
||||||
@@ -21,9 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define AUTO_SHIFT_TIMEOUT 200
|
|
||||||
#define NO_AUTO_SHIFT_NUMERIC
|
|
||||||
|
|
||||||
// RGB lighting
|
// RGB lighting
|
||||||
#define RGBLIGHT_SLEEP
|
#define RGBLIGHT_SLEEP
|
||||||
#undef RGBLED_NUM
|
#undef RGBLED_NUM
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ enum layer_names {
|
|||||||
_LOWER,
|
_LOWER,
|
||||||
_RAISE,
|
_RAISE,
|
||||||
_NUMPAD,
|
_NUMPAD,
|
||||||
_GAMING,
|
|
||||||
_ADJUST
|
_ADJUST
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -118,14 +117,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
* | | | | | | | | | | | | | |
|
* | | | | | | | | | | | | | |
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
* | TGLAS| | | | | | | | | | | |GAMING|
|
* | | | | | | | | | | | | | |
|
||||||
* `-----------------------------------------' `-----------------------------------------'
|
* `-----------------------------------------' `-----------------------------------------'
|
||||||
*/
|
*/
|
||||||
[_ADJUST] = LAYOUT_ortho_4x12(
|
[_ADJUST] = LAYOUT_ortho_4x12(
|
||||||
RESET, EEP_RST, _______, RALT(KC_SCLN), _______, _______, _______, TD(U), RALT(KC_Z), TD(O), _______, _______,
|
RESET, EEP_RST, _______, RALT(KC_SCLN), _______, _______, _______, TD(U), RALT(KC_Z), TD(O), _______, _______,
|
||||||
_______, RALT(KC_QUOT), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
_______, RALT(KC_QUOT), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
KC_ASTG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, TG(_GAMING)
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
),
|
),
|
||||||
|
|
||||||
/* Numpad
|
/* Numpad
|
||||||
@@ -144,27 +143,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
_______, _______, _______, _______, _______, _______, KC_4, KC_5, KC_6, _______, _______, _______,
|
_______, _______, _______, _______, _______, _______, KC_4, KC_5, KC_6, _______, _______, _______,
|
||||||
RGB_VAI, RGB_SAI, RGB_HUI, _______, _______, _______, KC_1, KC_2, KC_3, _______, _______, _______,
|
RGB_VAI, RGB_SAI, RGB_HUI, _______, _______, _______, KC_1, KC_2, KC_3, _______, _______, _______,
|
||||||
_______, _______, _______, _______, RGB_MOD, RGB_TOG, KC_CALC, KC_0, KC_PPLS, _______, _______, _______
|
_______, _______, _______, _______, RGB_MOD, RGB_TOG, KC_CALC, KC_0, KC_PPLS, _______, _______, _______
|
||||||
),
|
|
||||||
|
|
||||||
/* Gaming
|
|
||||||
* ,-----------------------------------------. ,-----------------------------------------.
|
|
||||||
* | | | | | | | | | | | | | |
|
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
||||||
* | | | | | | | | | | | | | |
|
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
||||||
* | | | | | | | | | | | | | |
|
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
||||||
* | | | | | RAISE| | | | LOWER| | | | |
|
|
||||||
* `-----------------------------------------' `-----------------------------------------'
|
|
||||||
*/
|
|
||||||
[_GAMING] = LAYOUT_ortho_4x12(
|
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
||||||
_______, _______, _______, _______, RAISE, _______, _______, LOWER, _______, _______, _______, _______
|
|
||||||
)};
|
)};
|
||||||
|
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
switch(keycode) {
|
switch(keycode) {
|
||||||
case RGB_VAI:
|
case RGB_VAI:
|
||||||
@@ -288,14 +268,9 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
|||||||
rgblight_setrgb_at(0,255,0, 0);
|
rgblight_setrgb_at(0,255,0, 0);
|
||||||
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
||||||
break;
|
break;
|
||||||
case _GAMING:
|
default:
|
||||||
rgb_mode = RGBLIGHT_MODE_RAINBOW_SWIRL + 5;
|
|
||||||
autoshift_disable();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
rgb_mode = RGBLIGHT_MODE_BREATHING + 1;
|
rgb_mode = RGBLIGHT_MODE_BREATHING + 1;
|
||||||
rgblight_mode_noeeprom(rgb_mode);
|
rgblight_mode_noeeprom(rgb_mode);
|
||||||
autoshift_enable();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
AUTO_SHIFT_ENABLE = yes
|
|
||||||
AUTO_SHIFT_MODIFIERS = no
|
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
TAP_DANCE_ENABLE = yes
|
TAP_DANCE_ENABLE = yes
|
||||||
|
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/* Soy20 PCB}}
|
||||||
|
Copyright (C) {{ 2020 }} {{ Drewkeys }}
|
||||||
|
|
||||||
|
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 3 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 "config_common.h"
|
||||||
|
|
||||||
|
/* USB Device descriptor parameter */
|
||||||
|
#define VENDOR_ID 0x4452 // "DR" short for DrewKeys
|
||||||
|
#define PRODUCT_ID 0x534f // "SO" short for Soy
|
||||||
|
#define DEVICE_VER 0x0001
|
||||||
|
#define MANUFACTURER drewkeys
|
||||||
|
#define PRODUCT soy20
|
||||||
|
|
||||||
|
/* key matrix size */
|
||||||
|
#define MATRIX_ROWS 5
|
||||||
|
#define MATRIX_COLS 4
|
||||||
|
|
||||||
|
/* key matrix pins */
|
||||||
|
#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4 }
|
||||||
|
#define MATRIX_COL_PINS { B5, B6, B7, C7 }
|
||||||
|
#define UNUSED_PINS
|
||||||
|
|
||||||
|
/* COL2ROW or ROW2COL */
|
||||||
|
#define DIODE_DIRECTION COL2ROW
|
||||||
|
|
||||||
|
/* Set 0 if debouncing isn't needed */
|
||||||
|
#define DEBOUNCE 5
|
||||||
|
|
||||||
|
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||||
|
#define LOCKING_SUPPORT_ENABLE
|
||||||
|
|
||||||
|
/* Locking resynchronize hack */
|
||||||
|
#define LOCKING_RESYNC_ENABLE
|
||||||
|
|
||||||
|
#ifdef RGB_DI_PIN
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#define RGBLED_NUM 0
|
||||||
|
#define RGBLIGHT_HUE_STEP 8
|
||||||
|
#define RGBLIGHT_SAT_STEP 8
|
||||||
|
#define RGBLIGHT_VAL_STEP 8
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"keyboard_name": "Soy20",
|
||||||
|
"url": "",
|
||||||
|
"maintainer": "twholt",
|
||||||
|
"width": 4,
|
||||||
|
"height": 5,
|
||||||
|
"layouts": {
|
||||||
|
"LAYOUT_ortho_5x4": {
|
||||||
|
"layout": [
|
||||||
|
{"label":"K00 (B0,B5)", "x":0, "y":0},
|
||||||
|
{"label":"K01 (B0,B6)", "x":1, "y":0},
|
||||||
|
{"label":"K02 (B0,B7)", "x":2, "y":0},
|
||||||
|
{"label":"K03 (B0,C7)", "x":3, "y":0},
|
||||||
|
{"label":"K10 (B1,B5)", "x":0, "y":1},
|
||||||
|
{"label":"K11 (B1,B6)", "x":1, "y":1},
|
||||||
|
{"label":"K12 (B1,B7)", "x":2, "y":1},
|
||||||
|
{"label":"K13 (B1,C7)", "x":3, "y":1},
|
||||||
|
{"label":"K20 (B2,B5)", "x":0, "y":2},
|
||||||
|
{"label":"K21 (B2,B6)", "x":1, "y":2},
|
||||||
|
{"label":"K22 (B2,B7)", "x":2, "y":2},
|
||||||
|
{"label":"K23 (B2,C7)", "x":3, "y":2},
|
||||||
|
{"label":"K30 (B3,B5)", "x":0, "y":3},
|
||||||
|
{"label":"K31 (B3,B6)", "x":1, "y":3},
|
||||||
|
{"label":"K32 (B3,B7)", "x":2, "y":3},
|
||||||
|
{"label":"K33 (B3,C7)", "x":3, "y":3},
|
||||||
|
{"label":"K40 (B4,B5)", "x":0, "y":4},
|
||||||
|
{"label":"K41 (B4,B6)", "x":1, "y":4},
|
||||||
|
{"label":"K42 (B4,B7)", "x":2, "y":4},
|
||||||
|
{"label":"K43 (B4,C7)", "x":3, "y":4}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
[0] = LAYOUT_ortho_5x4(
|
||||||
|
KC_PMNS, KC_PAST, KC_PSLS, MO(1),
|
||||||
|
KC_PPLS, KC_P9, KC_P8, KC_P7,
|
||||||
|
KC_TAB, KC_P5, KC_P6, KC_P4,
|
||||||
|
KC_PENT, KC_P3, KC_P2, KC_P1,
|
||||||
|
KC_DEL, KC_SCLN, KC_PDOT, KC_P0),
|
||||||
|
|
||||||
|
[1] = LAYOUT_ortho_5x4(
|
||||||
|
KC_NLCK, KC_PSCR, 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, RESET),
|
||||||
|
|
||||||
|
};
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
[0] = LAYOUT_ortho_5x4(
|
||||||
|
KC_PMNS, KC_PAST, KC_PSLS, MO(1),
|
||||||
|
KC_PPLS, KC_P9, KC_P8, KC_P7,
|
||||||
|
KC_TAB, KC_P5, KC_P6, KC_P4,
|
||||||
|
KC_PENT, KC_P3, KC_P2, KC_P1,
|
||||||
|
KC_DEL, KC_SCLN, KC_PDOT, KC_P0),
|
||||||
|
|
||||||
|
[1] = LAYOUT_ortho_5x4(
|
||||||
|
KC_NLCK, KC_PSCR, 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, RESET),
|
||||||
|
|
||||||
|
[2] = LAYOUT_ortho_5x4(
|
||||||
|
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),
|
||||||
|
|
||||||
|
[3] = LAYOUT_ortho_5x4(
|
||||||
|
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),
|
||||||
|
|
||||||
|
};
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
VIA_ENABLE = yes
|
||||||
|
LTO_ENABLE = yes
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Soy20
|
||||||
|
|
||||||
|
A 4x5 keypad created by drewkeys
|
||||||
|
|
||||||
|
* Keyboard Maintainer: [Friend-Or-F0H](https://github.com/Friend-Or-F0H)
|
||||||
|
* Hardware Supported: drewkeys Soy20 PCB
|
||||||
|
* Hardware Availability: Limited GB
|
||||||
|
|
||||||
|
Make example for this keyboard (after setting up your build environment):
|
||||||
|
|
||||||
|
make soy20:default
|
||||||
|
|
||||||
|
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).
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# MCU name
|
||||||
|
MCU = atmega32u2
|
||||||
|
|
||||||
|
# Bootloader selection
|
||||||
|
BOOTLOADER = atmel-dfu
|
||||||
|
|
||||||
|
# Build Options
|
||||||
|
# change yes to no to disable
|
||||||
|
#
|
||||||
|
BOOTMAGIC_ENABLE = full # Virtual DIP switch configuration
|
||||||
|
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||||
|
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||||
|
CONSOLE_ENABLE = no # Console for debug
|
||||||
|
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
|
NKRO_ENABLE = yes # USB Nkey Rollover
|
||||||
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||||
|
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||||
|
BLUETOOTH_ENABLE = no # Enable Bluetooth
|
||||||
|
AUDIO_ENABLE = no # Audio output
|
||||||
|
|
||||||
|
LAYOUTS = ortho_5x4
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/* Soy20 PCB}}
|
||||||
|
Copyright (C) {{ 2020 }} {{ Drewkeys }}
|
||||||
|
|
||||||
|
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 3 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 "soy20.h"
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/* Soy20 PCB}}
|
||||||
|
Copyright (C) {{ 2020 }} {{ Drewkeys }}
|
||||||
|
|
||||||
|
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 3 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 "quantum.h"
|
||||||
|
|
||||||
|
#define LAYOUT_ortho_5x4( \
|
||||||
|
K00, K01, K02, K03, \
|
||||||
|
K10, K11, K12, K13, \
|
||||||
|
K20, K21, K22, K23, \
|
||||||
|
K30, K31, K32, K33, \
|
||||||
|
K40, K41, K42, K43 \
|
||||||
|
) { \
|
||||||
|
{ K00, K01, K02, K03 }, \
|
||||||
|
{ K10, K11, K12, K13 }, \
|
||||||
|
{ K20, K21, K22, K23 }, \
|
||||||
|
{ K30, K31, K32, K33 }, \
|
||||||
|
{ K40, K41, K42, K43 } \
|
||||||
|
}
|
||||||
@@ -3,7 +3,10 @@
|
|||||||
75% keyboard from YMDK. YMDK sell the board and name it "YMD75", however revision 1 of the PCB has "MT84" printed on both sides.
|
75% keyboard from YMDK. YMDK sell the board and name it "YMD75", however revision 1 of the PCB has "MT84" printed on both sides.
|
||||||
|
|
||||||
* Keyboard Maintainer: [Wayne K Jones](github.com/WarmCatUK)
|
* Keyboard Maintainer: [Wayne K Jones](github.com/WarmCatUK)
|
||||||
* Hardware Supported: YMD75/MT84 (rev1 and rev2) with the ATmega32a chip.
|
* Hardware Supported:
|
||||||
|
- rev1 (ATmega32a)
|
||||||
|
- rev2 (ATmega32a)
|
||||||
|
- rev3 (ATmega32u4)
|
||||||
* Hardware Availability: <https://www.aliexpress.com/item/32812690592.html>
|
* Hardware Availability: <https://www.aliexpress.com/item/32812690592.html>
|
||||||
|
|
||||||
Make example for this keyboard (after setting up your build environment):
|
Make example for this keyboard (after setting up your build environment):
|
||||||
|
|||||||
@@ -23,12 +23,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#define VENDOR_ID 0x20A0
|
#define VENDOR_ID 0x20A0
|
||||||
#define PRODUCT_ID 0x422D
|
#define PRODUCT_ID 0x422D
|
||||||
#define DEVICE_VER 0x0200
|
|
||||||
|
|
||||||
#define MANUFACTURER YMDK
|
#define MANUFACTURER YMDK
|
||||||
#define PRODUCT YMD75 / MT84
|
#define PRODUCT YMD75 / MT84
|
||||||
#define DESCRIPTION 75% Keyboard
|
|
||||||
|
|
||||||
|
|
||||||
#define BACKLIGHT_PIN D4
|
#define BACKLIGHT_PIN D4
|
||||||
#define BACKLIGHT_LEVELS 12
|
#define BACKLIGHT_LEVELS 12
|
||||||
|
|||||||
@@ -6,7 +6,92 @@
|
|||||||
"height": 6,
|
"height": 6,
|
||||||
"layouts": {
|
"layouts": {
|
||||||
"LAYOUT": {
|
"LAYOUT": {
|
||||||
"layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":1, "y":0}, {"label":"F2", "x":2, "y":0}, {"label":"F3", "x":3, "y":0}, {"label":"F4", "x":4, "y":0}, {"label":"F5", "x":5, "y":0}, {"label":"F6", "x":6, "y":0}, {"label":"F7", "x":7, "y":0}, {"label":"F8", "x":8, "y":0}, {"label":"F9", "x":9, "y":0}, {"label":"F10", "x":10, "y":0}, {"label":"F11", "x":11, "y":0}, {"label":"F12", "x":12, "y":0}, {"label":"PrtSc", "x":13, "y":0}, {"label":"Del", "x":14, "y":0}, {"label":"Fn", "x":15, "y":0}, {"label":"~", "x":0, "y":1}, {"label":"!", "x":1, "y":1}, {"label":"@", "x":2, "y":1}, {"label":"#", "x":3, "y":1}, {"label":"$", "x":4, "y":1}, {"label":"%", "x":5, "y":1}, {"label":"^", "x":6, "y":1}, {"label":"&", "x":7, "y":1}, {"label":"*", "x":8, "y":1}, {"label":"(", "x":9, "y":1}, {"label":")", "x":10, "y":1}, {"label":"_", "x":11, "y":1}, {"label":"+", "x":12, "y":1}, {"label":"Backspace", "x":13, "y":1, "w":2}, {"label":"Home", "x":15, "y":1}, {"label":"Tab", "x":0, "y":2, "w":1.5}, {"label":"Q", "x":1.5, "y":2}, {"label":"W", "x":2.5, "y":2}, {"label":"E", "x":3.5, "y":2}, {"label":"R", "x":4.5, "y":2}, {"label":"T", "x":5.5, "y":2}, {"label":"Y", "x":6.5, "y":2}, {"label":"U", "x":7.5, "y":2}, {"label":"I", "x":8.5, "y":2}, {"label":"O", "x":9.5, "y":2}, {"label":"P", "x":10.5, "y":2}, {"label":"{", "x":11.5, "y":2}, {"label":"}", "x":12.5, "y":2}, {"label":"|", "x":13.5, "y":2, "w":1.5}, {"label":"End", "x":15, "y":2}, {"label":"Caps Lock", "x":0, "y":3, "w":1.75}, {"label":"A", "x":1.75, "y":3}, {"label":"S", "x":2.75, "y":3}, {"label":"D", "x":3.75, "y":3}, {"label":"F", "x":4.75, "y":3}, {"label":"G", "x":5.75, "y":3}, {"label":"H", "x":6.75, "y":3}, {"label":"J", "x":7.75, "y":3}, {"label":"K", "x":8.75, "y":3}, {"label":"L", "x":9.75, "y":3}, {"label":":", "x":10.75, "y":3}, {"label":"\"", "x":11.75, "y":3}, {"label":"Enter", "x":12.75, "y":3, "w":2.25}, {"label":"Page Up", "x":15, "y":3}, {"label":"Shift", "x":0, "y":4, "w":2.25}, {"label":"Z", "x":2.25, "y":4}, {"label":"X", "x":3.25, "y":4}, {"label":"C", "x":4.25, "y":4}, {"label":"V", "x":5.25, "y":4}, {"label":"B", "x":6.25, "y":4}, {"label":"N", "x":7.25, "y":4}, {"label":"M", "x":8.25, "y":4}, {"label":"<", "x":9.25, "y":4}, {"label":">", "x":10.25, "y":4}, {"label":"?", "x":11.25, "y":4}, {"label":"Shift", "x":12.25, "y":4, "w":1.75}, {"label":"\u2191", "x":14, "y":4}, {"label":"Page Down", "x":15, "y":4}, {"label":"Ctrl", "x":0, "y":5, "w":1.25}, {"label":"GUI", "x":1.25, "y":5, "w":1.25}, {"label":"Alt", "x":2.5, "y":5, "w":1.25}, {"x":3.75, "y":5, "w":6.25}, {"label":"Alt", "x":10, "y":5}, {"label":"Fn", "x":11, "y":5}, {"label":"Ctrl", "x":12, "y":5}, {"label":"\u2190", "x":13, "y":5}, {"label":"\u2193", "x":14, "y":5}, {"label":"\u2192", "x":15, "y":5}]
|
"layout": [
|
||||||
|
{"label":"Esc", "x":0, "y":0},
|
||||||
|
{"label":"F1", "x":1, "y":0},
|
||||||
|
{"label":"F2", "x":2, "y":0},
|
||||||
|
{"label":"F3", "x":3, "y":0},
|
||||||
|
{"label":"F4", "x":4, "y":0},
|
||||||
|
{"label":"F5", "x":5, "y":0},
|
||||||
|
{"label":"F6", "x":6, "y":0},
|
||||||
|
{"label":"F7", "x":7, "y":0},
|
||||||
|
{"label":"F8", "x":8, "y":0},
|
||||||
|
{"label":"F9", "x":9, "y":0},
|
||||||
|
{"label":"F10", "x":10, "y":0},
|
||||||
|
{"label":"F11", "x":11, "y":0},
|
||||||
|
{"label":"F12", "x":12, "y":0},
|
||||||
|
{"label":"PrtSc", "x":13, "y":0},
|
||||||
|
{"label":"Del", "x":14, "y":0},
|
||||||
|
{"label":"Fn", "x":15, "y":0},
|
||||||
|
{"label":"~", "x":0, "y":1},
|
||||||
|
{"label":"!", "x":1, "y":1},
|
||||||
|
{"label":"@", "x":2, "y":1},
|
||||||
|
{"label":"#", "x":3, "y":1},
|
||||||
|
{"label":"$", "x":4, "y":1},
|
||||||
|
{"label":"%", "x":5, "y":1},
|
||||||
|
{"label":"^", "x":6, "y":1},
|
||||||
|
{"label":"&", "x":7, "y":1},
|
||||||
|
{"label":"*", "x":8, "y":1},
|
||||||
|
{"label":"(", "x":9, "y":1},
|
||||||
|
{"label":")", "x":10, "y":1},
|
||||||
|
{"label":"_", "x":11, "y":1},
|
||||||
|
{"label":"+", "x":12, "y":1},
|
||||||
|
{"label":"Backspace", "x":13, "y":1, "w":2},
|
||||||
|
{"label":"Home", "x":15, "y":1},
|
||||||
|
{"label":"Tab", "x":0, "y":2, "w":1.5},
|
||||||
|
{"label":"Q", "x":1.5, "y":2},
|
||||||
|
{"label":"W", "x":2.5, "y":2},
|
||||||
|
{"label":"E", "x":3.5, "y":2},
|
||||||
|
{"label":"R", "x":4.5, "y":2},
|
||||||
|
{"label":"T", "x":5.5, "y":2},
|
||||||
|
{"label":"Y", "x":6.5, "y":2},
|
||||||
|
{"label":"U", "x":7.5, "y":2},
|
||||||
|
{"label":"I", "x":8.5, "y":2},
|
||||||
|
{"label":"O", "x":9.5, "y":2},
|
||||||
|
{"label":"P", "x":10.5, "y":2},
|
||||||
|
{"label":"{", "x":11.5, "y":2},
|
||||||
|
{"label":"}", "x":12.5, "y":2},
|
||||||
|
{"label":"|", "x":13.5, "y":2, "w":1.5},
|
||||||
|
{"label":"End", "x":15, "y":2},
|
||||||
|
{"label":"Caps Lock", "x":0, "y":3, "w":1.75},
|
||||||
|
{"label":"A", "x":1.75, "y":3},
|
||||||
|
{"label":"S", "x":2.75, "y":3},
|
||||||
|
{"label":"D", "x":3.75, "y":3},
|
||||||
|
{"label":"F", "x":4.75, "y":3},
|
||||||
|
{"label":"G", "x":5.75, "y":3},
|
||||||
|
{"label":"H", "x":6.75, "y":3},
|
||||||
|
{"label":"J", "x":7.75, "y":3},
|
||||||
|
{"label":"K", "x":8.75, "y":3},
|
||||||
|
{"label":"L", "x":9.75, "y":3},
|
||||||
|
{"label":":", "x":10.75, "y":3},
|
||||||
|
{"label":"\"", "x":11.75, "y":3},
|
||||||
|
{"label":"Enter", "x":12.75, "y":3, "w":2.25},
|
||||||
|
{"label":"Page Up", "x":15, "y":3},
|
||||||
|
{"label":"Shift", "x":0, "y":4, "w":2.25},
|
||||||
|
{"label":"Z", "x":2.25, "y":4},
|
||||||
|
{"label":"X", "x":3.25, "y":4},
|
||||||
|
{"label":"C", "x":4.25, "y":4},
|
||||||
|
{"label":"V", "x":5.25, "y":4},
|
||||||
|
{"label":"B", "x":6.25, "y":4},
|
||||||
|
{"label":"N", "x":7.25, "y":4},
|
||||||
|
{"label":"M", "x":8.25, "y":4},
|
||||||
|
{"label":"<", "x":9.25, "y":4},
|
||||||
|
{"label":">", "x":10.25, "y":4},
|
||||||
|
{"label":"?", "x":11.25, "y":4},
|
||||||
|
{"label":"Shift", "x":12.25, "y":4, "w":1.75},
|
||||||
|
{"label":"\u2191", "x":14, "y":4},
|
||||||
|
{"label":"Page Down", "x":15, "y":4},
|
||||||
|
{"label":"Ctrl", "x":0, "y":5, "w":1.25},
|
||||||
|
{"label":"GUI", "x":1.25, "y":5, "w":1.25},
|
||||||
|
{"label":"Alt", "x":2.5, "y":5, "w":1.25},
|
||||||
|
{"x":3.75, "y":5, "w":6.25},
|
||||||
|
{"label":"Alt", "x":10, "y":5},
|
||||||
|
{"label":"Fn", "x":11, "y":5},
|
||||||
|
{"label":"Ctrl", "x":12, "y":5},
|
||||||
|
{"label":"\u2190", "x":13, "y":5},
|
||||||
|
{"label":"\u2193", "x":14, "y":5},
|
||||||
|
{"label":"\u2192", "x":15, "y":5}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"LAYOUT_75_iso": {
|
"LAYOUT_75_iso": {
|
||||||
"layout": [
|
"layout": [
|
||||||
|
|||||||
@@ -20,15 +20,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
[1] = LAYOUT_75_iso(
|
[1] = LAYOUT_75_iso(
|
||||||
/* ┌─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┐ */
|
/* ┌─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┐ */
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MPRV, KC_MNXT,
|
RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MPRV, KC_MNXT,
|
||||||
/* ├─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┴─────────┼─────────┤ */
|
/* ├─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┴─────────┼─────────┤ */
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU,
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU,
|
||||||
/* ├─────────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬──────────────┼─────────┤ */
|
/* ├─────────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬────┴────┬──────────────┼─────────┤ */
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLD,
|
RGB_MOD, RGB_TOG, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_VOLD,
|
||||||
/* ├──────────────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬ ├─────────┤ */
|
/* ├──────────────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬──────┴──┬ ├─────────┤ */
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
/* ├───────────┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴─────────┴─┬─────────┼─────────┤ */
|
/* ├───────────┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴─────────┴─┬─────────┼─────────┤ */
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
_______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, _______, _______, _______, _______, _______, _______, _______,
|
||||||
/* ├───────────┼─────────┴─┬───────┴───┬─────┴─────────┴─────────┴─────────┴─────────┴─────────┴───────┬─┴───────┬─┴───────┬─┴───────┬─────────┼─────────┼─────────┤ */
|
/* ├───────────┼─────────┴─┬───────┴───┬─────┴─────────┴─────────┴─────────┴─────────┴─────────┴───────┬─┴───────┬─┴───────┬─┴───────┬─────────┼─────────┼─────────┤ */
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
/* └───────────┴───────────┴───────────┴───────────────────────────────────────────────────────────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┘ */
|
/* └───────────┴───────────┴───────────┴───────────────────────────────────────────────────────────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┘ */
|
||||||
|
|||||||
@@ -25,3 +25,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
|
#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
|
||||||
#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
|
#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
|
||||||
#define DIODE_DIRECTION COL2ROW
|
#define DIODE_DIRECTION COL2ROW
|
||||||
|
#define DEVICE_VER 0x0100
|
||||||
@@ -6,3 +6,4 @@
|
|||||||
#define MATRIX_ROW_PINS { B7, B6, B5, B4, B3, B0 }
|
#define MATRIX_ROW_PINS { B7, B6, B5, B4, B3, B0 }
|
||||||
#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
|
#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
|
||||||
#define DIODE_DIRECTION COL2ROW
|
#define DIODE_DIRECTION COL2ROW
|
||||||
|
#define DEVICE_VER 0x0200
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
{ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, KC_NO, K214 }, \
|
{ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, KC_NO, K214 }, \
|
||||||
{ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, K314 }, \
|
{ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, K314 }, \
|
||||||
{ K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, K414 }, \
|
{ K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, K414 }, \
|
||||||
{ K500, K501, K502, KC_NO, KC_NO, K505, K506, K507, K508, K509, K510, K511, KC_NO, K513, K514 } \
|
{ K500, K501, K502, KC_NO, KC_NO, K505, K506, K507, K508, K509, K510, K511, KC_NO, K513, K514 } \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LAYOUT_75_iso_rwkl( \
|
#define LAYOUT_75_iso_rwkl( \
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define MATRIX_ROWS 12
|
||||||
|
#define MATRIX_COLS 9
|
||||||
|
#define MATRIX_ROW_PINS { B7, B3, B2, B1, B0, E6, F0, F1, F4, F5, F6, F7 }
|
||||||
|
#define MATRIX_COL_PINS { D0, D1, D2, D3, D5, D4, D6, D7, B4 }
|
||||||
|
#define DIODE_DIRECTION ROW2COL
|
||||||
|
#define DEVICE_VER 0x0300
|
||||||
|
#define RGBLIGHT_EFFECT_KNIGHT_OFFSET 4
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Luiz Ribeiro <[email protected]>
|
||||||
|
|
||||||
|
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 "ymd75.h"
|
||||||
|
|
||||||
|
void keyboard_pre_init_kb(void) {
|
||||||
|
led_init_ports();
|
||||||
|
keyboard_pre_init_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
void led_init_ports(void) { setPinOutput(D1); }
|
||||||
|
|
||||||
|
bool led_update_kb(led_t led_state) {
|
||||||
|
if (led_update_user(led_state)) {
|
||||||
|
writePin(D1, led_state.caps_lock);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "quantum.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* LAYOUT
|
||||||
|
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
|
||||||
|
* │Esc│F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│Psc│Pse│Del│
|
||||||
|
* ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┴───┼───┤
|
||||||
|
* │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │0 │ - │ = │BckSpc │Hm │
|
||||||
|
* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤
|
||||||
|
* │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │End│
|
||||||
|
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤
|
||||||
|
* │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │PgU│
|
||||||
|
* ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤
|
||||||
|
* │ Shift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │RShift│ ↑ │PgD│
|
||||||
|
* ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤
|
||||||
|
* │Ctrl│Sup │Alt │ Space │Alt│Sup│Ctl│ ← │ ↓ │ → │
|
||||||
|
* └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LAYOUT( \
|
||||||
|
K50, K51, K52, K53, K54, K55, K56, K57, K58, KB8, KB7, KB5, KB4, KB3, KB6, KB2, \
|
||||||
|
K40, K41, K42, K43, K44, K45, K46, K47, K48, KA8, KA7, KA5, KA4, KA6, KA2, \
|
||||||
|
K30, K31, K32, K33, K34, K35, K36, K37, K38, K98, K97, K95, K94, K84, K96, \
|
||||||
|
K20, K21, K22, K23, K24, K25, K26, K27, K28, K88, K87, K85, K93, K86, \
|
||||||
|
K10, K12, K13, K14, K15, K16, K17, K18, K78, K77, K75, K74, K73, K76, \
|
||||||
|
K00, K01, K02, K06, K08, K07, K05, K04, K03, K66 \
|
||||||
|
) { \
|
||||||
|
{ K00, K01, K02, K03, K04, K05, K06, K07, K08 }, \
|
||||||
|
{ K10, KC_NO, K12, K13, K14, K15, K16, K17, K18 }, \
|
||||||
|
{ K20, K21, K22, K23, K24, K25, K26, K27, K28 }, \
|
||||||
|
{ K30, K31, K32, K33, K34, K35, K36, K37, K38 }, \
|
||||||
|
{ K40, K41, K42, K43, K44, K45, K46, K47, K48 }, \
|
||||||
|
{ K50, K51, K52, K53, K54, K55, K56, K57, K58 }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K66, KC_NO, KC_NO }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, K73, K74, K75, K76, K77, K78 }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, KC_NO, K84, K85, K86, K87, K88 }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, K93, K94, K95, K96, K97, K98 }, \
|
||||||
|
{ KC_NO, KC_NO, KA2, KC_NO, KA4, KA5, KA6, KA7, KA8 }, \
|
||||||
|
{ KC_NO, KC_NO, KB2, KB3, KB4, KB5, KB6, KB7, KB8 }, \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LAYOUT_75_iso
|
||||||
|
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
|
||||||
|
* │Esc│F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│Psc│Pse│Del│
|
||||||
|
* ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┴───┼───┤
|
||||||
|
* │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │0 │ - │ = │BckSpc │Hm │
|
||||||
|
* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤
|
||||||
|
* │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ │End│
|
||||||
|
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐Ent ├───┤
|
||||||
|
* │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ # │ │PgU│
|
||||||
|
* ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴┬───┼───┤
|
||||||
|
* │Shft│ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │Shift │ ↑ │PgD│
|
||||||
|
* ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤
|
||||||
|
* │Ctrl│Sup │Alt │ Space │Alt│Mo │Ctl│ ← │ ↓ │ → │
|
||||||
|
* └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LAYOUT_75_iso( \
|
||||||
|
K50, K51, K52, K53, K54, K55, K56, K57, K58, KB8, KB7, KB5, KB4, KB3, KB6, KB2, \
|
||||||
|
K40, K41, K42, K43, K44, K45, K46, K47, K48, KA8, KA7, KA5, KA4, KA6, KA2, \
|
||||||
|
K30, K31, K32, K33, K34, K35, K36, K37, K38, K98, K97, K95, K94, K96, \
|
||||||
|
K20, K21, K22, K23, K24, K25, K26, K27, K28, K88, K87, K85, K93, K84, K86, \
|
||||||
|
K10, K11, K12, K13, K14, K15, K16, K17, K18, K78, K77, K75, K74, K73, K76, \
|
||||||
|
K00, K01, K02, K06, K08, K07, K05, K04, K03, K66 \
|
||||||
|
) { \
|
||||||
|
{ K00, K01, K02, K03, K04, K05, K06, K07, K08 }, \
|
||||||
|
{ K10, K11, K12, K13, K14, K15, K16, K17, K18 }, \
|
||||||
|
{ K20, K21, K22, K23, K24, K25, K26, K27, K28 }, \
|
||||||
|
{ K30, K31, K32, K33, K34, K35, K36, K37, K38 }, \
|
||||||
|
{ K40, K41, K42, K43, K44, K45, K46, K47, K48 }, \
|
||||||
|
{ K50, K51, K52, K53, K54, K55, K56, K57, K58 }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K66, KC_NO, KC_NO }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, K73, K74, K75, K76, K77, K78 }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, KC_NO, K93, K85, K86, K87, K88 }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, K84, K94, K95, K96, K97, K98 }, \
|
||||||
|
{ KC_NO, KC_NO, KA2, KC_NO, KA4, KA5, KA6, KA7, KA8 }, \
|
||||||
|
{ KC_NO, KC_NO, KB2, KB3, KB4, KB5, KB6, KB7, KB8 }, \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LAYOUT_75_iso_rwkl
|
||||||
|
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
|
||||||
|
* │Esc│F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│Psc│Pse│Del│
|
||||||
|
* ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┴───┼───┤
|
||||||
|
* │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │0 │ - │ = │BckSpc │Hm │
|
||||||
|
* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤
|
||||||
|
* │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ │End│
|
||||||
|
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐Ent ├───┤
|
||||||
|
* │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ # │ │PgU│
|
||||||
|
* ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴┬───┼───┤
|
||||||
|
* │Shft│ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │Shift │ ↑ │PgD│
|
||||||
|
* ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┴┬──┴──┬───┼───┼───┤
|
||||||
|
* │Ctrl│Sup │Alt │ Space │ Alt │ Ctl │ ← │ ↓ │ → │
|
||||||
|
* └────┴────┴────┴────────────────────────┴─────┴─────┴───┴───┴───┘
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LAYOUT_75_iso_rwkl( \
|
||||||
|
K50, K51, K52, K53, K54, K55, K56, K57, K58, KB8, KB7, KB5, KB4, KB3, KB6, KB2, \
|
||||||
|
K40, K41, K42, K43, K44, K45, K46, K47, K48, KA8, KA7, KA5, KA4, KA6, KA2, \
|
||||||
|
K30, K31, K32, K33, K34, K35, K36, K37, K38, K98, K97, K95, K94, K96, \
|
||||||
|
K20, K21, K22, K23, K24, K25, K26, K27, K28, K88, K87, K85, K93, K84, K86, \
|
||||||
|
K10, K11, K12, K13, K14, K15, K16, K17, K18, K78, K77, K75, K74, K73, K76, \
|
||||||
|
K00, K01, K02, K06, K08, K05, K04, K03, K66 \
|
||||||
|
) { \
|
||||||
|
{ K00, K01, K02, K03, K04, K05, K06, KC_NO, K08 }, \
|
||||||
|
{ K10, K11, K12, K13, K14, K15, K16, K17, K18 }, \
|
||||||
|
{ K20, K21, K22, K23, K24, K25, K26, K27, K28 }, \
|
||||||
|
{ K30, K31, K32, K33, K34, K35, K36, K37, K38 }, \
|
||||||
|
{ K40, K41, K42, K43, K44, K45, K46, K47, K48 }, \
|
||||||
|
{ K50, K51, K52, K53, K54, K55, K56, K57, K58 }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K66, KC_NO, KC_NO }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, K73, K74, K75, K76, K77, K78 }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, KC_NO, K93, K85, K86, K87, K88 }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, K84, K94, K95, K96, K97, K98 }, \
|
||||||
|
{ KC_NO, KC_NO, KA2, KC_NO, KA4, KA5, KA6, KA7, KA8 }, \
|
||||||
|
{ KC_NO, KC_NO, KB2, KB3, KB4, KB5, KB6, KB7, KB8 }, \
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# MCU name
|
||||||
|
MCU = atmega32u4
|
||||||
|
|
||||||
|
# Bootloader selection
|
||||||
|
BOOTLOADER = atmel-dfu
|
||||||
|
|
||||||
|
# Build Options
|
||||||
|
# change yes to no to disable
|
||||||
|
#
|
||||||
|
BOOTMAGIC_ENABLE = full # Virtual DIP switch configuration
|
||||||
|
MOUSEKEY_ENABLE = no # Mouse keys
|
||||||
|
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||||
|
CONSOLE_ENABLE = no # Console for debug
|
||||||
|
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
|
NKRO_ENABLE = no # USB Nkey Rollover
|
||||||
|
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
|
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
||||||
|
BLUETOOTH_ENABLE = no # Enable Bluetooth
|
||||||
|
AUDIO_ENABLE = no # Audio output
|
||||||
|
KEY_LOCK_ENABLE = yes # Enable KC_LOCK support
|
||||||
@@ -6,4 +6,6 @@
|
|||||||
#include "rev1.h"
|
#include "rev1.h"
|
||||||
#elif defined(KEYBOARD_ymd75_rev2)
|
#elif defined(KEYBOARD_ymd75_rev2)
|
||||||
#include "rev2.h"
|
#include "rev2.h"
|
||||||
|
#elif defined(KEYBOARD_ymd75_rev3)
|
||||||
|
#include "rev3.h"
|
||||||
#endif
|
#endif
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright 2020 Daniel Reibl <[email protected]>
|
/* Copyright 2020 Janos Daniel Reibl <[email protected]> @riblee
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
+3
-181
@@ -1,5 +1,4 @@
|
|||||||
/* Copyright 2015-2017 Jack Humbert
|
/* Copyright 2020 Janos Daniel Reibl <[email protected]> @riblee
|
||||||
* Copyright 2020 Daniel Reibl <janos.daniel.reibl@protonmail.com>
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,146 +13,8 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include "riblee.h"
|
||||||
|
|
||||||
#include QMK_KEYBOARD_H
|
|
||||||
|
|
||||||
enum preonic_layers {
|
|
||||||
_QWERTY,
|
|
||||||
_COLEMAK,
|
|
||||||
_DVORAK,
|
|
||||||
_LOWER,
|
|
||||||
_RAISE,
|
|
||||||
_ADJUST
|
|
||||||
};
|
|
||||||
|
|
||||||
enum preonic_keycodes {
|
|
||||||
QWERTY = SAFE_RANGE,
|
|
||||||
COLEMAK,
|
|
||||||
DVORAK,
|
|
||||||
BACKLIT
|
|
||||||
};
|
|
||||||
|
|
||||||
#define LOWER MO(_LOWER)
|
|
||||||
#define RAISE MO(_RAISE)
|
|
||||||
|
|
||||||
// Tap Dance declarations
|
|
||||||
enum {
|
|
||||||
TD_A,
|
|
||||||
TD_E,
|
|
||||||
TD_I,
|
|
||||||
TD_O,
|
|
||||||
TD_U,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t shift = MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT);
|
|
||||||
|
|
||||||
// Tap Dance functions
|
|
||||||
void dance_key_a (qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
if (state->count == 1) {
|
|
||||||
SEND_STRING("a");
|
|
||||||
reset_tap_dance(state);
|
|
||||||
} else if (state->count == 2) {
|
|
||||||
if (!(keyboard_report->mods & shift)) {
|
|
||||||
send_unicode_string("á");
|
|
||||||
} else {
|
|
||||||
send_unicode_string("Á");
|
|
||||||
}
|
|
||||||
|
|
||||||
reset_tap_dance(state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void dance_key_e (qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
if (state->count == 1) {
|
|
||||||
SEND_STRING("e");
|
|
||||||
reset_tap_dance(state);
|
|
||||||
} else if (state->count == 2) {
|
|
||||||
if (!(keyboard_report->mods & shift)) {
|
|
||||||
send_unicode_string("é");
|
|
||||||
} else {
|
|
||||||
send_unicode_string("É");
|
|
||||||
}
|
|
||||||
|
|
||||||
reset_tap_dance(state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void dance_key_i (qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
if (state->count == 1) {
|
|
||||||
SEND_STRING("i");
|
|
||||||
reset_tap_dance(state);
|
|
||||||
} else if (state->count == 2) {
|
|
||||||
if (!(keyboard_report->mods & shift)) {
|
|
||||||
send_unicode_string("í");
|
|
||||||
} else {
|
|
||||||
send_unicode_string("Í");
|
|
||||||
}
|
|
||||||
|
|
||||||
reset_tap_dance(state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void dance_key_o (qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
if (state->count == 1) {
|
|
||||||
SEND_STRING("o");
|
|
||||||
reset_tap_dance(state);
|
|
||||||
} else if (state->count == 2) {
|
|
||||||
if (!(keyboard_report->mods & shift)) {
|
|
||||||
send_unicode_string("ó");
|
|
||||||
} else {
|
|
||||||
send_unicode_string("Ó");
|
|
||||||
}
|
|
||||||
|
|
||||||
reset_tap_dance(state);
|
|
||||||
} else if (state->count == 3) {
|
|
||||||
if (!(keyboard_report->mods & shift)) {
|
|
||||||
send_unicode_string("ö");
|
|
||||||
} else {
|
|
||||||
send_unicode_string("Ö");
|
|
||||||
}
|
|
||||||
|
|
||||||
reset_tap_dance(state);
|
|
||||||
} else if (state->count == 4) {
|
|
||||||
if (!(keyboard_report->mods & shift)) {
|
|
||||||
send_unicode_string("ő");
|
|
||||||
} else {
|
|
||||||
send_unicode_string("Ő");
|
|
||||||
}
|
|
||||||
|
|
||||||
reset_tap_dance(state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void dance_key_u (qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
if (state->count == 1) {
|
|
||||||
SEND_STRING("u");
|
|
||||||
reset_tap_dance(state);
|
|
||||||
} else if (state->count == 2) {
|
|
||||||
if (!(keyboard_report->mods & shift)) {
|
|
||||||
send_unicode_string("ú");
|
|
||||||
} else {
|
|
||||||
send_unicode_string("Ú");
|
|
||||||
}
|
|
||||||
|
|
||||||
reset_tap_dance(state);
|
|
||||||
} else if (state->count == 3) {
|
|
||||||
if (!(keyboard_report->mods & shift)) {
|
|
||||||
send_unicode_string("ü");
|
|
||||||
} else {
|
|
||||||
send_unicode_string("Ü");
|
|
||||||
}
|
|
||||||
|
|
||||||
reset_tap_dance(state);
|
|
||||||
} else if (state->count == 4) {
|
|
||||||
if (!(keyboard_report->mods & shift)) {
|
|
||||||
send_unicode_string("ű");
|
|
||||||
} else {
|
|
||||||
send_unicode_string("Ű");
|
|
||||||
}
|
|
||||||
|
|
||||||
reset_tap_dance(state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tap Dance definitions
|
// Tap Dance definitions
|
||||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||||
@@ -299,43 +160,4 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
)
|
)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
switch (keycode) {
|
|
||||||
case QWERTY:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
set_single_persistent_default_layer(_QWERTY);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case COLEMAK:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
set_single_persistent_default_layer(_COLEMAK);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case DVORAK:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
set_single_persistent_default_layer(_DVORAK);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case BACKLIT:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
register_code(keycode_config(KC_LGUI));
|
|
||||||
#ifdef BACKLIGHT_ENABLE
|
|
||||||
backlight_step();
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
unregister_code(keycode_config(KC_LGUI));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
File renamed without changes.
File renamed without changes.
@@ -6,6 +6,7 @@ import sys
|
|||||||
|
|
||||||
from milc import cli
|
from milc import cli
|
||||||
|
|
||||||
|
from . import c2json
|
||||||
from . import cformat
|
from . import cformat
|
||||||
from . import compile
|
from . import compile
|
||||||
from . import config
|
from . import config
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
"""Generate a keymap.json from a keymap.c file.
|
||||||
|
"""
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from milc import cli
|
||||||
|
|
||||||
|
import qmk.keymap
|
||||||
|
import qmk.path
|
||||||
|
|
||||||
|
|
||||||
|
@cli.argument('--no-cpp', arg_only=True, action='store_false', help='Do not use \'cpp\' on keymap.c')
|
||||||
|
@cli.argument('-o', '--output', arg_only=True, type=qmk.path.normpath, help='File to write to')
|
||||||
|
@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages")
|
||||||
|
@cli.argument('-kb', '--keyboard', arg_only=True, required=True, help='The keyboard\'s name')
|
||||||
|
@cli.argument('-km', '--keymap', arg_only=True, required=True, help='The keymap\'s name')
|
||||||
|
@cli.argument('filename', arg_only=True, help='keymap.c file')
|
||||||
|
@cli.subcommand('Creates a keymap.json from a keymap.c file.')
|
||||||
|
def c2json(cli):
|
||||||
|
"""Generate a keymap.json from a keymap.c file.
|
||||||
|
|
||||||
|
This command uses the `qmk.keymap` module to generate a keymap.json from a keymap.c file. The generated keymap is written to stdout, or to a file if -o is provided.
|
||||||
|
"""
|
||||||
|
cli.args.filename = qmk.path.normpath(cli.args.filename)
|
||||||
|
|
||||||
|
# Error checking
|
||||||
|
if not cli.args.filename.exists():
|
||||||
|
cli.log.error('C file does not exist!')
|
||||||
|
cli.print_usage()
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
if str(cli.args.filename) == '-':
|
||||||
|
# TODO(skullydazed/anyone): Read file contents from STDIN
|
||||||
|
cli.log.error('Reading from STDIN is not (yet) supported.')
|
||||||
|
cli.print_usage()
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
# Environment processing
|
||||||
|
if cli.args.output == ('-'):
|
||||||
|
cli.args.output = None
|
||||||
|
|
||||||
|
# Parse the keymap.c
|
||||||
|
keymap_json = qmk.keymap.c2json(cli.args.keyboard, cli.args.keymap, cli.args.filename, use_cpp=cli.args.no_cpp)
|
||||||
|
|
||||||
|
# Generate the keymap.json
|
||||||
|
try:
|
||||||
|
keymap_json = qmk.keymap.generate(keymap_json['keyboard'], keymap_json['layout'], keymap_json['layers'], type='json', keymap=keymap_json['keymap'])
|
||||||
|
except KeyError:
|
||||||
|
cli.log.error('Something went wrong. Try to use --no-cpp.')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if cli.args.output:
|
||||||
|
cli.args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
if cli.args.output.exists():
|
||||||
|
cli.args.output.replace(cli.args.output.name + '.bak')
|
||||||
|
cli.args.output.write_text(json.dumps(keymap_json))
|
||||||
|
|
||||||
|
if not cli.args.quiet:
|
||||||
|
cli.log.info('Wrote keymap to %s.', cli.args.output)
|
||||||
|
|
||||||
|
else:
|
||||||
|
print(json.dumps(keymap_json))
|
||||||
@@ -58,7 +58,7 @@ def parse_gcc_version(version):
|
|||||||
return {
|
return {
|
||||||
'major': int(m.group(1)),
|
'major': int(m.group(1)),
|
||||||
'minor': int(m.group(2)) if m.group(2) else 0,
|
'minor': int(m.group(2)) if m.group(2) else 0,
|
||||||
'patch': int(m.group(3)) if m.group(3) else 0
|
'patch': int(m.group(3)) if m.group(3) else 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -364,3 +364,5 @@ def doctor(cli):
|
|||||||
else:
|
else:
|
||||||
cli.log.info('{fg_yellow}Problems detected, please fix these problems before proceeding.')
|
cli.log.info('{fg_yellow}Problems detected, please fix these problems before proceeding.')
|
||||||
# FIXME(skullydazed/unclaimed): Link to a document about troubleshooting, or discord or something
|
# FIXME(skullydazed/unclaimed): Link to a document about troubleshooting, or discord or something
|
||||||
|
|
||||||
|
return ok
|
||||||
@@ -134,11 +134,11 @@ def info(cli):
|
|||||||
if not cli.config.info.keyboard:
|
if not cli.config.info.keyboard:
|
||||||
cli.log.error('Missing paramater: --keyboard')
|
cli.log.error('Missing paramater: --keyboard')
|
||||||
cli.subcommands['info'].print_help()
|
cli.subcommands['info'].print_help()
|
||||||
exit(1)
|
return False
|
||||||
|
|
||||||
if not is_keyboard(cli.config.info.keyboard):
|
if not is_keyboard(cli.config.info.keyboard):
|
||||||
cli.log.error('Invalid keyboard: "%s"', cli.config.info.keyboard)
|
cli.log.error('Invalid keyboard: "%s"', cli.config.info.keyboard)
|
||||||
exit(1)
|
return False
|
||||||
|
|
||||||
# Build the info.json file
|
# Build the info.json file
|
||||||
kb_info_json = info_json(cli.config.info.keyboard)
|
kb_info_json = info_json(cli.config.info.keyboard)
|
||||||
@@ -146,13 +146,10 @@ def info(cli):
|
|||||||
# Output in the requested format
|
# Output in the requested format
|
||||||
if cli.args.format == 'json':
|
if cli.args.format == 'json':
|
||||||
print(json.dumps(kb_info_json))
|
print(json.dumps(kb_info_json))
|
||||||
exit()
|
elif cli.args.format == 'text':
|
||||||
|
|
||||||
if cli.args.format == 'text':
|
|
||||||
print_text_output(kb_info_json)
|
print_text_output(kb_info_json)
|
||||||
|
|
||||||
elif cli.args.format == 'friendly':
|
elif cli.args.format == 'friendly':
|
||||||
print_friendly_output(kb_info_json)
|
print_friendly_output(kb_info_json)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
cli.log.error('Unknown format: %s', cli.args.format)
|
cli.log.error('Unknown format: %s', cli.args.format)
|
||||||
|
return False
|
||||||
@@ -13,4 +13,4 @@ def json_keymap(cli):
|
|||||||
"""Renamed to `qmk json2c`.
|
"""Renamed to `qmk json2c`.
|
||||||
"""
|
"""
|
||||||
cli.log.error('This command has been renamed to `qmk json2c`.')
|
cli.log.error('This command has been renamed to `qmk json2c`.')
|
||||||
exit(1)
|
return False
|
||||||
@@ -22,12 +22,12 @@ def json2c(cli):
|
|||||||
# TODO(skullydazed/anyone): Read file contents from STDIN
|
# TODO(skullydazed/anyone): Read file contents from STDIN
|
||||||
cli.log.error('Reading from STDIN is not (yet) supported.')
|
cli.log.error('Reading from STDIN is not (yet) supported.')
|
||||||
cli.print_usage()
|
cli.print_usage()
|
||||||
exit(1)
|
return False
|
||||||
|
|
||||||
if not cli.args.filename.exists():
|
if not cli.args.filename.exists():
|
||||||
cli.log.error('JSON file does not exist!')
|
cli.log.error('JSON file does not exist!')
|
||||||
cli.print_usage()
|
cli.print_usage()
|
||||||
exit(1)
|
return False
|
||||||
|
|
||||||
# Environment processing
|
# Environment processing
|
||||||
if cli.args.output and cli.args.output.name == '-':
|
if cli.args.output and cli.args.output.name == '-':
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ def kle2json(cli):
|
|||||||
file_path = Path(os.environ['ORIG_CWD'], cli.args.filename)
|
file_path = Path(os.environ['ORIG_CWD'], cli.args.filename)
|
||||||
# Check for valid file_path for more graceful failure
|
# Check for valid file_path for more graceful failure
|
||||||
if not file_path.exists():
|
if not file_path.exists():
|
||||||
return cli.log.error('File {fg_cyan}%s{style_reset_all} was not found.', file_path)
|
cli.log.error('File {fg_cyan}%s{style_reset_all} was not found.', file_path)
|
||||||
|
return False
|
||||||
out_path = file_path.parent
|
out_path = file_path.parent
|
||||||
raw_code = file_path.open().read()
|
raw_code = file_path.open().read()
|
||||||
# Check if info.json exists, allow overwrite with force
|
# Check if info.json exists, allow overwrite with force
|
||||||
@@ -50,8 +51,7 @@ def kle2json(cli):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
cli.log.error('Could not parse KLE raw data: %s', raw_code)
|
cli.log.error('Could not parse KLE raw data: %s', raw_code)
|
||||||
cli.log.exception(e)
|
cli.log.exception(e)
|
||||||
# FIXME: This should be better
|
return False
|
||||||
return cli.log.error('Could not parse KLE raw data.')
|
|
||||||
keyboard = OrderedDict(
|
keyboard = OrderedDict(
|
||||||
keyboard_name=kle.name,
|
keyboard_name=kle.name,
|
||||||
url='',
|
url='',
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ def list_keymaps(cli):
|
|||||||
"""
|
"""
|
||||||
if not is_keyboard(cli.config.list_keymaps.keyboard):
|
if not is_keyboard(cli.config.list_keymaps.keyboard):
|
||||||
cli.log.error('Keyboard %s does not exist!', cli.config.list_keymaps.keyboard)
|
cli.log.error('Keyboard %s does not exist!', cli.config.list_keymaps.keyboard)
|
||||||
exit(1)
|
return False
|
||||||
|
|
||||||
for name in qmk.keymap.list_keymaps(cli.config.list_keymaps.keyboard):
|
for name in qmk.keymap.list_keymaps(cli.config.list_keymaps.keyboard):
|
||||||
print(name)
|
print(name)
|
||||||
@@ -29,15 +29,15 @@ def new_keymap(cli):
|
|||||||
# check directories
|
# check directories
|
||||||
if not kb_path.exists():
|
if not kb_path.exists():
|
||||||
cli.log.error('Keyboard %s does not exist!', kb_path)
|
cli.log.error('Keyboard %s does not exist!', kb_path)
|
||||||
exit(1)
|
return False
|
||||||
|
|
||||||
if not keymap_path_default.exists():
|
if not keymap_path_default.exists():
|
||||||
cli.log.error('Keyboard default %s does not exist!', keymap_path_default)
|
cli.log.error('Keyboard default %s does not exist!', keymap_path_default)
|
||||||
exit(1)
|
return False
|
||||||
|
|
||||||
if keymap_path_new.exists():
|
if keymap_path_new.exists():
|
||||||
cli.log.error('Keymap %s already exists!', keymap_path_new)
|
cli.log.error('Keymap %s already exists!', keymap_path_new)
|
||||||
exit(1)
|
return False
|
||||||
|
|
||||||
# create user directory with default keymap files
|
# create user directory with default keymap files
|
||||||
shutil.copytree(keymap_path_default, keymap_path_new, symlinks=True)
|
shutil.copytree(keymap_path_default, keymap_path_new, symlinks=True)
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import subprocess
|
|||||||
import shlex
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from milc import cli
|
|
||||||
import qmk.keymap
|
import qmk.keymap
|
||||||
|
|
||||||
|
|
||||||
@@ -84,6 +83,4 @@ def run(command, *args, **kwargs):
|
|||||||
safecmd = ' '.join(safecmd)
|
safecmd = ' '.join(safecmd)
|
||||||
command = [os.environ['SHELL'], '-c', safecmd]
|
command = [os.environ['SHELL'], '-c', safecmd]
|
||||||
|
|
||||||
cli.log.debug('Running command: %s', command)
|
|
||||||
|
|
||||||
return subprocess.run(command, *args, **kwargs)
|
return subprocess.run(command, *args, **kwargs)
|
||||||
+19
-10
@@ -9,12 +9,19 @@ from milc import cli
|
|||||||
from qmk.constants import ARM_PROCESSORS, AVR_PROCESSORS, VUSB_PROCESSORS
|
from qmk.constants import ARM_PROCESSORS, AVR_PROCESSORS, VUSB_PROCESSORS
|
||||||
from qmk.c_parse import find_layouts
|
from qmk.c_parse import find_layouts
|
||||||
from qmk.keyboard import config_h, rules_mk
|
from qmk.keyboard import config_h, rules_mk
|
||||||
|
from qmk.makefile import parse_rules_mk_file
|
||||||
from qmk.math import compute
|
from qmk.math import compute
|
||||||
|
|
||||||
|
|
||||||
def info_json(keyboard):
|
def info_json(keyboard):
|
||||||
"""Generate the info.json data for a specific keyboard.
|
"""Generate the info.json data for a specific keyboard.
|
||||||
"""
|
"""
|
||||||
|
cur_dir = Path('keyboards')
|
||||||
|
rules = parse_rules_mk_file(cur_dir / keyboard / 'rules.mk')
|
||||||
|
if 'DEFAULT_FOLDER' in rules:
|
||||||
|
keyboard = rules['DEFAULT_FOLDER']
|
||||||
|
rules = parse_rules_mk_file(cur_dir / keyboard / 'rules.mk', rules)
|
||||||
|
|
||||||
info_data = {
|
info_data = {
|
||||||
'keyboard_name': str(keyboard),
|
'keyboard_name': str(keyboard),
|
||||||
'keyboard_folder': str(keyboard),
|
'keyboard_folder': str(keyboard),
|
||||||
@@ -22,7 +29,7 @@ def info_json(keyboard):
|
|||||||
'maintainer': 'qmk',
|
'maintainer': 'qmk',
|
||||||
}
|
}
|
||||||
|
|
||||||
for layout_name, layout_json in _find_all_layouts(keyboard).items():
|
for layout_name, layout_json in _find_all_layouts(keyboard, rules).items():
|
||||||
if not layout_name.startswith('LAYOUT_kc'):
|
if not layout_name.startswith('LAYOUT_kc'):
|
||||||
info_data['layouts'][layout_name] = layout_json
|
info_data['layouts'][layout_name] = layout_json
|
||||||
|
|
||||||
@@ -99,22 +106,24 @@ def _extract_rules_mk(info_data):
|
|||||||
return info_data
|
return info_data
|
||||||
|
|
||||||
|
|
||||||
def _find_all_layouts(keyboard):
|
def _search_keyboard_h(path):
|
||||||
"""Looks for layout macros associated with this keyboard.
|
|
||||||
"""
|
|
||||||
layouts = {}
|
|
||||||
rules = rules_mk(keyboard)
|
|
||||||
keyboard_path = Path(rules.get('DEFAULT_FOLDER', keyboard))
|
|
||||||
|
|
||||||
# Pull in all layouts defined in the standard files
|
|
||||||
current_path = Path('keyboards/')
|
current_path = Path('keyboards/')
|
||||||
for directory in keyboard_path.parts:
|
layouts = {}
|
||||||
|
for directory in path.parts:
|
||||||
current_path = current_path / directory
|
current_path = current_path / directory
|
||||||
keyboard_h = '%s.h' % (directory,)
|
keyboard_h = '%s.h' % (directory,)
|
||||||
keyboard_h_path = current_path / keyboard_h
|
keyboard_h_path = current_path / keyboard_h
|
||||||
if keyboard_h_path.exists():
|
if keyboard_h_path.exists():
|
||||||
layouts.update(find_layouts(keyboard_h_path))
|
layouts.update(find_layouts(keyboard_h_path))
|
||||||
|
|
||||||
|
return layouts
|
||||||
|
|
||||||
|
|
||||||
|
def _find_all_layouts(keyboard, rules):
|
||||||
|
"""Looks for layout macros associated with this keyboard.
|
||||||
|
"""
|
||||||
|
layouts = _search_keyboard_h(Path(keyboard))
|
||||||
|
|
||||||
if not layouts:
|
if not layouts:
|
||||||
# If we didn't find any layouts above we widen our search. This is error
|
# If we didn't find any layouts above we widen our search. This is error
|
||||||
# prone which is why we want to encourage people to follow the standard above.
|
# prone which is why we want to encourage people to follow the standard above.
|
||||||
|
|||||||
+247
-25
@@ -1,11 +1,18 @@
|
|||||||
"""Functions that help you work with QMK keymaps.
|
"""Functions that help you work with QMK keymaps.
|
||||||
"""
|
"""
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import json
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from pygments.lexers.c_cpp import CLexer
|
||||||
|
from pygments.token import Token
|
||||||
|
from pygments import lex
|
||||||
|
|
||||||
from milc import cli
|
from milc import cli
|
||||||
|
|
||||||
from qmk.keyboard import rules_mk
|
from qmk.keyboard import rules_mk
|
||||||
import qmk.path
|
import qmk.path
|
||||||
|
import qmk.commands
|
||||||
|
|
||||||
# The `keymap.c` template to use when a keyboard doesn't have its own
|
# The `keymap.c` template to use when a keyboard doesn't have its own
|
||||||
DEFAULT_KEYMAP_C = """#include QMK_KEYBOARD_H
|
DEFAULT_KEYMAP_C = """#include QMK_KEYBOARD_H
|
||||||
@@ -22,22 +29,35 @@ __KEYMAP_GOES_HERE__
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def template(keyboard):
|
def template(keyboard, type='c'):
|
||||||
"""Returns the `keymap.c` template for a keyboard.
|
"""Returns the `keymap.c` or `keymap.json` template for a keyboard.
|
||||||
|
|
||||||
If a template exists in `keyboards/<keyboard>/templates/keymap.c` that
|
If a template exists in `keyboards/<keyboard>/templates/keymap.c` that
|
||||||
text will be used instead of `DEFAULT_KEYMAP_C`.
|
text will be used instead of `DEFAULT_KEYMAP_C`.
|
||||||
|
|
||||||
|
If a template exists in `keyboards/<keyboard>/templates/keymap.json` that
|
||||||
|
text will be used instead of an empty dictionary.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
keyboard
|
keyboard
|
||||||
The keyboard to return a template for.
|
The keyboard to return a template for.
|
||||||
|
|
||||||
|
type
|
||||||
|
'json' for `keymap.json` and 'c' (or anything else) for `keymap.c`
|
||||||
"""
|
"""
|
||||||
template_file = Path('keyboards/%s/templates/keymap.c' % keyboard)
|
if type == 'json':
|
||||||
|
template_file = Path('keyboards/%s/templates/keymap.json' % keyboard)
|
||||||
|
template = {'keyboard': keyboard}
|
||||||
|
if template_file.exists():
|
||||||
|
template.update(json.loads(template_file.read_text()))
|
||||||
|
else:
|
||||||
|
template_file = Path('keyboards/%s/templates/keymap.c' % keyboard)
|
||||||
|
if template_file.exists():
|
||||||
|
template = template_file.read_text()
|
||||||
|
else:
|
||||||
|
template = DEFAULT_KEYMAP_C
|
||||||
|
|
||||||
if template_file.exists():
|
return template
|
||||||
return template_file.read_text()
|
|
||||||
|
|
||||||
return DEFAULT_KEYMAP_C
|
|
||||||
|
|
||||||
|
|
||||||
def _strip_any(keycode):
|
def _strip_any(keycode):
|
||||||
@@ -57,8 +77,8 @@ def is_keymap_dir(keymap):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def generate(keyboard, layout, layers):
|
def generate(keyboard, layout, layers, type='c', keymap=None):
|
||||||
"""Returns a keymap.c for the specified keyboard, layout, and layers.
|
"""Returns a `keymap.c` or `keymap.json` for the specified keyboard, layout, and layers.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
keyboard
|
keyboard
|
||||||
@@ -69,24 +89,30 @@ def generate(keyboard, layout, layers):
|
|||||||
|
|
||||||
layers
|
layers
|
||||||
An array of arrays describing the keymap. Each item in the inner array should be a string that is a valid QMK keycode.
|
An array of arrays describing the keymap. Each item in the inner array should be a string that is a valid QMK keycode.
|
||||||
|
|
||||||
|
type
|
||||||
|
'json' for `keymap.json` and 'c' (or anything else) for `keymap.c`
|
||||||
"""
|
"""
|
||||||
layer_txt = []
|
new_keymap = template(keyboard, type)
|
||||||
|
if type == 'json':
|
||||||
|
new_keymap['keymap'] = keymap
|
||||||
|
new_keymap['layout'] = layout
|
||||||
|
new_keymap['layers'] = layers
|
||||||
|
else:
|
||||||
|
layer_txt = []
|
||||||
|
for layer_num, layer in enumerate(layers):
|
||||||
|
if layer_num != 0:
|
||||||
|
layer_txt[-1] = layer_txt[-1] + ','
|
||||||
|
layer_keys = ', '.join(layer)
|
||||||
|
layer_txt.append('\t[%s] = %s(%s)' % (layer_num, layout, layer_keys))
|
||||||
|
|
||||||
for layer_num, layer in enumerate(layers):
|
keymap = '\n'.join(layer_txt)
|
||||||
if layer_num != 0:
|
new_keymap = new_keymap.replace('__KEYMAP_GOES_HERE__', keymap)
|
||||||
layer_txt[-1] = layer_txt[-1] + ','
|
|
||||||
|
|
||||||
layer = map(_strip_any, layer)
|
return new_keymap
|
||||||
layer_keys = ', '.join(layer)
|
|
||||||
layer_txt.append('\t[%s] = %s(%s)' % (layer_num, layout, layer_keys))
|
|
||||||
|
|
||||||
keymap = '\n'.join(layer_txt)
|
|
||||||
keymap_c = template(keyboard)
|
|
||||||
|
|
||||||
return keymap_c.replace('__KEYMAP_GOES_HERE__', keymap)
|
|
||||||
|
|
||||||
|
|
||||||
def write(keyboard, keymap, layout, layers):
|
def write(keyboard, keymap, layout, layers, type='c'):
|
||||||
"""Generate the `keymap.c` and write it to disk.
|
"""Generate the `keymap.c` and write it to disk.
|
||||||
|
|
||||||
Returns the filename written to.
|
Returns the filename written to.
|
||||||
@@ -103,12 +129,19 @@ def write(keyboard, keymap, layout, layers):
|
|||||||
|
|
||||||
layers
|
layers
|
||||||
An array of arrays describing the keymap. Each item in the inner array should be a string that is a valid QMK keycode.
|
An array of arrays describing the keymap. Each item in the inner array should be a string that is a valid QMK keycode.
|
||||||
|
|
||||||
|
type
|
||||||
|
'json' for `keymap.json` and 'c' (or anything else) for `keymap.c`
|
||||||
"""
|
"""
|
||||||
keymap_c = generate(keyboard, layout, layers)
|
keymap_content = generate(keyboard, layout, layers, type)
|
||||||
keymap_file = qmk.path.keymap(keyboard) / keymap / 'keymap.c'
|
if type == 'json':
|
||||||
|
keymap_file = qmk.path.keymap(keyboard) / keymap / 'keymap.json'
|
||||||
|
keymap_content = json.dumps(keymap_content)
|
||||||
|
else:
|
||||||
|
keymap_file = qmk.path.keymap(keyboard) / keymap / 'keymap.c'
|
||||||
|
|
||||||
keymap_file.parent.mkdir(parents=True, exist_ok=True)
|
keymap_file.parent.mkdir(parents=True, exist_ok=True)
|
||||||
keymap_file.write_text(keymap_c)
|
keymap_file.write_text(keymap_content)
|
||||||
|
|
||||||
cli.log.info('Wrote keymap to {fg_cyan}%s', keymap_file)
|
cli.log.info('Wrote keymap to {fg_cyan}%s', keymap_file)
|
||||||
|
|
||||||
@@ -188,3 +221,192 @@ def list_keymaps(keyboard):
|
|||||||
names = names.union([keymap.name for keymap in cl_path.iterdir() if is_keymap_dir(keymap)])
|
names = names.union([keymap.name for keymap in cl_path.iterdir() if is_keymap_dir(keymap)])
|
||||||
|
|
||||||
return sorted(names)
|
return sorted(names)
|
||||||
|
|
||||||
|
|
||||||
|
def _c_preprocess(path):
|
||||||
|
""" Run a file through the C pre-processor
|
||||||
|
|
||||||
|
Args:
|
||||||
|
path: path of the keymap.c file
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
the stdout of the pre-processor
|
||||||
|
"""
|
||||||
|
pre_processed_keymap = qmk.commands.run(['cpp', path], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
|
||||||
|
return pre_processed_keymap.stdout
|
||||||
|
|
||||||
|
|
||||||
|
def _get_layers(keymap): # noqa C901 : until someone has a good idea how to simplify/split up this code
|
||||||
|
""" Find the layers in a keymap.c file.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
keymap: the content of the keymap.c file
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
a dictionary containing the parsed keymap
|
||||||
|
"""
|
||||||
|
layers = list()
|
||||||
|
opening_braces = '({['
|
||||||
|
closing_braces = ')}]'
|
||||||
|
keymap_certainty = brace_depth = 0
|
||||||
|
is_keymap = is_layer = is_adv_kc = False
|
||||||
|
layer = dict(name=False, layout=False, keycodes=list())
|
||||||
|
for line in lex(keymap, CLexer()):
|
||||||
|
if line[0] is Token.Name:
|
||||||
|
if is_keymap:
|
||||||
|
# If we are inside the keymap array
|
||||||
|
# we know the keymap's name and the layout macro will come,
|
||||||
|
# followed by the keycodes
|
||||||
|
if not layer['name']:
|
||||||
|
if line[1].startswith('LAYOUT') or line[1].startswith('KEYMAP'):
|
||||||
|
# This can happen if the keymap array only has one layer,
|
||||||
|
# for macropads and such
|
||||||
|
layer['name'] = '0'
|
||||||
|
layer['layout'] = line[1]
|
||||||
|
else:
|
||||||
|
layer['name'] = line[1]
|
||||||
|
elif not layer['layout']:
|
||||||
|
layer['layout'] = line[1]
|
||||||
|
elif is_layer:
|
||||||
|
# If we are inside a layout macro,
|
||||||
|
# collect all keycodes
|
||||||
|
if line[1] == '_______':
|
||||||
|
kc = 'KC_TRNS'
|
||||||
|
elif line[1] == 'XXXXXXX':
|
||||||
|
kc = 'KC_NO'
|
||||||
|
else:
|
||||||
|
kc = line[1]
|
||||||
|
if is_adv_kc:
|
||||||
|
# If we are inside an advanced keycode
|
||||||
|
# collect everything and hope the user
|
||||||
|
# knew what he/she was doing
|
||||||
|
layer['keycodes'][-1] += kc
|
||||||
|
else:
|
||||||
|
layer['keycodes'].append(kc)
|
||||||
|
|
||||||
|
# The keymaps array's signature:
|
||||||
|
# const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS]
|
||||||
|
#
|
||||||
|
# Only if we've found all 6 keywords in this specific order
|
||||||
|
# can we know for sure that we are inside the keymaps array
|
||||||
|
elif line[1] == 'PROGMEM' and keymap_certainty == 2:
|
||||||
|
keymap_certainty = 3
|
||||||
|
elif line[1] == 'keymaps' and keymap_certainty == 3:
|
||||||
|
keymap_certainty = 4
|
||||||
|
elif line[1] == 'MATRIX_ROWS' and keymap_certainty == 4:
|
||||||
|
keymap_certainty = 5
|
||||||
|
elif line[1] == 'MATRIX_COLS' and keymap_certainty == 5:
|
||||||
|
keymap_certainty = 6
|
||||||
|
elif line[0] is Token.Keyword:
|
||||||
|
if line[1] == 'const' and keymap_certainty == 0:
|
||||||
|
keymap_certainty = 1
|
||||||
|
elif line[0] is Token.Keyword.Type:
|
||||||
|
if line[1] == 'uint16_t' and keymap_certainty == 1:
|
||||||
|
keymap_certainty = 2
|
||||||
|
elif line[0] is Token.Punctuation:
|
||||||
|
if line[1] in opening_braces:
|
||||||
|
brace_depth += 1
|
||||||
|
if is_keymap:
|
||||||
|
if is_layer:
|
||||||
|
# We found the beginning of a non-basic keycode
|
||||||
|
is_adv_kc = True
|
||||||
|
layer['keycodes'][-1] += line[1]
|
||||||
|
elif line[1] == '(' and brace_depth == 2:
|
||||||
|
# We found the beginning of a layer
|
||||||
|
is_layer = True
|
||||||
|
elif line[1] == '{' and keymap_certainty == 6:
|
||||||
|
# We found the beginning of the keymaps array
|
||||||
|
is_keymap = True
|
||||||
|
elif line[1] in closing_braces:
|
||||||
|
brace_depth -= 1
|
||||||
|
if is_keymap:
|
||||||
|
if is_adv_kc:
|
||||||
|
layer['keycodes'][-1] += line[1]
|
||||||
|
if brace_depth == 2:
|
||||||
|
# We found the end of a non-basic keycode
|
||||||
|
is_adv_kc = False
|
||||||
|
elif line[1] == ')' and brace_depth == 1:
|
||||||
|
# We found the end of a layer
|
||||||
|
is_layer = False
|
||||||
|
layers.append(layer)
|
||||||
|
layer = dict(name=False, layout=False, keycodes=list())
|
||||||
|
elif line[1] == '}' and brace_depth == 0:
|
||||||
|
# We found the end of the keymaps array
|
||||||
|
is_keymap = False
|
||||||
|
keymap_certainty = 0
|
||||||
|
elif is_adv_kc:
|
||||||
|
# Advanced keycodes can contain other punctuation
|
||||||
|
# e.g.: MT(MOD_LCTL | MOD_LSFT, KC_ESC)
|
||||||
|
layer['keycodes'][-1] += line[1]
|
||||||
|
|
||||||
|
elif line[0] is Token.Literal.Number.Integer and is_keymap and not is_adv_kc:
|
||||||
|
# If the pre-processor finds the 'meaning' of the layer names,
|
||||||
|
# they will be numbers
|
||||||
|
if not layer['name']:
|
||||||
|
layer['name'] = line[1]
|
||||||
|
|
||||||
|
else:
|
||||||
|
# We only care about
|
||||||
|
# operators and such if we
|
||||||
|
# are inside an advanced keycode
|
||||||
|
# e.g.: MT(MOD_LCTL | MOD_LSFT, KC_ESC)
|
||||||
|
if is_adv_kc:
|
||||||
|
layer['keycodes'][-1] += line[1]
|
||||||
|
|
||||||
|
return layers
|
||||||
|
|
||||||
|
|
||||||
|
def parse_keymap_c(keymap_file, use_cpp=True):
|
||||||
|
""" Parse a keymap.c file.
|
||||||
|
|
||||||
|
Currently only cares about the keymaps array.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
keymap_file: path of the keymap.c file
|
||||||
|
|
||||||
|
use_cpp: if True, pre-process the file with the C pre-processor
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
a dictionary containing the parsed keymap
|
||||||
|
"""
|
||||||
|
if use_cpp:
|
||||||
|
keymap_file = _c_preprocess(keymap_file)
|
||||||
|
else:
|
||||||
|
keymap_file = keymap_file.read_text()
|
||||||
|
|
||||||
|
keymap = dict()
|
||||||
|
keymap['layers'] = _get_layers(keymap_file)
|
||||||
|
return keymap
|
||||||
|
|
||||||
|
|
||||||
|
def c2json(keyboard, keymap, keymap_file, use_cpp=True):
|
||||||
|
""" Convert keymap.c to keymap.json
|
||||||
|
|
||||||
|
Args:
|
||||||
|
keyboard: The name of the keyboard
|
||||||
|
|
||||||
|
keymap: The name of the keymap
|
||||||
|
|
||||||
|
layout: The LAYOUT macro this keymap uses.
|
||||||
|
|
||||||
|
keymap_file: path of the keymap.c file
|
||||||
|
|
||||||
|
use_cpp: if True, pre-process the file with the C pre-processor
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
a dictionary in keymap.json format
|
||||||
|
"""
|
||||||
|
keymap_json = parse_keymap_c(keymap_file, use_cpp)
|
||||||
|
|
||||||
|
dirty_layers = keymap_json.pop('layers', None)
|
||||||
|
keymap_json['layers'] = list()
|
||||||
|
for layer in dirty_layers:
|
||||||
|
layer.pop('name')
|
||||||
|
layout = layer.pop('layout')
|
||||||
|
if not keymap_json.get('layout', False):
|
||||||
|
keymap_json['layout'] = layout
|
||||||
|
keymap_json['layers'].append(layer.pop('keycodes'))
|
||||||
|
|
||||||
|
keymap_json['keyboard'] = keyboard
|
||||||
|
keymap_json['keymap'] = keymap
|
||||||
|
return keymap_json
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Ignore generated info.json from pytest
|
||||||
|
info.json
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
import subprocess
|
from subprocess import STDOUT, PIPE
|
||||||
|
|
||||||
from qmk.commands import run
|
from qmk.commands import run
|
||||||
|
|
||||||
|
|
||||||
def check_subcommand(command, *args):
|
def check_subcommand(command, *args):
|
||||||
cmd = ['bin/qmk', command] + list(args)
|
cmd = ['bin/qmk', command] + list(args)
|
||||||
result = run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
|
result = run(cmd, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@@ -28,6 +29,11 @@ def test_compile():
|
|||||||
check_returncode(result)
|
check_returncode(result)
|
||||||
|
|
||||||
|
|
||||||
|
def test_compile_json():
|
||||||
|
result = check_subcommand('compile', '-kb', 'handwired/onekey/pytest', '-km', 'default_json')
|
||||||
|
check_returncode(result)
|
||||||
|
|
||||||
|
|
||||||
def test_flash():
|
def test_flash():
|
||||||
result = check_subcommand('flash', '-kb', 'handwired/onekey/pytest', '-km', 'default', '-n')
|
result = check_subcommand('flash', '-kb', 'handwired/onekey/pytest', '-km', 'default', '-n')
|
||||||
check_returncode(result)
|
check_returncode(result)
|
||||||
@@ -45,8 +51,9 @@ def test_config():
|
|||||||
|
|
||||||
|
|
||||||
def test_kle2json():
|
def test_kle2json():
|
||||||
result = check_subcommand('kle2json', 'kle.txt', '-f')
|
result = check_subcommand('kle2json', 'lib/python/qmk/tests/kle.txt', '-f')
|
||||||
check_returncode(result)
|
check_returncode(result)
|
||||||
|
assert 'Wrote out' in result.stdout
|
||||||
|
|
||||||
|
|
||||||
def test_doctor():
|
def test_doctor():
|
||||||
@@ -152,3 +159,15 @@ def test_info_matrix_render():
|
|||||||
assert 'LAYOUT_ortho_1x1' in result.stdout
|
assert 'LAYOUT_ortho_1x1' in result.stdout
|
||||||
assert '│0A│' in result.stdout
|
assert '│0A│' in result.stdout
|
||||||
assert 'Matrix for "LAYOUT_ortho_1x1"' in result.stdout
|
assert 'Matrix for "LAYOUT_ortho_1x1"' in result.stdout
|
||||||
|
|
||||||
|
|
||||||
|
def test_c2json():
|
||||||
|
result = check_subcommand("c2json", "-kb", "handwired/onekey/pytest", "-km", "default", "keyboards/handwired/onekey/keymaps/default/keymap.c")
|
||||||
|
check_returncode(result)
|
||||||
|
assert result.stdout.strip() == '{"keyboard": "handwired/onekey/pytest", "documentation": "This file is a keymap.json file for handwired/onekey/pytest", "keymap": "default", "layout": "LAYOUT_ortho_1x1", "layers": [["KC_A"]]}'
|
||||||
|
|
||||||
|
|
||||||
|
def test_c2json_nocpp():
|
||||||
|
result = check_subcommand("c2json", "--no-cpp", "-kb", "handwired/onekey/pytest", "-km", "default", "keyboards/handwired/onekey/keymaps/pytest_nocpp/keymap.c")
|
||||||
|
check_returncode(result)
|
||||||
|
assert result.stdout.strip() == '{"keyboard": "handwired/onekey/pytest", "documentation": "This file is a keymap.json file for handwired/onekey/pytest", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_ENTER"]]}'
|
||||||
@@ -6,14 +6,34 @@ def test_template_onekey_proton_c():
|
|||||||
assert templ == qmk.keymap.DEFAULT_KEYMAP_C
|
assert templ == qmk.keymap.DEFAULT_KEYMAP_C
|
||||||
|
|
||||||
|
|
||||||
|
def test_template_onekey_proton_c_json():
|
||||||
|
templ = qmk.keymap.template('handwired/onekey/proton_c', type='json')
|
||||||
|
assert templ == {'keyboard': 'handwired/onekey/proton_c'}
|
||||||
|
|
||||||
|
|
||||||
def test_template_onekey_pytest():
|
def test_template_onekey_pytest():
|
||||||
templ = qmk.keymap.template('handwired/onekey/pytest')
|
templ = qmk.keymap.template('handwired/onekey/pytest')
|
||||||
assert templ == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};\n'
|
assert templ == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};\n'
|
||||||
|
|
||||||
|
|
||||||
|
def test_template_onekey_pytest_json():
|
||||||
|
templ = qmk.keymap.template('handwired/onekey/pytest', type='json')
|
||||||
|
assert templ == {'keyboard': 'handwired/onekey/pytest', "documentation": "This file is a keymap.json file for handwired/onekey/pytest"}
|
||||||
|
|
||||||
|
|
||||||
def test_generate_onekey_pytest():
|
def test_generate_onekey_pytest():
|
||||||
templ = qmk.keymap.generate('handwired/onekey/pytest', 'LAYOUT', [['KC_A']])
|
templ = qmk.keymap.generate('handwired/onekey/pytest', 'LAYOUT', [['KC_A']])
|
||||||
assert templ == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {\t[0] = LAYOUT(KC_A)};\n'
|
assert templ == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {\t[0] = LAYOUT(KC_A)};\n'
|
||||||
|
|
||||||
|
|
||||||
|
def test_generate_onekey_pytest_json():
|
||||||
|
templ = qmk.keymap.generate('handwired/onekey/pytest', 'LAYOUT', [['KC_A']], type='json', keymap='default')
|
||||||
|
assert templ == {"keyboard": "handwired/onekey/pytest", "documentation": "This file is a keymap.json file for handwired/onekey/pytest", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_A"]]}
|
||||||
|
|
||||||
|
|
||||||
|
def test_parse_keymap_c():
|
||||||
|
parsed_keymap_c = qmk.keymap.parse_keymap_c('keyboards/handwired/onekey/keymaps/default/keymap.c')
|
||||||
|
assert parsed_keymap_c == {'layers': [{'name': '0', 'layout': 'LAYOUT_ortho_1x1', 'keycodes': ['KC_A']}]}
|
||||||
|
|
||||||
|
|
||||||
# FIXME(skullydazed): Add a test for qmk.keymap.write that mocks up an FD.
|
# FIXME(skullydazed): Add a test for qmk.keymap.write that mocks up an FD.
|
||||||
@@ -68,10 +68,12 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) {
|
|||||||
uint8_t tone = keycode - MIDI_TONE_MIN;
|
uint8_t tone = keycode - MIDI_TONE_MIN;
|
||||||
uint8_t velocity = compute_velocity(midi_config.velocity);
|
uint8_t velocity = compute_velocity(midi_config.velocity);
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
uint8_t note = midi_compute_note(keycode);
|
if (tone_status[tone] == MIDI_INVALID_NOTE) {
|
||||||
midi_send_noteon(&midi_device, channel, note, velocity);
|
uint8_t note = midi_compute_note(keycode);
|
||||||
dprintf("midi noteon channel:%d note:%d velocity:%d\n", channel, note, velocity);
|
midi_send_noteon(&midi_device, channel, note, velocity);
|
||||||
tone_status[tone] = note;
|
dprintf("midi noteon channel:%d note:%d velocity:%d\n", channel, note, velocity);
|
||||||
|
tone_status[tone] = note;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
uint8_t note = tone_status[tone];
|
uint8_t note = tone_status[tone];
|
||||||
if (note != MIDI_INVALID_NOTE) {
|
if (note != MIDI_INVALID_NOTE) {
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ appdirs
|
|||||||
argcomplete
|
argcomplete
|
||||||
colorama
|
colorama
|
||||||
hjson
|
hjson
|
||||||
|
pygments
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
Copyright 2020 Janos Daniel Reibl <janos.daniel.reibl@protonmail.com> @riblee
|
||||||
|
|
||||||
|
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/>.
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
/* Copyright 2020 Janos Daniel Reibl <[email protected]> @riblee
|
||||||
|
*
|
||||||
|
* 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 "riblee.h"
|
||||||
|
|
||||||
|
const uint8_t shift = MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT);
|
||||||
|
|
||||||
|
// Tap Dance functions
|
||||||
|
void dance_key_a (qk_tap_dance_state_t *state, void *user_data) {
|
||||||
|
if (state->count == 1) {
|
||||||
|
SEND_STRING("a");
|
||||||
|
reset_tap_dance(state);
|
||||||
|
} else if (state->count == 2) {
|
||||||
|
if (!(keyboard_report->mods & shift)) {
|
||||||
|
send_unicode_string("á");
|
||||||
|
} else {
|
||||||
|
send_unicode_string("Á");
|
||||||
|
}
|
||||||
|
|
||||||
|
reset_tap_dance(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dance_key_e (qk_tap_dance_state_t *state, void *user_data) {
|
||||||
|
if (state->count == 1) {
|
||||||
|
SEND_STRING("e");
|
||||||
|
reset_tap_dance(state);
|
||||||
|
} else if (state->count == 2) {
|
||||||
|
if (!(keyboard_report->mods & shift)) {
|
||||||
|
send_unicode_string("é");
|
||||||
|
} else {
|
||||||
|
send_unicode_string("É");
|
||||||
|
}
|
||||||
|
|
||||||
|
reset_tap_dance(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dance_key_i (qk_tap_dance_state_t *state, void *user_data) {
|
||||||
|
if (state->count == 1) {
|
||||||
|
SEND_STRING("i");
|
||||||
|
reset_tap_dance(state);
|
||||||
|
} else if (state->count == 2) {
|
||||||
|
if (!(keyboard_report->mods & shift)) {
|
||||||
|
send_unicode_string("í");
|
||||||
|
} else {
|
||||||
|
send_unicode_string("Í");
|
||||||
|
}
|
||||||
|
|
||||||
|
reset_tap_dance(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dance_key_o (qk_tap_dance_state_t *state, void *user_data) {
|
||||||
|
if (state->count == 1) {
|
||||||
|
SEND_STRING("o");
|
||||||
|
reset_tap_dance(state);
|
||||||
|
} else if (state->count == 2) {
|
||||||
|
if (!(keyboard_report->mods & shift)) {
|
||||||
|
send_unicode_string("ó");
|
||||||
|
} else {
|
||||||
|
send_unicode_string("Ó");
|
||||||
|
}
|
||||||
|
|
||||||
|
reset_tap_dance(state);
|
||||||
|
} else if (state->count == 3) {
|
||||||
|
if (!(keyboard_report->mods & shift)) {
|
||||||
|
send_unicode_string("ö");
|
||||||
|
} else {
|
||||||
|
send_unicode_string("Ö");
|
||||||
|
}
|
||||||
|
|
||||||
|
reset_tap_dance(state);
|
||||||
|
} else if (state->count == 4) {
|
||||||
|
if (!(keyboard_report->mods & shift)) {
|
||||||
|
send_unicode_string("ő");
|
||||||
|
} else {
|
||||||
|
send_unicode_string("Ő");
|
||||||
|
}
|
||||||
|
|
||||||
|
reset_tap_dance(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dance_key_u (qk_tap_dance_state_t *state, void *user_data) {
|
||||||
|
if (state->count == 1) {
|
||||||
|
SEND_STRING("u");
|
||||||
|
reset_tap_dance(state);
|
||||||
|
} else if (state->count == 2) {
|
||||||
|
if (!(keyboard_report->mods & shift)) {
|
||||||
|
send_unicode_string("ú");
|
||||||
|
} else {
|
||||||
|
send_unicode_string("Ú");
|
||||||
|
}
|
||||||
|
|
||||||
|
reset_tap_dance(state);
|
||||||
|
} else if (state->count == 3) {
|
||||||
|
if (!(keyboard_report->mods & shift)) {
|
||||||
|
send_unicode_string("ü");
|
||||||
|
} else {
|
||||||
|
send_unicode_string("Ü");
|
||||||
|
}
|
||||||
|
|
||||||
|
reset_tap_dance(state);
|
||||||
|
} else if (state->count == 4) {
|
||||||
|
if (!(keyboard_report->mods & shift)) {
|
||||||
|
send_unicode_string("ű");
|
||||||
|
} else {
|
||||||
|
send_unicode_string("Ű");
|
||||||
|
}
|
||||||
|
|
||||||
|
reset_tap_dance(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
case QWERTY:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_QWERTY);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case COLEMAK:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_COLEMAK);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case DVORAK:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_DVORAK);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case BACKLIT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(keycode_config(KC_LGUI));
|
||||||
|
#ifdef BACKLIGHT_ENABLE
|
||||||
|
backlight_step();
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
unregister_code(keycode_config(KC_LGUI));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/* Copyright 2020 Janos Daniel Reibl <[email protected]> @riblee
|
||||||
|
*
|
||||||
|
* 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 QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
enum preonic_layers {
|
||||||
|
_QWERTY,
|
||||||
|
_COLEMAK,
|
||||||
|
_DVORAK,
|
||||||
|
_LOWER,
|
||||||
|
_RAISE,
|
||||||
|
_ADJUST
|
||||||
|
};
|
||||||
|
|
||||||
|
enum preonic_keycodes {
|
||||||
|
QWERTY = SAFE_RANGE,
|
||||||
|
COLEMAK,
|
||||||
|
DVORAK,
|
||||||
|
BACKLIT
|
||||||
|
};
|
||||||
|
|
||||||
|
#define LOWER MO(_LOWER)
|
||||||
|
#define RAISE MO(_RAISE)
|
||||||
|
|
||||||
|
// Tap Dance declarations
|
||||||
|
enum {
|
||||||
|
TD_A,
|
||||||
|
TD_E,
|
||||||
|
TD_I,
|
||||||
|
TD_O,
|
||||||
|
TD_U,
|
||||||
|
};
|
||||||
|
|
||||||
|
void dance_key_a (qk_tap_dance_state_t *, void *);
|
||||||
|
void dance_key_e (qk_tap_dance_state_t *, void *);
|
||||||
|
void dance_key_i (qk_tap_dance_state_t *, void *);
|
||||||
|
void dance_key_o (qk_tap_dance_state_t *, void *);
|
||||||
|
void dance_key_u (qk_tap_dance_state_t *, void *);
|
||||||
|
|
||||||
|
layer_state_t layer_state_set_user(layer_state_t);
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record);
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
SRC += riblee.c
|
||||||
Reference in new issue
Block a user