logo

qmk_firmware

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

uma.c (5479B)


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