keymap.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #include QMK_KEYBOARD_H
  2. #include "split_util.h"
  3. extern keymap_config_t keymap_config;
  4. #ifdef RGBLIGHT_ENABLE
  5. //Following line allows macro to read current RGB settings
  6. extern rgblight_config_t rgblight_config;
  7. #endif
  8. extern uint8_t is_master;
  9. #define LOWER MO(_LOWER)
  10. #define RAISE MO(_RAISE)
  11. #define ESC_CTL LCTL_T(KC_ESC)
  12. // Each layer gets a name for readability, which is then used in the keymap matrix below.
  13. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
  14. // Layer names don't all need to be of the same length, obviously, and you can also skip them
  15. // entirely and just use numbers.
  16. enum crkbd_layers {
  17. _DVORAK,
  18. _LOWER,
  19. _RAISE,
  20. _ADJUST
  21. };
  22. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  23. [_DVORAK] = LAYOUT( \
  24. //,-----------------------------------------------. ,-----------------------------------------------.
  25. KC_TAB, KC_QUOT,KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH,\
  26. //|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  27. ESC_CTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINUS,\
  28. //|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  29. KC_LSFT,KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z,KC_SFTENT,\
  30. //|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  31. KC_LGUI, LOWER, KC_SPC, KC_BSPC, RAISE,KC_RALT \
  32. //`-----------------------' `----------------------'
  33. ),
  34. [_LOWER] = LAYOUT( \
  35. //,-----------------------------------------------. ,-----------------------------------------------.
  36. KC_TILD,KC_EXLM, KC_AT, KC_HASH, KC_DLR,KC_PERC, KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RIGHT,KC_RPRN,\
  37. //|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  38. _______,KC_VOLD,KC_VOLU,KC_MPRV,KC_MPLY,KC_MNXT, _______,KC_LEFT,KC_PLUS,KC_LCBR,KC_RCBR,KC_PIPE,\
  39. //|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  40. _______,_______,_______,KC_DOWN, KC_UP, _______, _______,_______,_______,KC_HOME, KC_END,_______,\
  41. //|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  42. _______,_______,_______, KC_DEL,_______,_______ \
  43. //`-----------------------' `----------------------'
  44. ),
  45. [_RAISE] = LAYOUT( \
  46. //,-----------------------------------------------. ,-----------------------------------------------.
  47. KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9,KC_RIGHT, KC_0, \
  48. //|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  49. _______,_______,_______,_______,_______,_______, _______,KC_LEFT, KC_EQL,KC_LBRC,KC_RBRC,KC_BSLS,\
  50. //|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  51. _______,_______,_______,KC_DOWN, KC_UP, _______, _______,_______,_______,KC_PGUP,KC_PGDN,_______,\
  52. //|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  53. _______,_______,_______, KC_DEL ,_______,_______ \
  54. //`-----------------------' `----------------------'
  55. ),
  56. [_ADJUST] = LAYOUT( \
  57. //,-----------------------------------------------. ,-----------------------------------------------.
  58. RGB_TOG,RGB_HUI,RGB_SAI,RGB_VAI,_______,RGB_M_T, _______,_______,_______,_______,KC_RIGHT,_______,\
  59. //|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  60. RGB_MOD,RGB_HUD,RGB_SAD,RGB_VAD,_______,_______, _______,KC_LEFT,_______,_______,_______,_______,\
  61. //|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  62. _______,KC_PSCR,_______,KC_DOWN, KC_UP, _______, _______,_______,_______,_______,_______,_______,\
  63. //|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  64. _______,_______,_______, KC_DEL ,_______,_______ \
  65. //`-----------------------' `----------------------'
  66. )
  67. };
  68. uint32_t layer_state_set_user(uint32_t state) {
  69. return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
  70. }
  71. #ifdef OLED_DRIVER_ENABLE
  72. oled_rotation_t oled_init_user(oled_rotation_t rotation) {
  73. if (!isLeftHand)
  74. return OLED_ROTATION_180; // flips the display 180 to see it from my side
  75. return rotation;
  76. }
  77. const char *read_logo(void);
  78. void oled_task_user(void){
  79. switch (biton32(layer_state)){
  80. case _DVORAK:
  81. oled_write_ln_P(PSTR("DVRK"), false);
  82. break;
  83. case _LOWER:
  84. oled_write_ln_P(PSTR("LOWER"), false);
  85. break;
  86. case _RAISE:
  87. oled_write_ln_P(PSTR("RAISE"), false);
  88. break;
  89. case _ADJUST:
  90. oled_write_ln_P(PSTR("ADJST"), false);
  91. break;
  92. default:
  93. oled_write_ln_P(PSTR("?????"), false);
  94. }
  95. //now print logo
  96. oled_write(read_logo(), false);
  97. }
  98. #endif