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.

83 lines
2.6 KiB

  1. /* Copyright 2020 Josef Adamcik
  2. * Modification for VIA support and RGB underglow by Jens Bonk-Wiltfang
  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. //Sets up what the OLED screens display.
  18. #ifdef OLED_DRIVER_ENABLE
  19. static void render_logo(void) {
  20. static const char PROGMEM qmk_logo[] = {
  21. 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
  22. 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
  23. 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0
  24. };
  25. oled_write_P(qmk_logo, false);
  26. }
  27. static void print_status_narrow(void) {
  28. // Print current mode
  29. oled_write_P(PSTR("\n\n"), false);
  30. switch (get_highest_layer(layer_state)) {
  31. case 0:
  32. oled_write_ln_P(PSTR("Qwrt"), false);
  33. break;
  34. case 1:
  35. oled_write_ln_P(PSTR("Clmk"), false);
  36. break;
  37. default:
  38. oled_write_P(PSTR("Mod\n"), false);
  39. break;
  40. }
  41. oled_write_P(PSTR("\n\n"), false);
  42. // Print current layer
  43. oled_write_ln_P(PSTR("LAYER"), false);
  44. switch (get_highest_layer(layer_state)) {
  45. case 0:
  46. case 1:
  47. oled_write_P(PSTR("Base\n"), false);
  48. break;
  49. case 2:
  50. oled_write_P(PSTR("Raise"), false);
  51. break;
  52. case 3:
  53. oled_write_P(PSTR("Lower"), false);
  54. break;
  55. default:
  56. oled_write_ln_P(PSTR("Undef"), false);
  57. }
  58. oled_write_P(PSTR("\n\n"), false);
  59. led_t led_usb_state = host_keyboard_led_state();
  60. oled_write_ln_P(PSTR("CPSLK"), led_usb_state.caps_lock);
  61. }
  62. oled_rotation_t oled_init_user(oled_rotation_t rotation) {
  63. if (is_keyboard_master()) {
  64. return OLED_ROTATION_270;
  65. }
  66. return rotation;
  67. }
  68. void oled_task_user(void) {
  69. if (is_keyboard_master()) {
  70. print_status_narrow();
  71. } else {
  72. render_logo();
  73. }
  74. }
  75. #endif