Peter's keyboard firmware (QMK) https://qmk.fm/
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.

keymap.c 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #include "atreus.h"
  2. // layers
  3. #define BASE 0
  4. #define KEYNAV 1
  5. #define KEYSEL 2
  6. #define MOUSE 3
  7. #define COMBINED 4
  8. // macros
  9. #define MOUSE_TOGGLE 1
  10. #define MOUSE_LOCK 2
  11. static bool mouse_lock = false;
  12. // building instructions:
  13. // make atreus:dvorak_42_key
  14. // flashing instructions:
  15. // avrdude -p atmega32u4 -c avr109 -U flash:w:atreus_dvorak_42_key.hex -P COM7
  16. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  17. [BASE] = {
  18. {KC_QUOTE, KC_COMMA, KC_DOT, KC_P, KC_Y, KC_TRNS, KC_F, KC_G, KC_C, KC_R, KC_L, },
  19. {KC_A, KC_O, KC_E, KC_U, KC_I, KC_TRNS, KC_D, KC_H, KC_T, KC_N, KC_S, },
  20. {KC_SCOLON, KC_Q, KC_J, KC_K, KC_X, MO(KEYNAV), KC_B, KC_M, KC_W, KC_V, KC_Z, },
  21. {OSM(MOD_LSFT), OSM(MOD_LCTL), M(MOUSE_TOGGLE), MO(KEYSEL), MO(COMBINED), KC_ENTER, KC_SPACE, KC_BSPC, RCTL(KC_BSPC), KC_CAPSLOCK, OSM(MOD_LSFT), }
  22. },
  23. [KEYNAV] = {
  24. {KC_ESC, MEH(KC_A), RCTL(KC_Z), RCTL(KC_S), MEH(KC_B), KC_TRNS, KC_TRNS, KC_HOME, KC_UP, KC_END, KC_PGUP, },
  25. {MEH(KC_C), MEH(KC_D), RSFT(KC_TAB), KC_TAB, MEH(KC_E), KC_TRNS, LCTL(KC_LEFT), KC_LEFT, KC_DOWN, KC_RIGHT, LCTL(KC_RIGHT), },
  26. {MEH(KC_F), MEH(KC_G), MEH(KC_H), MEH(KC_I), MEH(KC_J), KC_TRNS, KC_TRNS, RCTL(KC_C), RCTL(KC_X), RCTL(KC_V), KC_PGDOWN, },
  27. {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENTER, KC_SPACE, KC_BSPC, RCTL(KC_BSPC), KC_DELETE, LCTL(KC_DELETE), }
  28. },
  29. [KEYSEL] = {
  30. {KC_TRNS, KC_TRNS, RCTL(KC_Z), RCTL(KC_S), KC_TRNS, KC_TRNS, KC_TRNS, RSFT(KC_HOME), RSFT(KC_UP), RSFT(KC_END), RSFT(KC_PGUP), },
  31. {KC_TRNS, KC_TRNS, RSFT(KC_TAB), KC_TAB, KC_TRNS, KC_TRNS, RSFT(RCTL(KC_LEFT)), RSFT(KC_LEFT), RSFT(KC_DOWN), RSFT(KC_RIGHT), RSFT(RCTL(KC_RIGHT)), },
  32. {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RCTL(KC_C),RCTL(KC_X), RCTL(KC_V), RSFT(KC_PGDN), },
  33. {RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENTER, KC_SPACE, KC_BSPC, RCTL(KC_BSPC), KC_DELETE, LCTL(KC_DELETE), }
  34. },
  35. [COMBINED] = {
  36. {KC_ESC, KC_LABK, KC_RABK, KC_DQUO, KC_GRAVE, KC_TRNS, KC_PLUS, KC_7, KC_8, KC_9, KC_ASTR, },
  37. {KC_LPRN, KC_RPRN, KC_LBRACKET, KC_RBRACKET, KC_UNDS, KC_TRNS, KC_MINS, KC_4, KC_5, KC_6, KC_SLSH, },
  38. {KC_LCBR, KC_RCBR, KC_BSLS, KC_PIPE, KC_TILD, KC_TRNS, KC_EQUAL, KC_1, KC_2, KC_3, KC_QUES, },
  39. {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_0, KC_DOT, KC_TRNS, KC_TRNS, }
  40. },
  41. [MOUSE] = {
  42. {KC_TRNS, KC_PGUP, KC_MS_WH_UP, KC_UP, KC_TRNS, KC_TRNS, KC_UP, KC_HOME, KC_MS_U, KC_END, KC_MS_WH_UP, },
  43. {KC_MS_ACCEL0, KC_PGDN, KC_MS_WH_DOWN, KC_DOWN, KC_TRNS, KC_TRNS, KC_DOWN, KC_MS_L, KC_MS_D, KC_MS_R, KC_MS_WH_DOWN, },
  44. {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN3, MEH(KC_X), MEH(KC_Y), MEH(KC_Z), KC_F5, RCTL(KC_W), },
  45. {KC_TRNS, M(MOUSE_LOCK), KC_TRNS, KC_MS_ACCEL0, KC_TRNS, KC_BTN1, KC_BTN2, RSFT(RCTL(KC_TAB)), RCTL(KC_TAB), RCTL(KC_T), LALT(KC_LEFT), }
  46. },
  47. };
  48. const uint16_t PROGMEM fn_actions[] = {
  49. };
  50. const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
  51. {
  52. // MACRODOWN only works in this function
  53. switch(id) {
  54. case MOUSE_TOGGLE:
  55. if (record->event.pressed) {
  56. layer_on(MOUSE);
  57. } else {
  58. if(!mouse_lock)
  59. layer_off(MOUSE);
  60. }
  61. break;
  62. case MOUSE_LOCK:
  63. if (record->event.pressed)
  64. {
  65. if(mouse_lock)
  66. {
  67. mouse_lock = false;
  68. layer_off(MOUSE);
  69. }
  70. else
  71. mouse_lock = true;
  72. }
  73. break;
  74. }
  75. return MACRO_NONE;
  76. };