logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

um80.c (4986B)


  1. /* Copyright 2021 duoshock
  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. #ifndef WPM_ENABLE
  18. # define get_current_wpm() 0
  19. #endif
  20. #ifdef OLED_ENABLE
  21. void suspend_power_down_kb(void) {
  22. oled_off();
  23. suspend_power_down_user();
  24. }
  25. oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
  26. if (is_keyboard_master()) {
  27. return OLED_ROTATION_90;
  28. }
  29. return rotation;
  30. }
  31. //UM-80 logo
  32. static void render_logo(void) {
  33. static const char PROGMEM raw_logo[] = {
  34. 0,0,0,0,0,0,0,0,0,0,128,192,192,224,224,224,224,224,224,224,224,224,224,224,224,224,224,192,192,128,128,192,
  35. 192,224,224,224,224,224,224,224,224,192,192,128,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,
  36. 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,
  37. 0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,15,3,1,0,1,255,255,255,
  38. 255,255,255,255,255,255,255,255,255,255,255,254,252,240,0,0,0,0,0,0,0,0,0,254,254,254,0,0,0,0,0,0,254,254,254,
  39. 0,0,0,254,254,254,252,248,224,192,128,224,248,252,254,254,254,0,0,128,128,128,128,128,128,0,0,0,120,252,254,206,
  40. 206,206,206,254,124,120,0,0,240,248,252,62,30,14,14,30,62,252,248,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,
  41. 255,255,255,255,255,255,255,255,255,255,255,255,255,255,240,192,128,0,128,255,255,255,255,255,255,255,255,255,255,
  42. 255,255,255,255,127,63,15,0,0,0,0,0,0,0,0,0,15,63,63,124,112,112,112,112,124,63,63,15,0,0,0,127,127,127,0,1,7,15,
  43. 15,7,1,0,127,127,127,0,0,3,3,3,3,3,3,1,0,30,63,127,123,113,113,113,123,127,63,30,0,0,15,31,63,124,120,112,112,120,
  44. 124,63,31,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,3,1,1,3,3,7,7,7,7,7,7,7,7,3,3,1,
  45. 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,
  46. 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
  47. };
  48. oled_write_raw_P(raw_logo, sizeof(raw_logo));
  49. }
  50. // 32 * 18 Merge logo
  51. static const char PROGMEM merge_logo[] = {
  52. 0xf8, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x0e,
  53. 0x06, 0x04, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfc, 0xf8, 0xf0, 0xc0,
  54. 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xc0,
  55. 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x3f, 0x0f,
  56. 0x00, 0x01, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01,
  57. 0x01, 0x00, 0x01, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00
  58. };
  59. static void print_status_narrow(void) {
  60. oled_set_cursor(0,1);
  61. oled_write_raw_P(merge_logo, sizeof(merge_logo));
  62. oled_set_cursor(0,5);
  63. oled_write_P(PSTR("-----"), false);
  64. oled_set_cursor(0,6);
  65. oled_write_P(PSTR("LYR "), false);
  66. switch (get_highest_layer(layer_state)) {
  67. case 0:
  68. oled_write_P(PSTR("0"), false);
  69. break;
  70. case 1:
  71. oled_write_P(PSTR("1"), false);
  72. break;
  73. case 2:
  74. oled_write_P(PSTR("2"), false);
  75. break;
  76. case 3:
  77. oled_write_P(PSTR("3"), false);
  78. break;
  79. default:
  80. oled_write_ln_P(PSTR("Undef"), false);
  81. }
  82. led_t led_usb_state = host_keyboard_led_state();
  83. oled_write_ln_P(PSTR(" "), false);
  84. oled_write_P(PSTR("CAP "), false);
  85. oled_write_P(PSTR("."), led_usb_state.caps_lock);
  86. oled_write_P(PSTR("NUM "), false);
  87. oled_write_P(PSTR("."), led_usb_state.num_lock);
  88. oled_write_P(PSTR("SCR "), false);
  89. oled_write_P(PSTR("."), led_usb_state.scroll_lock);
  90. //oled_write_ln_P(PSTR(" "), false);
  91. oled_write_P(PSTR("-----"), false);
  92. // WPM counter Start
  93. oled_set_cursor(0,13);
  94. oled_write(" ", false);
  95. oled_write(get_u8_str(get_current_wpm(), '0'), false);
  96. oled_set_cursor(0,14);
  97. oled_write(" WPM ", false);
  98. // WPM counter End
  99. }
  100. bool oled_task_kb(void) {
  101. if (!oled_task_user()) { return false; }
  102. if (is_keyboard_master()) {
  103. print_status_narrow();
  104. //render_logo();
  105. } else {
  106. render_logo();
  107. //print_status_narrow();
  108. }
  109. return false;
  110. }
  111. #endif