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.

123 lines
6.4 KiB

  1. /* Copyright 2021 klackygears
  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 2 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 "quantum.h"
  17. #ifdef RGB_MATRIX_ENABLE
  18. // Logical Layout
  19. // Columns
  20. // 0 1 2 3 4 5 6 7 8 9 10 11 12 13
  21. // ROWS
  22. // 37 0 1 2 3 4 5 6 7 8 9 10 11 12 0
  23. // 36 13 1
  24. // 35 14 2
  25. // 34 15 3
  26. // 33 16 3
  27. // 32 17 4
  28. // 31 30 29 28 27 26 25 24 23 22 21 20 19 18 5
  29. led_config_t g_led_config = { {
  30. { 36, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 13 },
  31. { 34, 1, 2, 3, 4, 5, NO_LED, 6, 7, 8, 9, 10, 15 },
  32. { 33, 30, 29, 28, 27, 26, NO_LED, 23, 22, 21, 20, 19, 16 },
  33. { 32, 30, 29, 28, 27, 26, 24, 23, 22, 21, 20, 19, 17 }
  34. }, {
  35. { 30, 0 }, { 45, 0 }, { 60, 0 }, { 75, 0 }, { 90, 0 }, { 105, 0 }, { 119, 0 }, { 134, 0 }, { 149, 0 }, { 164, 0 }, { 179, 0 }, { 194, 0 }, { 209, 0 }, { 224, 11 },
  36. { 224, 21 }, { 224, 32 }, { 224, 43 }, { 224, 53 }, { 209, 64 }, { 194, 64 }, { 179, 64 }, { 164, 64 }, { 149, 64 }, { 134, 64 }, { 119, 64 }, { 105, 64 }, { 90, 64 },
  37. { 75, 64 }, { 60, 64 }, { 45, 64 }, { 30, 64 }, { 15, 64 }, { 0, 53 }, { 0, 43 }, { 0, 32 }, { 0, 21 }, { 0, 11 }, { 15, 0 },
  38. }, {
  39. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  40. 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  41. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  42. 1, 2,
  43. } };
  44. #endif
  45. #ifdef AUDIO_ENABLE
  46. const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS] = {
  47. {30, 31, 32, 33, 34, 35, 35, 36, 37, 38, 39, 40, 41},
  48. {18, 19, 20, 21, 22, 23, 0, 25, 25, 26, 27, 28, 29},
  49. { 6, 7, 8, 9, 10, 11, 0, 12, 13, 14, 15, 16, 17},
  50. { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
  51. };
  52. #endif
  53. #ifdef OLED_ENABLE
  54. bool oled_task_kb(void) {
  55. if (!oled_task_user()) { return false; }
  56. // Host Keyboard Layer Status
  57. oled_write_P(PSTR("Layer: "), false);
  58. switch (get_highest_layer(layer_state)) {
  59. case 0:
  60. oled_write_P(PSTR("Default\n"), false);
  61. break;
  62. case 1:
  63. oled_write_P(PSTR("Lower\n"), false);
  64. break;
  65. case 2:
  66. oled_write_P(PSTR("Raise\n"), false);
  67. break;
  68. case 3:
  69. oled_write_P(PSTR("Adjust\n"), false);
  70. break;
  71. case 4:
  72. oled_write_P(PSTR("FN\n"), false);
  73. break;
  74. default:
  75. // Or use the write_ln shortcut over adding '\n' to the end of your string
  76. oled_write_ln_P(PSTR("Undefined"), false);
  77. }
  78. // Host Keyboard LED Status
  79. led_t led_state = host_keyboard_led_state();
  80. oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
  81. oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
  82. oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
  83. oled_set_cursor(1,2);
  84. oled_advance_page(true);
  85. static const char PROGMEM ein60_logo[] = {
  86. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  87. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255, 11,251,139,139,139,139,139,139,139,139,139,139,139, 11, 15, 0,240,240, 16,240, 0,240,240, 16,240,224,192,128, 0, 0, 0, 0,240, 16,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,254,255, 11,251,139,139,139,139,139,139,139,139,139,139,139,143,128, 0, 0, 0, 0,254,255, 11,251, 11, 11, 11, 11,139,203,235,123,187,219,235,251,255, 7,252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  88. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255, 4,253,197,197,197,197,197,197,197,197,197,197,199,192,192, 0,255,255, 0,255, 0,255,255, 0,254, 13, 27, 55,111,222,188,120,255, 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255, 0,255,197,197,197,197,197,197,197,197,197,197,253,253,255,131,254, 0, 0,255,255, 0,255,184,220,238,247,219,205,198,195,193,192,255,255,255,128,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  89. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 0, 3, 3, 2, 3, 0, 3, 3, 2, 3, 0, 0, 0, 0, 0, 1, 3, 2, 2, 3, 0, 8, 28, 20, 20, 20, 20, 20, 28, 8, 0, 1, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 0, 0, 0, 1, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  90. };
  91. oled_write_raw_P(ein60_logo, sizeof(ein60_logo));
  92. return false;
  93. }
  94. #endif
  95. #ifdef ENCODER_ENABLE
  96. bool encoder_update_kb(uint8_t index, bool clockwise) {
  97. if (!encoder_update_user(index, clockwise)) { return false; }
  98. if (index == 0) { /* First encoder */
  99. if (clockwise) {
  100. tap_code_delay(KC_VOLU, 10);
  101. } else {
  102. tap_code_delay(KC_VOLD, 10);
  103. }
  104. } else if (index == 1) { /* Second encoder */
  105. if (clockwise) {
  106. tap_code(KC_DOWN);
  107. } else {
  108. tap_code(KC_UP);
  109. }
  110. }
  111. return true;
  112. }
  113. #endif