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.

118 lines
4.6 KiB

  1. #include QMK_KEYBOARD_H
  2. #include "debug.h"
  3. #include "action_layer.h"
  4. #include "version.h"
  5. #define BASE 0 // default layer
  6. #define SYMB 1 // symbols
  7. #define MDIA 2 // media keys
  8. enum custom_keycodes {
  9. PLACEHOLDER = SAFE_RANGE, // can always be here
  10. EPRM,
  11. VRSN,
  12. RGB_SLD
  13. };
  14. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  15. /* Keymap 0: Basic layer
  16. *
  17. * ,--------------------------------------------------. ,--------------------------------------------------.
  18. * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - |
  19. * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
  20. * | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ |
  21. * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
  22. * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2|' / Cmd |
  23. * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
  24. * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
  25. * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
  26. * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
  27. * `----------------------------------' `----------------------------------'
  28. * ,-------------. ,-------------.
  29. * | App | LGui | | Alt |Ctrl/Esc|
  30. * ,------|------|------| |------+--------+------.
  31. * | | | Home | | PgUp | | |
  32. * | Space|Backsp|------| |------| Tab |Enter |
  33. * | |ace | End | | PgDn | | |
  34. * `--------------------' `----------------------'
  35. */
  36. // If it accepts an argument (i.e, is a function), it doesn't need KC_.
  37. // Otherwise, it needs KC_*
  38. [BASE] = LAYOUT_ergodox( // layer 0 : default
  39. // left hand
  40. EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM,
  41. EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM,
  42. EPRM, EPRM, EPRM, EPRM, EPRM, EPRM,
  43. EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM,
  44. EPRM, EPRM, EPRM, EPRM,EPRM,
  45. EPRM, EPRM,
  46. EPRM,
  47. EPRM,EPRM,EPRM,
  48. // right hand
  49. EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM,
  50. EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM,
  51. EPRM, EPRM, EPRM, EPRM, EPRM,EPRM,
  52. EPRM,EPRM, EPRM, EPRM,EPRM, EPRM, EPRM,
  53. EPRM, EPRM,EPRM,EPRM, EPRM,
  54. EPRM, EPRM,
  55. EPRM,
  56. EPRM,EPRM, EPRM
  57. )
  58. };
  59. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  60. switch (keycode) {
  61. // dynamically generate these.
  62. case EPRM:
  63. if (record->event.pressed) {
  64. eeconfig_init();
  65. }
  66. return false;
  67. break;
  68. case VRSN:
  69. if (record->event.pressed) {
  70. SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
  71. }
  72. return false;
  73. break;
  74. case RGB_SLD:
  75. if (record->event.pressed) {
  76. #ifdef RGBLIGHT_ENABLE
  77. rgblight_mode(1);
  78. #endif
  79. }
  80. return false;
  81. break;
  82. }
  83. return true;
  84. }
  85. // Runs just one time when the keyboard initializes.
  86. void matrix_init_user(void) {
  87. eeconfig_init();
  88. };
  89. // Runs constantly in the background, in a loop.
  90. void matrix_scan_user(void) {
  91. uint8_t layer = biton32(layer_state);
  92. ergodox_board_led_off();
  93. ergodox_right_led_1_off();
  94. ergodox_right_led_2_off();
  95. ergodox_right_led_3_off();
  96. switch (layer) {
  97. // TODO: Make this relevant to the ErgoDox EZ.
  98. case 1:
  99. ergodox_right_led_1_on();
  100. break;
  101. case 2:
  102. ergodox_right_led_2_on();
  103. break;
  104. default:
  105. // none
  106. break;
  107. }
  108. };