From 8fa2d43b3805741bf2f2a9e919276d5f0aa5a19f Mon Sep 17 00:00:00 2001 From: mrT1ddl3s <60518619+mrT1ddl3s@users.noreply.github.com> Date: Tue, 2 Feb 2021 12:03:47 -0700 Subject: Knobgoblin info file fix (#11697) Co-authored-by: Ryan Co-authored-by: Drashna Jaelre --- keyboards/knobgoblin/info.json | 17 ++++--- keyboards/knobgoblin/keymaps/ortho/keymap.c | 72 -------------------------- keyboards/knobgoblin/knobgoblin.c | 78 +++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 79 deletions(-) diff --git a/keyboards/knobgoblin/info.json b/keyboards/knobgoblin/info.json index b2da3efb38..16404131bb 100644 --- a/keyboards/knobgoblin/info.json +++ b/keyboards/knobgoblin/info.json @@ -2,17 +2,18 @@ "keyboard_name": "knobgoblin", "url": "", "maintainer": "MrT1ddl3s", - "width": 4, + "width": 5, "height": 5, "layouts": { - "LAYOUT": { - "layout_ortho": [ - {"x": 1, "y": 0}, + "LAYOUT_ortho": { + "layout": [ + + {"x": 1, "y": 0}, {"x": 2, "y": 0}, {"x": 3, "y": 0}, {"x": 4, "y": 0}, - {"x": 1, "y": 1}, + {"x": 1, "y": 1}, {"x": 2, "y": 1}, {"x": 3, "y": 1}, {"x": 4, "y": 1}, @@ -22,12 +23,14 @@ {"x": 3, "y": 2}, {"x": 4, "y": 2}, - {"x": 1, "y": 3}, + {"x": 0, "y": 3}, + {"x": 1, "y": 3}, {"x": 2, "y": 3}, {"x": 3, "y": 3}, {"x": 4, "y": 3}, - {"x": 1, "y": 4}, + {"x": 0, "y": 4}, + {"x": 1, "y": 4}, {"x": 2, "y": 4}, {"x": 3, "y": 4}, {"x": 4, "y": 4} diff --git a/keyboards/knobgoblin/keymaps/ortho/keymap.c b/keyboards/knobgoblin/keymaps/ortho/keymap.c index d545904a53..57c68a8b1b 100644 --- a/keyboards/knobgoblin/keymaps/ortho/keymap.c +++ b/keyboards/knobgoblin/keymaps/ortho/keymap.c @@ -16,7 +16,6 @@ #include QMK_KEYBOARD_H - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_ortho( @@ -35,74 +34,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_BSPC, KC_DEL, KC_TRNS ) }; - -/* assign keycodes to the encoder rotation */ -void encoder_update_user(uint8_t index, bool clockwise) { - - if (index == 1) { /* Bottom encoder */ - if (clockwise) { - tap_code(KC_VOLU); - } else { - tap_code(KC_VOLD); - } - } - if (index == 0) { /* Top encoder */ - if (clockwise) { - tap_code(KC_MNXT); - } else { - tap_code(KC_MPRV); - } - } -} -#ifdef OLED_DRIVER_ENABLE -/* rotate screen for proper orentation*/ -oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; } - -/* byte map for the goblin logo, knob goblin text, and level text */ -static void render_logo(void) { - static const char PROGMEM my_logo[] = { - 0x00, 0xe0, 0x40, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0xc0, 0x60, 0x20, 0x10, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x10, 0x20, 0x60, 0xc0, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x40, 0xe0, 0x00, - 0x00, 0x03, 0x06, 0x3c, 0x49, 0x91, 0x21, 0x00, 0x40, 0x80, 0x80, 0x80, 0x80, 0x00, 0x60, 0x00, - 0x00, 0x60, 0x00, 0x80, 0x80, 0x80, 0x80, 0x40, 0x00, 0x21, 0x91, 0x49, 0x3c, 0x06, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1f, 0x60, 0x40, 0xc0, 0x06, 0x0e, 0x0f, 0x67, 0x50, 0xc0, - 0xc0, 0x50, 0x67, 0x0f, 0x0e, 0x06, 0xc0, 0x40, 0x60, 0x1f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x7b, 0xc7, 0x8e, 0x1e, 0x3e, 0x3e, - 0x3e, 0x3e, 0x1e, 0x8e, 0xc7, 0x7b, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x06, 0x04, - 0x04, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x83, 0x03, 0x03, 0x03, 0x83, 0x03, 0x83, 0x03, 0x03, 0x03, 0x83, - 0x03, 0x03, 0x83, 0x83, 0x83, 0x03, 0x03, 0x83, 0x83, 0x83, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x04, 0x06, 0x09, 0x10, 0x00, 0x1f, 0x03, 0x06, 0x0c, 0x1f, - 0x00, 0x0f, 0x10, 0x10, 0x10, 0x0f, 0x00, 0x1f, 0x12, 0x12, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x78, 0xfc, 0x84, 0xa4, 0xa4, 0x68, 0x00, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0xfc, 0x94, - 0x94, 0x68, 0x00, 0xfc, 0x80, 0x80, 0x80, 0x00, 0xfc, 0x00, 0xfc, 0x18, 0x30, 0x60, 0xfc, 0x00, - 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, - 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, - 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x50, 0x50, 0x50, 0x00, 0xf0, 0x00, 0x00, - 0x00, 0xf0, 0x00, 0xf0, 0x50, 0x50, 0x50, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, 0x02, 0x02, 0x02, 0x00, 0x03, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, - 0x01, 0x00, 0x00, 0x03, 0x02, 0x02, 0x02, 0x00, 0x03, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 - - }; - oled_write_raw_P(my_logo, sizeof(my_logo)); -} - -/* text display for layer indication */ -void oled_task_user(void) { - - render_logo(); - oled_set_cursor(0,11); - oled_advance_char(); - switch (get_highest_layer(layer_state)) { - case 0: - oled_write_P(PSTR("ONE\n"), false); - break; - case 1: - oled_write_P(PSTR("TWO\n"), false); - break; - } - -} -#endif - diff --git a/keyboards/knobgoblin/knobgoblin.c b/keyboards/knobgoblin/knobgoblin.c index f82c0178a0..8905e770f1 100644 --- a/keyboards/knobgoblin/knobgoblin.c +++ b/keyboards/knobgoblin/knobgoblin.c @@ -15,3 +15,81 @@ */ #include "knobgoblin.h" + +#ifdef ENCODER_ENABLE +/* assign keycodes to the encoder rotation */ +__attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) { + + if (index == 1) { /* Bottom encoder */ + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } + if (index == 0) { /* Top encoder */ + if (clockwise) { + tap_code(KC_MNXT); + } else { + tap_code(KC_MPRV); + } + } +} +#endif + +#ifdef OLED_DRIVER_ENABLE +/* rotate screen for proper orentation*/ +__attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; } + +/* byte map for the goblin logo, knob goblin text, and level text */ +static void render_goblin_logo(void) { + static const char PROGMEM my_logo[] = { + 0x00, 0xe0, 0x40, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0xc0, 0x60, 0x20, 0x10, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x10, 0x20, 0x60, 0xc0, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x40, 0xe0, 0x00, + 0x00, 0x03, 0x06, 0x3c, 0x49, 0x91, 0x21, 0x00, 0x40, 0x80, 0x80, 0x80, 0x80, 0x00, 0x60, 0x00, + 0x00, 0x60, 0x00, 0x80, 0x80, 0x80, 0x80, 0x40, 0x00, 0x21, 0x91, 0x49, 0x3c, 0x06, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1f, 0x60, 0x40, 0xc0, 0x06, 0x0e, 0x0f, 0x67, 0x50, 0xc0, + 0xc0, 0x50, 0x67, 0x0f, 0x0e, 0x06, 0xc0, 0x40, 0x60, 0x1f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x7b, 0xc7, 0x8e, 0x1e, 0x3e, 0x3e, + 0x3e, 0x3e, 0x1e, 0x8e, 0xc7, 0x7b, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x06, 0x04, + 0x04, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x83, 0x03, 0x03, 0x03, 0x83, 0x03, 0x83, 0x03, 0x03, 0x03, 0x83, + 0x03, 0x03, 0x83, 0x83, 0x83, 0x03, 0x03, 0x83, 0x83, 0x83, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x04, 0x06, 0x09, 0x10, 0x00, 0x1f, 0x03, 0x06, 0x0c, 0x1f, + 0x00, 0x0f, 0x10, 0x10, 0x10, 0x0f, 0x00, 0x1f, 0x12, 0x12, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x78, 0xfc, 0x84, 0xa4, 0xa4, 0x68, 0x00, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0xfc, 0x94, + 0x94, 0x68, 0x00, 0xfc, 0x80, 0x80, 0x80, 0x00, 0xfc, 0x00, 0xfc, 0x18, 0x30, 0x60, 0xfc, 0x00, + 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, + 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, + 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x50, 0x50, 0x50, 0x00, 0xf0, 0x00, 0x00, + 0x00, 0xf0, 0x00, 0xf0, 0x50, 0x50, 0x50, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x03, 0x02, 0x02, 0x02, 0x00, 0x03, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, + 0x01, 0x00, 0x00, 0x03, 0x02, 0x02, 0x02, 0x00, 0x03, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 + }; + oled_write_raw_P(my_logo, sizeof(my_logo)); +} + +/* text display for layer indication */ +__attribute__((weak)) void oled_task_user(void) { + + render_goblin_logo(); + + switch (get_highest_layer(layer_state)) { + case 0: + oled_set_cursor(0,11); + oled_advance_char(); + oled_write_P(PSTR("ONE\n"), false); + break; + case 1: + oled_set_cursor(0,11); + oled_advance_char(); + oled_write_P(PSTR("TWO\n"), false); + break; + case 2: + oled_set_cursor(0,11); + oled_write_P(PSTR("THREE\n"), false); + break; + } +} +#endif -- cgit v1.2.3