diff options
Diffstat (limited to 'layouts/community/ergodox/reset_eeprom/keymap.c')
| -rw-r--r-- | layouts/community/ergodox/reset_eeprom/keymap.c | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/layouts/community/ergodox/reset_eeprom/keymap.c b/layouts/community/ergodox/reset_eeprom/keymap.c new file mode 100644 index 000000000..c960af9cb --- /dev/null +++ b/layouts/community/ergodox/reset_eeprom/keymap.c | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | #include QMK_KEYBOARD_H | ||
| 2 | #include "debug.h" | ||
| 3 | #include "action_layer.h" | ||
| 4 | #include "version.h" | ||
| 5 | |||
| 6 | #define BASE 0 // default layer | ||
| 7 | #define SYMB 1 // symbols | ||
| 8 | #define MDIA 2 // media keys | ||
| 9 | |||
| 10 | enum custom_keycodes { | ||
| 11 | PLACEHOLDER = SAFE_RANGE, // can always be here | ||
| 12 | EPRM, | ||
| 13 | VRSN, | ||
| 14 | RGB_SLD | ||
| 15 | }; | ||
| 16 | |||
| 17 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 18 | /* Keymap 0: Basic layer | ||
| 19 | * | ||
| 20 | * ,--------------------------------------------------. ,--------------------------------------------------. | ||
| 21 | * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - | | ||
| 22 | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| | ||
| 23 | * | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ | | ||
| 24 | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | ||
| 25 | * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2|' / Cmd | | ||
| 26 | * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| | ||
| 27 | * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift | | ||
| 28 | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | ||
| 29 | * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 | | ||
| 30 | * `----------------------------------' `----------------------------------' | ||
| 31 | * ,-------------. ,-------------. | ||
| 32 | * | App | LGui | | Alt |Ctrl/Esc| | ||
| 33 | * ,------|------|------| |------+--------+------. | ||
| 34 | * | | | Home | | PgUp | | | | ||
| 35 | * | Space|Backsp|------| |------| Tab |Enter | | ||
| 36 | * | |ace | End | | PgDn | | | | ||
| 37 | * `--------------------' `----------------------' | ||
| 38 | */ | ||
| 39 | // If it accepts an argument (i.e, is a function), it doesn't need KC_. | ||
| 40 | // Otherwise, it needs KC_* | ||
| 41 | [BASE] = LAYOUT_ergodox( // layer 0 : default | ||
| 42 | // left hand | ||
| 43 | EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, | ||
| 44 | EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, | ||
| 45 | EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, | ||
| 46 | EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, | ||
| 47 | EPRM, EPRM, EPRM, EPRM,EPRM, | ||
| 48 | EPRM, EPRM, | ||
| 49 | EPRM, | ||
| 50 | EPRM,EPRM,EPRM, | ||
| 51 | // right hand | ||
| 52 | EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, | ||
| 53 | EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, | ||
| 54 | EPRM, EPRM, EPRM, EPRM, EPRM,EPRM, | ||
| 55 | EPRM,EPRM, EPRM, EPRM,EPRM, EPRM, EPRM, | ||
| 56 | EPRM, EPRM,EPRM,EPRM, EPRM, | ||
| 57 | EPRM, EPRM, | ||
| 58 | EPRM, | ||
| 59 | EPRM,EPRM, EPRM | ||
| 60 | ) | ||
| 61 | }; | ||
| 62 | |||
| 63 | const uint16_t PROGMEM fn_actions[] = { | ||
| 64 | [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) | ||
| 65 | }; | ||
| 66 | |||
| 67 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
| 68 | { | ||
| 69 | // MACRODOWN only works in this function | ||
| 70 | switch(id) { | ||
| 71 | case 0: | ||
| 72 | if (record->event.pressed) { | ||
| 73 | SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); | ||
| 74 | } | ||
| 75 | break; | ||
| 76 | case 1: | ||
| 77 | if (record->event.pressed) { // For resetting EEPROM | ||
| 78 | eeconfig_init(); | ||
| 79 | } | ||
| 80 | break; | ||
| 81 | } | ||
| 82 | return MACRO_NONE; | ||
| 83 | }; | ||
| 84 | |||
| 85 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 86 | switch (keycode) { | ||
| 87 | // dynamically generate these. | ||
| 88 | case EPRM: | ||
| 89 | if (record->event.pressed) { | ||
| 90 | eeconfig_init(); | ||
| 91 | } | ||
| 92 | return false; | ||
| 93 | break; | ||
| 94 | case VRSN: | ||
| 95 | if (record->event.pressed) { | ||
| 96 | SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); | ||
| 97 | } | ||
| 98 | return false; | ||
| 99 | break; | ||
| 100 | case RGB_SLD: | ||
| 101 | if (record->event.pressed) { | ||
| 102 | #ifdef RGBLIGHT_ENABLE | ||
| 103 | rgblight_mode(1); | ||
| 104 | #endif | ||
| 105 | } | ||
| 106 | return false; | ||
| 107 | break; | ||
| 108 | } | ||
| 109 | return true; | ||
| 110 | } | ||
| 111 | |||
| 112 | // Runs just one time when the keyboard initializes. | ||
| 113 | void matrix_init_user(void) { | ||
| 114 | eeconfig_init(); | ||
| 115 | }; | ||
| 116 | |||
| 117 | |||
| 118 | // Runs constantly in the background, in a loop. | ||
| 119 | void matrix_scan_user(void) { | ||
| 120 | |||
| 121 | uint8_t layer = biton32(layer_state); | ||
| 122 | |||
| 123 | ergodox_board_led_off(); | ||
| 124 | ergodox_right_led_1_off(); | ||
| 125 | ergodox_right_led_2_off(); | ||
| 126 | ergodox_right_led_3_off(); | ||
| 127 | switch (layer) { | ||
| 128 | // TODO: Make this relevant to the ErgoDox EZ. | ||
| 129 | case 1: | ||
| 130 | ergodox_right_led_1_on(); | ||
| 131 | break; | ||
| 132 | case 2: | ||
| 133 | ergodox_right_led_2_on(); | ||
| 134 | break; | ||
| 135 | default: | ||
| 136 | // none | ||
| 137 | break; | ||
| 138 | } | ||
| 139 | |||
| 140 | }; | ||
