diff options
author | Uy Bui <uybv.cntt@gmail.com> | 2021-07-20 14:26:26 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-19 22:26:26 -0700 |
commit | 125691558398c4bfff93b457147b2802365cbd3f (patch) | |
tree | 1e4ea53de60bef8b57c441f752b52f9518409bc3 /keyboards/wekey | |
parent | 35ee990bd0293efbd5746671f1e58cec262a066b (diff) | |
download | qmk_firmware-125691558398c4bfff93b457147b2802365cbd3f.tar.gz qmk_firmware-125691558398c4bfff93b457147b2802365cbd3f.zip |
[Keyboard] Add we27 numpad (#13137)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/wekey')
-rw-r--r-- | keyboards/wekey/we27/config.h | 219 | ||||
-rw-r--r-- | keyboards/wekey/we27/encoder_actions.c | 57 | ||||
-rw-r--r-- | keyboards/wekey/we27/encoder_actions.h | 21 | ||||
-rw-r--r-- | keyboards/wekey/we27/info.json | 29 | ||||
-rw-r--r-- | keyboards/wekey/we27/keymaps/default/keymap.c | 52 | ||||
-rw-r--r-- | keyboards/wekey/we27/keymaps/default/readme.md | 1 | ||||
-rw-r--r-- | keyboards/wekey/we27/keymaps/via/keymap.c | 52 | ||||
-rw-r--r-- | keyboards/wekey/we27/keymaps/via/readme.md | 1 | ||||
-rw-r--r-- | keyboards/wekey/we27/keymaps/via/rules.mk | 2 | ||||
-rw-r--r-- | keyboards/wekey/we27/readme.md | 19 | ||||
-rw-r--r-- | keyboards/wekey/we27/rgb_matrix_kb.inc | 27 | ||||
-rw-r--r-- | keyboards/wekey/we27/rules.mk | 32 | ||||
-rw-r--r-- | keyboards/wekey/we27/we27.c | 58 | ||||
-rw-r--r-- | keyboards/wekey/we27/we27.h | 53 |
14 files changed, 623 insertions, 0 deletions
diff --git a/keyboards/wekey/we27/config.h b/keyboards/wekey/we27/config.h new file mode 100644 index 0000000000..332b476a4d --- /dev/null +++ b/keyboards/wekey/we27/config.h @@ -0,0 +1,219 @@ +/* +Copyright 2021 @wekey + +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 + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x5559 +#define PRODUCT_ID 0x0001 +#define DEVICE_VER 0x0001 +#define MANUFACTURER @wekey +#define PRODUCT We27 + +/* key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 5 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * + */ +#define MATRIX_ROW_PINS { F1, D7, B4, B5, B6, F6 } +#define MATRIX_COL_PINS { F4, F5, C7, D6, D4 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* + * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. + */ +// #define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6 + +#ifdef RGB_MATRIX_ENABLE +// The pin connected to the data pin of the LEDs +#define RGB_DI_PIN C6 +// The number of LEDs connected +#define DRIVER_LED_TOTAL 27 + +#define RGB_MATRIX_KEYPRESSES // reacts to keypresses +#define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses) +#define RGB_MATRIX_STARTUP_HUE 108 // Sets the default hue value, if none has been set +#define RGB_MATRIX_STARTUP_SAT 255 // Sets the default saturation value, if none has been set +#define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set +#define RGB_MATRIX_STARTUP_SPD 127 // Sets the default animation speed, if none has been set +#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_COLOR // Sets the default mode, if none has been set + +#define DISABLE_RGB_MATRIX_ALPHAS_MODS +#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN +#define DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +#define DISABLE_RGB_MATRIX_BREATHING +#define DISABLE_RGB_MATRIX_BAND_SAT // * +#define DISABLE_RGB_MATRIX_BAND_VAL +#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +#define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT +#define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL +#define DISABLE_RGB_MATRIX_CYCLE_ALL +#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN +#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN +#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +// #define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON // * +#define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL +#define DISABLE_RGB_MATRIX_CYCLE_SPIRAL +#define DISABLE_RGB_MATRIX_DUAL_BEACON +#define DISABLE_RGB_MATRIX_RAINBOW_BEACON +#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS +#define DISABLE_RGB_MATRIX_RAINDROPS +#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +#define DISABLE_RGB_MATRIX_HUE_BREATHING +#define DISABLE_RGB_MATRIX_HUE_PENDULUM +#define DISABLE_RGB_MATRIX_HUE_WAVE +#define DISABLE_RGB_MATRIX_TYPING_HEATMAP +#define DISABLE_RGB_MATRIX_DIGITAL_RAIN +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +#define DISABLE_RGB_MATRIX_SPLASH +#define DISABLE_RGB_MATRIX_MULTISPLASH +#define DISABLE_RGB_MATRIX_SOLID_SPLASH +#define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH + +#endif + +#ifdef ENCODER_ENABLE +#define ENCODERS_PAD_A { D3 } +#define ENCODERS_PAD_B { D2 } +#define ENCODER_RESOLUTION 2 + +#define ENCODERS 1 +#define ENCODERS_CW_KEY { { 4, 5 } } +#define ENCODERS_CCW_KEY { { 4, 3 } } +#endif + +//#define LED_NUM_LOCK_PIN B0 +//#define LED_CAPS_LOCK_PIN B1 +//#define LED_SCROLL_LOCK_PIN B2 +//#define LED_COMPOSE_PIN B3 +//#define LED_KANA_PIN B4 + +//#define BACKLIGHT_PIN B7 +//#define BACKLIGHT_LEVELS 3 +//#define BACKLIGHT_BREATHING + +//#define RGB_DI_PIN E2 +//#ifdef RGB_DI_PIN +//# define RGBLED_NUM 16 +//# define RGBLIGHT_HUE_STEP 8 +//# define RGBLIGHT_SAT_STEP 8 +//# define RGBLIGHT_VAL_STEP 8 +//# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ +//# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ +/*== all animations enable ==*/ +//# define RGBLIGHT_ANIMATIONS +/*== or choose animations ==*/ +//# define RGBLIGHT_EFFECT_BREATHING +//# define RGBLIGHT_EFFECT_RAINBOW_MOOD +//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# define RGBLIGHT_EFFECT_SNAKE +//# define RGBLIGHT_EFFECT_KNIGHT +//# define RGBLIGHT_EFFECT_CHRISTMAS +//# define RGBLIGHT_EFFECT_STATIC_GRADIENT +//# define RGBLIGHT_EFFECT_RGB_TEST +//# define RGBLIGHT_EFFECT_ALTERNATING +/*== customize breathing effect ==*/ +/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ +//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 +/*==== use exp() and sin() ====*/ +//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 +//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 +//#endif + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* 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 + +/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. + * This is useful for the Windows task manager shortcut (ctrl+shift+esc). + */ +//#define GRAVE_ESC_CTRL_OVERRIDE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * 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 + +/* disable these deprecated features by default */ +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION + +/* Bootmagic Lite key configuration */ +//#define BOOTMAGIC_LITE_ROW 0 +//#define BOOTMAGIC_LITE_COLUMN 0 diff --git a/keyboards/wekey/we27/encoder_actions.c b/keyboards/wekey/we27/encoder_actions.c new file mode 100644 index 0000000000..0f32ac2723 --- /dev/null +++ b/keyboards/wekey/we27/encoder_actions.c @@ -0,0 +1,57 @@ +/* Copyright 2020 Neil Brian Ramirez + * Copyright 2021 drashna jael're (@drashna) + * Copyright 2021 uybv + * + * 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 3 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/>. + */ + +#include "encoder_actions.h" + +#ifdef ENCODER_ENABLE + +# ifdef ENCODERS +static uint8_t encoder_state[ENCODERS] = {0}; +static keypos_t encoder_cw[ENCODERS] = ENCODERS_CW_KEY; +static keypos_t encoder_ccw[ENCODERS] = ENCODERS_CCW_KEY; +# endif + +void encoder_action_unregister(void) { +# ifdef ENCODERS + for (int index = 0; index < ENCODERS; ++index) { + if (encoder_state[index]) { + keyevent_t encoder_event = (keyevent_t) { + .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], + .pressed = false, + .time = (timer_read() | 1) + }; + encoder_state[index] = 0; + action_exec(encoder_event); + } + } +# endif +} + +void encoder_action_register(uint8_t index, bool clockwise) { +# ifdef ENCODERS + keyevent_t encoder_event = (keyevent_t) { + .key = clockwise ? encoder_cw[index] : encoder_ccw[index], + .pressed = true, + .time = (timer_read() | 1) + }; + encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); + action_exec(encoder_event); +# endif +} + +#endif diff --git a/keyboards/wekey/we27/encoder_actions.h b/keyboards/wekey/we27/encoder_actions.h new file mode 100644 index 0000000000..2484af52ae --- /dev/null +++ b/keyboards/wekey/we27/encoder_actions.h @@ -0,0 +1,21 @@ +/* Copyright 2020 Neil Brian Ramirez + * + * 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 3 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/>. + */ + +#include "quantum.h" + +void encoder_action_unregister(void); + +void encoder_action_register(uint8_t index, bool clockwise); diff --git a/keyboards/wekey/we27/info.json b/keyboards/wekey/we27/info.json new file mode 100644 index 0000000000..e83f53b444 --- /dev/null +++ b/keyboards/wekey/we27/info.json @@ -0,0 +1,29 @@ +{ + "keyboard_name": "we27", + "url": "", + "maintainer": "@wekey.dev", + "width": 5, + "height": 6.25, + "layouts": { + "LAYOUT_numpad_6x5": { + "layout": [ + {"label":"ESC", "x":0, "y":0.75}, {"label":"PRTSC", "x":1, "y":0.75}, {"label":"F5", "x":2, "y":0.75}, {"label":"F11", "x":3, "y":0.75}, + {"label":"NLCK", "x":0, "y":2.25}, {"label":"DEL", "x":1, "y":2.25}, {"label":"/", "x":2, "y":2.25}, {"label":"*", "x":3, "y":2.25}, {"label":"-", "x":4, "y":2.25}, + {"label":"HOME", "x":0, "y":3.25}, {"label":"7", "x":1, "y":3.25}, {"label":"8", "x":2, "y":3.25}, {"label":"9", "x":3, "y":3.25}, + {"label":"END", "x":0, "y":4.25}, {"label":"4", "x":1, "y":4.25}, {"label":"5", "x":2, "y":4.25}, {"label":"6", "x":3, "y":4.25}, {"label":"+", "x":4, "y":3.25, "h":2}, + {"label":"ANY", "x":0, "y":5.25}, {"label":"1", "x":1, "y":5.25}, {"label":"2", "x":2, "y":5.25}, {"label":"3", "x":3, "y":5.25}, + {"label":"FN", "x":0, "y":6.25}, {"label":"0", "x":1, "y":6.25, "w":2}, {"label":".", "x":3, "y":6.25}, {"label":"ENTER", "x":4, "y":5.25, "h":2} + ] + }, + "LAYOUT_numpad_6x5_encoder": { + "layout": [ + {"label":"ESC", "x":0, "y":0.75}, {"label":"PRTSC", "x":1, "y":0.75}, {"label":"F5", "x":2, "y":0.75}, {"label":"F11", "x":3, "y":0.75}, {"label":"MUTE", "x":4, "y":0.75}, {"label":"VOLD", "x":3.75, "y":0, "w":0.75, "h":0.75}, {"label":"VOLU", "x":4.5, "y":0, "w":0.75, "h":0.75}, + {"label":"NLCK", "x":0, "y":2.25}, {"label":"DEL", "x":1, "y":2.25}, {"label":"/", "x":2, "y":2.25}, {"label":"*", "x":3, "y":2.25}, {"label":"-", "x":4, "y":2.25}, + {"label":"HOME", "x":0, "y":3.25}, {"label":"7", "x":1, "y":3.25}, {"label":"8", "x":2, "y":3.25}, {"label":"9", "x":3, "y":3.25}, + {"label":"END", "x":0, "y":4.25}, {"label":"4", "x":1, "y":4.25}, {"label":"5", "x":2, "y":4.25}, {"label":"6", "x":3, "y":4.25}, {"label":"+", "x":4, "y":3.25, "h":2}, + {"label":"ANY", "x":0, "y":5.25}, {"label":"1", "x":1, "y":5.25}, {"label":"2", "x":2, "y":5.25}, {"label":"3", "x":3, "y":5.25}, + {"label":"FN", "x":0, "y":6.25}, {"label":"0", "x":1, "y":6.25, "w":2}, {"label":".", "x":3, "y":6.25}, {"label":"ENTER", "x":4, "y":5.25, "h":2} + ] + } + } +} diff --git a/keyboards/wekey/we27/keymaps/default/keymap.c b/keyboards/wekey/we27/keymaps/default/keymap.c new file mode 100644 index 0000000000..fdaafa7d82 --- /dev/null +++ b/keyboards/wekey/we27/keymaps/default/keymap.c @@ -0,0 +1,52 @@ +/* Copyright 2021 @wekey + * + * 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/>. + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [0] = LAYOUT_numpad_6x5_encoder( + KC_ESC , KC_PWR , KC_SLEP, KC_F11 , KC_MUTE, KC_VOLD, KC_VOLU, + KC_NLCK, KC_BSPC, KC_PSLS, KC_PAST, KC_PMNS, + RGB_MOD, KC_P7 , KC_P8 , KC_P9 , + RGB_RMOD, KC_P4 , KC_P5 , KC_P6 , KC_PPLS, + RGB_TOG, KC_P1 , KC_P2 , KC_P3 , + MO(1) , KC_P0 , KC_PDOT, KC_PENT + ), + [1] = LAYOUT_numpad_6x5_encoder( + _______, _______, _______, _______, KC_MPLY, KC_MPRV, KC_MNXT, + _______, _______, _______, _______, _______, + RGB_SPI, RGB_HUI, RGB_SAI, RGB_VAI, + RGB_SPD, RGB_HUD, RGB_SAD, RGB_VAD, _______, + _______, _______, _______, _______, + _______, _______, _______, RESET + ), + [2] = LAYOUT_numpad_6x5_encoder( + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______ + ), + [3] = LAYOUT_numpad_6x5_encoder( + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______ + ) +}; diff --git a/keyboards/wekey/we27/keymaps/default/readme.md b/keyboards/wekey/we27/keymaps/default/readme.md new file mode 100644 index 0000000000..8ad307a9c3 --- /dev/null +++ b/keyboards/wekey/we27/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for we27 diff --git a/keyboards/wekey/we27/keymaps/via/keymap.c b/keyboards/wekey/we27/keymaps/via/keymap.c new file mode 100644 index 0000000000..fdaafa7d82 --- /dev/null +++ b/keyboards/wekey/we27/keymaps/via/keymap.c @@ -0,0 +1,52 @@ +/* Copyright 2021 @wekey + * + * 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/>. + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [0] = LAYOUT_numpad_6x5_encoder( + KC_ESC , KC_PWR , KC_SLEP, KC_F11 , KC_MUTE, KC_VOLD, KC_VOLU, + KC_NLCK, KC_BSPC, KC_PSLS, KC_PAST, KC_PMNS, + RGB_MOD, KC_P7 , KC_P8 , KC_P9 , + RGB_RMOD, KC_P4 , KC_P5 , KC_P6 , KC_PPLS, + RGB_TOG, KC_P1 , KC_P2 , KC_P3 , + MO(1) , KC_P0 , KC_PDOT, KC_PENT + ), + [1] = LAYOUT_numpad_6x5_encoder( + _______, _______, _______, _______, KC_MPLY, KC_MPRV, KC_MNXT, + _______, _______, _______, _______, _______, + RGB_SPI, RGB_HUI, RGB_SAI, RGB_VAI, + RGB_SPD, RGB_HUD, RGB_SAD, RGB_VAD, _______, + _______, _______, _______, _______, + _______, _______, _______, RESET + ), + [2] = LAYOUT_numpad_6x5_encoder( + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______ + ), + [3] = LAYOUT_numpad_6x5_encoder( + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______ + ) +}; diff --git a/keyboards/wekey/we27/keymaps/via/readme.md b/keyboards/wekey/we27/keymaps/via/readme.md new file mode 100644 index 0000000000..8ad307a9c3 --- /dev/null +++ b/keyboards/wekey/we27/keymaps/via/readme.md @@ -0,0 +1 @@ +# The default keymap for we27 diff --git a/keyboards/wekey/we27/keymaps/via/rules.mk b/keyboards/wekey/we27/keymaps/via/rules.mk new file mode 100644 index 0000000000..36b7ba9cbc --- /dev/null +++ b/keyboards/wekey/we27/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +LTO_ENABLE = yes diff --git a/keyboards/wekey/we27/readme.md b/keyboards/wekey/we27/readme.md new file mode 100644 index 0000000000..3212f9505f --- /dev/null +++ b/keyboards/wekey/we27/readme.md @@ -0,0 +1,19 @@ +# we27 + +![we27](https://i.imgur.com/DvZ3EBah.jpg) + +A customizable 20% hot-swap, RGB numpad and encoder. + +* Keyboard Maintainer: [@wekey](https://github.com/wekey-dev) +* Hardware Supported: WE27 PCB rev1 +* Hardware Availability: custom pcb group buys + +Make example for this keyboard (after setting up your build environment): + + make wekey/we27:default + +Flashing example for this keyboard: + + make wekey/we27:default: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/wekey/we27/rgb_matrix_kb.inc b/keyboards/wekey/we27/rgb_matrix_kb.inc new file mode 100644 index 0000000000..a7eeffbbe9 --- /dev/null +++ b/keyboards/wekey/we27/rgb_matrix_kb.inc @@ -0,0 +1,27 @@ + +//RGB_MATRIX_EFFECT(SOLID_REACTIVE_WIDE2) +RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE2) +//RGB_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS2) +//RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS2) + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +static HSV SOLID_REACTIVE_WIDE_math2(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { + uint16_t effect = tick - dist > 255 || dist > 32 ? 255 : tick - dist; + hsv.v = qadd8(hsv.v, 255 - effect); + return hsv; +} + +static HSV SOLID_REACTIVE_NEXUS_math2(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { + uint16_t effect = tick - dist > 255 || ((dx > 8 || dx < -8) && (dy > 8 || dy < -8)) ? 255 : tick - dist; + hsv.v = qadd8(hsv.v, 255 - effect); + hsv.h = rgb_matrix_config.hsv.h + dy / 4; + return hsv; +} + +bool SOLID_REACTIVE_WIDE2(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math2); } +bool SOLID_REACTIVE_MULTIWIDE2(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math2); } +bool SOLID_REACTIVE_NEXUS2(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math2); } +bool SOLID_REACTIVE_MULTINEXUS2(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math2); } + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/keyboards/wekey/we27/rules.mk b/keyboards/wekey/we27/rules.mk new file mode 100644 index 0000000000..f510969bf6 --- /dev/null +++ b/keyboards/wekey/we27/rules.mk @@ -0,0 +1,32 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # 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 +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes +RGB_MATRIX_ENABLE = yes # Use RGB matrix +RGB_MATRIX_DRIVER = WS2812 + +DEBOUNCE_TYPE = sym_defer_pk +RGB_MATRIX_CUSTOM_KB = yes + +SRC += encoder_actions.c + +LAYOUTS = numpad_6x5 diff --git a/keyboards/wekey/we27/we27.c b/keyboards/wekey/we27/we27.c new file mode 100644 index 0000000000..2765e6f3bd --- /dev/null +++ b/keyboards/wekey/we27/we27.c @@ -0,0 +1,58 @@ +/* Copyright 2021 @wekey + * + * 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/>. + */ + +#include "we27.h" +#include "encoder_actions.h" + +#ifdef RGB_MATRIX_ENABLE + +#define __ NO_LED + +led_config_t g_led_config = { { + { 0, 1, 2, 3, 4 }, + { 9, 8, 7, 6, 5 }, + { 10, 11, 12, 13, 14 }, + { 18, 17, 16, 15, __ }, + { 19, 20, 21, 22, 23 }, + { 26, 25, __, 24, __ } +}, { + {0,1},{56,1},{112,1},{168,1},{224,1}, + {0,16},{56,16},{112,16},{168,16},{224,16}, + {0,28},{56,28},{112,28},{168,28},{224,28}, + {0,40},{56,40},{112,40},{168,40}, + {0,52},{56,52},{112,52},{168,52},{224,52}, + {0,64},{56,64},{168,64} +}, { + 1, 1, 1, 1, 1, + 1, 1, 4, 4, 4, + 1, 4, 4, 4, 4, + 1, 4, 4, 4, + 1, 4, 4, 4, 4, + 1, 4, 4 +} }; + +#endif + +void matrix_scan_kb(void) { + encoder_action_unregister(); + matrix_scan_user(); +} + +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { return false; } + encoder_action_register(index, clockwise); + return true; +}; diff --git a/keyboards/wekey/we27/we27.h b/keyboards/wekey/we27/we27.h new file mode 100644 index 0000000000..5542a52d2f --- /dev/null +++ b/keyboards/wekey/we27/we27.h @@ -0,0 +1,53 @@ +/* Copyright 2021 @wekey + * + * 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 + +#include "quantum.h" + +#define ___ KC_NO + +#define LAYOUT_numpad_6x5( \ + K00, K01, K02, K03, K04, \ + K10, K11, K12, K13, K14, \ + K20, K21, K22, K23, \ + K30, K31, K32, K33, K24, \ + K40, K41, K42, K43, \ + K50, K51, K53, K44 \ +) { \ + { K00, K01, K02, K03, K04 }, \ + { K10, K11, K12, K13, K14 }, \ + { K20, K21, K22, K23, K24 }, \ + { K30, K31, K32, K33, ___ }, \ + { K40, K41, K42, K43, K44 }, \ + { K50, K51, ___, K53, ___ } \ +} + +#define LAYOUT_numpad_6x5_encoder( \ + K00, K01, K02, K03, K04, K34, K54, \ + K10, K11, K12, K13, K14, \ + K20, K21, K22, K23, \ + K30, K31, K32, K33, K24, \ + K40, K41, K42, K43, \ + K50, K51, K53, K44 \ +) { \ + { K00, K01, K02, K03, K04 }, \ + { K10, K11, K12, K13, K14 }, \ + { K20, K21, K22, K23, K24 }, \ + { K30, K31, K32, K33, K34 }, \ + { K40, K41, K42, K43, K44 }, \ + { K50, K51, ___, K53, K54 } \ +} |