Permalink
Fetching contributors…
Cannot retrieve contributors at this time
317 lines (296 sloc) 10.4 KB
#include QMK_KEYBOARD_H
#include "debug.h"
#include "action_layer.h"
#include "version.h"
enum custom_keycodes {
PLACEHOLDER = SAFE_RANGE, // can always be here
EPRM,
VRSN,
RGB_SLD,
MACRO_ARROW,
MACRO_FAT_ARROW
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_ergodox(// Left Side
// First Row
KC_GRAVE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LCBR,
// Second Row
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T,
// First Verical Key
KC_LPRN,
// Third Row
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G,
// Fourth Row
LT(1, KC_9), GUI_T(KC_Z), KC_X, KC_C, KC_V, KC_B,
// Second Vertical Key
KC_LBRACKET,
// Fifth Row
KC_LCTL, KC_LALT, GUI_T(KC_NO), KC_TRANSPARENT, KC_EQUAL,
// Left Thumb Culster
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
LSFT_T(KC_ENTER),
KC_UNDS,
KC_ENTER,
// Right Side
// First Row
KC_RCBR, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPACE,
// First Vertical Key
KC_RPRN,
// Second Row
KC_Y, KC_U, KC_I, KC_O, KC_P, GUI_T(KC_BSLASH),
// Third Row
KC_H, KC_J, KC_K, KC_L, KC_SCOLON, KC_QUOTE,
//Second vertical Key
KC_RBRACKET,
// Fourth Row
KC_N, KC_M, KC_COMMA, KC_DOT, LT(2, KC_SLASH), LT(1, KC_0),
// Fifth Row
KC_MINUS, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,
// Right Thumb Cluster
KC_LEFT,
KC_RIGHT,
KC_UP,
KC_SPACE,
KC_BSPACE,
RSFT_T(KC_SPACE)),
[1] = LAYOUT_ergodox(// Left Side
// First Row
KC_TILDE, KC_EXCLAIM, KC_AT, KC_HASH, KC_DOLLAR, KC_PERCENT, KC_TRANSPARENT,
// Second Row
KC_TRANSPARENT, KC_QUOTE, KC_PLUS, KC_EQUAL, KC_CIRCUMFLEX, KC_TILDE,
// First Verical Key
KC_TRANSPARENT,
// Third Row
KC_ESCAPE, KC_AMPERSAND, KC_AT, KC_DOLLAR, KC_PERCENT, KC_RABK,
// Fourth Row
KC_LEFT_PAREN, KC_0, KC_ASTERISK, KC_LCBR, KC_RCBR, KC_LBRACKET,
// Second Vertical Key
KC_RBRACKET,
// Fifth Row
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,
// Left Thumb Culster
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
// Right Side
// First Row
KC_TRANSPARENT, KC_CIRCUMFLEX, KC_AMPERSAND, KC_ASTERISK, KC_LEFT_PAREN, KC_RIGHT_PAREN, KC_TRANSPARENT,
// First Vertical Key
KC_TRANSPARENT,
// Second Row
KC_QUESTION, KC_UNDERSCORE, KC_PLUS, KC_PIPE, KC_PLUS, KC_BSLASH,
// Third Row
KC_HASH, KC_AMPERSAND, KC_ASTERISK, KC_LABK, KC_COLON, KC_ENTER,
//Second vertical Key
KC_TRANSPARENT,
// Fourth Row
KC_EXCLAIM, KC_MINUS, KC_COMMA, MACRO_ARROW, MACRO_FAT_ARROW, KC_RIGHT_PAREN,
// Fifth Row
KC_MINUS, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,
// Right Thumb Cluster
KC_LEFT,
KC_RIGHT,
KC_UP,
KC_TRANSPARENT,
KC_BSPACE,
RCTL_T(KC_SPACE)),
[2] = LAYOUT_ergodox(KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_MS_UP,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_MS_LEFT,
KC_MS_DOWN,
KC_MS_RIGHT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_MS_BTN1,
KC_MS_BTN2,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_MS_BTN1,
KC_MS_BTN2,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_MEDIA_PLAY_PAUSE,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_MEDIA_PREV_TRACK,
KC_MEDIA_NEXT_TRACK,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_AUDIO_VOL_UP,
KC_AUDIO_VOL_DOWN,
KC_AUDIO_MUTE,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_TRANSPARENT,
KC_WWW_BACK),
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_TAP_TOGGLE(1)
};
// leaving this in place for compatibilty with old keymaps cloned and re-compiled.
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch(id) {
case 0:
if (record->event.pressed) {
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
}
break;
}
return MACRO_NONE;
};
void matrix_init_user(void) {
#ifdef RGBLIGHT_COLOR_LAYER_0
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0);
#endif
};
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) {
rgblight_mode(1);
}
return false;
break;
case MACRO_ARROW:
if (record->event.pressed) {
SEND_STRING("->");
}
break;
case MACRO_FAT_ARROW:
if (record->event.pressed) {
SEND_STRING("=>");
}
break;
}
return true;
}
uint32_t layer_state_set_user(uint32_t state) {
uint8_t layer = biton32(state);
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
switch (layer) {
case 0:
#ifdef RGBLIGHT_COLOR_LAYER_0
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0);
#endif
break;
case 1:
ergodox_right_led_1_on();
#ifdef RGBLIGHT_COLOR_LAYER_1
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_1);
#endif
break;
case 2:
ergodox_right_led_2_on();
#ifdef RGBLIGHT_COLOR_LAYER_2
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_2);
#endif
break;
case 3:
ergodox_right_led_3_on();
#ifdef RGBLIGHT_COLOR_LAYER_3
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_3);
#endif
break;
case 4:
ergodox_right_led_1_on();
ergodox_right_led_2_on();
#ifdef RGBLIGHT_COLOR_LAYER_4
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_4);
#endif
break;
case 5:
ergodox_right_led_1_on();
ergodox_right_led_3_on();
#ifdef RGBLIGHT_COLOR_LAYER_5
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_5);
#endif
break;
case 6:
ergodox_right_led_2_on();
ergodox_right_led_3_on();
#ifdef RGBLIGHT_COLOR_LAYER_6
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_6);
#endif
break;
case 7:
ergodox_right_led_1_on();
ergodox_right_led_2_on();
ergodox_right_led_3_on();
#ifdef RGBLIGHT_COLOR_LAYER_7
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_6);
#endif
break;
default:
break;
}
return state;
};