From 2ee9afb8489a7571b03b5b317f8dff08551e16a2 Mon Sep 17 00:00:00 2001 From: FansForFlorida <69491183+FansForFlorida@users.noreply.github.com> Date: Tue, 29 Nov 2022 22:35:21 -0500 Subject: [PATCH] Add support for Velocifire Sun20pro numpad (#290) * Added support for Velocifire Sun20pro numpad * Cleaned up formatting * Added default keymap --- keyboards/velocifire/sun20pro/config.h | 117 ++++++++++++++++++ keyboards/velocifire/sun20pro/info.json | 5 + .../sun20pro/keymaps/default/keymap.c | 90 ++++++++++++++ .../velocifire/sun20pro/keymaps/vial/keymap.c | 42 +++++++ .../velocifire/sun20pro/keymaps/vial/rules.mk | 24 ++++ .../sun20pro/keymaps/vial/vial.json | 59 +++++++++ keyboards/velocifire/sun20pro/readme.md | 20 +++ keyboards/velocifire/sun20pro/rules.mk | 1 + keyboards/velocifire/sun20pro/sun20pro.c | 30 +++++ keyboards/velocifire/sun20pro/sun20pro.h | 36 ++++++ 10 files changed, 424 insertions(+) create mode 100644 keyboards/velocifire/sun20pro/config.h create mode 100644 keyboards/velocifire/sun20pro/info.json create mode 100644 keyboards/velocifire/sun20pro/keymaps/default/keymap.c create mode 100644 keyboards/velocifire/sun20pro/keymaps/vial/keymap.c create mode 100644 keyboards/velocifire/sun20pro/keymaps/vial/rules.mk create mode 100644 keyboards/velocifire/sun20pro/keymaps/vial/vial.json create mode 100644 keyboards/velocifire/sun20pro/readme.md create mode 100644 keyboards/velocifire/sun20pro/rules.mk create mode 100644 keyboards/velocifire/sun20pro/sun20pro.c create mode 100644 keyboards/velocifire/sun20pro/sun20pro.h diff --git a/keyboards/velocifire/sun20pro/config.h b/keyboards/velocifire/sun20pro/config.h new file mode 100644 index 0000000000..8dfd18cc6c --- /dev/null +++ b/keyboards/velocifire/sun20pro/config.h @@ -0,0 +1,117 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +#include "config_common.h" + +#define VIAL_KEYBOARD_UID {0x97, 0x61, 0x7D, 0x2F, 0xA7, 0x5E, 0x42, 0x40} + +#define VIAL_UNLOCK_COMBO_ROWS { 0, 4 } +#define VIAL_UNLOCK_COMBO_COLS { 0, 3 } + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x0002 +#define PRODUCT_ID 0x0002 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Velocifire +#define PRODUCT Sun20pro + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 4 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { B0, B1, B2, B3, B7 } +#define MATRIX_COL_PINS { F7, F6, F5, F4 } +#define ENCODERS_PAD_A { D6 } +#define ENCODERS_PAD_B { D7 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* number of backlight levels */ +#ifdef BACKLIGHT_PIN +# define BACKLIGHT_LEVELS 3 +#endif + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#undef LOCKING_SUPPORT_ENABLE + +/* Locking resynchronize hack */ +#undef LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#define RGB_MATRIX_KEYPRESSES + +#define RGB_DI_PIN C7 +#ifdef RGB_DI_PIN +# define RGBLED_NUM 25 +# 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 +// RGB Matrix +# ifdef RGB_MATRIX_ENABLE +# define DRIVER_LED_TOTAL RGBLED_NUM + +// RGB Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects +// # define ENABLE_RGB_MATRIX_ALPHAS_MODS +# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +// # define ENABLE_RGB_MATRIX_GR45ADIENT_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_BREATHING +// # define ENABLE_RGB_MATRIX_BAND_SAT +// # define ENABLE_RGB_MATRIX_BAND_VAL +// # define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +// # define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +// # define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +// # define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_DUAL_BEACON +# define ENABLE_RGB_MATRIX_RAINBOW_BEACON +// # define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +# define ENABLE_RGB_MATRIX_RAINDROPS +// # define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +// # define ENABLE_RGB_MATRIX_HUE_BREATHING +// # define ENABLE_RGB_MATRIX_HUE_PENDULUM +// # define ENABLE_RGB_MATRIX_HUE_WAVE +// # define ENABLE_RGB_MATRIX_PIXEL_RAIN +// # define ENABLE_RGB_MATRIX_PIXEL_FLOW +// # define ENABLE_RGB_MATRIX_PIXEL_FRACTAL +// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined +// # define ENABLE_RGB_MATRIX_TYPING_HEATMAP +# define ENABLE_RGB_MATRIX_DIGITAL_RAIN +// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE +// # define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +// # define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +// # define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +// # define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +// # define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +// # define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +// # define ENABLE_RGB_MATRIX_SPLASH +// # define ENABLE_RGB_MATRIX_MULTISPLASH +// # define ENABLE_RGB_MATRIX_SOLID_SPLASH +// # define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH +# endif +#endif diff --git a/keyboards/velocifire/sun20pro/info.json b/keyboards/velocifire/sun20pro/info.json new file mode 100644 index 0000000000..f987af97bf --- /dev/null +++ b/keyboards/velocifire/sun20pro/info.json @@ -0,0 +1,5 @@ +{ + "keyboard_name": "Sun20pro", + "url": "", + "maintainer": "qmk", +} diff --git a/keyboards/velocifire/sun20pro/keymaps/default/keymap.c b/keyboards/velocifire/sun20pro/keymaps/default/keymap.c new file mode 100644 index 0000000000..a9b8683825 --- /dev/null +++ b/keyboards/velocifire/sun20pro/keymaps/default/keymap.c @@ -0,0 +1,90 @@ +#include "sun20pro.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + LAYOUT( + KC_MUTE, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, + KC_P7, KC_P8, KC_P9, + KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_P1, KC_P2, KC_P3, + KC_INS, KC_PDOT, KC_PENT), + + LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS), + + LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS), + + LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS), + +}; + +void matrix_init_user(void) { +} + +void matrix_scan_user(void) { +} + +void encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { /* First encoder */ + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } else if (index == 1) { /* Second encoder */ + if (clockwise) { + tap_code(KC_DOWN); + } else { + tap_code(KC_UP); + } + } +} + + +void led_set_user(uint8_t usb_led) { + + if (usb_led & (1 << USB_LED_NUM_LOCK)) { + + } else { + + } + + if (usb_led & (1 << USB_LED_CAPS_LOCK)) { + + } else { + + } + + if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { + + } else { + + } + + if (usb_led & (1 << USB_LED_COMPOSE)) { + + } else { + + } + + if (usb_led & (1 << USB_LED_KANA)) { + + } else { + + } + +} diff --git a/keyboards/velocifire/sun20pro/keymaps/vial/keymap.c b/keyboards/velocifire/sun20pro/keymaps/vial/keymap.c new file mode 100644 index 0000000000..6a49280b8d --- /dev/null +++ b/keyboards/velocifire/sun20pro/keymaps/vial/keymap.c @@ -0,0 +1,42 @@ +#include "sun20pro.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + LAYOUT( + TG(1), KC_PSLS, KC_PAST, KC_PMNS, KC_MUTE, + KC_7, KC_8, KC_9, + KC_4, KC_5, KC_6, KC_PPLS, + KC_1, KC_2, KC_3, + KC_0, KC_DOT, KC_PENT), + + LAYOUT( + _______, _______, _______, _______, _______, + KC_HOME, KC_UP, KC_PGUP, + KC_LEFT, KC_NO, KC_RGHT, _______, + KC_END, KC_DOWN, KC_PGDN, + KC_INS, KC_DEL, _______), + + LAYOUT( + _______, _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______), + + LAYOUT( + _______, _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______), + +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [1] = { ENCODER_CCW_CW(_______, _______) }, + [2] = { ENCODER_CCW_CW(_______, _______) }, + [3] = { ENCODER_CCW_CW(_______, _______) }, +}; +#endif diff --git a/keyboards/velocifire/sun20pro/keymaps/vial/rules.mk b/keyboards/velocifire/sun20pro/keymaps/vial/rules.mk new file mode 100644 index 0000000000..063771041c --- /dev/null +++ b/keyboards/velocifire/sun20pro/keymaps/vial/rules.mk @@ -0,0 +1,24 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +VIA_ENABLE = yes +VIAL_ENABLE = yes +ENCODER_ENABLE = yes +ENCODER_MAP_ENABLE = yes + +LTO_ENABLE = yes + +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 +VIALRGB_ENABLE = yes + +COMBO_ENABLE = no +COMMAND_ENABLE = no # Commands for debug and configuration +CONSOLE_ENABLE = no # Console for debug +EXTRAKEY_ENABLE = yes # Audio control and System control +MUSIC_ENABLE = no +QMK_SETTINGS = no +TAP_DANCE_ENABLE = yes diff --git a/keyboards/velocifire/sun20pro/keymaps/vial/vial.json b/keyboards/velocifire/sun20pro/keymaps/vial/vial.json new file mode 100644 index 0000000000..deb0e67e71 --- /dev/null +++ b/keyboards/velocifire/sun20pro/keymaps/vial/vial.json @@ -0,0 +1,59 @@ +{ + "name": "Sun20Plus", + "vendorId": "0x0002", + "productId": "0x0002", + "lighting": "vialrgb", + "matrix": { + "rows": 5, + "cols": 4 + }, + "layouts": { + "keymap": [ + [ + "0,0", + "0,1", + "0,2", + "0,3", + { + "x": 1 + }, + "3,3" + ], + [ + "1,0", + "1,1", + "1,2", + { + "h": 2 + }, + "2,3", + { + "x": 0.5 + }, + "0,0\n\n\n\n\n\n\n\n\ne", + "0,1\n\n\n\n\n\n\n\n\ne" + ], + [ + "2,0", + "2,1", + "2,2" + ], + [ + "3,0", + "3,1", + "3,2", + { + "h": 2 + }, + "4,3" + ], + [ + { + "w": 2 + }, + "4,0", + "4,2" + ] + ] + } +} \ No newline at end of file diff --git a/keyboards/velocifire/sun20pro/readme.md b/keyboards/velocifire/sun20pro/readme.md new file mode 100644 index 0000000000..5cf865b21d --- /dev/null +++ b/keyboards/velocifire/sun20pro/readme.md @@ -0,0 +1,20 @@ +# Velocifire Sun20pro macropad + +![Velocifire Sun20pro macropad](https://i.imgur.com/WgpwoLk.jpeg) + +Sun20pro is 5×4 numpad with a rotary encoder. + +* Hardware Supported: Sun20pro +* Hardware Availability: group buy (limited to 500): Nov. 25th, 7 PM PST - Dec. 10th, 7 PM PST + +Make example for this keyboard (after setting up your build environment): + + make velocifire/sun20pro:vial + +Flash the default keymap: + + make velocifire/sun20pro:vial:flash + +Press the reset button on the bottom of the PCB when prompted. + +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/velocifire/sun20pro/rules.mk b/keyboards/velocifire/sun20pro/rules.mk new file mode 100644 index 0000000000..e19674593e --- /dev/null +++ b/keyboards/velocifire/sun20pro/rules.mk @@ -0,0 +1 @@ +DEFAULT_FOLDER = velocifire/sun20pro diff --git a/keyboards/velocifire/sun20pro/sun20pro.c b/keyboards/velocifire/sun20pro/sun20pro.c new file mode 100644 index 0000000000..61f3f23a34 --- /dev/null +++ b/keyboards/velocifire/sun20pro/sun20pro.c @@ -0,0 +1,30 @@ +#include "sun20pro.h" + +#ifdef RGB_MATRIX_ENABLE +#define __ NO_LED + +led_config_t g_led_config = { { + // Key Matrix to LED Index + { 4, 8, 13, 16 }, + { 3, 7, 12, __ }, + { 2, 6, 11, 15 }, + { 1, 5, 10, __ }, + { 0, __, 9, 14 } +}, { + // LED Index to Physical Position + {0,0}, {56,0}, {112,0}, {168,0}, + {0,16}, {56,16}, {112,16}, + {0,32}, {56,32}, {112,32}, {168,24}, + {0,48}, {56,48}, {112,48}, + {0,64}, {112,64}, {168,56}, + {224,8}, {224,16}, {224,24}, {224,32}, {224,40}, {224,48}, {224,56}, {224,64} +}, { + // LED Index to Flag + 4, 4, 4, 4, + 4, 4, 4, + 4, 4, 4, 4, + 4, 4, 4, + 4, 4, 4, + 2, 2, 2, 2, 2, 2, 2, 2 +} }; +#endif diff --git a/keyboards/velocifire/sun20pro/sun20pro.h b/keyboards/velocifire/sun20pro/sun20pro.h new file mode 100644 index 0000000000..07d46afd34 --- /dev/null +++ b/keyboards/velocifire/sun20pro/sun20pro.h @@ -0,0 +1,36 @@ +/* Copyright 2022 John Hall + * + * 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 + +// The first section contains all of the arguments +// The second converts the arguments into a two-dimensional array +#define LAYOUT( \ + K00, K01, K02, K03, K33, \ + K10, K11, K12, \ + K20, K21, K22, K23, \ + K30, K31, K32, \ + K40, K42, K43 \ +) { \ + { K00, K01, K02, K03 }, \ + { K10, K11, K12, XXX }, \ + { K20, K21, K22, K23 }, \ + { K30, K31, K32, K33 }, \ + { K40, XXX, K42, K43 } \ +}