From bf3e3b4d3ee322183b0403cfd2134c375e05faef Mon Sep 17 00:00:00 2001 From: Dejvino Date: Sat, 21 Oct 2023 09:34:38 +0200 Subject: [PATCH] Readme for flashing ErgoDone with Dejvino's layout --- .gitignore | 1 + README.md | 30 +++++++ keymap/keymap.c | 204 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 235 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100755 keymap/keymap.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4e73d1e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +hid_bootloader_cli diff --git a/README.md b/README.md new file mode 100644 index 0000000..c4e277c --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# Dejvino's ErgoDone Keyboard Firmware + +## Compile +1. Clone this repo in recursive mode (with submodules): `git clone --recurse-submodules ` +2. Setup QMK (see [docs](https://docs.qmk.fm/#/newbs_getting_started)) + 1. Install qmk helper: `python3 -m pip install --user qmk` + 2. Run the setup: `qmk setup` +3. Compile (inside `qmk_firmware`) + 1. default ErgoDone keyboard (optional): `make ktec/ergodone:default` + 2. link Dejvino's keyboard layout: `ln -s $(pwd)../keymap keyboards/ktec/ergodone/keymaps/dejvino` + 3. Dejvino's ErgoDone keyboard layout: `make ktec/ergodone:dejvino` + +## Flash +(see [ErgoDone Readme](./qmk_firmware/keyboards/ktec/ergodone/readme.md)) + +Get the [TKG Toolkit](https://github.com/kairyu/tkg-toolkit) flashing utility: `wget https://raw.githubusercontent.com/kairyu/tkg-toolkit/master/linux/bin/hid_bootloader_cli -O hid_bootloader_cli && chmod +x hid_bootloader_cli` + +### Enter flashing mode +1. Disconnect KBD +2. Press and hold two top-right-most keys on the left-half KBD +3. Connect KBD (LEDs will be blinking) + +### Flashing +1. `sudo ./hid_bootloader_cli -mmcu=atmega32u4 qmk_firmware/ktec_ergodone_dejvino.hex` +2. Disconnect & connect KBD + +## Resources +- [QMK Firmware](https://github.com/qmk/qmk_firmware) +- [TKG Toolkit](https://github.com/kairyu/tkg-toolkit) +- [ErgoDone Readme](./qmk_firmware/keyboards/ktec/ergodone/readme.md) diff --git a/keymap/keymap.c b/keymap/keymap.c new file mode 100755 index 0000000..a4e1f5e --- /dev/null +++ b/keymap/keymap.c @@ -0,0 +1,204 @@ +#include QMK_KEYBOARD_H +#include "debug.h" +#include "action_layer.h" +#include "version.h" + +#define BASE 0 // Base = Workman-D +#define NUMB 1 // numbers +#define FNCK 2 // F# + +// Useful link: https://docusaurus.qmk.fm/keycodes + +enum custom_keycodes { + PLACEHOLDER = SAFE_RANGE, // can always be here + VRSN, + DYNAMIC_MACRO_RANGE +}; + + #include "dynamic_macro.h" + +// [Info] +// Meh = LCtrl + LAlt + LShift + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: WORKMAN-D Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | Esc/Meh| 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 | 9 | 0 | - | = | Ins/Meh| + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Tab/L_F| Q | H | R | W | B | Psc | | Scl | J | F | U | P | ' | \ /L_F | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | LShift | A | S | D | T | G |------| |------| Y | N | E | O | I | ;/RShft| + * |--------+------+------+------+------+------| Alt | | Alt |------+------+------+------+------+--------| + * | LAlt | Z | X | M | C | V | Cmd | | Cmd | K | L | , | . | / | RAlt | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |LCtrl | Left | Up | Down | Right| | Up | Down | [ | ] | RCtrl| + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * |L_NUMB| ` | | Home | End | + * ,------|------|------| |------+------+------. + * | | | App | | PgUp | | | + * | Space|Backsp|------| |------| Del |Enter | + * | |ace | LCmd | | PgDn | | | + * `--------------------' `--------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +[BASE] = LAYOUT_ergodox( + // left hand + MEH_T(KC_ESC), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, + LT(FNCK,KC_TAB),KC_Q, KC_H, KC_R, KC_W, KC_B, KC_PSCR, + KC_LSFT, KC_A, KC_S, KC_D, KC_T, KC_G, + KC_LALT, KC_Z, KC_X, KC_M, KC_C, KC_V, LALT(KC_LGUI), + KC_LCTL, KC_LEFT, KC_UP, KC_DOWN,KC_RGHT, + MO(NUMB), KC_GRV, + KC_LALT, + KC_SPC,KC_BSPC, KC_LGUI, + // right hand + KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQUAL, MEH_T(KC_INS), + KC_SCROLL_LOCK, KC_J, KC_F, KC_U, KC_P, KC_QUOT, LT(FNCK,KC_BSLS), + KC_Y, KC_N, KC_E, KC_O, KC_I, RSFT_T(KC_SCLN), + RALT(KC_RGUI), KC_K, KC_L, KC_COMM,KC_DOT, KC_SLSH, KC_RALT, + KC_WBAK, KC_WFWD,KC_LBRC, KC_RBRC, KC_RCTL, + KC_HOME, KC_END, + KC_PGUP, + KC_PGDN, KC_DEL, KC_ENT + ), + +/* Keymap 1: Numeric Layer + * + * ,---------------------------------------------------. ,--------------------------------------------------. + * | | | |NLock | / | * | - | | | | | | | | | + * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| + * | | | | 7 | 8 | 9 | + | | | | | | | | | + * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | 4 | 5 | 6 |------| |------| | | | | | | + * |---------+------+------+------+------+------| Ret | | |------+------+------+------+------+--------| + * | | | | 1 | 2 | 3 | | | | | | | | | | + * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | 0 | . | | | | | | | + * `-----------------------------------' `----------------------------------' + * ,-------------. ,------------- + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// Function Keys +[NUMB] = LAYOUT_ergodox( + // left hand + _______,_______,_______,KC_NUM_LOCK, KC_PSLS,KC_PAST,KC_PMNS, + _______,_______,_______,KC_KP_7,KC_KP_8,KC_KP_9,KC_PPLS, + _______,_______,_______,KC_KP_4,KC_KP_5,KC_KP_6, + _______,_______,_______,KC_KP_1,KC_KP_2,KC_KP_3,KC_KP_ENTER, + _______,_______,_______,KC_KP_0,KC_KP_DOT, + _______,_______, + _______, + _______,_______,_______, + // right hand + _______,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______, + _______,_______, + _______, + _______,_______,_______ +), +/* Keymap 2: Fn Layer + * + * ,---------------------------------------------------. ,--------------------------------------------------. + * | | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | | + * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| + * | | | | | | | | | | | | | | | | + * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | |------| |------| | | | | | | + * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | | | | | | | | | | | + * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | | | | + * `-----------------------------------' `----------------------------------' + * ,-------------. ,------------- + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// Function Keys +[FNCK] = LAYOUT_ergodox( + // left hand + _______,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, + _______,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______, + _______,_______, + _______, + _______,_______,_______, + // right hand + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, + _______,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______, + _______,_______, + _______, + _______,_______,_______ +), + +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_TAP_TOGGLE(NUMB), // FN1 - Momentary Layer 1 (Numbers) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_dynamic_macro(keycode, record)) { + return false; + } + switch (keycode) { + case VRSN: + if (record->event.pressed) { + SEND_STRING (" <[ Dejvino's Keyboard ]> "); + } + return false; + break; + } + return true; +} + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { + //set_unicode_input_mode(UC_LINX); +}; + + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + + + switch (layer) { + case FNCK: + ergodox_right_led_1_on(); + break; + case NUMB: + ergodox_right_led_2_on(); + break; + + default: + // none + break; + } + +};