logo

qmk_firmware

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

franky36.c (2096B)


  1. /* Copyright 2024-2025 Grigory Avdyushin
  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 QMK_KEYBOARD_H
  17. #ifdef OLED_ENABLE
  18. static void render_logo(void) {
  19. static const char PROGMEM qmk_logo[] = {
  20. 0x80, 0x81, 0x82, 0x83, 0x84,
  21. 0xA0, 0xA1, 0xA2, 0xA3, 0xA4,
  22. 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0x00, 0x0A, 0x0A
  23. };
  24. oled_write_P(qmk_logo, false);
  25. }
  26. static void render_mod_status(uint8_t modifiers) {
  27. oled_write_P(PSTR("MODS:"), false);
  28. oled_write_P(PSTR("S"), (modifiers & MOD_MASK_SHIFT));
  29. oled_write_P(PSTR("C"), (modifiers & MOD_MASK_CTRL));
  30. oled_write_P(PSTR("A"), (modifiers & MOD_MASK_ALT));
  31. oled_write_ln_P(PSTR("G"), (modifiers & MOD_MASK_GUI));
  32. oled_write_ln_P(PSTR(" "), false);
  33. }
  34. static void render_layer_state(void) {
  35. oled_write_ln_P(PSTR(" "), false);
  36. oled_write_P("BASE ", layer_state_is(0));
  37. oled_write_P("LOWER", layer_state_is(1));
  38. oled_write_P("RAISE", layer_state_is(2));
  39. oled_write_P("NAV ", layer_state_is(3));
  40. oled_write_ln_P(PSTR(" "), false);
  41. }
  42. static void render_capsword_state(bool on) {
  43. oled_write_ln_P("CAPSW", on);
  44. }
  45. oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
  46. return OLED_ROTATION_270;
  47. }
  48. bool oled_task_kb(void) {
  49. if (!oled_task_user()) {
  50. return false;
  51. }
  52. render_logo();
  53. render_layer_state();
  54. render_mod_status(get_mods() | get_oneshot_mods());
  55. render_capsword_state(is_caps_word_on());
  56. return false;
  57. }
  58. #endif