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.

98 lines
3.7 KiB

  1. #include QMK_KEYBOARD_H
  2. #ifdef PROTOCOL_LUFA
  3. #include "split_util.h"
  4. #endif
  5. #ifdef SSD1306OLED
  6. #include "oled.h"
  7. #endif
  8. #include "edvorakjp.h"
  9. /*
  10. * enum custom_keycodes {
  11. * KC_LOCK = NEW_SAFE_RANGE,
  12. * };
  13. */
  14. #define KC_ KC_TRNS
  15. #define KC_TMB1 KC_LA(TAB)
  16. #define KC_TMB2 KC_LS(SPC)
  17. #define KC_TMB3 TD(TD_LOWER) // act as LOWER when hold, as KC_LANG2(=English) when tapped
  18. #define KC_TMB4 TD(TD_RAISE) // act as RAISE when hold, as KC_LANG1(=Japanese) when tapped
  19. #define KC_TMB5 KC_RC(BSPC)
  20. #define KC_TMB6 KC_RG(ENT)
  21. #define KC_TMB7 KC_RC(DEL)
  22. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  23. [_EDVORAK] = LAYOUT_kc(
  24. //|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
  25. GRV ,QUOT,COMM , DOT , Y , Q , F , G , R , W , P ,BSLS,
  26. //|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
  27. EQL , A ,LA(O),LG(E),LC(I), U , D ,RS(T),RG(N),RA(S), M ,MINS,
  28. //|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
  29. ESC ,SCLN, X , C , V , Z , H , J , K , L , B ,SLSH,
  30. //`----+----+-----+-----+-----+----+----| |----+----+-----+-----+-----+----+----'
  31. TMB1 ,TMB2,TMB3, TMB4,TMB5,TMB6
  32. // `-----+----+----' `----+----+-----'
  33. ),
  34. [_LOWER] = LAYOUT_kc(
  35. //|----+----+------+------+------+----| |----+------+------+-------+----+----|
  36. , , LCBR , LBRC , LPRN , , , RPRN , RBRC , RCBR , , ,
  37. //|----+----+------+------+------+----| |----+------+------+-------+----+----|
  38. F1 , F2 ,LA(F3),LG(F4),LC(F5), F6 , F7 ,RS(F8),RG(F9),RA(F10),F11 ,F12 ,
  39. //|----+----+------+------+------+----| |----+------+------+-------+----+----|
  40. PSCR, , HOME , PGDN , PGUP ,END , LEFT, DOWN , UP , RGHT , , ,
  41. //`----+----+------+------+------+----+----| |----+----+------+------+-------+----+----'
  42. , , NO , MAC ,TMB7,
  43. // `-----+----+----' `----+----+-----'
  44. ),
  45. [_RAISE] = LAYOUT_kc(
  46. //|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
  47. , ,EXLM , AT ,HASH ,DLR , PERC,CIRC ,AMPR ,ASTR , , ,
  48. //|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
  49. , 1 ,LA(2),LG(3),LC(4), 5 , 6 ,RS(7),RG(8),RA(9), 0 , ,
  50. //|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
  51. PSCR, ,HOME ,PGDN ,PGUP ,END , LEFT,DOWN , UP ,RGHT , , ,
  52. //`----+----+-----+-----+-----+----+----| |----+----+-----+-----+-----+----+----'
  53. , ,WIN , NO , ,
  54. // `-----+----+----' `----+----+----'
  55. )
  56. };
  57. #ifdef SSD1306OLED
  58. void matrix_init_keymap(void) {
  59. //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
  60. #ifdef MASTER_RIGHT
  61. iota_gfx_init(has_usb()); // turns on the display
  62. #else
  63. iota_gfx_init(!has_usb());
  64. #endif // MASTER_RIGHT
  65. }
  66. void matrix_scan_user(void) {
  67. iota_gfx_task(); // this is what updates the display continuously
  68. }
  69. #endif
  70. #ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT
  71. uint32_t layer_state_set_keymap(uint32_t state) {
  72. rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
  73. switch (biton32(state)) {
  74. case _LOWER:
  75. rgblight_sethsv_noeeprom_red();
  76. break;
  77. case _RAISE:
  78. rgblight_sethsv_noeeprom_green();
  79. break;
  80. default: // for any other layers, or the default layer
  81. rgblight_mode(RGBLIGHT_MODE_STATIC_GRADIENT + 3);
  82. rgblight_sethsv_red();
  83. break;
  84. }
  85. return state;
  86. }
  87. #endif