From b53356f7ab051c7ef208e8cd2927b7671e731db8 Mon Sep 17 00:00:00 2001 From: Cameron Varley Date: Sun, 2 Apr 2023 04:34:54 -0400 Subject: [PATCH] [Keyboard] Add GMMK Numpad (#20067) Co-authored-by: Sergey Vlasov Co-authored-by: Drashna Jaelre --- keyboards/gmmk/numpad/config.h | 84 +++++++++++ keyboards/gmmk/numpad/halconf.h | 26 ++++ keyboards/gmmk/numpad/info.json | 51 +++++++ .../gmmk/numpad/keymaps/default/keymap.c | 60 ++++++++ keyboards/gmmk/numpad/keymaps/via/keymap.c | 79 ++++++++++ keyboards/gmmk/numpad/keymaps/via/rules.mk | 2 + keyboards/gmmk/numpad/matrix.c | 133 +++++++++++++++++ keyboards/gmmk/numpad/mcuconf.h | 26 ++++ keyboards/gmmk/numpad/numpad.c | 136 ++++++++++++++++++ keyboards/gmmk/numpad/post_config.h | 21 +++ keyboards/gmmk/numpad/readme.md | 40 ++++++ keyboards/gmmk/numpad/rules.mk | 26 ++++ 12 files changed, 684 insertions(+) create mode 100644 keyboards/gmmk/numpad/config.h create mode 100644 keyboards/gmmk/numpad/halconf.h create mode 100644 keyboards/gmmk/numpad/info.json create mode 100644 keyboards/gmmk/numpad/keymaps/default/keymap.c create mode 100644 keyboards/gmmk/numpad/keymaps/via/keymap.c create mode 100644 keyboards/gmmk/numpad/keymaps/via/rules.mk create mode 100644 keyboards/gmmk/numpad/matrix.c create mode 100644 keyboards/gmmk/numpad/mcuconf.h create mode 100644 keyboards/gmmk/numpad/numpad.c create mode 100644 keyboards/gmmk/numpad/post_config.h create mode 100644 keyboards/gmmk/numpad/readme.md create mode 100644 keyboards/gmmk/numpad/rules.mk diff --git a/keyboards/gmmk/numpad/config.h b/keyboards/gmmk/numpad/config.h new file mode 100644 index 00000000000..6aa0a6c0160 --- /dev/null +++ b/keyboards/gmmk/numpad/config.h @@ -0,0 +1,84 @@ +/* Copyright 2021 Glorious, LLC + * Modified 2022 by rustedaperture for qmk_firmware + * + * 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 + +#define SLIDER_PIN B0 +#define MIDI_ADVANCED + +#define LOCKING_SUPPORT_ENABLE +#define LOCKING_RESYNC_ENABLE + +#define SPI_DRIVER SPIDQ +#define SPI_SCK_PIN B3 +#define SPI_MOSI_PIN B5 +#define SPI_MISO_PIN B4 + +#define DRIVER_1_CS B12 +#define DRIVER_1_EN A15 +#define DRIVER_1_PW_EN B13 + +#define DRIVER_COUNT 1 + +#define RGB_MATRIX_LED_COUNT 31 + +#define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN B6 +#define WEAR_LEVELING_BACKING_SIZE 2048 + +#define ENABLE_RGB_MATRIX_ALPHAS_MODS +#define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +#define ENABLE_RGB_MATRIX_GRADIENT_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 +#define ENABLE_RGB_MATRIX_TYPING_HEATMAP +#define ENABLE_RGB_MATRIX_DIGITAL_RAIN +#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 \ No newline at end of file diff --git a/keyboards/gmmk/numpad/halconf.h b/keyboards/gmmk/numpad/halconf.h new file mode 100644 index 00000000000..b6b68a4e633 --- /dev/null +++ b/keyboards/gmmk/numpad/halconf.h @@ -0,0 +1,26 @@ +/* Copyright 2021 Glorious, LLC + * Modified 2022 by rustedaperture for qmk_firmware + * + * 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 + +#define HAL_USE_SPI TRUE +#define SPI_USE_WAIT TRUE +#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD +#define HAL_USE_ADC TRUE + + +#include_next \ No newline at end of file diff --git a/keyboards/gmmk/numpad/info.json b/keyboards/gmmk/numpad/info.json new file mode 100644 index 00000000000..d5ea534b67e --- /dev/null +++ b/keyboards/gmmk/numpad/info.json @@ -0,0 +1,51 @@ +{ + "keyboard_name": "GMMK Numpad", + "manufacturer": "Glorious", + "url": "https://www.gloriousgaming.com/products/gmmk-numpad", + "maintainer": "GloriousThrall", + "usb": { + "vid": "0x320F", + "pid": "0x5088", + "device_version": "0.0.1" + }, + "encoder": { + "rotary": [ + {"pin_a": "A2", "pin_b": "A1"} + ] + }, + "processor": "WB32F3G71", + "bootloader": "wb32-dfu", + "diode_direction": "ROW2COL", + "matrix_pins": { + "rows": ["A3", "A4", "A5", "A6", "A7"], + "cols": ["B7", "B1", "B10", "B11"] + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"label": "NUM", "matrix": [0, 0], "x": 0, "y": 0}, + {"label": "/", "matrix": [0, 1], "x": 1, "y": 0}, + {"label": "*", "matrix": [0, 2], "x": 2, "y": 0}, + {"label": "-", "matrix": [0, 3], "x": 3, "y": 0}, + + {"label": "7", "matrix": [1, 0], "x": 0, "y": 1}, + {"label": "8", "matrix": [1, 1], "x": 1, "y": 1}, + {"label": "9", "matrix": [1, 2], "x": 2, "y": 1}, + {"label": "+", "matrix": [1, 3], "x": 3, "y": 1, "h": 2}, + + {"label": "4", "matrix": [2, 0], "x": 0, "y": 2}, + {"label": "5", "matrix": [2, 1], "x": 1, "y": 2}, + {"label": "6", "matrix": [2, 2], "x": 2, "y": 2}, + {"label": "CALC", "matrix": [2, 3], "x": 3, "y": 2}, + + {"label": "1", "matrix": [3, 0], "x": 0, "y": 3}, + {"label": "2", "matrix": [3, 1], "x": 1, "y": 3}, + {"label": "3", "matrix": [3, 2], "x": 2, "y": 3}, + {"label": "RET", "matrix": [3, 3], "x": 3, "y": 3, "h": 2}, + + {"label": "0", "matrix": [4, 0], "x": 0, "y": 4, "w": 2}, + {"label": ".", "matrix": [4, 3], "x": 3, "y": 4} + ] + } + } +} diff --git a/keyboards/gmmk/numpad/keymaps/default/keymap.c b/keyboards/gmmk/numpad/keymaps/default/keymap.c new file mode 100644 index 00000000000..aa1829cdd41 --- /dev/null +++ b/keyboards/gmmk/numpad/keymaps/default/keymap.c @@ -0,0 +1,60 @@ +/* Copyright 2021 Glorious, LLC + * Modified 2022 by rustedaperture for qmk_firmware + +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 +#include "analog.h" +#include "qmk_midi.h" + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// NUM / * - +// 7 8 9 + +// 4 5 6 ENCODER +// 1 2 3 RET +// 0 . + + [0] = LAYOUT( + MO(1), KC_PSLS, KC_PAST, KC_PMNS, + KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_P4, KC_P5, KC_P6, KC_CALC, + KC_P1, KC_P2, KC_P3, KC_PENT, + KC_P0, KC_PDOT + ), + [1] = LAYOUT( + _______, KC_PSLS, KC_PAST, KC_PMNS, + KC_P7, RGB_VAI, KC_P9, KC_PPLS, + RGB_RMOD, KC_P5, RGB_MOD, KC_CALC, + KC_P1, RGB_VAD, KC_P3, KC_PENT, + RGB_TOG, QK_BOOT + ) +}; + +// Potentiometer Slider, MIDI Control + +uint8_t divisor = 0; + +void slider(void) { + if (divisor++) { /* only run the slider function 1/256 times it's called */ + return; + } + midi_send_cc(&midi_device, 2, 0x3E, 0x7F + (analogReadPin(SLIDER_PIN) >> 3)); +} + +void housekeeping_task_user(void) { + slider(); +} \ No newline at end of file diff --git a/keyboards/gmmk/numpad/keymaps/via/keymap.c b/keyboards/gmmk/numpad/keymaps/via/keymap.c new file mode 100644 index 00000000000..aa7730acdd1 --- /dev/null +++ b/keyboards/gmmk/numpad/keymaps/via/keymap.c @@ -0,0 +1,79 @@ +/* Copyright 2021 Glorious, LLC +Modified 2022 by rustedaperture for qmk_firmware +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 +#include "analog.h" +#include "qmk_midi.h" + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// NUM / * - +// 7 8 9 + +// 4 5 6 ENCODER +// 1 2 3 RET +// 0 . + + [0] = LAYOUT( + MO(1), KC_PSLS, KC_PAST, KC_PMNS, + KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_P4, KC_P5, KC_P6, KC_CALC, + KC_P1, KC_P2, KC_P3, KC_PENT, + KC_P0, KC_PDOT + ), + [1] = LAYOUT( + _______, KC_PSLS, KC_PAST, KC_PMNS, + KC_P7, RGB_VAI, KC_P9, KC_PPLS, + RGB_RMOD, KC_P5, RGB_MOD, KC_CALC, + KC_P1, RGB_VAD, KC_P3, KC_PENT, + RGB_TOG, QK_BOOT + ), + [2] = LAYOUT( + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______ + ), + [3] = LAYOUT( + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______ + ), +}; +// clang-format on + +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [1] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [2] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [3] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) } +}; + +// Potentiometer Slider, MIDI Control + +uint8_t divisor = 0; + +void slider(void) { + if (divisor++) { /* only run the slider function 1/256 times it's called */ + return; + } + midi_send_cc(&midi_device, 2, 0x3E, 0x7F + (analogReadPin(SLIDER_PIN) >> 3)); +} + +void housekeeping_task_user(void) { + slider(); +} \ No newline at end of file diff --git a/keyboards/gmmk/numpad/keymaps/via/rules.mk b/keyboards/gmmk/numpad/keymaps/via/rules.mk new file mode 100644 index 00000000000..49d34e41fd4 --- /dev/null +++ b/keyboards/gmmk/numpad/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE=yes +ENCODER_MAP_ENABLE=yes diff --git a/keyboards/gmmk/numpad/matrix.c b/keyboards/gmmk/numpad/matrix.c new file mode 100644 index 00000000000..99adb38f184 --- /dev/null +++ b/keyboards/gmmk/numpad/matrix.c @@ -0,0 +1,133 @@ +// Copyright 2023 Cameron Varley (@RustedAperture) +// SPDX-License-Identifier: GPL-2.0-or-later + +/* + * scan matrix + */ +#include +#include +#include "wait.h" +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "debounce.h" +#include "quantum.h" + +/* matrix state(1:on, 0:off) */ +extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values +extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values + +static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; +#define MATRIX_ROW_SHIFTER ((matrix_row_t)1) + +static inline void setPinOutput_writeLow(pin_t pin) { + ATOMIC_BLOCK_FORCEON { + setPinOutput(pin); + writePinLow(pin); + } +} + +static inline void setPinOutput_writeHigh(pin_t pin) { + ATOMIC_BLOCK_FORCEON { + setPinOutput(pin); + writePinHigh(pin); + } +} + +static inline void setPinInputHigh_atomic(pin_t pin) { + ATOMIC_BLOCK_FORCEON { + setPinInputHigh(pin); + } +} + +static inline uint8_t readMatrixPin(pin_t pin) { + if (pin != NO_PIN) { + return readPin(pin); + } else { + return 1; + } +} + +static bool select_col(uint8_t col) { + pin_t pin = col_pins[col]; + if (pin != NO_PIN) { + setPinOutput_writeLow(pin); + return true; + } + return false; +} + +static void unselect_col(uint8_t col) { + pin_t pin = col_pins[col]; + if (pin != NO_PIN) { +# ifdef MATRIX_UNSELECT_DRIVE_HIGH + setPinOutput_writeHigh(pin); +# else + setPinInputHigh_atomic(pin); +# endif + } +} + +static void unselect_cols(void) { + for (uint8_t x = 0; x < MATRIX_COLS; x++) { + unselect_col(x); + } +} + + +__attribute__((weak)) void matrix_init_custom(void) { + unselect_cols(); + for (uint8_t x = 0; x < MATRIX_ROWS; x++) { + if (row_pins[x] != NO_PIN) { + setPinInputHigh_atomic(row_pins[x]); + } + } + setPinInputHigh_atomic(B8); +} + +__attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter) { // Start with a clear matrix row + bool key_pressed = false; + + // Select col + if (!select_col(current_col)) { // select col + return; // skip NO_PIN col + } + matrix_output_select_delay(); + + // For each row... + for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) { + // Check row pin state + if (current_col == 3 && row_index == 2 && readMatrixPin(B8) == 1) { + current_matrix[row_index] |= row_shifter; + key_pressed = !readMatrixPin(B8); + } else if (readMatrixPin(row_pins[row_index]) == 0) { + // Pin LO, set col bit + current_matrix[row_index] |= row_shifter; + key_pressed = true; + } else { + // Pin HI, clear col bit + current_matrix[row_index] &= ~row_shifter; + } + } + + // Unselect col + unselect_col(current_col); + matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + static matrix_row_t temp_matrix[MATRIX_ROWS] = {0}; + + matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; + for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { + matrix_read_rows_on_col(temp_matrix, current_col, row_shifter); + } + + bool changed = memcmp(current_matrix, temp_matrix, sizeof(temp_matrix)) != 0; + if (changed) { + memcpy(current_matrix, temp_matrix, sizeof(temp_matrix)); + } + return changed; +} diff --git a/keyboards/gmmk/numpad/mcuconf.h b/keyboards/gmmk/numpad/mcuconf.h new file mode 100644 index 00000000000..a07efdbffb8 --- /dev/null +++ b/keyboards/gmmk/numpad/mcuconf.h @@ -0,0 +1,26 @@ +/* Copyright 2021 Glorious, LLC + * Modified 2022 by rustedaperture for qmk_firmware + * + * 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_next + +#undef WB32_SPI_USE_QSPI +#define WB32_SPI_USE_QSPI TRUE + +// #undef WB32_ADC_USE_ADC1 +#define WB32_ADC_USE_ADC1 TRUE \ No newline at end of file diff --git a/keyboards/gmmk/numpad/numpad.c b/keyboards/gmmk/numpad/numpad.c new file mode 100644 index 00000000000..ed4fed26678 --- /dev/null +++ b/keyboards/gmmk/numpad/numpad.c @@ -0,0 +1,136 @@ +/* Copyright 2021 Glorious, LLC + * Modified 2022 by rustedaperture for qmk_firmware + * + * 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 "quantum.h" + +#ifdef RGB_MATRIX_ENABLE + +const aw_led g_aw_leds[RGB_MATRIX_LED_COUNT] = { +/* Each AW20216 channel is controlled by a register at some offset between 0x00 + * and 0xD7 inclusive. + * See drivers/awinic/aw20216.h for the mapping between register offsets and + * driver pin locations. + * driver + * | R location + * | | G location + * | | | B location + * | | | | */ + {0, CS4_SW1, CS5_SW1, CS6_SW1 }, // 0 NUM + {0, CS4_SW2, CS5_SW2, CS6_SW2 }, // 1 / + {0, CS7_SW1, CS8_SW1, CS9_SW1 }, // 2 * + {0, CS7_SW2, CS8_SW2, CS9_SW2 }, // 3 - + {0, CS4_SW3, CS5_SW3, CS6_SW3 }, // 4 7 + {0, CS4_SW4, CS5_SW4, CS6_SW4 }, // 5 8 + {0, CS7_SW3, CS8_SW3, CS9_SW3 }, // 6 9 + {0, CS7_SW4, CS8_SW4, CS9_SW4 }, // 7 + + {0, CS4_SW5, CS5_SW5, CS6_SW5 }, // 8 4 + {0, CS4_SW6, CS5_SW6, CS6_SW6 }, // 9 5 + {0, CS7_SW5, CS8_SW5, CS9_SW5 }, // 10 6 + {0, CS4_SW7, CS5_SW7, CS6_SW7 }, // 11 1 + {0, CS4_SW8, CS5_SW8, CS6_SW8 }, // 12 2 + {0, CS7_SW7, CS8_SW7, CS9_SW7 }, // 13 3 + {0, CS7_SW8, CS8_SW8, CS9_SW8 }, // 14 ENTER + {0, CS4_SW9, CS5_SW9, CS6_SW9 }, // 15 0 + {0, CS7_SW9, CS8_SW9, CS9_SW9 }, // 16 . + {0, CS1_SW1, CS2_SW1, CS3_SW1 }, // 17 LED18 + {0, CS1_SW2, CS2_SW2, CS3_SW2 }, // 18 LED19 + {0, CS1_SW3, CS2_SW3, CS3_SW3 }, // 19 LED20 + {0, CS1_SW4, CS2_SW4, CS3_SW4 }, // 20 LED21 + {0, CS1_SW5, CS2_SW5, CS3_SW5 }, // 21 LED22 + {0, CS1_SW6, CS2_SW6, CS3_SW6 }, // 22 LED23 + {0, CS1_SW7, CS2_SW7, CS3_SW7 }, // 23 LED24 + {0, CS10_SW1, CS11_SW1, CS12_SW1 }, // 24 LED27 + {0, CS10_SW2, CS11_SW2, CS12_SW2 }, // 25 LED28 + {0, CS10_SW3, CS11_SW3, CS12_SW3 }, // 26 LED29 + {0, CS10_SW4, CS11_SW4, CS12_SW4 }, // 27 LED30 + {0, CS10_SW5, CS11_SW5, CS12_SW5 }, // 28 LED31 + {0, CS10_SW6, CS11_SW6, CS12_SW6 }, // 29 LED32 + {0, CS10_SW7, CS11_SW7, CS12_SW7 }, // 30 LED33 +}; + +led_config_t g_led_config = {{ + { 0, 1, 2, 3 }, + { 4, 5, 6, 7 }, + { 8, 9, 10, NO_LED}, + { 11, 12, 13, 14 }, + { 15, NO_LED, NO_LED, 16 } +}, { + {45, 0 }, // 0 NUM + {90, 0 }, // 1 / + {134, 0 }, // 2 * + {179, 0 }, // 3 - + {45, 16 }, // 4 7 + {90, 16 }, // 5 8 + {134, 16 }, // 6 9 + {179, 24 }, // 7 + + {45, 32 }, // 8 4 + {90, 32 }, // 9 5 + {134, 32 }, // 10 6 + {45, 48 }, // 11 1 + {90, 48 }, // 12 2 + {134, 48 }, // 13 3 + {179, 56 }, // 14 ENTER + {67, 64 }, // 15 0 + {134, 64 }, // 16 . + {0, 0 }, // 17 LED18 + {0, 11 }, // 18 LED19 + {0, 21 }, // 19 LED20 + {0, 32 }, // 20 LED21 + {0, 43 }, // 21 LED22 + {0, 53 }, // 22 LED23 + {0, 64 }, // 23 LED24 + {224, 0 }, // 24 LED27 + {224, 11 }, // 25 LED28 + {224, 21 }, // 26 LED29 + {224, 32 }, // 27 LED30 + {224, 43 }, // 28 LED31 + {224, 53 }, // 29 LED32 + {224, 64 } // 30 LED33 +}, { + 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, 2, 2, 2, 2, 2, 2 +} }; + +# ifdef DRIVER_1_PW_EN + +void keyboard_pre_init_user(void) { + wait_ms(2000); + setPinOutput(DRIVER_1_PW_EN); + writePinHigh(DRIVER_1_PW_EN); +} +# endif + +#endif + +#ifdef ENCODER_ENABLE +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { + return false; + } + if (clockwise) { + tap_code_delay(KC_VOLU, 10); + } else { + tap_code_delay(KC_VOLD, 10); + } + return true; +} +#endif diff --git a/keyboards/gmmk/numpad/post_config.h b/keyboards/gmmk/numpad/post_config.h new file mode 100644 index 00000000000..6ee57f4439e --- /dev/null +++ b/keyboards/gmmk/numpad/post_config.h @@ -0,0 +1,21 @@ +/* Copyright 2022 by rustedaperture + * + * 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 + +#ifndef TAP_CODE_DELAY +# define TAP_CODE_DELAY 10 +#endif \ No newline at end of file diff --git a/keyboards/gmmk/numpad/readme.md b/keyboards/gmmk/numpad/readme.md new file mode 100644 index 00000000000..d40b2b8c587 --- /dev/null +++ b/keyboards/gmmk/numpad/readme.md @@ -0,0 +1,40 @@ +# GMMK NUMPAD + +![GMMK NUMPAD](https://i.imgur.com/JV4C5os.png) + +A 17 Key macropad made and sold by Glorious LLC, equipped with a WB32 microcontroller, with support for a rotary encoder. + +* Keyboard Maintainer: [GloriousThrall](https://github.com/GloriousThrall) +* Hardware Supported: GMMK Numpad +* Hardware Availability: [GloriousPCGaming.com](https://www.gloriousgaming.com/products/gmmk-numpad) + +Make example for this keyboard (after setting up your build environment): + + make gmmk/numpad:default + +Flashing example for this keyboard: + + make gmmk/numpad: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). + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the Num key and plug in the keyboard +* **Keycode in layout**: Press the Num+Del key which is mapped to `QK_BOOT` +* **Physical switch**: Pinhole located ubnde the zero key press while inserting the USB +* **From Glorious Core Firmware**: Press Enter+Plus at the same time while plugging in the USB + +## Slider + +The slider is currently compatible with [Midi2Vol](https://github.com/jesusvallejo/Midi2Vol), [Midi Mixer (Windows)](https://github.com/jpwilliams/midi-mixer-releases/releases), [Midi2Lightroom (Mac)](https://rsjaffe.github.io/MIDI2LR/), and [ControllerMate (Mac)](https://www.orderedbytes.com/controllermate/) + +## Encoder Button + +The Button is set to KC_CALC by default and is located at 2,3 on the matrix + +## Broken + +* Bluetooth functionality \ No newline at end of file diff --git a/keyboards/gmmk/numpad/rules.mk b/keyboards/gmmk/numpad/rules.mk new file mode 100644 index 00000000000..4d23ffbfaf3 --- /dev/null +++ b/keyboards/gmmk/numpad/rules.mk @@ -0,0 +1,26 @@ +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +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 +NKRO_ENABLE = yes # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes +KEYBOARD_SHARED_EP = yes +MIDI_ENABLE = yes + +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = AW20216 + +EEPROM_DRIVER = wear_leveling +WEAR_LEVELING_DRIVER = spi_flash + +LTO_ENABLE = yes + +SRC += analog.c \ + matrix.c \ No newline at end of file