logo

qmk_firmware

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

mini36.c (3986B)


  1. /*
  2. * Copyright 2022 Kevin Gee <info@controller.works>
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #include "quantum.h"
  18. #ifdef OLED_ENABLE
  19. static void render_logo(void) {
  20. static const char PROGMEM raw_logo[] = {
  21. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6,134,230,126, 30, 6, 0, 0, 0, 0, 0,128,192, 96, 56, 28, 6, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  22. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,248,252, 6, 3, 3, 3, 3, 7,254,252, 6, 3, 3, 3, 3, 6,252,248, 0, 0, 0, 0, 0, 0,255,255, 0, 0, 0, 0, 0, 0,248,252, 6, 3, 3, 3, 3, 3, 3, 6,252,248, 0, 0, 0, 0, 0, 0,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 31, 27, 24, 48,224,192, 0, 0,240,252, 62, 27, 25, 24, 24, 24, 24, 48,224,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  23. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,127,127, 0, 0, 0, 0, 0, 0,127,127, 0, 0, 0, 0, 0, 0,127,127, 0, 0, 0, 0, 0, 0,127,127, 0, 0, 0, 0, 0, 0,127,127, 0, 0, 0, 0, 0, 0, 0, 0,127,127, 0, 0, 0, 0, 0, 0,127,127, 0, 0, 0, 0, 0, 12, 24, 48, 96, 96, 96, 96, 96, 96, 48, 31, 15, 0, 0, 15, 31, 48, 96, 96, 96, 96, 96, 96, 48, 31, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  24. };
  25. oled_write_raw_P(raw_logo, sizeof(raw_logo));
  26. }
  27. oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
  28. if (!is_keyboard_master()) {
  29. return OLED_ROTATION_180; // flips the display 180 degrees if offhand
  30. }
  31. return rotation;
  32. }
  33. bool render_status(void) {
  34. // Host Keyboard Layer Status
  35. oled_write_P(PSTR("Layer: "), false);
  36. switch (get_highest_layer(layer_state)) {
  37. case 0:
  38. oled_write_P(PSTR("BASE\n"), false);
  39. break;
  40. case 1:
  41. oled_write_P(PSTR("LOWER\n"), false);
  42. break;
  43. case 2:
  44. oled_write_P(PSTR("RAISE\n"), false);
  45. break;
  46. case 3:
  47. oled_write_P(PSTR("ADJUST\n"), false);
  48. break;
  49. default:
  50. // Or use the write_ln shortcut over adding '\n' to the end of your string
  51. oled_write_ln_P(PSTR("Undefined"), false);
  52. }
  53. // Host Keyboard LED Status
  54. led_t led_state = host_keyboard_led_state();
  55. oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
  56. oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
  57. oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
  58. return false;
  59. }
  60. bool oled_task_kb(void) {
  61. if (!oled_task_user()) {
  62. return false;
  63. }
  64. if (is_keyboard_master()) {
  65. render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
  66. } else {
  67. render_logo(); // Renders a static logo
  68. oled_scroll_left(); // Turns on scrolling
  69. }
  70. return false;
  71. }
  72. #endif