You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
224 lines
11 KiB
224 lines
11 KiB
7 years ago
|
#include QMK_KEYBOARD_H
|
||
9 years ago
|
#include "debug.h"
|
||
9 years ago
|
#include "action_layer.h"
|
||
9 years ago
|
#include "version.h"
|
||
9 years ago
|
|
||
9 years ago
|
#define BASE 0 // default layer
|
||
|
#define SYMB 1 // symbols
|
||
|
#define MDIA 2 // media keys
|
||
9 years ago
|
|
||
8 years ago
|
enum custom_keycodes {
|
||
|
PLACEHOLDER = SAFE_RANGE, // can always be here
|
||
|
EPRM,
|
||
|
VRSN,
|
||
|
RGB_SLD
|
||
|
};
|
||
8 years ago
|
|
||
9 years ago
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||
9 years ago
|
/* Keymap 0: Basic layer
|
||
|
*
|
||
|
* ,--------------------------------------------------. ,--------------------------------------------------.
|
||
|
* | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - |
|
||
|
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
|
||
9 years ago
|
* | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ |
|
||
9 years ago
|
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
|
||
8 years ago
|
* | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2|' / Cmd |
|
||
9 years ago
|
* |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
|
||
9 years ago
|
* | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
|
||
|
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
|
||
9 years ago
|
* |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
|
||
9 years ago
|
* `----------------------------------' `----------------------------------'
|
||
|
* ,-------------. ,-------------.
|
||
9 years ago
|
* | App | LGui | | Alt |Ctrl/Esc|
|
||
9 years ago
|
* ,------|------|------| |------+--------+------.
|
||
|
* | | | Home | | PgUp | | |
|
||
|
* | Space|Backsp|------| |------| Tab |Enter |
|
||
|
* | |ace | End | | PgDn | | |
|
||
|
* `--------------------' `----------------------'
|
||
|
*/
|
||
|
// If it accepts an argument (i.e, is a function), it doesn't need KC_.
|
||
|
// Otherwise, it needs KC_*
|
||
7 years ago
|
[BASE] = LAYOUT_ergodox( // layer 0 : default
|
||
9 years ago
|
// left hand
|
||
9 years ago
|
KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT,
|
||
9 years ago
|
KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB),
|
||
9 years ago
|
KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G,
|
||
9 years ago
|
KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO),
|
||
9 years ago
|
LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT,
|
||
9 years ago
|
ALT_T(KC_APP), KC_LGUI,
|
||
9 years ago
|
KC_HOME,
|
||
|
KC_SPC,KC_BSPC,KC_END,
|
||
9 years ago
|
// right hand
|
||
8 years ago
|
KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
|
||
|
TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
|
||
|
KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT),
|
||
|
MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
|
||
|
KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1,
|
||
9 years ago
|
KC_LALT, CTL_T(KC_ESC),
|
||
9 years ago
|
KC_PGUP,
|
||
|
KC_PGDN,KC_TAB, KC_ENT
|
||
9 years ago
|
),
|
||
9 years ago
|
/* Keymap 1: Symbol Layer
|
||
|
*
|
||
8 years ago
|
* ,---------------------------------------------------. ,--------------------------------------------------.
|
||
|
* |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
|
||
|
* |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------|
|
||
|
* | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 |
|
||
|
* |---------+------+------+------+------+------| | | |------+------+------+------+------+--------|
|
||
|
* | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
|
||
|
* |---------+------+------+------+------+------| | | |------+------+------+------+------+--------|
|
||
|
* | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
|
||
|
* `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
|
||
|
* | EPRM | | | | | | | . | 0 | = | |
|
||
|
* `-----------------------------------' `----------------------------------'
|
||
9 years ago
|
* ,-------------. ,-------------.
|
||
8 years ago
|
* |Animat| | |Toggle|Solid |
|
||
9 years ago
|
* ,------|------|------| |------+------+------.
|
||
8 years ago
|
* |Bright|Bright| | | |Hue- |Hue+ |
|
||
|
* |ness- |ness+ |------| |------| | |
|
||
9 years ago
|
* | | | | | | | |
|
||
|
* `--------------------' `--------------------'
|
||
|
*/
|
||
|
// SYMBOLS
|
||
7 years ago
|
[SYMB] = LAYOUT_ergodox(
|
||
9 years ago
|
// left hand
|
||
8 years ago
|
VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
|
||
9 years ago
|
KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
|
||
9 years ago
|
KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV,
|
||
9 years ago
|
KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS,
|
||
8 years ago
|
EPRM,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
|
||
8 years ago
|
RGB_MOD,KC_TRNS,
|
||
9 years ago
|
KC_TRNS,
|
||
8 years ago
|
RGB_VAD,RGB_VAI,KC_TRNS,
|
||
9 years ago
|
// right hand
|
||
|
KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
|
||
|
KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
|
||
|
KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS,
|
||
|
KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS,
|
||
|
KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS,
|
||
8 years ago
|
RGB_TOG, RGB_SLD,
|
||
9 years ago
|
KC_TRNS,
|
||
8 years ago
|
KC_TRNS, RGB_HUD, RGB_HUI
|
||
9 years ago
|
),
|
||
|
/* Keymap 2: Media and mouse keys
|
||
|
*
|
||
|
* ,--------------------------------------------------. ,--------------------------------------------------.
|
||
|
* | | | | | | | | | | | | | | | |
|
||
|
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
|
||
9 years ago
|
* | | | | MsUp | | | | | | | | | | | |
|
||
9 years ago
|
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
|
||
9 years ago
|
* | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play |
|
||
9 years ago
|
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
|
||
|
* | | | | | | | | | | | | Prev | Next | | |
|
||
|
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
|
||
9 years ago
|
* | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | |
|
||
9 years ago
|
* `----------------------------------' `----------------------------------'
|
||
|
* ,-------------. ,-------------.
|
||
|
* | | | | | |
|
||
|
* ,------|------|------| |------+------+------.
|
||
|
* | | | | | | |Brwser|
|
||
|
* | | |------| |------| |Back |
|
||
|
* | | | | | | | |
|
||
|
* `--------------------' `--------------------'
|
||
|
*/
|
||
|
// MEDIA AND MOUSE
|
||
7 years ago
|
[MDIA] = LAYOUT_ergodox(
|
||
9 years ago
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||
9 years ago
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
|
||
|
KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
|
||
9 years ago
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||
9 years ago
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
|
||
9 years ago
|
KC_TRNS, KC_TRNS,
|
||
|
KC_TRNS,
|
||
|
KC_TRNS, KC_TRNS, KC_TRNS,
|
||
|
// right hand
|
||
|
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,
|
||
9 years ago
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY,
|
||
9 years ago
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
|
||
9 years ago
|
KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
|
||
9 years ago
|
KC_TRNS, KC_TRNS,
|
||
|
KC_TRNS,
|
||
|
KC_TRNS, KC_TRNS, KC_WBAK
|
||
|
),
|
||
9 years ago
|
};
|
||
|
|
||
|
const uint16_t PROGMEM fn_actions[] = {
|
||
9 years ago
|
[1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols)
|
||
9 years ago
|
};
|
||
|
|
||
|
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||
|
{
|
||
|
// MACRODOWN only works in this function
|
||
|
switch(id) {
|
||
|
case 0:
|
||
|
if (record->event.pressed) {
|
||
9 years ago
|
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
|
||
9 years ago
|
}
|
||
|
break;
|
||
8 years ago
|
case 1:
|
||
|
if (record->event.pressed) { // For resetting EEPROM
|
||
|
eeconfig_init();
|
||
|
}
|
||
|
break;
|
||
9 years ago
|
}
|
||
|
return MACRO_NONE;
|
||
|
};
|
||
9 years ago
|
|
||
8 years ago
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||
|
switch (keycode) {
|
||
|
// dynamically generate these.
|
||
|
case EPRM:
|
||
|
if (record->event.pressed) {
|
||
|
eeconfig_init();
|
||
|
}
|
||
|
return false;
|
||
|
break;
|
||
|
case VRSN:
|
||
|
if (record->event.pressed) {
|
||
|
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
|
||
|
}
|
||
|
return false;
|
||
|
break;
|
||
|
case RGB_SLD:
|
||
|
if (record->event.pressed) {
|
||
|
#ifdef RGBLIGHT_ENABLE
|
||
|
rgblight_mode(1);
|
||
|
#endif
|
||
|
}
|
||
|
return false;
|
||
|
break;
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
9 years ago
|
// Runs just one time when the keyboard initializes.
|
||
9 years ago
|
void matrix_init_user(void) {
|
||
9 years ago
|
|
||
|
};
|
||
|
|
||
8 years ago
|
|
||
9 years ago
|
// Runs constantly in the background, in a loop.
|
||
9 years ago
|
void matrix_scan_user(void) {
|
||
9 years ago
|
|
||
9 years ago
|
uint8_t layer = biton32(layer_state);
|
||
|
|
||
|
ergodox_board_led_off();
|
||
9 years ago
|
ergodox_right_led_1_off();
|
||
|
ergodox_right_led_2_off();
|
||
|
ergodox_right_led_3_off();
|
||
9 years ago
|
switch (layer) {
|
||
9 years ago
|
// TODO: Make this relevant to the ErgoDox EZ.
|
||
9 years ago
|
case 1:
|
||
9 years ago
|
ergodox_right_led_1_on();
|
||
9 years ago
|
break;
|
||
|
case 2:
|
||
9 years ago
|
ergodox_right_led_2_on();
|
||
9 years ago
|
break;
|
||
|
default:
|
||
|
// none
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
};
|