diff options
Diffstat (limited to 'keyboards/rgbkb/zen/rev2')
-rw-r--r-- | keyboards/rgbkb/zen/rev2/config.h | 86 | ||||
-rw-r--r-- | keyboards/rgbkb/zen/rev2/info.json | 345 | ||||
-rw-r--r-- | keyboards/rgbkb/zen/rev2/keymaps/debug/keymap.c | 19 | ||||
-rw-r--r-- | keyboards/rgbkb/zen/rev2/keymaps/default/keymap.c | 117 | ||||
-rw-r--r-- | keyboards/rgbkb/zen/rev2/rev2.c | 66 | ||||
-rw-r--r-- | keyboards/rgbkb/zen/rev2/rev2.h | 56 | ||||
-rw-r--r-- | keyboards/rgbkb/zen/rev2/rules.mk | 9 |
7 files changed, 698 insertions, 0 deletions
diff --git a/keyboards/rgbkb/zen/rev2/config.h b/keyboards/rgbkb/zen/rev2/config.h new file mode 100644 index 0000000000..c56956108d --- /dev/null +++ b/keyboards/rgbkb/zen/rev2/config.h @@ -0,0 +1,86 @@ +/* +Copyright 2017 Danny Nguyen <danny@hexwire.com> + +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 <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x3061 +#define DEVICE_VER 0x0002 +#define MANUFACTURER Legonut +#define PRODUCT "Project Zen" +#define DESCRIPTION "Split gaming keyboard" + +/* key matrix size */ +// Rows are doubled-up + +// wiring of each half +#ifdef CONVERT_TO_PROTON_C + #define MATRIX_ROWS 5 + #define MATRIX_COLS 7 +#else + #define MATRIX_ROWS 10 + #define MATRIX_COLS 7 +#endif + +// Proton-C does pin conversion +#define MATRIX_ROW_PINS { C6, E6, B5, D7, B4 } +#define MATRIX_COL_PINS { F4, F5, F6, F7, B3, B1, B2 } + +#define NUMBER_OF_ENCODERS 1 + +#define ENCODERS_PAD_A { D4 } +#define ENCODERS_PAD_B { D2 } + +#define RGB_DI_PIN B6 +#define SOFT_SERIAL_PIN D3 + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* ws2812 RGB LED */ +#define RGBLED_NUM 34 // Number of LEDs +#define RGBLIGHT_ANIMATIONS + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +// #define NO_DEBUG + +/* disable print */ +// #define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION diff --git a/keyboards/rgbkb/zen/rev2/info.json b/keyboards/rgbkb/zen/rev2/info.json new file mode 100644 index 0000000000..b3015388c1 --- /dev/null +++ b/keyboards/rgbkb/zen/rev2/info.json @@ -0,0 +1,345 @@ +{ + "keyboard_name": "Zen", + "url": "", + "maintainer": "qmk", + "width": 17, + "height": 6.5, + "layouts": { + "LAYOUT": { + "layout": [ + { + "label": "k00", + "x": 0.5, + "y": 0 + }, + { + "label": "k01", + "x": 1.5, + "y": 0 + }, + { + "label": "k02", + "x": 2.5, + "y": 0 + }, + { + "label": "k03", + "x": 3.5, + "y": 0 + }, + { + "label": "k04", + "x": 4.5, + "y": 0 + }, + { + "label": "k05", + "x": 5.5, + "y": 0 + }, + { + "label": "k55", + "x": 10.5, + "y": 0 + }, + { + "label": "k54", + "x": 11.5, + "y": 0 + }, + { + "label": "k53", + "x": 12.5, + "y": 0 + }, + { + "label": "k52", + "x": 13.5, + "y": 0 + }, + { + "label": "k51", + "x": 14.5, + "y": 0 + }, + { + "label": "k50", + "x": 15.5, + "y": 0 + }, + { + "label": "k10", + "x": 0, + "y": 1, + "w": 1.5 + }, + { + "label": "k11", + "x": 1.5, + "y": 1 + }, + { + "label": "k12", + "x": 2.5, + "y": 1 + }, + { + "label": "k13", + "x": 3.5, + "y": 1 + }, + { + "label": "k14", + "x": 4.5, + "y": 1 + }, + { + "label": "k15", + "x": 5.5, + "y": 1 + }, + { + "label": "k65", + "x": 10.5, + "y": 1 + }, + { + "label": "k64", + "x": 11.5, + "y": 1 + }, + { + "label": "k63", + "x": 12.5, + "y": 1 + }, + { + "label": "k62", + "x": 13.5, + "y": 1 + }, + { + "label": "k61", + "x": 14.5, + "y": 1 + }, + { + "label": "k60", + "x": 15.5, + "y": 1, + "w": 1.5 + }, + { + "label": "k20", + "x": 0, + "y": 2, + "w": 1.5 + }, + { + "label": "k21", + "x": 1.5, + "y": 2 + }, + { + "label": "k22", + "x": 2.5, + "y": 2 + }, + { + "label": "k23", + "x": 3.5, + "y": 2 + }, + { + "label": "k24", + "x": 4.5, + "y": 2 + }, + { + "label": "k25", + "x": 5.5, + "y": 2 + }, + { + "label": "k75", + "x": 10.5, + "y": 2 + }, + { + "label": "k74", + "x": 11.5, + "y": 2 + }, + { + "label": "k73", + "x": 12.5, + "y": 2 + }, + { + "label": "k72", + "x": 13.5, + "y": 2 + }, + { + "label": "k71", + "x": 14.5, + "y": 2 + }, + { + "label": "k70", + "x": 15.5, + "y": 2, + "w": 1.5 + }, + { + "label": "k30", + "x": 0, + "y": 3, + "w": 1.5 + }, + { + "label": "k31", + "x": 1.5, + "y": 3 + }, + { + "label": "k32", + "x": 2.5, + "y": 3 + }, + { + "label": "k33", + "x": 3.5, + "y": 3 + }, + { + "label": "k34", + "x": 4.5, + "y": 3 + }, + { + "label": "k35", + "x": 5.5, + "y": 3 + }, + { + "label": "k16", + "x": 6.5, + "y": 3 + }, + { + "label": "k66", + "x": 9.5, + "y": 3 + }, + { + "label": "k85", + "x": 10.5, + "y": 3 + }, + { + "label": "k84", + "x": 11.5, + "y": 3 + }, + { + "label": "k83", + "x": 12.5, + "y": 3 + }, + { + "label": "k82", + "x": 13.5, + "y": 3 + }, + { + "label": "k81", + "x": 14.5, + "y": 3 + }, + { + "label": "k80", + "x": 15.5, + "y": 3, + "w": 1.5 + }, + { + "label": "k40", + "x": 0, + "y": 4, + "w": 1.5 + }, + { + "label": "k41", + "x": 1.5, + "y": 4 + }, + { + "label": "k42", + "x": 2.5, + "y": 4 + }, + { + "label": "k43", + "x": 3.5, + "y": 4 + }, + { + "label": "k44", + "x": 4.5, + "y": 4 + }, + { + "label": "k36", + "x": 6, + "y": 4.5, + "h": 2 + }, + { + "label": "k26", + "x": 7, + "y": 4.5, + "h": 2 + }, + { + "label": "k76", + "x": 9, + "y": 4.5, + "h": 2 + }, + { + "label": "k86", + "x": 10, + "y": 4.5, + "h": 2 + }, + { + "label": "k94", + "x": 11.5, + "y": 4 + }, + { + "label": "k93", + "x": 12.5, + "y": 4 + }, + { + "label": "k92", + "x": 13.5, + "y": 4 + }, + { + "label": "k91", + "x": 14.5, + "y": 4 + }, + { + "label": "k90", + "x": 15.5, + "y": 4, + "w": 1.5 + } + ] + } + } + } diff --git a/keyboards/rgbkb/zen/rev2/keymaps/debug/keymap.c b/keyboards/rgbkb/zen/rev2/keymaps/debug/keymap.c new file mode 100644 index 0000000000..e2d3d6a356 --- /dev/null +++ b/keyboards/rgbkb/zen/rev2/keymaps/debug/keymap.c @@ -0,0 +1,19 @@ +#include QMK_KEYBOARD_H +#include <stdio.h> + +// extern keymap_config_t keymap_config; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { { { KC_TRNS } } }; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + static char buf[10] = " "; + + if (record->event.pressed) { + snprintf(buf, 10, "C%dR%d ", record->event.key.col, record->event.key.row); + + send_string(buf); + } + return false; + + return true; +} diff --git a/keyboards/rgbkb/zen/rev2/keymaps/default/keymap.c b/keyboards/rgbkb/zen/rev2/keymaps/default/keymap.c new file mode 100644 index 0000000000..dba4a2ddd8 --- /dev/null +++ b/keyboards/rgbkb/zen/rev2/keymaps/default/keymap.c @@ -0,0 +1,117 @@ +#include QMK_KEYBOARD_H + +extern keymap_config_t keymap_config; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +enum layer_number { + _QWERTY = 0, + _NAV +}; + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + NAV +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Qwerty + * ,-----------------------------------------. .-----------------------------------------. + * | GESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | | Y | U | I | O | P | \ | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * |CAPS(NAV)|A | S | D | F | G | | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------..------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B |RGBPrv||RGBNxt| N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------||------+------+------+------+------+------+------| + * | Ctrl | GUI | Alt |RGBTOG| NAV |Space |Delete||Enter |Space | NAV | - | = | PGUP | PGDN | + * `----------------------------------+-------------''------------------------------------------------' + * |Space |Delete||Enter |Space | + * '-------------''-------------' + */ + [_QWERTY] = LAYOUT( \ + KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, \ + LT(_NAV, KC_CAPS),KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, RGB_RMOD,RGB_MOD, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, \ + KC_LCTL, KC_LGUI, KC_LALT, RGB_TOG, MO(_NAV), KC_SPC, KC_DEL, KC_ENT, KC_SPACE, MO(_NAV), KC_MINS, KC_EQL, KC_PGUP, KC_PGDN, \ + KC_SPC, KC_DEL, KC_ENT, KC_SPACE \ + ), + + /* NAV + * ,-----------------------------------------. .-----------------------------------------. + * | GESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | | Y | U | I | O | P | \ | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * |CAPS(NAV)|A | S | D | F | G | | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------..------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | || | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------||------+------+------+------+------+------+------| + * | Ctrl | GUI | Alt |RGBTOG| NAV |Space |Delete||Enter |Space | NAV | - | = | PGUP | PGDN | + * `----------------------------------+-------------''------------------------------------------------' + * |Space |Delete||Enter |Space | + * '-------------''-------------' + */ + [_NAV] = LAYOUT( \ + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ + _______, RGB_SAI, RGB_VAI, RGB_SAD, RESET, KC_LBRC, KC_RBRC, KC_PGUP, KC_UP, KC_PGDN, KC_INS, KC_HOME, \ + _______, RGB_HUD, RGB_VAD, RGB_HUI, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_DEL, KC_END, \ + KC_LSFT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MPRV, KC_MNXT, \ + KC_LCTL, KC_LGUI, KC_LALT, RGB_MOD, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_VOLU, KC_VOLD, \ + _______, _______, _______, _______ + ), + +}; + +void encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { /* First encoder */ + if (clockwise) { + tap_code(KC_PGDN); + } else { + tap_code(KC_PGUP); + } + } else if (index == 1) { /* Second encoder from slave */ + if (clockwise) { + tap_code(KC_UP); + } else { + tap_code(KC_DOWN); + } + } +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(1UL<<_QWERTY); + } + return false; + break; + //case COLEMAK: + //if (record->event.pressed) { + //set_single_persistent_default_layer(1UL<<_COLEMAK); + //} + //return false; + //break; + } + return true; +} + + +#if OLED_DRIVER_ENABLE +const char* layer_name_user(uint32_t layer) { + switch (layer) { + case _QWERTY: + return PSTR("QWRTY"); + case _NAV: + return PSTR("NAV\n"); + default: + return PSTR("UNDEF"); + } +} +#endif diff --git a/keyboards/rgbkb/zen/rev2/rev2.c b/keyboards/rgbkb/zen/rev2/rev2.c new file mode 100644 index 0000000000..28a5a9f203 --- /dev/null +++ b/keyboards/rgbkb/zen/rev2/rev2.c @@ -0,0 +1,66 @@ +#include "rev2.h" + +#ifdef OLED_DRIVER_ENABLE +#include "split_util.h" +#include "oled_driver.h" + +__attribute__((weak)) +void render_logo(void) { + static const char PROGMEM sol_logo[] = { + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, + 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, + 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0}; + + oled_write_P(sol_logo, false); +} + +__attribute__((weak)) +const char* layer_name_user(uint32_t layer) { + switch (layer) { + default: + return PSTR("UNDEF\n"); + } +} + +__attribute__((weak)) +void render_status(void) { + // Setup for 270 degree rendering because it's awesome! + // It can house 16 lines of text, with 5 letters each line + // Render to mode icon + static const char PROGMEM mode_logo[2][4] = { + {0x97,0x98,0x0a,0}, + {0xb7,0xb8,0x0a,0} }; + + oled_write_P(mode_logo[0], false); // Line 1 + oled_write_P(mode_logo[1], false); // Line 2 + + // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below + oled_set_cursor(0, 3); // Line 3 + oled_write_P(PSTR("Layer"), false); // Line 4 + oled_write_P(layer_name_user(biton32(layer_state)), false); + + // Host Keyboard LED Status + uint8_t led_usb_state = host_keyboard_leds(); + oled_set_cursor(0, oled_max_lines() - 4); // Line 13 + oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLK") : PSTR(" "), false); // Line 14 + oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false); // Line 15 + oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false); // Line 16 +} + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (is_keyboard_master()) + return OLED_ROTATION_270; // flips the display 270 degrees if mainhand + return rotation; +} + +__attribute__((weak)) +void oled_task_user(void) { + if (is_keyboard_master()) { + render_status(); + } else { + render_logo(); + oled_scroll_left(); + } +} + +#endif diff --git a/keyboards/rgbkb/zen/rev2/rev2.h b/keyboards/rgbkb/zen/rev2/rev2.h new file mode 100644 index 0000000000..101622988d --- /dev/null +++ b/keyboards/rgbkb/zen/rev2/rev2.h @@ -0,0 +1,56 @@ +#pragma once + +#include "zen.h" + +//void promicro_bootloader_jmp(bool program); +#include "quantum.h" + + +#ifdef USE_I2C +#include <stddef.h> +#ifdef __AVR__ + #include <avr/io.h> + #include <avr/interrupt.h> +#endif +#endif + +//void promicro_bootloader_jmp(bool program); + +#ifdef CONVERT_TO_PROTON_C + #define LAYOUT( \ + k00, k01, k02, k03, k04, k05, k55, k54, k53, k52, k51, k50, \ + k10, k11, k12, k13, k14, k15, k65, k64, k63, k62, k61, k60, \ + k20, k21, k22, k23, k24, k25, k75, k74, k73, k72, k71, k70, \ + k30, k31, k32, k33, k34, k35, k16, k66, k85, k84, k83, k82, k81, k80, \ + k40, k41, k42, k43, k44, k36, k26, k76, k86, k94, k93, k92, k91, k90, \ + k45, k46, k96, k95 \ + ) \ + { \ + { k00, k01, k02, k03, k04, k05, KC_NO }, \ + { k10, k11, k12, k13, k14, k15, k16 }, \ + { k20, k21, k22, k23, k24, k25, k26 }, \ + { k30, k31, k32, k33, k34, k35, k36 }, \ + { k40, k41, k42, k43, k44, k45, k46 } \ + } +#else + #define LAYOUT( \ + k00, k01, k02, k03, k04, k05, k55, k54, k53, k52, k51, k50, \ + k10, k11, k12, k13, k14, k15, k65, k64, k63, k62, k61, k60, \ + k20, k21, k22, k23, k24, k25, k75, k74, k73, k72, k71, k70, \ + k30, k31, k32, k33, k34, k35, k16, k66, k85, k84, k83, k82, k81, k80, \ + k40, k41, k42, k43, k44, k36, k26, k76, k86, k94, k93, k92, k91, k90, \ + k45, k46, k96, k95 \ + ) \ + { \ + { k00, k01, k02, k03, k04, k05, KC_NO }, \ + { k10, k11, k12, k13, k14, k15, k16 }, \ + { k20, k21, k22, k23, k24, k25, k26 }, \ + { k30, k31, k32, k33, k34, k35, k36 }, \ + { k40, k41, k42, k43, k44, k45, k46 }, \ + { k50, k51, k52, k53, k54, k55, KC_NO }, \ + { k60, k61, k62, k63, k64, k65, k66 }, \ + { k70, k71, k72, k73, k74, k75, k76 }, \ + { k80, k81, k82, k83, k84, k85, k86 }, \ + { k90, k91, k92, k93, k94, k95, k96 } \ + } +#endif diff --git a/keyboards/rgbkb/zen/rev2/rules.mk b/keyboards/rgbkb/zen/rev2/rules.mk new file mode 100644 index 0000000000..e9d19a69aa --- /dev/null +++ b/keyboards/rgbkb/zen/rev2/rules.mk @@ -0,0 +1,9 @@ +ENCODER_ENABLE = yes + +OLED_DRIVER_ENABLE = no + +# Setup so that OLED can be turned on/off easily +ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes) + # Custom local font file + OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\" +endif |