ergodone-keyboard/keymap/keymap.c

205 lines
10 KiB
C
Executable File

#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;
}
};