logo

qmk_firmware

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

equals.c (1489B)


  1. // Copyright 2023 @boardsource
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "quantum.h"
  4. #ifdef QUANTUM_PAINTER_ENABLE
  5. #include "qp.h"
  6. #include "qp_st7735.h"
  7. #include "graphics/thintel15.qff.c"
  8. static painter_device_t oled;
  9. static painter_font_handle_t font;
  10. __attribute__((weak)) void ui_init(void) {
  11. oled = qp_st7735_make_spi_device(128, 160, OLED_CS_PIN, OLED_DC_PIN, OLED_RST_PIN, 8, 0);
  12. font = qp_load_font_mem(font_thintel15);
  13. qp_init(oled, QP_ROTATION_0);
  14. qp_rect(oled, 0, 0, 130, 162, 0, 0, 0, true);
  15. qp_rect(oled, 20, 20, 108, 60, 55, 55, 55, true);
  16. qp_rect(oled, 20, 80, 108, 120, 55, 55, 55, true);
  17. qp_flush(oled);
  18. }
  19. __attribute__((weak)) void ui_task(void) {
  20. static const char *text = "Layer:";
  21. int16_t width = qp_textwidth(font, text);
  22. qp_drawtext(oled, 20, 140, font, text);
  23. switch (get_highest_layer(layer_state)) {
  24. case 0:
  25. qp_drawtext(oled, (20 + width), 140, font, "QWERTY");
  26. break;
  27. case 1:
  28. qp_drawtext(oled, (20 + width), 140, font, "SYMBOL");
  29. break;
  30. case 2:
  31. qp_drawtext(oled, (20 + width), 140, font, "NUMBER");
  32. break;
  33. default:
  34. qp_drawtext(oled, (20 + width), 140, font, "_PANIC_");
  35. break;
  36. }
  37. }
  38. void keyboard_post_init_kb(void) {
  39. ui_init();
  40. keyboard_post_init_user();
  41. }
  42. void housekeeping_task_kb(void) {
  43. ui_task();
  44. }
  45. #endif // QUANTUM_PAINTER_ENABLE