summaryrefslogtreecommitdiff
path: root/keyboards/zen/rev2
diff options
context:
space:
mode:
authorXScorpion2 <rcalt2vt@gmail.com>2019-04-15 00:29:50 -0400
committerDrashna Jaelre <drashna@live.com>2019-04-14 21:29:50 -0700
commitffc82ebdb2ee00c14dd225eb057d209d4584a623 (patch)
tree8b6fdf04546b52ce810e28bf1183e35ec628cc7e /keyboards/zen/rev2
parent49746830402cc0e1c0227c6c3c06ebc22fcd016c (diff)
[Keyboard] Zen keyboard update for Rev2 (#5522)
* Updated Zen keyboard for rev2 support * Fixing r1 compile errors * PR feedback and changes for Proton-C compile errors
Diffstat (limited to 'keyboards/zen/rev2')
-rw-r--r--keyboards/zen/rev2/config.h98
-rw-r--r--keyboards/zen/rev2/keymaps/debug/keymap.c19
-rw-r--r--keyboards/zen/rev2/keymaps/default/keymap.c117
-rw-r--r--keyboards/zen/rev2/rev2.c66
-rw-r--r--keyboards/zen/rev2/rev2.h56
-rw-r--r--keyboards/zen/rev2/rules.mk14
6 files changed, 370 insertions, 0 deletions
diff --git a/keyboards/zen/rev2/config.h b/keyboards/zen/rev2/config.h
new file mode 100644
index 0000000000..dc37472f6b
--- /dev/null
+++ b/keyboards/zen/rev2/config.h
@@ -0,0 +1,98 @@
+/*
+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
+
+// If using 90 Degree rotation, increase block cout
+#ifdef OLED_ROTATE90
+ #define OLED_DISPLAY_CUSTOM
+ #define OLED_DISPLAY_WIDTH 128
+ #define OLED_DISPLAY_HEIGHT 32
+ #define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 512 (compile time mathed)
+ #define OLED_BLOCK_TYPE uint16_t // Type to use for segmenting the oled display for smart rendering, use unsigned types only
+ #define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 8 (compile time mathed)
+ #define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed)
+ #define OLED_SOURCE_MAP { 0, 8, 16, 24 }
+ #define OLED_TARGET_MAP { 24, 16, 8, 0 }
+#endif
+
+/*
+ * 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/zen/rev2/keymaps/debug/keymap.c b/keyboards/zen/rev2/keymaps/debug/keymap.c
new file mode 100644
index 0000000000..e2d3d6a356
--- /dev/null
+++ b/keyboards/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/zen/rev2/keymaps/default/keymap.c b/keyboards/zen/rev2/keymaps/default/keymap.c
new file mode 100644
index 0000000000..41003e4a55
--- /dev/null
+++ b/keyboards/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.
+#define _QWERTY 0
+#define _NAV 2
+
+
+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/zen/rev2/rev2.c b/keyboards/zen/rev2/rev2.c
new file mode 100644
index 0000000000..4104460db1
--- /dev/null
+++ b/keyboards/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 90 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
+}
+
+#ifdef OLED_ROTATE90
+bool oled_init_user(bool flip180) {
+ return true;
+}
+#endif
+
+__attribute__((weak))
+void oled_task_user(void) {
+ if (is_keyboard_master()) {
+ render_status();
+ } else {
+ render_logo();
+ oled_scroll_left();
+ }
+}
+
+#endif
diff --git a/keyboards/zen/rev2/rev2.h b/keyboards/zen/rev2/rev2.h
new file mode 100644
index 0000000000..101622988d
--- /dev/null
+++ b/keyboards/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/zen/rev2/rules.mk b/keyboards/zen/rev2/rules.mk
new file mode 100644
index 0000000000..d1fe410525
--- /dev/null
+++ b/keyboards/zen/rev2/rules.mk
@@ -0,0 +1,14 @@
+ENCODER_ENABLE = yes
+
+OLED_DRIVER_ENABLE = no
+OLED_ROTATE90 = yes
+
+# Setup so that OLED and 90 degree rotation can be turned on/off easily
+# with "OLED_DRIVER_ENABLE = yes" or "OLED_ROTATE90 = no" in user's rules.mk file
+ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
+ # Custom local font file
+ OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\"
+ ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
+ OPT_DEFS += -DOLED_ROTATE90
+ endif
+endif