Compare commits

..

6 Commits

Author SHA1 Message Date
7e8f239c2e [CI] Revert to previous logic for branch name and changes (#7343) 2019-11-12 23:53:05 -08:00
6449bd2551 [Keymap] update calbatr0ss layout (#7342) 2019-11-12 23:10:54 -08:00
1cd7afaff1 [Keymap] Added Xulkal ALT Keymap (#7332)
* Added Xulkal ALT Keymap

* Hadron compile fix

* Keymap fix
2019-11-12 23:02:58 -08:00
12ea2e3649 [Keyboard] Add keyboard Setta21 (#7320)
* [Keyboard] Add keyboard Setta21

Add Setta21 keyboard.

A 21 keys Tenkey.
Salicylic-acid3

* Update keyboards/setta21/keymaps/default/keymap.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/setta21/keymaps/default/keymap.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/setta21/keymaps/salicylic/keymap.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/setta21/keymaps/salicylic/keymap.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/setta21/keymaps/salicylic/keymap.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/setta21/keymaps/default/keymap.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/setta21/keymaps/default/keymap.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/setta21/keymaps/default/keymap.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/setta21/info.json

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/setta21/rev1/rev1.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/setta21/rules.mk

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/setta21/keymaps/salicylic/keymap.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/setta21/keymaps/salicylic/keymap.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/setta21/keymaps/salicylic/keymap.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Keymap Update

Removed the keymap matrix_init_user.
Changed the declaration of DRIVER_LED_TOTAL.

* Update keyboards/setta21/readme.md

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/setta21/readme.md

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/setta21/readme.md

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/setta21/readme.md

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/setta21/rev1/rev1.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/setta21/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/setta21/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/setta21/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/setta21/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/setta21/rev1/rev1.c

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/setta21/rev1/rev1.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update Keymap

Removed OLED sleep timer in keymap.

* Update keyboards/setta21/rev1/rev1.h

Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com>
2019-11-12 23:01:14 -08:00
a4c2a9b083 format code according to conventions [skip ci] 2019-11-13 05:24:56 +00:00
7329c2d02d Add cli convert subcommand, from raw KLE to JSON (#6898)
* Add initial pass at KLE convert

* Add cli log on convert

* Move kle2xy, add absolute filepath arg support

* Add overwrite flag, and context sensitive conversion

* Update docs/cli.md

* Fix converter.py typo

* Add convert unit test

* Rename to kle2qmk

* Rename subcommand

* Rename subcommand to kle2json

* Change tests to cover rename

* Rename in __init__.py

* Update CLI docs with new subcommand name

* Fix from suggestions in PR #6898

* Help with cases of case sensitivity

* Update cli.md

* Use angle brackets to indicate required option

* Make the output text more accurate
2019-11-12 20:55:41 -08:00
31 changed files with 1075 additions and 34 deletions

View File

@ -135,6 +135,28 @@ Creates a keymap.c from a QMK Configurator export.
qmk json-keymap [-o OUTPUT] filename
```
## `qmk kle2json`
This command allows you to convert from raw KLE data to QMK Configurator JSON. It accepts either an absolute file path, or a file name in the current directory. By default it will not overwrite `info.json` if it is already present. Use the `-f` or `--force` flag to overwrite.
**Usage**:
```
qmk kle2json [-f] <filename>
```
**Examples**:
```
$ qmk kle2json kle.txt
☒ File info.json already exists, use -f or --force to overwrite.
```
```
$ qmk kle2json -f kle.txt -f
Ψ Wrote out to info.json
```
## `qmk list-keyboards`
This command lists all the keyboards currently defined in `qmk_firmware`

View File

@ -11,16 +11,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* │ CTRL │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ ENTER │
* ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤
* │ SHIFT │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ SHIFT│LYR│
* ├────┬───┴┬──┴─┬─┴───┴──┬┴───┼───┴───┴──┬┴───┼───┴┬────┬┴───┤
* │CAPS│ OS │ ALT│ SPACE │ FN │ SPACE │ ALT│ OS │MENU│CTRL│
* └────┴────┴────┴────────┴────┴──────────┴────┴────┴────┴────┘
* ├────┬───┴┬──┴─┬─┴───┴───┴┬──┴─┬─┴───┴──┬┴───┼───┴┬────┬┴───┤
* │CAPS│ ALT│ OS │ SPACE │ FN │ SPACE │ OS │ ALT│MENU│CTRL│
* └────┴────┴────┴──────────┴────┴────────┴────┴────┴────┴────┘
*/
LAYOUT_60_calbatr0ss(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(3),
KC_CAPS, KC_LGUI, KC_LALT, KC_SPC, MO(2), KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL),
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(3),
KC_CAPS, KC_LALT, KC_LGUI, KC_SPC, MO(2), KC_SPC, KC_RGUI, KC_RALT, KC_APP, KC_RCTL),
/* LAYER 1
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
@ -31,54 +31,54 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* │ CTRL │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ ENTER │
* ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤
* │ SHIFT │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ SHIFT│LYR│
* ├────┬───┴┬──┴─┬─┴───┴──┬┴───┼───┴───┴──┬┴───┼───┴┬────┬┴───┤
* │CAPS│ ALT│ OS │ SPACE │ FN │ SPACE │ OS │ ALT│MENU│CTRL│
* └────┴────┴────┴────────┴────┴──────────┴────┴────┴────┴────┘
* ├────┬───┴┬──┴─┬─┴───┴───┴┬──┴─┬─┴───┴──┬┴───┼───┴┬────┬┴───┤
* │CAPS│ OS │ ALT│ SPACE │ FN │ SPACE │ ALT│ OS │MENU│CTRL│
* └────┴────┴────┴──────────┴────┴────────┴────┴────┴────┴────┘
*/
LAYOUT_60_calbatr0ss(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(3),
KC_CAPS, KC_LALT, KC_LGUI, KC_SPC, MO(2), KC_SPC, KC_RGUI, KC_RALT, KC_APP, KC_RCTL),
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(3),
KC_CAPS, KC_LGUI, KC_LALT, KC_SPC, MO(2), KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL),
/* LAYER 2
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
* │ │F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│ │ │
* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┤
* │ │ │ │ │ │ │ │PDN│ UP│PUP│ │ │ │ DEL │
* │ │RGB│ │ │ │ │ │PDN│ UP│PUP│ │ │ │ DEL │
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤
* │ │ │ │ │ │ │HOM│LFT│DWN│RHT│END│ │ │
* ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤
* │ │ │ │ │ │VDN│VUP│MUT│PRV│NXT│PLY│ │ │
* ├────┬───┴┬──┴─┬─┴───┴──┬┴───┼───┴───┴──┬┴───┼───┴┬────┬┴───┤
* │RSET│ │ │ │ │ │ │ │ │ │
* └────┴────┴────┴────────┴────┴──────────┴────┴────┴────┴────┘
* ├────┬───┴┬──┴─┬─┴───┴───┴┬──┴─┬─┴───┴──┬┴───┼───┴┬────┬┴───┤
* │RSET│ │ │ │ │ │ │ │ │ │
* └────┴────┴────┴──────────┴────┴────────┴────┴────┴────┴────┘
*/
LAYOUT_60_calbatr0ss(
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGDN, KC_UP, KC_PGUP, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL,
KC_TRNS, RGB_TOG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGDN, KC_UP, KC_PGUP, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_MPRV, KC_MNXT, KC_MPLY, KC_TRNS, KC_TRNS,
RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
/* LAYER 3
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
* │ │WIN│MAC│ │ │ │ │ │ │ │ │ │ │ │ │
* │ ││ │ │ │ │ │ │ │ │ │ │ │ │
* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┤
* │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
* │ │ │WIN│ │ │ │ │ │ │ │ │ │ │ │
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤
* │ │ │ │ │ │ │ │ │ │ │ │ │ │
* ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤
* │ │ │ │ │ │ │ │ │ │ │ │ │ │
* ├────┬───┴┬──┴─┬─┴───┴──┬┴───┼───┴───┴──┬┴───┼───┴┬────┬┴───┤
* │ │ │ │ │ │ │ │ │ │ │
* └────┴────┴────┴────────┴────┴──────────┴────┴────┴────┴────┘
* │ │ │ │ │ │ │ │MAC│ │ │ │ │ │
* ├────┬───┴┬──┴─┬─┴───┴───┴┬──┴─┬─┴───┴──┬┴───┼───┴┬────┬┴───┤
* │ │ │ │ │ │ │ │ │ │ │
* └────┴────┴────┴──────────┴────┴────────┴────┴────┴────┴────┘
*/
LAYOUT_60_calbatr0ss(
KC_TRNS, DF(0), DF(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, DF(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, DF(0), 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)
};

View File

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

View File

@ -0,0 +1,79 @@
#include QMK_KEYBOARD_H
#include "xulkal.h"
enum ctrl_keycodes {
U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active
U_T_AGCR, //USB Toggle Automatic GCR control
DBG_TOG, //DEBUG Toggle On / Off
DBG_MTRX, //DEBUG Toggle Matrix Prints
DBG_KBD, //DEBUG Toggle Keyboard Prints
DBG_MOU, //DEBUG Toggle Mouse Prints
};
#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode
#define EXPAND_LAYOUT(...) LAYOUT(__VA_ARGS__)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT(
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, TD_BSPC, KC_HOME, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_END, \
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, \
KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, TD_COMM, KC_DOT, KC_SLSH, KC_RSPC, KC_UP, KC_PGDN, \
KC_LCPO, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LOWER, KC_LEFT, KC_DOWN, KC_RGHT \
),
#ifndef GAMELAYER_DISABLE
[_GAME] = LAYOUT(
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_END, \
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, \
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LOWER, KC_LEFT, KC_DOWN, KC_RGHT \
),
#endif
[_LOWER] = LAYOUT(
_______, RGB_RMOD,RGB_MOD, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
RGB_SPI, RGB_SAI, RGB_VAI, RGB_HUI, RESET, QWERTY, _______, U_T_AUTO,U_T_AGCR,_______, _______, _______, _______, _______, _______, \
RGB_SPD, RGB_SAD, RGB_VAD, RGB_HUD, RGBRST, GAME, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______ \
)
};
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL))
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
bool process_record_keymap(uint16_t keycode, keyrecord_t *record)
{
switch (keycode) {
case U_T_AUTO:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL)
TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
return false;
case U_T_AGCR:
if (record->event.pressed && MODS_SHIFT && MODS_CTRL)
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
return false;
case DBG_TOG:
if (record->event.pressed)
TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
return false;
case DBG_MTRX:
if (record->event.pressed)
TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix");
return false;
case DBG_KBD:
if (record->event.pressed)
TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard");
return false;
case DBG_MOU:
if (record->event.pressed)
TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse");
return false;
}
return true;
}

View File

@ -0,0 +1 @@
DISABLE_LTO = yes

View File

@ -0,0 +1,21 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2015 Jack Humbert
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 "config_common.h"

View File

@ -0,0 +1,34 @@
{
"keyboard_name": "setta21",
"url": "https://salicylic-acid3.hatenablog.com/",
"maintainer": "Salicylic_acid3",
"width": 18.25,
"height": 6.25,
"layouts": {
"LAYOUT_numpad_6x4": {
"layout": [
{"label":"ESC", "x":0, "y":0},
{"label":"F2", "x":1, "y":0},
{"label":"\uff1d", "x":2, "y":0},
{"label":"Del", "x":3, "y":0},
{"label":"Num Lock", "x":0, "y":1.25},
{"label":"/", "x":1, "y":1.25},
{"label":"*", "x":2, "y":1.25},
{"label":"-", "x":3, "y":1.25},
{"label":"7", "x":0, "y":2.25},
{"label":"8", "x":1, "y":2.25},
{"label":"9", "x":2, "y":2.25},
{"label":"+", "x":3, "y":2.25, "h":2},
{"label":"4", "x":0, "y":3.25},
{"label":"5", "x":1, "y":3.25},
{"label":"6", "x":2, "y":3.25},
{"label":"1", "x":0, "y":4.25},
{"label":"2", "x":1, "y":4.25},
{"label":"3", "x":2, "y":4.25},
{"label":"Enter", "x":3, "y":4.25, "h":2},
{"label":"0", "x":0, "y":5.25, "w":2},
{"label":".", "x":2, "y":5.25}
]
}
}
}

View File

@ -0,0 +1,23 @@
/* Copyright 2018 Salicylic_acid3
*
* 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
/* Select hand configuration */
#define TAPPING_FORCE_HOLD
#define TAPPING_TERM 180

View File

@ -0,0 +1,69 @@
#include QMK_KEYBOARD_H
#ifdef RGBLIGHT_ENABLE
//Following line allows macro to read current RGB settings
extern rgblight_config_t rgblight_config;
#endif
extern uint8_t is_master;
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
enum layer_number {
_BASE,
_ARROW,
_ADJUST,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_numpad_6x4(
//,-----------------------------------|
LT(_ADJUST,KC_ESC), KC_F2, KC_EQL, KC_DEL,
//|--------+--------+--------+--------|
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
//|--------+--------+--------+--------|
KC_P7, KC_P8, KC_P9,
//|--------+--------+--------+--------|
KC_P4, KC_P5, KC_P6, KC_PPLS,
//|--------+--------+--------+--------|
KC_P1, KC_P2, KC_P3,
//|--------+--------+--------+--------|
LT(_ARROW, KC_P0), KC_PDOT,KC_PENT
//`-----------------------------------'
),
[_ARROW] = LAYOUT_numpad_6x4(
//,-----------------------------------|
KC_ESC, _______, _______, _______,
//|--------+--------+--------+--------|
XXXXXXX, _______, _______, _______,
//|--------+--------+--------+--------|
XXXXXXX, KC_UP, XXXXXXX,
//|--------+--------+--------+--------|
KC_LEFT, KC_DOWN,KC_RIGHT, _______,
//|--------+--------+--------+--------|
XXXXXXX, KC_DOWN, XXXXXXX,
//|--------+--------+--------+--------|
MO(_ARROW), _______, _______
//`-----------------------------------'
),
[_ADJUST] = LAYOUT_numpad_6x4( /* Base */
//,-----------------------------------|
MO(_ADJUST), _______, _______, _______,
//|--------+--------+--------+--------|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------|
RGB_SAD, RGB_SAI, XXXXXXX,
//|--------+--------+--------+--------|
RGB_HUD, RGB_HUI, XXXXXXX, RGB_TOG,
//|--------+--------+--------+--------|
RGB_VAD, RGB_VAI, XXXXXXX,
//|--------+--------+--------+--------|
XXXXXXX, XXXXXXX, RGB_MOD
//`-----------------------------------'
)
};

View File

@ -0,0 +1,38 @@
# The default keymap for setta21
## Base
| 1 | 2 | 3 | 4 |
|:----------:|:----:|:----:|:----:|
|Adjust , ESC| F2 | = | Del |
| NumLock | / | * | minus|
| 7 | 8 | 9 | |
| 4 | 5 | 6 | + |
| 1 | 2 | 3 | |
| Arrow , 0 | | . | Ent |
## Arrow
| 1 | 2 | 3 | 4 |
|:----------:|:----:|:----:|:----:|
| ESC | F2 | = | Del |
| XXXXX | / | * | minus|
| XXXXX | UP | XXXXX| |
| LEFT | DOWN | RIGHT| + |
| XXXXX | DOWN | XXXXX| |
| Arrow | | . | Ent |
## Adjust
| 1 | 2 | 3 | 4 |
|:----------:|:-----:|:----:|:------:|
| Adjust | F2 | = | Del |
| XXXXX | XXXXX | XXXXX| XXXXX |
| XXXXX |RGB_SAI| XXXXX| |
| LEFT |RGB_HUI| XXXXX| RGB_TOG|
| RGB_VAD |RGB_VAI| XXXXX| |
| XXXXX | | XXXXX| RGB_MOD|

View File

@ -0,0 +1,40 @@
/* Copyright 2018 Salicylic_acid3
*
* 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
/* Select hand configuration */
#define TAPPING_FORCE_HOLD
#define TAPPING_TERM 180
#define DRIVER_LED_TOTAL RGBLED_NUM
#ifdef RGB_MATRIX_ENABLE
# define RGB_MATRIX_KEYPRESSES // reacts to keypresses
// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)
// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
// # define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
// # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
// # define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255
# define RGB_MATRIX_HUE_STEP 8
# define RGB_MATRIX_SAT_STEP 8
# define RGB_MATRIX_LIMIT_VAL 50
# define RGB_MATRIX_VAL_STEP 5
# define RGB_MATRIX_SPD_STEP 10
#endif

View File

@ -0,0 +1,197 @@
#include QMK_KEYBOARD_H
#include "keymap_jp.h"
#ifdef RGBLIGHT_ENABLE
//Following line allows macro to read current RGB settings
extern rgblight_config_t rgblight_config;
#endif
extern uint8_t is_master;
#ifdef OLED_DRIVER_ENABLE
static uint32_t oled_timer = 0;
#endif
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
enum layer_number {
_BASE = 0,
_ARROW,
_MACRO,
_ADJUST,
};
enum custom_keycodes {
RGB_RST = SAFE_RANGE,
SEND_SUM,
SEND_AVE,
SEND_CIF,
SEND_MAX,
SEND_MIN
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_numpad_6x4(
//,-----------------------------------|
KC_ESC, KC_F2, JP_EQL, KC_DEL,
//|--------+--------+--------+--------|
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
//|--------+--------+--------+--------|
KC_P7, KC_P8, KC_P9,
//|--------+--------+--------+--------|
KC_P4, KC_P5, KC_P6, KC_PPLS,
//|--------+--------+--------+--------|
KC_P1, KC_P2, KC_P3,
//|--------+--------+--------+--------|
LT(_ARROW, KC_P0),LT(_MACRO, KC_PDOT),KC_PENT
//`-----------------------------------'
),
[_ARROW] = LAYOUT_numpad_6x4(
//,-----------------------------------|
_______, _______, _______, _______,
//|--------+--------+--------+--------|
XXXXXXX, _______, _______, _______,
//|--------+--------+--------+--------|
XXXXXXX, KC_UP, XXXXXXX,
//|--------+--------+--------+--------|
KC_LEFT, KC_DOWN,KC_RIGHT, _______,
//|--------+--------+--------+--------|
XXXXXXX, KC_DOWN, XXXXXXX,
//|--------+--------+--------+--------|
MO(_ARROW), MO(_MACRO), _______
//`-----------------------------------'
),
[_MACRO] = LAYOUT_numpad_6x4(
//,-----------------------------------|
_______, _______, _______, _______,
//|--------+--------+--------+--------|
SEND_MIN,SEND_MAX,SEND_CIF,SEND_AVE,
//|--------+--------+--------+--------|
KC_F7, KC_F8, KC_F9,
//|--------+--------+--------+--------|
KC_F4, KC_F5, KC_F6,SEND_SUM,
//|--------+--------+--------+--------|
KC_F11, KC_F12, KC_F3,
//|--------+--------+--------+--------|
_______, _______, JP_RPRN
//`-----------------------------------'
),
[_ADJUST] = LAYOUT_numpad_6x4( /* Base */
//,-----------------------------------|
_______, _______, _______, _______,
//|--------+--------+--------+--------|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------|
RGB_SAD, RGB_SAI, XXXXXXX,
//|--------+--------+--------+--------|
RGB_HUD, RGB_HUI, XXXXXXX, RGB_TOG,
//|--------+--------+--------+--------|
RGB_VAD, RGB_VAI, XXXXXXX,
//|--------+--------+--------+--------|
_______, _______, RGB_MOD
//`-----------------------------------'
)
};
//A description for expressing the layer position in LED mode.
layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, _ARROW, _MACRO, _ADJUST);
}
int RGB_current_mode;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
bool result = false;
if (record->event.pressed) {
#ifdef OLED_DRIVER_ENABLE
oled_timer = timer_read32();
#endif
}
switch (keycode) {
case SEND_SUM:
if (record->event.pressed) {
SEND_STRING("_SUM*");
}
break;
case SEND_AVE:
if (record->event.pressed) {
SEND_STRING("_AVERAGE*");
}
break;
case SEND_CIF:
if (record->event.pressed) {
SEND_STRING("_COUNTIF*");
}
break;
case SEND_MAX:
if (record->event.pressed) {
SEND_STRING("_MAX*");
}
break;
case SEND_MIN:
if (record->event.pressed) {
SEND_STRING("_MIN*");
}
break;
#ifdef RGBLIGHT_ENABLE
case RGB_MOD:
if (record->event.pressed) {
rgblight_mode(RGB_current_mode);
rgblight_step();
RGB_current_mode = rgblight_config.mode;
}
break;
case RGB_RST:
if (record->event.pressed) {
eeconfig_update_rgblight_default();
rgblight_enable();
RGB_current_mode = rgblight_config.mode;
}
break;
#endif
default:
result = true;
break;
}
return result;
}
#ifdef OLED_DRIVER_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_0; }
void render_layer_state(void) {
oled_write_P(PSTR("LAYER: "), false);
oled_write_P(PSTR(" Arrow "), layer_state_is(_ARROW));
oled_write_P(PSTR(" Macro "), layer_state_is(_MACRO));
}
void render_keylock_status(uint8_t led_usb_state) {
oled_write_P(PSTR("NumLock"), led_usb_state & (1 << USB_LED_NUM_LOCK));
oled_write_P(PSTR(" "), false);
}
void render_layer_messages(void) {
oled_write_P(PSTR("Setta21 For Your Good Job. "), false);
}
void render_status(void) {
/* Show Keyboard Layout */
render_layer_messages();
render_keylock_status(host_keyboard_leds());
render_layer_state();
}
void oled_task_user(void) {
render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
}
#endif

View File

@ -0,0 +1,49 @@
# The salicylic keymap for setta21
## Base
| 1 | 2 | 3 | 4 |
|:----------:|:----:|:---------:|:----:|
| ESC | F2 | = | Del |
| NumLock | / | * | minus|
| 7 | 8 | 9 | |
| 4 | 5 | 6 | + |
| 1 | 2 | 3 | |
| Arrow , 0 | | Macro , . | Ent |
## Arrow
| 1 | 2 | 3 | 4 |
|:----------:|:----:|:-----:|:----:|
| ESC | F2 | = | Del |
| XXXXX | / | * | minus|
| XXXXX | UP | XXXXX | |
| LEFT | DOWN | RIGHT | + |
| XXXXX | DOWN | XXXXX | |
| Arrow | | Macro | Ent |
## Macro
| 1 | 2 | 3 | 4 |
|:----------:|:------:|:---------:|:--------:|
| ESC | F2 | = | Del |
| =MIN( | =MAX( | =COUNTIF( | =AVERAGE(|
| F7 | F8 | F9 | |
| F4 | F5 | F6 | =SUM( |
| F11 | F12 | F3 | |
| Arrow | | Macro | ) |
## Adjust
| 1 | 2 | 3 | 4 |
|:----------:|:-----:|:----:|:------:|
| Adjust | F2 | = | Del |
| XXXXX | XXXXX | XXXXX| XXXXX |
| XXXXX |RGB_SAI| XXXXX| |
| LEFT |RGB_HUI| XXXXX| RGB_TOG|
| RGB_VAD |RGB_VAI| XXXXX| |
| Arrow | | Macro| RGB_MOD|

View File

@ -0,0 +1,3 @@
RGBLIGHT_ENABLE = no
RGB_MATRIX_ENABLE = WS2812

View File

@ -0,0 +1,17 @@
# setta21
![setta21](https://cdn-ak.f.st-hatena.com/images/fotolife/S/Salicylic_acid3/20190315/20190315022018.jpg)
This is 21 keys tenkeypad.
* Keyboard Maintainer: [Salicylic_acid3](https://github.com/Salicylic-acid3)
* Hardware Supported: setta21 PCB, Pro Micro
* Hardware Availability: [PCB & Case Data](https://github.com/Salicylic-acid3/PCB_Data), [Booth Shop](https://salicylic-acid3.booth.pm/items/1271667)
Make example for this keyboard (after setting up your build environment):
make setta21: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).
[Build guide](https://salicylic-acid3.hatenablog.com/entry/setta21-build-guide)

View File

@ -0,0 +1,67 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2015 Jack Humbert
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
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x3060
#define DEVICE_VER 0x0011
#define MANUFACTURER Salicylic_Acid
#define PRODUCT setta21
#define DESCRIPTION A custom tenkeypad
/* key matrix size */
#define MATRIX_ROWS 4
#define MATRIX_COLS 6
// wiring of each half
#define MATRIX_ROW_PINS { D4, C6, D7, E6 }
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3 }
/* 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
/* ws2812 RGB LED */
#define RGB_DI_PIN D3
#define RGBLED_NUM 21 // Number of LEDs
#define RGBLIGHT_ANIMATIONS
#ifndef IOS_DEVICE_ENABLE
#define RGBLIGHT_LIMIT_VAL 180
#define RGBLIGHT_VAL_STEP 17
#else
#define RGBLIGHT_LIMIT_VAL 50
#define RGBLIGHT_VAL_STEP 4
#endif
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#if defined(RGBLIGHT_ENABLE) && !defined(IOS_DEVICE_ENABLE)
#define USB_MAX_POWER_CONSUMPTION 400
#else
// fix iPhone and iPad power adapter issue
// iOS device need lessthan 100
#define USB_MAX_POWER_CONSUMPTION 100
#endif

View File

@ -0,0 +1,25 @@
#include "rev1.h"
#ifdef RGB_MATRIX_ENABLE
led_config_t g_led_config = { {
// Key Matrix to LED Index
{ 14,13, 7, 6, 0,20 },
{ 12, 8, 5, 1,19 },
{ 15,11, 9, 4, 2,18 },
{ 16, 10, 3,17 }
}, {
// LED Index to Physical Position
{ 0, 179 }, { 21, 179 }, { 43, 179 }, { 64, 179 }, { 43, 134 }, { 21, 134 }, { 0, 134 }, { 0, 90 }, { 21, 90 }, { 43, 90 },
{ 64, 112 }, { 43, 45 }, { 21, 45 }, { 0, 45 }, { 11, 0 }, { 43, 0 }, { 64, 23 }, { 64, 224 }, { 43, 224 }, { 21, 224 },
{ 0, 224 }
}, {
// LED Index to Flag
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4
} };
#endif
void matrix_init_kb(void) {
matrix_init_user();
};

View File

@ -0,0 +1,18 @@
#pragma once
#include "setta21.h"
#define LAYOUT_numpad_6x4( \
L05, L15, L25, L35, \
L04, L14, L24, L34, \
L03, L13, L23, \
L02, L12, L22, L32, \
L01, L11, L21, \
L00, L20, L30 \
) \
{ \
{ L00, L01, L02, L03, L04, L05 }, \
{KC_NO, L11, L12, L13, L14, L15 }, \
{ L20, L21, L22, L23, L24, L25 }, \
{ L30,KC_NO, L32,KC_NO, L34, L35 } \
}

View File

View File

@ -0,0 +1,37 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = caterina
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = no # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
TAP_DANCE_ENABLE = no
OLED_DRIVER_ENABLE = yes
USE_I2C = no
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
DEFAULT_FOLDER = setta21/rev1
LAYOUTS = numpad_6x4

View File

@ -0,0 +1 @@
#include "setta21.h"

View File

@ -0,0 +1,7 @@
#pragma once
#include "quantum.h"
#ifdef KEYBOARD_setta21_rev1
#include "rev1.h"
#endif

146
lib/python/kle2xy.py Normal file
View File

@ -0,0 +1,146 @@
""" Original code from https://github.com/skullydazed/kle2xy
"""
import hjson
from decimal import Decimal
class KLE2xy(list):
"""Abstract interface for interacting with a KLE layout.
"""
def __init__(self, layout=None, name='', invert_y=True):
super(KLE2xy, self).__init__()
self.name = name
self.invert_y = invert_y
self.key_width = Decimal('19.05')
self.key_skel = {'decal': False, 'border_color': 'none', 'keycap_profile': '', 'keycap_color': 'grey', 'label_color': 'black', 'label_size': 3, 'label_style': 4, 'width': Decimal('1'), 'height': Decimal('1'), 'x': Decimal('0'), 'y': Decimal('0')}
self.rows = Decimal(0)
self.columns = Decimal(0)
if layout:
self.parse_layout(layout)
@property
def width(self):
"""Returns the width of the keyboard plate.
"""
return (Decimal(self.columns) * self.key_width) + self.key_width / 2
@property
def height(self):
"""Returns the height of the keyboard plate.
"""
return (self.rows * self.key_width) + self.key_width / 2
@property
def size(self):
"""Returns the size of the keyboard plate.
"""
return (self.width, self.height)
def attrs(self, properties):
"""Parse the keyboard properties dictionary.
"""
# FIXME: Store more than just the keyboard name.
if 'name' in properties:
self.name = properties['name']
def parse_layout(self, layout):
# Wrap this in a dictionary so hjson will parse KLE raw data
layout = '{"layout": [' + layout + ']}'
layout = hjson.loads(layout)['layout']
# Initialize our state machine
current_key = self.key_skel.copy()
current_row = Decimal(0)
current_col = Decimal(0)
current_x = 0
current_y = self.key_width / 2
if isinstance(layout[0], dict):
self.attrs(layout[0])
layout = layout[1:]
for row_num, row in enumerate(layout):
self.append([])
# Process the current row
for key in row:
if isinstance(key, dict):
if 'w' in key and key['w'] != Decimal(1):
current_key['width'] = Decimal(key['w'])
if 'w2' in key and 'h2' in key and key['w2'] == 1.5 and key['h2'] == 1:
# FIXME: ISO Key uses these params: {x:0.25,w:1.25,h:2,w2:1.5,h2:1,x2:-0.25}
current_key['isoenter'] = True
if 'h' in key and key['h'] != Decimal(1):
current_key['height'] = Decimal(key['h'])
if 'a' in key:
current_key['label_style'] = self.key_skel['label_style'] = int(key['a'])
if current_key['label_style'] < 0:
current_key['label_style'] = 0
elif current_key['label_style'] > 9:
current_key['label_style'] = 9
if 'f' in key:
font_size = int(key['f'])
if font_size > 9:
font_size = 9
elif font_size < 1:
font_size = 1
current_key['label_size'] = self.key_skel['label_size'] = font_size
if 'p' in key:
current_key['keycap_profile'] = self.key_skel['keycap_profile'] = key['p']
if 'c' in key:
current_key['keycap_color'] = self.key_skel['keycap_color'] = key['c']
if 't' in key:
# FIXME: Need to do better validation, plus figure out how to support multiple colors
if '\n' in key['t']:
key['t'] = key['t'].split('\n')[0]
if key['t'] == "0":
key['t'] = "#000000"
current_key['label_color'] = self.key_skel['label_color'] = key['t']
if 'x' in key:
current_col += Decimal(key['x'])
current_x += Decimal(key['x']) * self.key_width
if 'y' in key:
current_row += Decimal(key['y'])
current_y += Decimal(key['y']) * self.key_width
if 'd' in key:
current_key['decal'] = True
else:
current_key['name'] = key
current_key['row'] = current_row
current_key['column'] = current_col
# Determine the X center
x_center = (current_key['width'] * self.key_width) / 2
current_x += x_center
current_key['x'] = current_x
current_x += x_center
# Determine the Y center
y_center = (current_key['height'] * self.key_width) / 2
y_offset = y_center - (self.key_width / 2)
current_key['y'] = (current_y + y_offset)
# Tend to our row/col count
current_col += current_key['width']
if current_col > self.columns:
self.columns = current_col
# Invert the y-axis if neccesary
if self.invert_y:
current_key['y'] = -current_key['y']
# Store this key
self[-1].append(current_key)
current_key = self.key_skel.copy()
# Move to the next row
current_x = 0
current_y += self.key_width
current_col = Decimal(0)
current_row += Decimal(1)
if current_row > self.rows:
self.rows = Decimal(current_row)

View File

@ -10,6 +10,7 @@ from . import doctor
from . import hello
from . import json
from . import list
from . import kle2json
from . import new
from . import pyformat
from . import pytest

77
lib/python/qmk/cli/kle2json.py Executable file
View File

@ -0,0 +1,77 @@
"""Convert raw KLE to JSON
"""
import json
import os
from pathlib import Path
from argparse import FileType
from decimal import Decimal
from collections import OrderedDict
from milc import cli
from kle2xy import KLE2xy
from qmk.converter import kle2qmk
class CustomJSONEncoder(json.JSONEncoder):
def default(self, obj):
try:
if isinstance(obj, Decimal):
if obj % 2 in (Decimal(0), Decimal(1)):
return int(obj)
return float(obj)
except TypeError:
pass
return JSONEncoder.default(self, obj)
@cli.argument('filename', help='The KLE raw txt to convert')
@cli.argument('-f', '--force', action='store_true', help='Flag to overwrite current info.json')
@cli.subcommand('Convert a KLE layout to a Configurator JSON')
def kle2json(cli):
"""Convert a KLE layout to QMK's layout format.
""" # If filename is a path
if cli.args.filename.startswith("/") or cli.args.filename.startswith("./"):
file_path = Path(cli.args.filename)
# Otherwise assume it is a file name
else:
file_path = Path(os.environ['ORIG_CWD'], cli.args.filename)
# Check for valid file_path for more graceful failure
if not file_path.exists():
return cli.log.error('File {fg_cyan}%s{style_reset_all} was not found.', str(file_path))
out_path = file_path.parent
raw_code = file_path.open().read()
# Check if info.json exists, allow overwrite with force
if Path(out_path, "info.json").exists() and not cli.args.force:
cli.log.error('File {fg_cyan}%s/info.json{style_reset_all} already exists, use -f or --force to overwrite.', str(out_path))
return False
try:
# Convert KLE raw to x/y coordinates (using kle2xy package from skullydazed)
kle = KLE2xy(raw_code)
except Exception as e:
cli.log.error('Could not parse KLE raw data: %s', raw_code)
cli.log.exception(e)
# FIXME: This should be better
return cli.log.error('Could not parse KLE raw data.')
keyboard = OrderedDict(
keyboard_name=kle.name,
url='',
maintainer='qmk',
width=kle.columns,
height=kle.rows,
layouts={'LAYOUT': {
'layout': 'LAYOUT_JSON_HERE'
}},
)
# Initialize keyboard with json encoded from ordered dict
keyboard = json.dumps(keyboard, indent=4, separators=(', ', ': '), sort_keys=False, cls=CustomJSONEncoder)
# Initialize layout with kle2qmk from converter module
layout = json.dumps(kle2qmk(kle), separators=(', ', ':'), cls=CustomJSONEncoder)
# Replace layout in keyboard json
keyboard = keyboard.replace('"LAYOUT_JSON_HERE"', layout)
# Write our info.json
file = open(str(out_path) + "/info.json", "w")
file.write(keyboard)
file.close()
cli.log.info('Wrote out {fg_cyan}%s/info.json', str(out_path))

View File

@ -0,0 +1,33 @@
"""Functions to convert to and from QMK formats
"""
from collections import OrderedDict
def kle2qmk(kle):
"""Convert a KLE layout to QMK's layout format.
"""
layout = []
for row in kle:
for key in row:
if key['decal']:
continue
qmk_key = OrderedDict(
label="",
x=key['column'],
y=key['row'],
)
if key['width'] != 1:
qmk_key['w'] = key['width']
if key['height'] != 1:
qmk_key['h'] = key['height']
if 'name' in key and key['name']:
qmk_key['label'] = key['name'].split('\n', 1)[0]
else:
del (qmk_key['label'])
layout.append(qmk_key)
return layout

View File

@ -0,0 +1,5 @@
["¬\n`","!\n1","\"\n2","£\n3","$\n4","%\n5","^\n6","&\n7","*\n8","(\n9",")\n0","_\n-","+\n=",{w:2},"Backspace"],
[{w:1.5},"Tab","Q","W","E","R","T","Y","U","I","O","P","{\n[","}\n]",{x:0.25,w:1.25,h:2,w2:1.5,h2:1,x2:-0.25},"Enter"],
[{w:1.75},"Caps Lock","A","S","D","F","G","H","J","K","L",":\n;","@\n'","~\n#"],
[{w:1.25},"Shift","|\n\\","Z","X","C","V","B","N","M","<\n,",">\n.","?\n/",{w:2.75},"Shift"],
[{w:1.25},"Ctrl",{w:1.25},"Win",{w:1.25},"Alt",{a:7,w:6.25},"",{a:4,w:1.25},"AltGr",{w:1.25},"Win",{w:1.25},"Menu",{w:1.25},"Ctrl"]

View File

@ -20,6 +20,10 @@ def test_config():
assert 'general.color' in result.stdout
def test_kle2json():
assert check_subcommand('kle2json', 'kle.txt', '-f').returncode == 0
def test_doctor():
result = check_subcommand('doctor')
assert result.returncode == 0

View File

@ -3,3 +3,4 @@
appdirs
argcomplete
colorama
hjson

View File

@ -1,9 +1,12 @@
#pragma once
#if defined(RGB_MATRIX_ENABLE)
#include "rgb_matrix.h"
# include "rgb_matrix.h"
#elif defined(RGBLIGHT_ENABLE)
#include "rgblight.h"
# if !defined(__AVR__)
# define PROGMEM
# endif
# include "rgblight.h"
#endif
#ifdef RGB_MATRIX_ENABLE

Some files were not shown because too many files have changed in this diff Show More