From 20a0fa9209756288b014f65671bcaab12a028229 Mon Sep 17 00:00:00 2001 From: Takashi Shibusawa Date: Tue, 10 Mar 2020 17:38:37 +0900 Subject: [Keyboard] Palette1202 (#7736) * added Palette1202 * removed currently unused cords * Update keyboards/palette1202/config.h Co-Authored-By: Drashna Jaelre * Apply suggestions from code review Co-Authored-By: Drashna Jaelre 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 * Update keyboards/palette1202/lib/oled_helper.h Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com> Co-authored-by: Drashna Jaelre Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> Co-authored-by: Ryan --- keyboards/palette1202/lib/glcdfont.c | 233 ++++++++++++++++++++++++++++++++ keyboards/palette1202/lib/oled_helper.c | 30 ++++ keyboards/palette1202/lib/oled_helper.h | 7 + 3 files changed, 270 insertions(+) create mode 100644 keyboards/palette1202/lib/glcdfont.c create mode 100644 keyboards/palette1202/lib/oled_helper.c create mode 100644 keyboards/palette1202/lib/oled_helper.h (limited to 'keyboards/palette1202/lib') diff --git a/keyboards/palette1202/lib/glcdfont.c b/keyboards/palette1202/lib/glcdfont.c new file mode 100644 index 000000000..f017091f8 --- /dev/null +++ b/keyboards/palette1202/lib/glcdfont.c @@ -0,0 +1,233 @@ +// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. +// See gfxfont.h for newer custom bitmap font info. + +#include "progmem.h" + +// Standard ASCII 5x7 font + +static const unsigned char font[] PROGMEM = { +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x3e, 0x5b, 0x4f, 0x5b, 0x3e, 0x00, +0x3e, 0x6b, 0x4f, 0x6b, 0x3e, 0x00, +0x1c, 0x3e, 0x7c, 0x3e, 0x1c, 0x00, +0x18, 0x3c, 0x7e, 0x3c, 0x18, 0x00, +0x1c, 0x57, 0x7d, 0x57, 0x1c, 0x00, +0x1c, 0x5e, 0x7f, 0x5e, 0x1c, 0x00, +0x00, 0x18, 0x3c, 0x18, 0x00, 0x00, +0xff, 0xe7, 0xc3, 0xe7, 0xff, 0x00, +0x00, 0x18, 0x24, 0x18, 0x00, 0x00, +0xff, 0xe7, 0xdb, 0xe7, 0xff, 0x00, +0x30, 0x28, 0x1a, 0x06, 0x0e, 0x00, +0x26, 0x29, 0x79, 0x29, 0x26, 0x00, +0x40, 0x7f, 0x05, 0x05, 0x07, 0x00, +0x40, 0x7f, 0x05, 0x25, 0x3f, 0x00, +0x5a, 0x3c, 0xe7, 0x3c, 0x5a, 0x00, +0x7f, 0x3e, 0x1c, 0x1c, 0x08, 0x00, +0x08, 0x1c, 0x1c, 0x3e, 0x7f, 0x00, +0x14, 0x22, 0x7f, 0x22, 0x14, 0x00, +0x5f, 0x5f, 0x00, 0x5f, 0x5f, 0x00, +0x06, 0x09, 0x7f, 0x01, 0x7f, 0x00, +0x00, 0x66, 0x89, 0x95, 0x6a, 0x00, +0x60, 0x60, 0x60, 0x60, 0x60, 0x00, +0x94, 0xa2, 0xff, 0xa2, 0x94, 0x00, +0x08, 0x04, 0x7e, 0x04, 0x08, 0x00, +0x10, 0x20, 0x7e, 0x20, 0x10, 0x00, +0x08, 0x08, 0x2a, 0x1c, 0x08, 0x00, +0x08, 0x1c, 0x2a, 0x08, 0x08, 0x00, +0x1e, 0x10, 0x10, 0x10, 0x10, 0x00, +0x0c, 0x1e, 0x0c, 0x1e, 0x0c, 0x00, +0x30, 0x38, 0x3e, 0x38, 0x30, 0x00, +0x06, 0x0e, 0x3e, 0x0e, 0x06, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, +0x00, 0x07, 0x00, 0x07, 0x00, 0x00, +0x14, 0x7f, 0x14, 0x7f, 0x14, 0x00, +0x24, 0x2a, 0x7f, 0x2a, 0x12, 0x00, +0x23, 0x13, 0x08, 0x64, 0x62, 0x00, +0x36, 0x49, 0x56, 0x20, 0x50, 0x00, +0x00, 0x08, 0x07, 0x03, 0x00, 0x00, +0x00, 0x1c, 0x22, 0x41, 0x00, 0x00, +0x00, 0x41, 0x22, 0x1c, 0x00, 0x00, +0x2a, 0x1c, 0x7f, 0x1c, 0x2a, 0x00, +0x08, 0x08, 0x3e, 0x08, 0x08, 0x00, +0x00, 0x80, 0x70, 0x30, 0x00, 0x00, +0x08, 0x08, 0x08, 0x08, 0x08, 0x00, +0x00, 0x00, 0x60, 0x60, 0x00, 0x00, +0x20, 0x10, 0x08, 0x04, 0x02, 0x00, +0x3e, 0x51, 0x49, 0x45, 0x3e, 0x00, +0x00, 0x42, 0x7f, 0x40, 0x00, 0x00, +0x72, 0x49, 0x49, 0x49, 0x46, 0x00, +0x21, 0x41, 0x49, 0x4d, 0x33, 0x00, +0x18, 0x14, 0x12, 0x7f, 0x10, 0x00, +0x27, 0x45, 0x45, 0x45, 0x39, 0x00, +0x3c, 0x4a, 0x49, 0x49, 0x31, 0x00, +0x41, 0x21, 0x11, 0x09, 0x07, 0x00, +0x36, 0x49, 0x49, 0x49, 0x36, 0x00, +0x46, 0x49, 0x49, 0x29, 0x1e, 0x00, +0x00, 0x00, 0x14, 0x00, 0x00, 0x00, +0x00, 0x40, 0x34, 0x00, 0x00, 0x00, +0x00, 0x08, 0x14, 0x22, 0x41, 0x00, +0x14, 0x14, 0x14, 0x14, 0x14, 0x00, +0x00, 0x41, 0x22, 0x14, 0x08, 0x00, +0x02, 0x01, 0x59, 0x09, 0x06, 0x00, +0x3e, 0x41, 0x5d, 0x59, 0x4e, 0x00, +0x78, 0x16, 0x11, 0x16, 0x78, 0x00, +0x7f, 0x49, 0x49, 0x49, 0x36, 0x00, +0x3e, 0x41, 0x41, 0x41, 0x22, 0x00, +0x7f, 0x41, 0x41, 0x41, 0x3e, 0x00, +0x7f, 0x49, 0x49, 0x49, 0x41, 0x00, +0x7f, 0x09, 0x09, 0x09, 0x01, 0x00, +0x3e, 0x41, 0x41, 0x51, 0x73, 0x00, +0x7f, 0x08, 0x08, 0x08, 0x7f, 0x00, +0x00, 0x41, 0x7f, 0x41, 0x00, 0x00, +0x20, 0x40, 0x41, 0x3f, 0x01, 0x00, +0x7f, 0x08, 0x14, 0x22, 0x41, 0x00, +0x7f, 0x40, 0x40, 0x40, 0x40, 0x00, +0x7f, 0x02, 0x1c, 0x02, 0x7f, 0x00, +0x7f, 0x04, 0x08, 0x10, 0x7f, 0x00, +0x3e, 0x41, 0x41, 0x41, 0x3e, 0x00, +0x7f, 0x09, 0x09, 0x09, 0x06, 0x00, +0x3e, 0x41, 0x51, 0x21, 0x5e, 0x00, +0x7f, 0x09, 0x19, 0x29, 0x46, 0x00, +0x26, 0x49, 0x49, 0x49, 0x32, 0x00, +0x03, 0x01, 0x7f, 0x01, 0x03, 0x00, +0x3f, 0x40, 0x40, 0x40, 0x3f, 0x00, +0x1f, 0x20, 0x40, 0x20, 0x1f, 0x00, +0x3f, 0x40, 0x38, 0x40, 0x3f, 0x00, +0x63, 0x14, 0x08, 0x14, 0x63, 0x00, +0x03, 0x04, 0x78, 0x04, 0x03, 0x00, +0x61, 0x59, 0x49, 0x4d, 0x43, 0x00, +0x00, 0x7f, 0x41, 0x41, 0x41, 0x00, +0x02, 0x04, 0x08, 0x10, 0x20, 0x00, +0x00, 0x41, 0x41, 0x41, 0x7f, 0x00, +0x04, 0x02, 0x01, 0x02, 0x04, 0x00, +0x40, 0x40, 0x40, 0x40, 0x40, 0x00, +0x00, 0x03, 0x07, 0x08, 0x00, 0x00, +0x20, 0x54, 0x54, 0x78, 0x40, 0x00, +0x7f, 0x28, 0x44, 0x44, 0x38, 0x00, +0x38, 0x44, 0x44, 0x44, 0x28, 0x00, +0x38, 0x44, 0x44, 0x28, 0x7f, 0x00, +0x38, 0x54, 0x54, 0x54, 0x18, 0x00, +0x00, 0x08, 0x7e, 0x09, 0x02, 0x00, +0x18, 0x24, 0x24, 0x1c, 0x78, 0x00, +0x7f, 0x08, 0x04, 0x04, 0x78, 0x00, +0x00, 0x44, 0x7d, 0x40, 0x00, 0x00, +0x20, 0x40, 0x40, 0x3d, 0x00, 0x00, +0x7f, 0x10, 0x28, 0x44, 0x00, 0x00, +0x00, 0x41, 0x7f, 0x40, 0x00, 0x00, +0x7c, 0x04, 0x78, 0x04, 0x78, 0x00, +0x7c, 0x08, 0x04, 0x04, 0x78, 0x00, +0x38, 0x44, 0x44, 0x44, 0x38, 0x00, +0xfc, 0x18, 0x24, 0x24, 0x18, 0x00, +0x18, 0x24, 0x24, 0x18, 0xfc, 0x00, +0x7c, 0x08, 0x04, 0x04, 0x08, 0x00, +0x08, 0x54, 0x54, 0x54, 0x20, 0x00, +0x04, 0x04, 0x3f, 0x44, 0x24, 0x00, +0x3c, 0x40, 0x40, 0x20, 0x7c, 0x00, +0x1c, 0x20, 0x40, 0x20, 0x1c, 0x00, +0x1c, 0x60, 0x10, 0x60, 0x1c, 0x00, +0x44, 0x28, 0x10, 0x28, 0x44, 0x00, +0x44, 0x28, 0x10, 0x08, 0x04, 0x00, +0x44, 0x64, 0x54, 0x4c, 0x44, 0x00, +0x00, 0x08, 0x36, 0x41, 0x00, 0x00, +0x00, 0x00, 0x77, 0x00, 0x00, 0x00, +0x00, 0x41, 0x36, 0x08, 0x00, 0x00, +0x02, 0x01, 0x02, 0x04, 0x02, 0x00, +0x3c, 0x26, 0x23, 0x26, 0x3c, 0x00, +0xff, 0xff, 0xff, 0xff, 0x0f, 0x0f, +0x0f, 0xff, 0xff, 0xfe, 0xfc, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xf8, 0xfc, 0xfe, 0xff, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xc0, 0xf0, 0xfc, 0xff, 0x00, 0x00, +0x00, 0x00, 0x00, 0xc0, 0xf0, 0xfc, +0xff, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xff, 0xff, 0xff, 0xff, 0x00, 0x00, +0x00, 0xff, 0xff, 0xff, 0xff, 0x00, +0x00, 0xfe, 0xff, 0xff, 0x0f, 0x0f, +0x0f, 0xff, 0xff, 0xfe, 0x00, 0x00, +0xff, 0xff, 0xff, 0xff, 0x00, 0x00, +0xfe, 0xff, 0xff, 0x0f, 0x0f, 0x0f, +0xff, 0xff, 0xfe, 0x00, 0x00, 0x0e, +0xff, 0xff, 0xff, 0xff, 0x0e, 0x0e, +0x0e, 0x00, 0x0e, 0xff, 0xff, 0xff, +0xff, 0x0e, 0x0e, 0x0e, 0x00, 0x00, +0xfe, 0xff, 0xff, 0x0f, 0x0f, 0x0f, +0xff, 0xff, 0xfe, 0x00, 0x00, 0xf3, +0xf3, 0x03, 0x03, 0xe3, 0xf3, 0x73, +0x73, 0xf3, 0xe3, 0x03, 0xc3, 0xe3, +0x73, 0x33, 0x73, 0xe3, 0xc3, 0x03, +0xe3, 0xf3, 0x73, 0x73, 0xf3, 0xe3, +0x03, 0x00, 0x00, 0x00, 0x00, 0x00, +0xff, 0xff, 0xff, 0xff, 0x78, 0x78, +0x78, 0x7f, 0x7f, 0x3f, 0x0f, 0x00, +0x00, 0xf8, 0xfc, 0xfe, 0x1e, 0x1e, +0x1e, 0xff, 0xff, 0xff, 0x00, 0x00, +0xff, 0xff, 0xff, 0xff, 0x00, 0x00, +0xff, 0xff, 0xff, 0x1c, 0x1c, 0x1c, +0x9f, 0x9f, 0x9f, 0x00, 0x00, 0x00, +0xff, 0xff, 0xff, 0xff, 0x00, 0x00, +0x00, 0x00, 0x00, 0xff, 0xff, 0xff, +0xff, 0x00, 0x00, 0x00, 0x00, 0x00, +0xff, 0xff, 0xff, 0x1c, 0x1c, 0x1c, +0x9f, 0x9f, 0x9f, 0x00, 0x00, 0xff, +0xff, 0x00, 0x00, 0x01, 0x81, 0xe0, +0xf8, 0x3f, 0x0f, 0x00, 0xff, 0xff, +0x00, 0x00, 0x00, 0xff, 0xff, 0x00, +0x01, 0x81, 0xe0, 0xf8, 0x3f, 0x0f, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xff, 0xff, 0xff, 0xff, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x7f, 0xff, 0xff, 0xf0, 0xf0, +0xf0, 0xff, 0xff, 0xff, 0x00, 0x00, +0xff, 0xff, 0xff, 0xff, 0x00, 0x00, +0x7f, 0xff, 0xff, 0xf0, 0xf0, 0xf0, +0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, +0x7f, 0xff, 0xff, 0xff, 0xe0, 0xe0, +0xe0, 0x00, 0x00, 0x7f, 0xff, 0xff, +0xff, 0xe0, 0xe0, 0xe0, 0x00, 0x00, +0x7f, 0xff, 0xff, 0xf0, 0xf0, 0xf0, +0xff, 0xff, 0x7f, 0x00, 0x00, 0xcf, +0xcf, 0xc0, 0xc0, 0xce, 0xcf, 0xcf, +0xce, 0xce, 0xce, 0xc0, 0xc3, 0xc7, +0xce, 0xcc, 0xce, 0xc7, 0xc3, 0xc0, +0xce, 0xcf, 0xcf, 0xce, 0xce, 0xce, +0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; 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 +#include + +// 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 diff --git a/keyboards/palette1202/lib/oled_helper.h b/keyboards/palette1202/lib/oled_helper.h new file mode 100644 index 000000000..0d1dde461 --- /dev/null +++ b/keyboards/palette1202/lib/oled_helper.h @@ -0,0 +1,7 @@ +#pragma once +#ifdef OLED_DRIVER_ENABLE + +void render_row(int row, const char* status); + +#endif /* #ifdef OLED_DRIVER_ENABLE */ + -- cgit v1.2.3-70-g09d2