diff options
author | Erez Zukerman <ezuk@madmimi.com> | 2015-10-27 00:54:46 +0200 |
---|---|---|
committer | Erez Zukerman <ezuk@madmimi.com> | 2015-10-27 00:54:46 +0200 |
commit | 0c47e8b008ccb6bfbb7051a5c2e4b0031dae0fa5 (patch) | |
tree | 0f883338e928824d1940fe98f23a69d0e4194e20 /keyboard/ergodox_ez/keymaps | |
parent | cc1c32671eb1eb43a87e55ac4ffa60b15115e48d (diff) |
[Jack & Erez] Comments + tiny updates and cleanup
Diffstat (limited to 'keyboard/ergodox_ez/keymaps')
-rw-r--r-- | keyboard/ergodox_ez/keymaps/keymap_default.c | 133 | ||||
-rw-r--r-- | keyboard/ergodox_ez/keymaps/keymap_ergodox_ez.c | 211 |
2 files changed, 344 insertions, 0 deletions
diff --git a/keyboard/ergodox_ez/keymaps/keymap_default.c b/keyboard/ergodox_ez/keymaps/keymap_default.c new file mode 100644 index 0000000000..98cc9c5a6f --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/keymap_default.c @@ -0,0 +1,133 @@ +#include "ergodox_ez.h" +#include "debug.h" +#include "action_layer.h" + +// TODO: Define layer names that make sense for the ErgoDox EZ. +#define DEFAULT_LAYER 0 +#define COLEMAK_LAYER 1 +#define DVORAK_LAYER 2 +#define LOWER_LAYER 1 +#define RAISE_LAYER 4 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[DEFAULT_LAYER] = KEYMAP( // layer 0 : default + // left hand + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, + KC_BSLS,KC_Q, KC_W, KC_E, KC_R, KC_T, KC_FN2, + KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_FN1, + KC_LGUI,KC_GRV, KC_BSLS,KC_LEFT,KC_RGHT, + KC_LCTL,KC_LALT, + KC_HOME, + KC_BSPC,KC_DEL, KC_END, + // right hand + KC_FN3, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_LBRC,KC_Y, KC_U, KC_I, KC_O, KC_P, KC_RBRC, + KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, + KC_FN1, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT, + KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,KC_RGUI, + KC_RALT,KC_RCTL, + KC_PGUP, + KC_PGDN,KC_ENT, KC_SPC + ), +[LOWER_LAYER] = KEYMAP( // layer 0 : default + // left hand + KC_EQL, KC_1, KC_2, KC_3, LALT(KC_TAB), KC_5, KC_ESC, + KC_BSLS,KC_Q, S(KC_W), KC_E, KC_R, KC_T, KC_FN2, + KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_FN1, + KC_LGUI,KC_GRV, KC_BSLS,KC_LEFT,KC_RGHT, + KC_LCTL,KC_LALT, + KC_HOME, + KC_BSPC,KC_DEL, KC_END, + // right hand + KC_FN3, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_LBRC,KC_Y, KC_U, KC_I, KC_O, KC_P, KC_RBRC, + KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, + KC_FN1, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT, + KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,KC_RGUI, + KC_RALT,KC_RCTL, + KC_PGUP, + KC_PGDN,KC_ENT, KC_SPC + ) +}; + +const uint16_t PROGMEM fn_actions[] = { + + [1] = ACTION_LAYER_MOMENTARY(LOWER_LAYER), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(LOWER_LAYER), // to LOWER + + [3] = ACTION_DEFAULT_LAYER_SET(DEFAULT_LAYER), + [4] = ACTION_DEFAULT_LAYER_SET(COLEMAK_LAYER), + [5] = ACTION_DEFAULT_LAYER_SET(DVORAK_LAYER), +}; + +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) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + +// Runs just one time when the keyboard initializes. +void * matrix_init_user(void) { + +}; + +// Runs constantly in the background, in a loop. +void * matrix_scan_user(void) { + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_left_led_1_off(); + ergodox_left_led_2_off(); + ergodox_left_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case 1: + // all + ergodox_left_led_1_on(); + ergodox_left_led_2_on(); + ergodox_left_led_3_on(); + break; + case 2: + // blue + ergodox_left_led_2_on(); + break; + case 8: + // blue and green + ergodox_left_led_2_on(); + // break missed intentionally + case 3: + // green + ergodox_left_led_3_on(); + break; + case 6: + ergodox_board_led_on(); + // break missed intentionally + case 4: + case 5: + case 7: + // white + ergodox_left_led_1_on(); + break; + case 9: + // white+green + ergodox_left_led_1_on(); + ergodox_left_led_3_on(); + break; + default: + // none + break; + } + + mcp23018_status = ergodox_left_leds_update(); +}; diff --git a/keyboard/ergodox_ez/keymaps/keymap_ergodox_ez.c b/keyboard/ergodox_ez/keymaps/keymap_ergodox_ez.c new file mode 100644 index 0000000000..bab16ece53 --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/keymap_ergodox_ez.c @@ -0,0 +1,211 @@ +// TODO: Move all of this stuff into the default keymap, and then get rid of this file. +#include "action_util.h" +#include "action_layer.h" +#define KC_SW0 KC_FN0 +#define DEBUG_ACTION + +static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Keymap 0: Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Del | Q | W | E | R | T | Up | | Up | Y | U | I | O | P | \ | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2| ' | + * |--------+------+------+------+------+------| L1 | | L1 |------+------+------+------+------+--------| + * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |Grv/L1| ~L1 | TAB | Left | Right| | Up | Down | [ | ] | ~L1 | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | Rclk | LGui | | Alt |Ctrl/Esc| + * ,------|------|------| |------+--------+------. + * | | | Home | | PgUp | | | + * | Space| Enter|------| |------| Tab |Enter | + * | | | End | | PgDn | | | + * `--------------------' `----------------------' + */ + + + // Basic layer + + KEYMAP( + EQL, 1, 2, 3, 4, 5, LEFT, + DEL, Q, W, E, R, T, UP, + BSPC, A, S, D, F, G, + LSFT, FN29, X, C, V, B, FN1, + FN30, FN4, TAB, LEFT, RIGHT, + + BTN2,LGUI, + HOME, + SPC, ENT, END, + //RIGHT + RIGHT,6, 7, 8, 9, 0, MINS, + UP, Y, U, I, O, P, BSLS, + H, J, K, L, FN31, QUOT, + FN1, N, M, COMM, DOT, FN28, RSFT, + UP, DOWN, LBRC, RBRC, FN4, + LALT, FN27, + PGUP, + PGDN, TAB, ENT + ), + + /* Keymap 1: Symbol Layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | Flash | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | : | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | . | 0 | = | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ + // SYMBOLS + KEYMAP( + FN0, F1, F2, F3, F4, F5, TRNS, + TRNS, FN7, FN8, FN23, FN24, FN18, TRNS, + FN22, FN9, FN10, FN15, FN16, GRV, + TRNS, FN11, FN12, LBRC, RBRC, FN17, TRNS, + TRNS, TRNS, TRNS, TRNS, TRNS, + + TRNS, TRNS, + TRNS, + TRNS, TRNS, TRNS, + // right hand + TRNS, F6, F7, F8, F9, F10, F11, + TRNS, UP, 7, 8, 9, FN14, F12, + DOWN, 4, 5, 6, FN26, TRNS, + TRNS, FN13, 1, 2, 3, BSLS, TRNS, + TRNS,DOT, 0, EQL, TRNS, + TRNS, TRNS, + TRNS, + TRNS, TRNS, TRNS + ), + /* Keymap 2: Media and mouse keys + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | MsUp | | | | | | | | | | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | |MsLeft|MsDown|MsRght| | |------| |------| | | | Play | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | | | | | | | Prev | Next | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | Lclk | Rclk | |VolUp |VolDn | | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ + // MEDIA AND MOUSE + KEYMAP( + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, + TRNS, TRNS, MS_U, TRNS, TRNS, TRNS, TRNS, + TRNS, MS_L, MS_D, MS_R, TRNS, TRNS, + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, + TRNS, TRNS, TRNS, BTN3, BTN2, + + TRNS, TRNS, + TRNS, + TRNS, TRNS, TRNS, + // right hand + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, + TRNS, TRNS, TRNS, MPLY, TRNS, TRNS, + TRNS, TRNS, TRNS, MPRV, MNXT, TRNS, TRNS, + VOLU, VOLD, TRNS, TRNS, TRNS, + TRNS, TRNS, + TRNS, + TRNS, TRNS, WBAK + ), +}; + +/* id for user defined functions */ +enum function_id { + TEENSY_KEY, +}; + +/* + * Fn action definition + */ +static const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_FUNCTION(TEENSY_KEY), // FN0 - Teensy key + [1] = ACTION_LAYER_INVERT(1, ON_RELEASE), // FN1 - Toggle 1 + [2] = ACTION_LAYER_TOGGLE(2), // FN2 - Toggle 2 + [3] = ACTION_LAYER_TOGGLE(3), // FN3 - Toggle 3 + [4] = ACTION_LAYER_TAP_TOGGLE(1), // FN4 - Momentary Layer 1 + [5] = ACTION_LAYER_MOMENTARY(2), // FN5 - Momentary L2 + + // SYMBOLS + ACTION_MODS_KEY(MOD_LSFT, KC_QUOT), // FN6 - " + ACTION_MODS_KEY(MOD_LSFT, KC_1), // FN7 - ! + ACTION_MODS_KEY(MOD_LSFT, KC_2), // FN8 - @ + ACTION_MODS_KEY(MOD_LSFT, KC_3), // FN9 - # + ACTION_MODS_KEY(MOD_LSFT, KC_4), // FN10 - $ + ACTION_MODS_KEY(MOD_LSFT, KC_5), // FN11 - % + ACTION_MODS_KEY(MOD_LSFT, KC_6), // FN12 - ^ + ACTION_MODS_KEY(MOD_LSFT, KC_7), // FN13 - & + ACTION_MODS_KEY(MOD_LSFT, KC_8), // FN14 - * + ACTION_MODS_KEY(MOD_LSFT, KC_9), // FN15 - ( + ACTION_MODS_KEY(MOD_LSFT, KC_0), // FN16 - ) + ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // FN17 - ~ + ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), // FN18 - | + ACTION_MODS_KEY(MOD_LSFT, KC_MINS), // FN19 - _ + ACTION_MODS_KEY(MOD_LSFT, KC_COMM), // FN20 - < + ACTION_MODS_KEY(MOD_LSFT, KC_DOT), // FN21 - > + ACTION_MODS_KEY(MOD_LSFT, KC_SCLN), // FN22 - : + ACTION_MODS_KEY(MOD_LSFT, KC_LBRC), // FN23 - { + ACTION_MODS_KEY(MOD_LSFT, KC_RBRC), // FN24 - } + ACTION_MODS_KEY(MOD_LSFT, KC_SLSH), // FN25 - ? + ACTION_MODS_KEY(MOD_LSFT, KC_EQL), // FN26 - + + + ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC), // FN27 - Control/esc on tap + ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SLSH), // FN28 - slash becomes Ctrl when held (right pinky) + ACTION_MODS_TAP_KEY(MOD_LCTL, KC_Z), // FN29 - z becomes Ctrl when held (left pinky) + + // Fancy tapping/toggling + ACTION_LAYER_TAP_KEY(1, KC_GRV), // FN30 - Layer 1 when holding backtick key + ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN31 - Layer 2 when holding semicolon key + + +}; + +void action_function(keyrecord_t *event, uint8_t id, uint8_t opt) +{ + print("action_function called\n"); + print("id = "); phex(id); print("\n"); + print("opt = "); phex(opt); print("\n"); + if (id == TEENSY_KEY) { + clear_keyboard(); + print("\n\nJump to bootloader... "); + _delay_ms(250); + bootloader_jump(); // should not return + print("not supported.\n"); + } +} + +void * matrix_init_user(void) { + +}; + +void * matrix_scan_user(void) { + +}; |