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.

223 lines
15 KiB

  1. /* Copyright 2020 Pylon
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 3 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include QMK_KEYBOARD_H
  17. /* Due to how the matrix is setup - the right split backspace key is, for firmware purposes the key to the right of up arrow, which on the actual keyboard is a blocker*/
  18. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  19. [0] = LAYOUT_all(
  20. KC_MUTE, KC_F13 , KC_F14 , KC_F15 , KC_F16 , KC_F17 , KC_F18 , KC_F19 , KC_F20 , KC_F21 , KC_F22 , KC_F23 , KC_F24 , KC_MPRV, KC_MPLY, KC_MNXT , KC_INS , KC_HOME, KC_PGUP,
  21. KC_ESC , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , KC_PSCR, KC_SLCK, KC_PAUSE, KC_DEL , KC_END , KC_PGDN,
  22. KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_MINS, KC_EQL , KC_BSPC, KC_BSPC, KC_CALC, KC_NLCK , KC_PSLS, KC_PAST, KC_PMNS,
  23. KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_LBRC, KC_RBRC, KC_BSLS, RGB_TOG, KC_P7 , KC_P8 , KC_P9 , KC_PEQL,
  24. KC_CAPS, KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, KC_ENT , KC_ENT , KC_MSEL, KC_P4 , KC_P5 , KC_P6 , KC_PPLS,
  25. KC_LSFT, KC_BSLS, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSFT, KC_UP , KC_P1 , KC_P2 , KC_P3 , KC_PENT,
  26. KC_LCTL, KC_LGUI, KC_LALT, KC_SPC , KC_SPC , KC_SPC , KC_RALT, KC_APP , KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0 , KC_P0 , KC_PDOT
  27. ),
  28. [1] = LAYOUT_all(
  29. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  30. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  31. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______, _______ , _______, _______, _______,
  32. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  33. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  34. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______ , _______, _______, _______,
  35. _______,_______,_______ , _______ ,_______ ,_______ , _______ ,_______ ,_______ , _______, _______, _______, _______ , _______, _______
  36. ),
  37. [2] = LAYOUT_all(
  38. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  39. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  40. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______, _______ , _______, _______, _______,
  41. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  42. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  43. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______ , _______, _______, _______,
  44. _______,_______,_______ , _______ ,_______ ,_______ , _______ ,_______ ,_______ , _______, _______, _______, _______ , _______, _______
  45. ),
  46. [3] = LAYOUT_all(
  47. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  48. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  49. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______, _______ , _______, _______, _______,
  50. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  51. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  52. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______ , _______, _______, _______,
  53. _______,_______,_______ , _______ ,_______ ,_______ , _______ ,_______ ,_______ , _______, _______, _______, _______ , _______, _______
  54. ),
  55. [4] = LAYOUT_all(
  56. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  57. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  58. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______, _______ , _______, _______, _______,
  59. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  60. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  61. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______ , _______, _______, _______,
  62. _______,_______,_______ , _______ ,_______ ,_______ , _______ ,_______ ,_______ , _______, _______, _______, _______ , _______, _______
  63. ),
  64. [5] = LAYOUT_all(
  65. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  66. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  67. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______, _______ , _______, _______, _______,
  68. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  69. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  70. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______ , _______, _______, _______,
  71. _______,_______,_______ , _______ ,_______ ,_______ , _______ ,_______ ,_______ , _______, _______, _______, _______ , _______, _______
  72. ),
  73. [6] = LAYOUT_all(
  74. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  75. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  76. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______, _______ , _______, _______, _______,
  77. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  78. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  79. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______ , _______, _______, _______,
  80. _______,_______,_______ , _______ ,_______ ,_______ , _______ ,_______ ,_______ , _______, _______, _______, _______ , _______, _______
  81. ),
  82. [7] = LAYOUT_all(
  83. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  84. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  85. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______, _______ , _______, _______, _______,
  86. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  87. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______, _______ , _______, _______, _______,
  88. _______,_______,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______, _______ , _______, _______, _______,
  89. _______,_______,_______ , _______ ,_______ ,_______ , _______ ,_______ ,_______ , _______, _______, _______, _______ , _______, _______
  90. ),
  91. };
  92. uint8_t go_to_layer = 0; /* Used for the layer changing code for the encoder below */
  93. void encoder_update_user(uint8_t index, bool clockwise) {
  94. if (matrix_is_on(6, 10)) { /* Use the knob to change layers when holding down Menu key. Unfortunately using layers to initiate this behavior is not possible. */
  95. if (clockwise) {
  96. layer_off(go_to_layer);
  97. if(go_to_layer<7) {
  98. go_to_layer++;
  99. }
  100. else {
  101. go_to_layer=0;
  102. }
  103. layer_on(go_to_layer);
  104. }
  105. else {
  106. layer_off(go_to_layer);
  107. /* update go_to_layer*/
  108. if(go_to_layer>0) {
  109. go_to_layer--;
  110. }
  111. else {
  112. go_to_layer=7;
  113. }
  114. layer_on(go_to_layer);
  115. }
  116. }
  117. else { /* normal operation as volume knob */
  118. if (clockwise) {
  119. tap_code(KC_VOLU);
  120. }
  121. else {
  122. tap_code(KC_VOLD);
  123. }
  124. }
  125. }
  126. /*Default layer is white.*/
  127. /*Remember to also change the color in keyboard_post_init_kb in boston.c to make the startup color match the layer 0 color */
  128. const rgblight_segment_t PROGMEM layer_0[] = RGBLIGHT_LAYER_SEGMENTS(
  129. {0, 4, 0, 0, 128} /*White*/
  130. );
  131. const rgblight_segment_t PROGMEM layer_1[] = RGBLIGHT_LAYER_SEGMENTS(
  132. {0, 4, 0, 255, 128} /*Red*/
  133. );
  134. const rgblight_segment_t PROGMEM layer_2[] = RGBLIGHT_LAYER_SEGMENTS(
  135. {0, 4, 21, 255, 128} /*Orange*/
  136. );
  137. const rgblight_segment_t PROGMEM layer_3[] = RGBLIGHT_LAYER_SEGMENTS(
  138. {0, 4, 43, 255, 128} /*Yellow*/
  139. );
  140. const rgblight_segment_t PROGMEM layer_4[] = RGBLIGHT_LAYER_SEGMENTS(
  141. {0, 4, 75, 255, 128} /*Green*/
  142. );
  143. const rgblight_segment_t PROGMEM layer_5[] = RGBLIGHT_LAYER_SEGMENTS(
  144. {0, 4, 135, 255, 128} /*Teal*/
  145. );
  146. const rgblight_segment_t PROGMEM layer_6[] = RGBLIGHT_LAYER_SEGMENTS(
  147. {0, 4, 160, 255, 128} /*Blue*/
  148. );
  149. const rgblight_segment_t PROGMEM layer_7[] = RGBLIGHT_LAYER_SEGMENTS(
  150. {0, 4, 190, 255, 128} /*Magenta*/
  151. );
  152. const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
  153. layer_0,
  154. layer_1,
  155. layer_2,
  156. layer_3,
  157. layer_4,
  158. layer_5,
  159. layer_6,
  160. layer_7
  161. );
  162. void keyboard_post_init_user(void) {
  163. // Enable the LED layers
  164. rgblight_layers = my_rgb_layers;
  165. }
  166. layer_state_t layer_state_set_user(layer_state_t state) {
  167. // Both layers will light up if both kb layers are active
  168. rgblight_set_layer_state(0, layer_state_cmp(state, 0));
  169. rgblight_set_layer_state(1, layer_state_cmp(state, 1));
  170. rgblight_set_layer_state(2, layer_state_cmp(state, 2));
  171. rgblight_set_layer_state(3, layer_state_cmp(state, 3));
  172. rgblight_set_layer_state(4, layer_state_cmp(state, 4));
  173. rgblight_set_layer_state(5, layer_state_cmp(state, 5));
  174. rgblight_set_layer_state(6, layer_state_cmp(state, 6));
  175. rgblight_set_layer_state(7, layer_state_cmp(state, 7));
  176. return state;
  177. }
  178. bool led_update_user(led_t led_state) {
  179. rgblight_set_layer_state(0, true);
  180. return true;
  181. }