ein_60.c 4.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 AUDIO_ENABLE
  18. const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS] = {
  19. {30, 31, 32, 33, 34, 35, 35, 36, 37, 38, 39, 40, 41},
  20. {18, 19, 20, 21, 22, 23, 0, 25, 25, 26, 27, 28, 29},
  21. { 6, 7, 8, 9, 10, 11, 0, 12, 13, 14, 15, 16, 17},
  22. { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
  23. };
  24. #endif
  25. #ifdef OLED_ENABLE
  26. bool oled_task_kb(void) {
  27. if (!oled_task_user()) { return false; }
  28. // Host Keyboard Layer Status
  29. oled_write_P(PSTR("Layer: "), false);
  30. switch (get_highest_layer(layer_state)) {
  31. case 0:
  32. oled_write_P(PSTR("Default\n"), false);
  33. break;
  34. case 1:
  35. oled_write_P(PSTR("Lower\n"), false);
  36. break;
  37. case 2:
  38. oled_write_P(PSTR("Raise\n"), false);
  39. break;
  40. case 3:
  41. oled_write_P(PSTR("Adjust\n"), false);
  42. break;
  43. case 4:
  44. oled_write_P(PSTR("FN\n"), false);
  45. break;
  46. default:
  47. // Or use the write_ln shortcut over adding '\n' to the end of your string
  48. oled_write_ln_P(PSTR("Undefined"), false);
  49. }
  50. // Host Keyboard LED Status
  51. led_t led_state = host_keyboard_led_state();
  52. oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
  53. oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
  54. oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
  55. oled_set_cursor(1,2);
  56. oled_advance_page(true);
  57. static const char PROGMEM ein60_logo[] = {
  58. 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,
  59. 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,
  60. 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,
  61. 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,
  62. };
  63. oled_write_raw_P(ein60_logo, sizeof(ein60_logo));
  64. return false;
  65. }
  66. #endif
  67. #ifdef ENCODER_ENABLE
  68. bool encoder_update_kb(uint8_t index, bool clockwise) {
  69. if (!encoder_update_user(index, clockwise)) { return false; }
  70. if (index == 0) { /* First encoder */
  71. if (clockwise) {
  72. tap_code_delay(KC_VOLU, 10);
  73. } else {
  74. tap_code_delay(KC_VOLD, 10);
  75. }
  76. } else if (index == 1) { /* Second encoder */
  77. if (clockwise) {
  78. tap_code(KC_DOWN);
  79. } else {
  80. tap_code(KC_UP);
  81. }
  82. }
  83. return true;
  84. }
  85. #endif