aboutsummaryrefslogtreecommitdiffstats
path: root/keyboards/palette1202/lib/oled_helper.c
diff options
context:
space:
mode:
authorTakashi Shibusawa <futurabodoni@gmail.com>2020-03-10 17:38:37 +0900
committerGitHub <noreply@github.com>2020-03-10 01:38:37 -0700
commit20a0fa9209756288b014f65671bcaab12a028229 (patch)
treeca4aeb513bb1a652584b37e0e0d02d39b882e29b /keyboards/palette1202/lib/oled_helper.c
parent2d14d12c7409e8de3f8d465635be115e06ba26f7 (diff)
downloadfirmware-20a0fa9209756288b014f65671bcaab12a028229.tar.gz
firmware-20a0fa9209756288b014f65671bcaab12a028229.tar.bz2
firmware-20a0fa9209756288b014f65671bcaab12a028229.zip
[Keyboard] Palette1202 (#7736)
* added Palette1202 * removed currently unused cords * Update keyboards/palette1202/config.h Co-Authored-By: Drashna Jaelre <drashna@live.com> * Apply suggestions from code review Co-Authored-By: Drashna Jaelre <drashna@live.com> Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com> * Update readme.md removed unnecessary horizontal line from readme.md * Update readme.md Fixed style, make command example * Removed spaces * removed unused config.h * fixed defines * fixed send string on rotate encoder * fixed layer numbers for OLED Display * fixed to use existing function to set default layer https://github.com/qmk/qmk_firmware/pull/7736#discussion_r366699616 * flipped rotary encoder directions * Added layer for Clip studio on iOS * Update keyboards/palette1202/rules.mk Co-Authored-By: Ryan <fauxpark@gmail.com> * Update keyboards/palette1202/lib/oled_helper.h Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com> Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/palette1202/lib/oled_helper.c')
-rw-r--r--keyboards/palette1202/lib/oled_helper.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/keyboards/palette1202/lib/oled_helper.c b/keyboards/palette1202/lib/oled_helper.c
new file mode 100644
index 000000000..d4a0b2eb5
--- /dev/null
+++ b/keyboards/palette1202/lib/oled_helper.c
@@ -0,0 +1,30 @@
+#ifdef OLED_DRIVER_ENABLE
+#include QMK_KEYBOARD_H
+#include <stdio.h>
+#include <string.h>
+
+// returns character cord of the logo by line number
+char *read_logo(int row) {
+ static char logoLines[][18] = {
+ { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0},
+ { 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0},
+ { 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0},
+ { 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0}
+ };
+ return logoLines[row];
+}
+
+void render_row(int row, const char* status) {
+ // reset cursor position
+ oled_set_cursor(0, row);
+ // read logo charcode
+ char * logoLine = read_logo(row);
+ // copy logo into buffer
+ char writeLine[22];
+ strcpy(writeLine, logoLine);
+ // combine status string with logo
+ strcat(writeLine, status);
+ // write the line to OLED
+ oled_write(writeLine, false);
+}
+#endif