logo

qmk_firmware

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

oled_helper.c (1080B)


  1. #include "oled_helper.h"
  2. #include "oled_driver.h"
  3. #include <stdio.h>
  4. #include <string.h>
  5. #ifdef OLED_ENABLE
  6. // returns character cord of the logo by line number
  7. char *read_logo(int row) {
  8. static char logoLines[][18] = {
  9. { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0},
  10. { 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0},
  11. { 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0},
  12. { 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0}
  13. };
  14. return logoLines[row];
  15. }
  16. void render_row(int row, const char* status) {
  17. // reset cursor position
  18. oled_set_cursor(0, row);
  19. // read logo charcode
  20. char * logoLine = read_logo(row);
  21. // copy logo into buffer
  22. char writeLine[22];
  23. strcpy(writeLine, logoLine);
  24. // combine status string with logo
  25. strcat(writeLine, status);
  26. // write the line to OLED
  27. oled_write(writeLine, false);
  28. }
  29. #endif