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.

176 lines
9.1 KiB

  1. /**
  2. * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #include "drashna.h"
  18. // clang-format off
  19. #define LAYOUT_split_3x5_2_wrapper(...) LAYOUT_split_3x5_2(__VA_ARGS__)
  20. #define LAYOUT_split_3x5_2_base( \
  21. K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
  22. K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
  23. K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
  24. ) \
  25. LAYOUT_split_3x5_2 ( \
  26. K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
  27. ALT_T(K11), K12, K13, K14, GUI_T(K15), LGUI_T(K16), K17, K18, K19, LALT_T(K1A), \
  28. CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), \
  29. KC_SPC, BK_LWER, DL_RAIS, RSFT_T(KC_ENT) \
  30. )
  31. #define LAYOUT_split_3x5_2_base_wrapper(...) LAYOUT_split_3x5_2_base(__VA_ARGS__)
  32. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  33. [_DEFAULT_LAYER_1] = LAYOUT_split_3x5_2_base_wrapper(
  34. _________________QWERTY_L1_________________, _________________QWERTY_R1_________________,
  35. _________________QWERTY_L2_________________, _________________QWERTY_R2_________________,
  36. _________________QWERTY_L3_________________, _________________QWERTY_R3_________________
  37. ),
  38. [_DEFAULT_LAYER_2] = LAYOUT_split_3x5_2_base_wrapper(
  39. ______________COLEMAK_MOD_DH_L1____________, ______________COLEMAK_MOD_DH_R1____________,
  40. ______________COLEMAK_MOD_DH_L2____________, ______________COLEMAK_MOD_DH_R2____________,
  41. ______________COLEMAK_MOD_DH_L3____________, ______________COLEMAK_MOD_DH_R3____________
  42. ),
  43. [_DEFAULT_LAYER_3] = LAYOUT_split_3x5_2_base_wrapper(
  44. _________________COLEMAK_L1________________, _________________COLEMAK_R1________________,
  45. _________________COLEMAK_L2________________, _________________COLEMAK_R2________________,
  46. _________________COLEMAK_L3________________, _________________COLEMAK_R3________________
  47. ),
  48. [_DEFAULT_LAYER_4] = LAYOUT_split_3x5_2_base_wrapper(
  49. _________________DVORAK_L1_________________, _________________DVORAK_R1_________________,
  50. _________________DVORAK_L2_________________, _________________DVORAK_R2_________________,
  51. _________________DVORAK_L3_________________, _________________DVORAK_R3_________________
  52. ),
  53. [_MOUSE] = LAYOUT_split_3x5_2(
  54. _______, _______, _______, _______, _______, KC_WH_U, DPI_RMOD,DPI_MOD, S_D_RMOD,S_D_MOD,
  55. _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6,
  56. _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______,
  57. SNIPING, _______, _______, _______
  58. ),
  59. [_LOWER] = LAYOUT_split_3x5_2_wrapper(
  60. _________________LOWER_L1__________________, _________________LOWER_R1__________________,
  61. _________________LOWER_L2__________________, _________________LOWER_R2__________________,
  62. _________________LOWER_L3__________________, _________________LOWER_R3__________________,
  63. _______, _______, _______, AUTO_CTN
  64. ),
  65. [_RAISE] = LAYOUT_split_3x5_2_wrapper(
  66. _________________RAISE_L1__________________, _________________RAISE_R1__________________,
  67. _________________RAISE_L2__________________, _________________RAISE_R2__________________,
  68. _________________RAISE_L3__________________, _________________RAISE_R3__________________,
  69. _______, _______, _______, _______
  70. ),
  71. [_ADJUST] = LAYOUT_split_3x5_2_wrapper(
  72. _________________ADJUST_L1_________________, _________________ADJUST_R1_________________,
  73. _________________ADJUST_L2_________________, _________________ADJUST_R2_________________,
  74. _________________ADJUST_L3_________________, _________________ADJUST_R3_________________,
  75. KC_NUKE, _______, _______, QK_BOOT
  76. ),
  77. };
  78. #if defined(OLED_ENABLE) && defined(OLED_DISPLAY_128X128)
  79. # ifdef UNICODE_COMMON_ENABLE
  80. # include "process_unicode_common.h"
  81. # include "keyrecords/unicode.h"
  82. # endif
  83. extern const char PROGMEM display_border[3];
  84. extern bool is_oled_enabled;
  85. bool oled_task_keymap(void) {
  86. static const char PROGMEM header_image[] = {
  87. 0, 192, 32, 16, 8, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 7, 15, 31, 63, 127, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 63, 31, 15, 7, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 8, 16, 32, 192, 0,
  88. // 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 7, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 7, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 0
  89. };
  90. oled_write_raw_P(header_image, sizeof(header_image));
  91. oled_set_cursor(7, 0);
  92. oled_write_P(PSTR("Dilemma"), true);
  93. render_default_layer_state(1, 1);
  94. render_layer_state(1, 2);
  95. render_kitty(0, 5);
  96. render_wpm(1, 7, 5);
  97. # if defined(POINTING_DEVICE_ENABLE)
  98. render_pointing_dpi_status(dilemma_get_pointer_sniping_enabled() ? dilemma_get_pointer_sniping_dpi() : dilemma_get_pointer_default_dpi(), 1, 7, 6);
  99. render_mouse_mode(17, 6);
  100. # elif defined(WPM_ENABLE) && defined(DEBUG_MATRIX_SCAN_RATE)
  101. render_matrix_scan_rate(1, 7, 6);
  102. # endif
  103. render_bootmagic_status(7, 7);
  104. render_user_status(1, 9);
  105. render_mod_status(get_mods() | get_oneshot_mods(), 1, 10);
  106. render_keylock_status(host_keyboard_led_state(), 1, 11);
  107. render_unicode_mode(1, 12);
  108. // render_rgb_hsv(1, 13);
  109. oled_set_cursor(1, 13);
  110. oled_write_P(PSTR("OS: "), false);
  111. extern os_variant_t os_type;
  112. switch (os_type) {
  113. case OS_LINUX:
  114. oled_write_ln_P(PSTR("Linux"), false);
  115. break;
  116. case OS_WINDOWS:
  117. oled_write_ln_P(PSTR("Windows"), false);
  118. break;
  119. case OS_MACOS:
  120. oled_write_ln_P(PSTR("MacOS"), false);
  121. break;
  122. case OS_IOS:
  123. oled_write_ln_P(PSTR("iOS"), false);
  124. break;
  125. default:
  126. break;
  127. }
  128. render_keylogger_status(1, 14);
  129. for (uint8_t i = 1; i < 15; i++) {
  130. oled_set_cursor(0, i);
  131. oled_write_raw_P(display_border, sizeof(display_border));
  132. oled_set_cursor(21, i);
  133. oled_write_raw_P(display_border, sizeof(display_border));
  134. }
  135. static const char PROGMEM footer_image[] = {0, 3, 4, 8, 16, 32, 64, 128, 128, 128, 128, 128, 128, 128, 192, 224, 240, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 240, 224, 192, 128, 128, 128, 128, 128, 128, 128, 64, 32, 16, 8, 4, 3, 0};
  136. oled_set_cursor(0, 15);
  137. oled_write_raw_P(footer_image, sizeof(footer_image));
  138. return false;
  139. }
  140. #endif
  141. #ifdef SWAP_HANDS_ENABLE
  142. const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
  143. /* Left hand, matrix positions */
  144. {{0, 4}, {3, 4}, {2, 4}, {5, 4}, {4, 4}},
  145. {{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}},
  146. {{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}},
  147. {{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}},
  148. /* Right hand, matrix positions */
  149. {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}},
  150. {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}},
  151. {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}},
  152. {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}},
  153. };
  154. #endif