From 719881c2ee2b61b15ed02d82c2870f7ae93e70e5 Mon Sep 17 00:00:00 2001 From: Kyrre Havik Date: Sat, 5 Feb 2022 04:06:49 +0100 Subject: [PATCH] [Keyboard] Add Xenon keyboard (#15915) Co-authored-by: Sam Mohr Co-authored-by: Drashna Jaelre Co-authored-by: Ryan Co-authored-by: Joel Challis --- keyboards/xenon/config.h | 65 ++++++++++++++++ keyboards/xenon/info.json | 70 +++++++++++++++++ keyboards/xenon/keymaps/default/keymap.c | 64 ++++++++++++++++ keyboards/xenon/readme.md | 30 ++++++++ keyboards/xenon/rules.mk | 21 +++++ keyboards/xenon/xenon.c | 97 ++++++++++++++++++++++++ keyboards/xenon/xenon.h | 40 ++++++++++ 7 files changed, 387 insertions(+) create mode 100644 keyboards/xenon/config.h create mode 100644 keyboards/xenon/info.json create mode 100644 keyboards/xenon/keymaps/default/keymap.c create mode 100644 keyboards/xenon/readme.md create mode 100644 keyboards/xenon/rules.mk create mode 100644 keyboards/xenon/xenon.c create mode 100644 keyboards/xenon/xenon.h diff --git a/keyboards/xenon/config.h b/keyboards/xenon/config.h new file mode 100644 index 0000000000..b14861140c --- /dev/null +++ b/keyboards/xenon/config.h @@ -0,0 +1,65 @@ +/* +Copyright 2020 Kyrre Havik Eriksen + +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 0x3404 +#define DEVICE_VER 0x0001 +#define PRODUCT Xenon + +/* key matrix size */ +/* Rows are doubled up */ +#define MATRIX_ROWS 10 +#define MATRIX_COLS 7 + +// wiring +#define MATRIX_ROW_PINS { D4, C6, D7, E6, B4 } +#define MATRIX_COL_PINS { B2, B3, B1, F7, F6, F5, F4 } + +#define ENCODERS_PAD_A { B6 } +#define ENCODERS_PAD_B { B5 } + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* + * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. + */ +#define SOFT_SERIAL_PIN D2 + +/* 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 + +#ifdef OLED_ENABLE + #define OLED_DISPLAY_128X32 +#endif + +// If you are using an Elite C rev3 on the slave side, uncomment the lines below: +// #define SPLIT_USB_DETECT +// #define NO_USB_STARTUP_CHECK diff --git a/keyboards/xenon/info.json b/keyboards/xenon/info.json new file mode 100644 index 0000000000..e0b5e95264 --- /dev/null +++ b/keyboards/xenon/info.json @@ -0,0 +1,70 @@ +{ + "keyboard_name": "Xenon", + "url": "https://github.com/narinari/xenon-keyboard", + "maintainer": "Kyrremann", + "manufacturer": "narinari", + "layouts": { + "LAYOUT": { + "layout": [ + {"x":3, "y":0}, + {"x":11, "y":0}, + {"x":2, "y":0.25}, + {"x":4, "y":0.25}, + {"x":10, "y":0.25}, + {"x":12, "y":0.25}, + {"x":5, "y":0.5}, + {"x":9, "y":0.5}, + {"x":0, "y":0.75}, + {"x":1, "y":0.75}, + {"x":13, "y":0.75}, + {"x":14, "y":0.75}, + + {"x":3, "y":1}, + {"x":11, "y":1}, + {"x":2, "y":1.25}, + {"x":4, "y":1.25}, + {"x":10, "y":1.25}, + {"x":12, "y":1.25}, + {"x":5, "y":1.5}, + {"x":9, "y":1.5}, + {"x":0, "y":1.75}, + {"x":1, "y":1.75}, + {"x":13, "y":1.75}, + {"x":14, "y":1.75}, + + {"x":3, "y":2}, + {"x":11, "y":2}, + {"x":2, "y":2.25}, + {"x":4, "y":2.25}, + {"x":10, "y":2.25}, + {"x":12, "y":2.25}, + {"x":5, "y":2.5}, + {"x":9, "y":2.5}, + {"x":0, "y":2.75}, + {"x":1, "y":2.75}, + {"x":13, "y":2.75}, + {"x":14, "y":2.75}, + + {"x":3, "y":3}, + {"x":11, "y":3}, + {"x":2, "y":3.25}, + {"x":4, "y":3.25}, + {"x":10, "y":3.25}, + {"x":12, "y":3.25}, + {"x":5, "y":3.5}, + {"x":6, "y":3.5}, + {"x":8, "y":3.5}, + {"x":9, "y":3.5}, + + {"x":3, "y":4}, + {"x":11, "y":4}, + {"x":4, "y":4.25}, + {"x":10, "y":4.25}, + {"x":5, "y":4.5}, + {"x":6, "y":4.5}, + {"x":8, "y":4.5}, + {"x":9, "y":4.5} + ] + } + } +} diff --git a/keyboards/xenon/keymaps/default/keymap.c b/keyboards/xenon/keymaps/default/keymap.c new file mode 100644 index 0000000000..97d1016647 --- /dev/null +++ b/keyboards/xenon/keymaps/default/keymap.c @@ -0,0 +1,64 @@ +/* Copyright 2020 Kyrre Havik Eriksen + * + * 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 + +enum layers { + _QWERTY = 0, + _LOWER, + _RAISE, + _ADJUST +}; + +#define M_LWR MO(_LOWER) +#define M_RSE MO(_RAISE) +#define L(kc) (LSFT(kc)) +#define R(kc) (RALT(kc)) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT( + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, + KC_LCTL, 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, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), + KC_MUTE, KC_RALT, KC_LALT, KC_LGUI, KC_SPC, KC_ENT, M_LWR, KC_BSPC, M_RSE, KC_MPLY, + KC_DEL , KC_PGDN, KC_PGUP, KC_ESC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + ), + [_LOWER] = LAYOUT( + KC_BSLS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_TRNS, L(KC_1),L(KC_2), L(KC_3), L(KC_4),L(KC_5), L(KC_6), L(KC_7), L(KC_8), L(KC_9), L(KC_0), L(KC_MINS), + KC_TRNS, KC_GRV, KC_TRNS, L(KC_EQL),L(KC_RBRC),L(KC_BSLS), KC_BSLS, KC_RBRC, KC_EQL, KC_VOLD, KC_VOLU, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_ENT, KC_SPC, KC_TRNS, KC_TRNS, KC_RALT, + KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_ENT, KC_SPC, KC_TAB, KC_BSPC + ), + [_RAISE] = 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, + KC_LCTL, 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, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), + KC_LGUI, KC_DEL, KC_ENT, KC_SPC, KC_ESC, KC_ENT, KC_SPC, KC_TAB, KC_BSPC, KC_RALT, + KC_DEL, KC_ENT, KC_SPC, KC_ESC, KC_ENT, KC_SPC, KC_TAB, KC_BSPC + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + // If console is enabled, it will print the matrix position and status of each key pressed +#ifdef CONSOLE_ENABLE + uprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed); +#endif + return true; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} diff --git a/keyboards/xenon/readme.md b/keyboards/xenon/readme.md new file mode 100644 index 0000000000..d3b4464710 --- /dev/null +++ b/keyboards/xenon/readme.md @@ -0,0 +1,30 @@ +# Xenon + +![Xenon](https://i.imgur.com/QYMDzGFh.jpg) + +Xenon is 60% columnar staggered keyboard. + +* Cherry MX and Kailh low profile key switch support +* OLED display +* Full color LED +* Prototype board area (behind the promicro) + +* Keyboard Maintainer: [Narinari](https://github.com/narinari) +* Keymap Maintainer: [Kyrremann](https://github.com/Kyrremann) +* Keyboard files can be found here: https://github.com/narinari/xenon-keyboard + +Make example for this keyboard (after setting up your build environment): + + make xenon:default + +Example of flashing this keyboard: + + make xenon:default:flash + +How to enter bootloader (DFU): + +Press the reset button next to the TRRS port on the side you are trying to flash (USB must be connected to the Pro Micro that you are flashing). + +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 +the [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/xenon/rules.mk b/keyboards/xenon/rules.mk new file mode 100644 index 0000000000..aeaa1fd104 --- /dev/null +++ b/keyboards/xenon/rules.mk @@ -0,0 +1,21 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +SPLIT_KEYBOARD = yes +OLED_ENABLE = yes +ENCODER_ENABLE = yes diff --git a/keyboards/xenon/xenon.c b/keyboards/xenon/xenon.c new file mode 100644 index 0000000000..9ca5720776 --- /dev/null +++ b/keyboards/xenon/xenon.c @@ -0,0 +1,97 @@ +/* Copyright 2020 Kyrre Havik Eriksen + * + * 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 "xenon.h" + +#ifdef OLED_ENABLE +oled_rotation_t oled_init_kb(oled_rotation_t rotation) { + if (!is_keyboard_master()) { + return OLED_ROTATION_180; // flips the display 180 degrees if offhand + } + + return OLED_ROTATION_270; +} + +static void render_named_logo(void) { + static const char PROGMEM raw_logo[] = { + 12, 60,252,252,252,236,236,140, 12, 28,248,192, 0,192,248,252,252,252,108, 12, 12,140,236, 60, 12, 0, 0, 0,248,252,252,252,236,204,204,204,204,204,204,204,204,204,204,204,204,140, 12,252,248, 0, 0, 0,252,252,252,252,236,236,236,204, 12, 60,240,192, 0, 0, 0,252,252,252,236,236, 12, 12, 12,252,248, 0, 0,192,224, 96, 48, 24, 24,140,140,132,196,196,196,196,132,140,140, 12, 24, 48, 48, 96,192,128, 0, 0,252,252,252,236,236,236,236,140, 28,120,224,128, 0, 0,252,252,252,252,236,236, 12, 12, 12,252, + 0, 0, 0, 3, 15,255,255,255,254,248,192,195,223,255,255, 63, 15, 1,224,248, 30, 7, 1, 0, 0, 0, 0, 0,255,255,255,255,255,255, 0, 0, 1, 63, 63, 51, 51, 51, 51, 51, 51, 51,243, 3, 1, 0, 0, 0,255,255,255,255,255, 1, 15,127,255,252,240,195, 15, 60,240,255,255,255,255,255, 0, 0, 0,255,255,254,255,255,255,127, 14, 2,195,247, 63, 31, 15, 15, 15, 15, 31, 63,255,255,254,252,248,224, 1, 3, 30,252,255,255,255,255,255, 3, 31,255,254,248,225,135, 30,120,255,255,255,255,255,255, 0, 0, 0,255, + 0, 0,128,240,252,255,255,255, 63, 7, 1,227,127,255,255,255,248,224, 1, 7, 62,240,192, 0, 0, 0, 0, 0,255,255,255,255,255,255, 1, 3, 7,255,255,207,207,207,207,207,206,204,207,192,128, 0, 0, 0,255,255,255,255,255, 0, 0, 0,255,255, 15,127,255,252,240,227,143,127,255,255, 0, 0, 0,255,255, 63,255,255,255,254,240,192,131,135, 12, 24, 48, 48, 48, 48, 24, 28, 15,159,255, 63, 31, 7,128,192,120, 31,255,255,255,255,255, 0, 0, 0,255,255, 31,127,255,252,241,199, 31,127,255,255, 0, 0, 0,255, + 48, 62, 63, 63, 63, 63, 63, 56, 48, 60, 31, 3, 0, 3, 31, 63, 63, 63, 63, 60, 60, 56, 59, 63, 56, 0, 0, 0, 31, 63, 63, 63, 63, 63, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 56, 63, 31, 0, 0, 0, 63, 63, 63, 63, 63, 60, 56, 48, 63, 63, 0, 0, 0, 3, 31, 63, 63, 62, 61, 63, 60, 56, 48, 63, 31, 0, 0, 1, 7, 7, 15, 31, 31, 63, 63, 63, 62, 62, 62, 62, 63, 63, 63, 31, 31, 15, 14, 6, 3, 1, 0, 0, 63, 63, 63, 63, 63, 60, 56, 56, 63, 31, 0, 0, 1, 7, 31, 63, 63, 60, 63, 63, 60, 56, 48, 63 + }; + oled_write_raw_P(raw_logo, sizeof(raw_logo)); +} + +static void render_status(void) { + oled_write_P(PSTR("\n\n\n-----\nXENON\n-----\n\n"), false); + + // Host Keyboard Layer Status + switch (get_highest_layer(layer_state)) { + case 0: + oled_write_P(PSTR("Base \n"), false); + break; + case 1: + oled_write_P(PSTR("Lower\n"), false); + break; + case 2: + oled_write_P(PSTR("Raise\n"), false); + break; + default: + oled_write_P(PSTR("Undef\n"), false); + } + oled_write_P(PSTR("Layer\n"), false); +} + +bool oled_task_kb(void) { + if (!oled_task_user()) { + return false; + } + + if (is_keyboard_master()) { + render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc) + } else { + render_named_logo(); + } + + return true; +} +#endif + +#ifdef ENCODER_ENABLE +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { + return false; + } + + if (index == 0) { + // Volume control + if (clockwise) { + tap_code(KC_VOLD); + } else { + tap_code(KC_VOLU); + } + } + else if (index == 1) { + // Page up/Page down + if (clockwise) { + tap_code(KC_PGDN); + } else { + tap_code(KC_PGUP); + } + } + + return true; +} +#endif diff --git a/keyboards/xenon/xenon.h b/keyboards/xenon/xenon.h new file mode 100644 index 0000000000..030d9bcb8c --- /dev/null +++ b/keyboards/xenon/xenon.h @@ -0,0 +1,40 @@ +/* Copyright 2020 Kyrre Havik Eriksen + * + * 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" + +#define XXX KC_NO + +#define LAYOUT( \ + L00, L01, L02, L03, L04, L05, R06, R07, R08, R09, R10, R11, \ + L12, L13, L14, L15, L16, L17, R18, R19, R20, R21, R22, R23, \ + L24, L25, L26, L27, L28, L29, R30, R31, R32, R33, R34, R35, \ + L36, L37, L38, L39, L40, R41, R42, R43, R44, R45, \ + L46, L47, L48, L49, R50, R51, R52, R53 \ +) \ +{ \ + { XXX, L05, L04, L03, L02, L01, L00 }, \ + { XXX, L17, L16, L15, L14, L13, L12 }, \ + { XXX, L29, L28, L27, L26, L25, L24 }, \ + { L40, L39, L38, L37, L36, XXX, XXX }, \ + { L49, L48, L47, L46, XXX, XXX, XXX }, \ + { XXX, R06, R07, R08, R09, R10, R11 }, \ + { XXX, R18, R19, R20, R21, R22, R23 }, \ + { XXX, R30, R31, R32, R33, R34, R35 }, \ + { R41, R42, R43, R44, R45, XXX, XXX }, \ + { R50, R51, R52, R53, XXX, XXX, XXX } \ +}