From 20a0fa9209756288b014f65671bcaab12a028229 Mon Sep 17 00:00:00 2001 From: Takashi Shibusawa Date: Tue, 10 Mar 2020 17:38:37 +0900 Subject: [PATCH] [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/config.h | 55 +++ keyboards/palette1202/info.json | 30 ++ .../palette1202/keymaps/default/config.h | 20 ++ .../palette1202/keymaps/default/keymap.c | 329 ++++++++++++++++++ .../palette1202/keymaps/default/readme.md | 1 + .../palette1202/keymaps/key-check/keymap.c | 150 ++++++++ .../palette1202/keymaps/key-check/readme.md | 2 + keyboards/palette1202/lib/glcdfont.c | 233 +++++++++++++ keyboards/palette1202/lib/oled_helper.c | 30 ++ keyboards/palette1202/lib/oled_helper.h | 7 + keyboards/palette1202/palette1202.c | 24 ++ keyboards/palette1202/palette1202.h | 37 ++ keyboards/palette1202/readme.md | 22 ++ keyboards/palette1202/rules.mk | 37 ++ 14 files changed, 977 insertions(+) create mode 100644 keyboards/palette1202/config.h create mode 100644 keyboards/palette1202/info.json create mode 100644 keyboards/palette1202/keymaps/default/config.h create mode 100644 keyboards/palette1202/keymaps/default/keymap.c create mode 100644 keyboards/palette1202/keymaps/default/readme.md create mode 100644 keyboards/palette1202/keymaps/key-check/keymap.c create mode 100644 keyboards/palette1202/keymaps/key-check/readme.md 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 create mode 100644 keyboards/palette1202/palette1202.c create mode 100644 keyboards/palette1202/palette1202.h create mode 100644 keyboards/palette1202/readme.md create mode 100644 keyboards/palette1202/rules.mk diff --git a/keyboards/palette1202/config.h b/keyboards/palette1202/config.h new file mode 100644 index 00000000000..65db763b4d6 --- /dev/null +++ b/keyboards/palette1202/config.h @@ -0,0 +1,55 @@ +/* +Copyright 2019 niltea + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x1202 +#define DEVICE_VER 0x0001 +#define MANUFACTURER niltea +#define PRODUCT Palette1202 +#define DESCRIPTION A left hand device with rotary encoder + +/* key matrix size */ +#define MATRIX_ROWS 3 +#define MATRIX_COLS 5 + +#define MATRIX_ROW_PINS { B6, B2, B3 } +#define MATRIX_COL_PINS { C6, D7, E6, B4, B5 } +#define UNUSED_PINS { D2, D3, D4, B1 } + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW + +/* Encoders */ +#define ENCODERS_PAD_A { F4, F6 } +#define ENCODERS_PAD_B { F5, F7 } + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* Register custom font file */ +#ifdef OLED_DRIVER_ENABLE + #define OLED_FONT_H "lib/glcdfont.c" +#endif + +/* Feature disable options */ +#define NO_DEBUG +#define NO_PRINT diff --git a/keyboards/palette1202/info.json b/keyboards/palette1202/info.json new file mode 100644 index 00000000000..847948626e4 --- /dev/null +++ b/keyboards/palette1202/info.json @@ -0,0 +1,30 @@ +{ + "keyboard_name": "Palette1202", + "url": "https://github.com/niltea/Palette1202", + "maintainer": "niltea", + "width": 5, + "height": 3.5, + "layouts": { + "LAYOUT": { + "key_count": 14, + "layout": [ + { "label":"Tab", "x": 0, "y": 0.75 }, + { "label":"GUI + A", "x": 1, "y": 0.25 }, + { "label":"E", "x": 2, "y": 0 }, + { "label":"P", "x": 3, "y": 0.5 }, + { "label":"GUI + 0", "x": 4, "y": 0 }, + + { "label":"Fn", "x": 0, "y": 1.75 }, + { "label":"M", "x": 1, "y": 1.25 }, + { "label":"BackSP", "x": 2, "y": 1 }, + { "label":"B", "x": 3, "y": 1.5 }, + { "label":"HYPR", "x": 4, "y": 1 }, + + { "label":"Shift", "x": 1, "y": 2.5 }, + { "label":"LGUI", "x": 2, "y": 2.5 }, + { "label":"GUI + Z", "x": 3, "y": 2.5 }, + { "label":"Space", "x": 4, "y": 2.5, "r": 15 } + ] + } + } +} diff --git a/keyboards/palette1202/keymaps/default/config.h b/keyboards/palette1202/keymaps/default/config.h new file mode 100644 index 00000000000..a5bb9bbfc86 --- /dev/null +++ b/keyboards/palette1202/keymaps/default/config.h @@ -0,0 +1,20 @@ +/* Copyright 2019 niltea + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define TAPPING_FORCE_HOLD +#define TAPPING_TERM 100 diff --git a/keyboards/palette1202/keymaps/default/keymap.c b/keyboards/palette1202/keymaps/default/keymap.c new file mode 100644 index 00000000000..9c7bc745635 --- /dev/null +++ b/keyboards/palette1202/keymaps/default/keymap.c @@ -0,0 +1,329 @@ +/* Copyright 2019 niltea + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include QMK_KEYBOARD_H +#ifdef OLED_DRIVER_ENABLE + #include + #include "lib/oled_helper.h" +#endif + +enum custom_keycode { + Mac_CS = SAFE_RANGE, + Mac_PS, + Win_CS, + Win_PS, + IOS_CS, +}; +enum layerID { + MAC_CS_1 = 0, + MAC_CS_2, + MAC_PS_1, + MAC_PS_2, + WIN_CS_1, + WIN_CS_2, + WIN_PS_1, + WIN_PS_2, + IOS_CS_1, + IOS_CS_2, + SETTING, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + // Mac + // Clip Studio + [MAC_CS_1] = LAYOUT( + KC_TAB, LGUI(KC_A), KC_E, KC_P, LGUI(KC_0), + MO(MAC_CS_2), KC_M, KC_BSPC, KC_B, KC_HYPR, + KC_LSFT, KC_LGUI, LGUI(KC_Z), KC_SPC + ), + [MAC_CS_2] = LAYOUT( + MO(SETTING), KC_ESC, KC_G, KC_R, LGUI(KC_GRV), + _______, LGUI(KC_D), KC_K, KC_F, LGUI(KC_S), + KC_LALT, KC_I, SGUI(KC_Z), KC_H + ), + // Photoshop + [MAC_PS_1] = LAYOUT( + KC_TAB, LGUI(KC_A), KC_E, KC_B, LGUI(KC_1), + MO(MAC_PS_2), KC_L, LGUI(KC_DEL), LGUI(KC_QUOT), KC_MEH, + KC_LSFT, KC_LGUI, LGUI(KC_Z), KC_SPC + ), + [MAC_PS_2] = LAYOUT( + MO(SETTING), KC_ESC, KC_G, KC_R, KC_ESC, + _______, LGUI(KC_D), KC_V, LGUI(KC_T), LGUI(KC_S), + KC_LALT, KC_I, SGUI(KC_Z), KC_H + ), + + // Windows + // Clip Studio + [WIN_CS_1] = LAYOUT( + KC_TAB, LCTL(KC_A), KC_E, KC_P, LCTL(KC_0), + MO(WIN_CS_2), KC_M, KC_BSPC, KC_B, KC_HYPR, + KC_LSFT, KC_LCTRL, LCTL(KC_Z), KC_SPC + ), + [WIN_CS_2] = LAYOUT( + MO(SETTING), KC_ESC, KC_G, KC_R, LCTL(KC_GRV), + _______, LCTL(KC_D), KC_K, KC_F, LCTL(KC_S), + KC_LALT, KC_I, C(S(KC_Z)), KC_H + ), + // Photoshop + [WIN_PS_1] = LAYOUT( + KC_TAB, LCTL(KC_A), KC_E, KC_B, LCTL(KC_1), + MO(WIN_PS_2), KC_L, LCTL(KC_DEL), LCTL(KC_QUOT), KC_MEH, + KC_LSFT, KC_LCTRL, LCTL(KC_Z), KC_SPC + ), + [WIN_PS_2] = LAYOUT( + MO(SETTING), KC_ESC, KC_G, KC_R, KC_ESC, + _______, LCTL(KC_D), KC_V, LCTL(KC_T), LCTL(KC_S), + KC_LALT, KC_I, C(S(KC_Z)), KC_H + ), + // iOS + // Clip Studio + [IOS_CS_1] = LAYOUT( + KC_TAB, LGUI(KC_A), KC_E, KC_P, LGUI(KC_0), + MO(IOS_CS_2), KC_M, KC_BSPC, KC_B, LGUI(KC_LALT), + KC_LSFT, KC_LGUI, LGUI(KC_Z), KC_SPC + ), + [IOS_CS_2] = LAYOUT( + MO(SETTING), KC_ESC, KC_G, KC_R, LGUI(KC_EQL), + _______, LGUI(KC_D), KC_K, KC_F, LGUI(KC_S), + KC_LALT, KC_I, SGUI(KC_Z), KC_H + ), + [SETTING] = LAYOUT( + _______, IOS_CS, Win_CS, Mac_CS, KC_NO, + _______, KC_NO, Win_PS, Mac_PS, KC_NO, + KC_NO, KC_NO, KC_NO, KC_NO + ), +}; + +void encoder_update_user(uint8_t index, bool clockwise) { + uint8_t currentDefault = get_highest_layer(default_layer_state); + uint8_t currentLayer = get_highest_layer(layer_state); + if (index == 0) { /* the upper encoder */ + switch (currentDefault) { + case MAC_CS_1: + if (currentLayer % 2 == 0) { + // default layer + // Zoom + tap_code16(!clockwise ? G(KC_EQL) : G(KC_MINS)); + } else { + // Fn Layer + // rotate canvas + tap_code(!clockwise ? KC_QUOT : KC_MINS); + } + break; + case MAC_PS_1: + if (currentLayer % 2 == 0) { + // default layer + // Zoom + tap_code16(!clockwise ? G(KC_EQL) : G(KC_MINS)); + } else { + // Fn Layer + // undo / redo + tap_code16(!clockwise ? S(G(KC_Z)) : G(KC_Z)); + } + break; + case WIN_CS_1: + if (currentLayer % 2 == 0) { + // default layer + // Zoom + tap_code16(!clockwise ? C(KC_EQL) : C(KC_MINS)); + } else { + // Fn Layer + // rotate canvas + tap_code(!clockwise ? KC_QUOT : KC_MINS); + } + break; + case WIN_PS_1: + if (currentLayer % 2 == 0) { + // default layer + // Zoom + tap_code16(!clockwise ? C(KC_SCLN) : C(KC_MINS)); + } else { + // Fn Layer + // undo / redo + tap_code16(!clockwise ? C(S(KC_Z)) : C(KC_Z)); + } + break; + case IOS_CS_1: + if (currentLayer % 2 == 0) { + // default layer + // Zoom + tap_code16(!clockwise ? G(KC_SCLN) : G(KC_MINS)); + } else { + // Fn Layer + // rotate canvas + tap_code(!clockwise ? KC_EQL : KC_MINS); + } + break; + default: + break; + } + } else if (index == 1) { /* the lower encoder */ + switch (currentDefault) { + case MAC_CS_1: + if (currentLayer % 2 == 0) { + // default layer + // size of brush + tap_code(!clockwise ? KC_RBRC : KC_LBRC); + } else { + // Fn Layer + // opacity of brush + tap_code16(!clockwise ? G(KC_RBRC) : G(KC_LBRC)); + } + break; + case MAC_PS_1: + if (currentLayer % 2 == 0) { + // default layer + // size of brush + tap_code(!clockwise ? KC_RBRC : KC_LBRC); + } else { + // Fn Layer + // opacity of brush + tap_code16(!clockwise ? KC_RCBR : KC_LCBR); + } + break; + case WIN_CS_1: + if (currentLayer % 2 == 0) { + // default layer + // rotate canvas + tap_code(!clockwise ? KC_RBRC : KC_LBRC); + } else { + // Fn Layer + // opacity of brush + tap_code16(!clockwise ? C(KC_RBRC) : C(KC_LBRC)); + } + break; + case WIN_PS_1: + if (currentLayer % 2 == 0) { + // default layer + // rotate canvas + tap_code(!clockwise ? KC_RBRC : KC_LBRC); + } else { + // Fn Layer + // opacity of brush + tap_code16(!clockwise ? KC_RCBR : KC_LCBR); + } + break; + case IOS_CS_1: + if (currentLayer % 2 == 0) { + // default layer + // size of brush + tap_code(!clockwise ? KC_BSLS : KC_RBRC); + } else { + // Fn Layer + // opacity of brush + tap_code16(!clockwise ? G(KC_BSLS) : G(KC_RBRC)); + } + break; + default: + break; + } + } +} + +// custom keycode +// switch default layer +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case Mac_CS: + if (record->event.pressed) { + set_single_persistent_default_layer(MAC_CS_1); + } + return false; + break; + case Mac_PS: + if (record->event.pressed) { + set_single_persistent_default_layer(MAC_PS_1); + } + return false; + break; + case Win_CS: + if (record->event.pressed) { + set_single_persistent_default_layer(WIN_CS_1); + } + return false; + break; + case Win_PS: + if (record->event.pressed) { + set_single_persistent_default_layer(WIN_PS_1); + } + return false; + break; + case IOS_CS: + if (record->event.pressed) { + set_single_persistent_default_layer(IOS_CS_1); + } + return false; + break; + } + return true; +} + +// OLED Display +#ifdef OLED_DRIVER_ENABLE +void oled_task_user(void) { + // get layer Number + uint8_t currentDefault = get_highest_layer(default_layer_state); + uint8_t currentLayer = get_highest_layer(layer_state); + // write OS mode / 1st line of the logo + switch (currentDefault) { + case MAC_CS_1: + case MAC_PS_1: + render_row(0, "Mac "); + break; + case WIN_CS_1: + case WIN_PS_1: + render_row(0, "Win "); + break; + case IOS_CS_1: + render_row(0, "iOS "); + break; + default: + render_row(0, " "); + } + + // write Application mode / 2nd line of the logo + switch (currentDefault) { + case MAC_CS_1: + case WIN_CS_1: + case IOS_CS_1: + render_row(1, "A:CS"); + break; + case MAC_PS_1: + case WIN_PS_1: + render_row(1, "A:Ps"); + break; + default: + render_row(1, " "); + } + + if (currentLayer == SETTING) { + // 3rd & 4th line of the logo + render_row(2, "****"); + render_row(3, "LSEL"); + } else { + // Layer Status / 3rd line of the logo + if (currentLayer % 2 == 0) { + // default layer + render_row(2, "L:DF"); + } else { + // Fn Layer + render_row(2, "L:Fn"); + } + // pressed key / 4th line of the logo + render_row(3, " "); + } +} +#endif // #ifdef OLED_DRIVER_ENABLE diff --git a/keyboards/palette1202/keymaps/default/readme.md b/keyboards/palette1202/keymaps/default/readme.md new file mode 100644 index 00000000000..e84238695a6 --- /dev/null +++ b/keyboards/palette1202/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for Palette1202 diff --git a/keyboards/palette1202/keymaps/key-check/keymap.c b/keyboards/palette1202/keymaps/key-check/keymap.c new file mode 100644 index 00000000000..c3496f78c07 --- /dev/null +++ b/keyboards/palette1202/keymaps/key-check/keymap.c @@ -0,0 +1,150 @@ +/* Copyright 2019 niltea + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include QMK_KEYBOARD_H +#ifdef OLED_DRIVER_ENABLE + #include + #include "lib/oled_helper.h" +#endif + +// Defines the keycodes used by our macros in process_record_user +enum custom_keycodes { + KEY_01 = SAFE_RANGE, + KEY_02, + KEY_03, + KEY_04, + KEY_05, + KEY_06, + KEY_07, + KEY_08, + KEY_09, + KEY_10, + KEY_11, + KEY_12, + KEY_13, + KEY_14 +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KEY_01, KEY_02, KEY_03, KEY_04, KEY_05, + KEY_06, KEY_07, KEY_08, KEY_09, KEY_10, + KEY_11, KEY_12, KEY_13, KEY_14 + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KEY_01: + if (record->event.pressed) { + SEND_STRING("R1C1"); + } + break; + case KEY_02: + if (record->event.pressed) { + SEND_STRING("R1C2"); + } + break; + case KEY_03: + if (record->event.pressed) { + SEND_STRING("R1C3"); + } + break; + case KEY_04: + if (record->event.pressed) { + SEND_STRING("R1C4"); + } + break; + case KEY_05: + if (record->event.pressed) { + SEND_STRING("ENCODER-UPPER:Button"); + } + break; + + case KEY_06: + if (record->event.pressed) { + SEND_STRING("R2C1"); + } + break; + case KEY_07: + if (record->event.pressed) { + SEND_STRING("R2C2"); + } + break; + case KEY_08: + if (record->event.pressed) { + SEND_STRING("R2C3"); + } + break; + + case KEY_09: + if (record->event.pressed) { + SEND_STRING("R2C4"); + } + break; + case KEY_10: + if (record->event.pressed) { + SEND_STRING("ENCODER-LOWER:Button"); + } + break; + case KEY_11: + if (record->event.pressed) { + SEND_STRING("R3C1"); + } + break; + case KEY_12: + if (record->event.pressed) { + SEND_STRING("R3C2"); + } + break; + case KEY_13: + if (record->event.pressed) { + SEND_STRING("R3C3"); + } + break; + case KEY_14: + if (record->event.pressed) { + SEND_STRING("R3C4"); + } + break; + } + return true; +} + +void encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { /* the upper encoder */ + if (clockwise) { + SEND_STRING("ENCODER-UPPER:CW"); + } else { + SEND_STRING("ENCODER-UPPER:CCW"); + } + } else if (index == 1) { /* the lower encoder */ + if (clockwise) { + SEND_STRING("ENCODER-LOWER:CW"); + } else { + SEND_STRING("ENCODER-LOWER:CCW"); + } + } +} + +// OLED Display +#ifdef OLED_DRIVER_ENABLE +void oled_task_user(void) { + render_row(0, "TEST"); + render_row(1, "test"); + render_row(2, "TEST"); + render_row(3, "test"); +} +#endif // #ifdef OLED_DRIVER_ENABLE diff --git a/keyboards/palette1202/keymaps/key-check/readme.md b/keyboards/palette1202/keymaps/key-check/readme.md new file mode 100644 index 00000000000..c9e27ce1431 --- /dev/null +++ b/keyboards/palette1202/keymaps/key-check/readme.md @@ -0,0 +1,2 @@ +# The test-purpose keymap for Palette1202 +組み立て後のテスト用keymapです。 \ No newline at end of file diff --git a/keyboards/palette1202/lib/glcdfont.c b/keyboards/palette1202/lib/glcdfont.c new file mode 100644 index 00000000000..f017091f835 --- /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 00000000000..d4a0b2eb5f6 --- /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 00000000000..0d1dde461dd --- /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 */ + diff --git a/keyboards/palette1202/palette1202.c b/keyboards/palette1202/palette1202.c new file mode 100644 index 00000000000..74ce08319e3 --- /dev/null +++ b/keyboards/palette1202/palette1202.c @@ -0,0 +1,24 @@ +/* Copyright 2019 niltea + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "palette1202.h" + +// initialize OLED if OLED is enabled +#ifdef OLED_DRIVER_ENABLE + oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return OLED_ROTATION_180; + } +#endif + \ No newline at end of file diff --git a/keyboards/palette1202/palette1202.h b/keyboards/palette1202/palette1202.h new file mode 100644 index 00000000000..737e381f73e --- /dev/null +++ b/keyboards/palette1202/palette1202.h @@ -0,0 +1,37 @@ +/* Copyright 2019 niltea + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include "quantum.h" + +/* This a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ +#define LAYOUT( \ + k00, k01, k02, k03, k04, \ + k10, k11, k12, k13, k14, \ + k21, k22, k23, k24 \ +) \ +{ \ + { k00, k01, k02, k03, k04 }, \ + { k10, k11, k12, k13, k14 }, \ + { KC_NO, k21, k22, k23, k24 }, \ +} diff --git a/keyboards/palette1202/readme.md b/keyboards/palette1202/readme.md new file mode 100644 index 00000000000..4451eac4984 --- /dev/null +++ b/keyboards/palette1202/readme.md @@ -0,0 +1,22 @@ +# Palette1202 + +![Palette1202](https://palette1202.nilgiri-tea.net/images/palette1202.jpg) + +A left hand device with rotary encoder, for artists. + +* Keyboard Maintainer: [niltea](https://github.com/niltea) +* Hardware Supported: Palette1202 +* Hardware Availability: [Pixiv Booth](https://booth.pm/) +* [PCB & Case](https://github.com/niltea/Palette1202) + +Make example for this keyboard (after setting up your build environment): + +- default + + make palette1202:default:flash + +- key check (for after build) + + make palette1202:key-check:flash + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/palette1202/rules.mk b/keyboards/palette1202/rules.mk new file mode 100644 index 00000000000..57ea5030efb --- /dev/null +++ b/keyboards/palette1202/rules.mk @@ -0,0 +1,37 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = no # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +MIDI_ENABLE = no # MIDI support +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches +HD44780_ENABLE = no # Enable support for HD44780 based LCDs +ENCODER_ENABLE = yes # Enable support for rotary encoders +OLED_DRIVER_ENABLE = yes # Enable support for OLED display + +# Additional code +SRC += lib/oled_helper.c # Adding OLED