From eb6555f9c97ed8001999d70ac9d41d720c4595da Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 8 Mar 2023 15:20:15 -0500 Subject: [PATCH 01/34] GMMK Numpad (Default, Via, Vial) --- keyboards/gmmk/numpad/config.h | 121 ++++++++++++++++ keyboards/gmmk/numpad/halconf.h | 9 ++ keyboards/gmmk/numpad/info.json | 39 +++++ .../gmmk/numpad/keymaps/default/keymap.c | 56 ++++++++ keyboards/gmmk/numpad/keymaps/via/config.h | 21 +++ keyboards/gmmk/numpad/keymaps/via/keymap.c | 62 ++++++++ keyboards/gmmk/numpad/keymaps/via/rules.mk | 2 + keyboards/gmmk/numpad/keymaps/vial/config.h | 30 ++++ keyboards/gmmk/numpad/keymaps/vial/keymap.c | 62 ++++++++ keyboards/gmmk/numpad/keymaps/vial/rules.mk | 5 + keyboards/gmmk/numpad/mcuconf.h | 25 ++++ keyboards/gmmk/numpad/numpad.c | 134 ++++++++++++++++++ keyboards/gmmk/numpad/numpad.h | 41 ++++++ keyboards/gmmk/numpad/rules.mk | 26 ++++ 14 files changed, 633 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/config.h 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/keymaps/vial/config.h create mode 100644 keyboards/gmmk/numpad/keymaps/vial/keymap.c create mode 100644 keyboards/gmmk/numpad/keymaps/vial/rules.mk create mode 100644 keyboards/gmmk/numpad/mcuconf.h create mode 100644 keyboards/gmmk/numpad/numpad.c create mode 100644 keyboards/gmmk/numpad/numpad.h 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 000000000000..c70775e2156e --- /dev/null +++ b/keyboards/gmmk/numpad/config.h @@ -0,0 +1,121 @@ +/* Copyright 2021 Gigahawk + * + * 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 MATRIX_ROWS 5 +#define MATRIX_COLS 4 + +#define MATRIX_ROW_PINS \ + { A3, A4, A5, A6, A7 } +#define MATRIX_COL_PINS \ + { B7, B1, B10, B11 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION ROW2COL + +/* Hold ESC on start up to clear EEPROM and boot into bootloader mode */ +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 + +#define TAP_CODE_DELAY 10 +#define ENCODERS_PAD_A \ + { A1 } +#define ENCODERS_PAD_B \ + { A2 } + +#define SLIDER_PIN B0 + +/* 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 + +#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 DRIVER_1_LED_TOTAL 31 +#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL) + +#define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN B6 +#define WEAR_LEVELING_BACKING_SIZE 2048 + +// 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_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 +// 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 + +/* 1000Hz USB polling - it's the default on stock firmware */ +// #define USB_POLLING_INTERVAL_MS 1 + +/* Set debounce time to 5ms */ +#define DEBOUNCE 5 + +/* Force NKRO on boot up regardless of the setting saved in the EEPROM (uncomment to enable it) */ +// #define FORCE_NKRO \ 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 000000000000..2d426a0f1422 --- /dev/null +++ b/keyboards/gmmk/numpad/halconf.h @@ -0,0 +1,9 @@ +#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 000000000000..879d6e9e3e61 --- /dev/null +++ b/keyboards/gmmk/numpad/info.json @@ -0,0 +1,39 @@ +{ + "keyboard_name": "GMMK Numpad", + "manufacturer": "Glorious", + "url": "https://www.pcgamingrace.com/products/glorious-gmmk-pro-75-barebone-black-reservation", + "maintainer": "GloriousThrall", + "usb": { + "vid": "0x320F", + "pid": "0x5088", + "device_version": "0.0.1" + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"x": 0,"y": 0}, + {"x": 1,"y": 0}, + {"x": 2,"y": 0}, + {"x": 3,"y": 0}, + + {"x": 0,"y": 1}, + {"x": 1,"y": 1}, + {"x": 2,"y": 1}, + {"x": 3,"y": 1,"h": 2}, + + {"x": 0,"y": 2}, + {"x": 1,"y": 2}, + {"x": 2,"y": 2}, + {"x": 3,"y": 2}, + + {"x": 0,"y": 3}, + {"x": 1,"y": 3}, + {"x": 2,"y": 3}, + {"x": 3,"y": 3,"h": 2}, + + {"x": 0,"y": 4,"w": 2}, + {"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 000000000000..dece68e7d213 --- /dev/null +++ b/keyboards/gmmk/numpad/keymaps/default/keymap.c @@ -0,0 +1,56 @@ +/* Copyright 2021 Glorious, LLC + +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" + + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// NUM / * - +// 7 8 9 + +// 4 5 6 CALC +// 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 + ) +}; +// clang-format on + +#ifdef ENCODER_ENABLE +bool encoder_update_user(uint8_t index, bool clockwise) { + if (!clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + return true; +} +#endif diff --git a/keyboards/gmmk/numpad/keymaps/via/config.h b/keyboards/gmmk/numpad/keymaps/via/config.h new file mode 100644 index 000000000000..5936a756f0b2 --- /dev/null +++ b/keyboards/gmmk/numpad/keymaps/via/config.h @@ -0,0 +1,21 @@ +/* Copyright 2021 Gigahawk + * Modified 2021 by usrfriendly for vial-qmk + * + * 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 DRIVER_1_LED_TOTAL 31 +#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL) diff --git a/keyboards/gmmk/numpad/keymaps/via/keymap.c b/keyboards/gmmk/numpad/keymaps/via/keymap.c new file mode 100644 index 000000000000..b03daeda1ad3 --- /dev/null +++ b/keyboards/gmmk/numpad/keymaps/via/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2021 Glorious, LLC +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" + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// NUM / * - +// 7 8 9 + +// 4 5 6 CALC +// 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_VOLU, KC_VOLD) }, + [1] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, + [2] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, + [3] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) } +}; \ 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 000000000000..49d34e41fd4b --- /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/keymaps/vial/config.h b/keyboards/gmmk/numpad/keymaps/vial/config.h new file mode 100644 index 000000000000..98aa8f7d9773 --- /dev/null +++ b/keyboards/gmmk/numpad/keymaps/vial/config.h @@ -0,0 +1,30 @@ +/* Copyright 2021 Gigahawk + * Modified 2021 by usrfriendly for vial-qmk + * + * 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 DRIVER_1_LED_TOTAL 31 +#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL) + +//enable RGB Matrix Effects for Vial +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#define RGB_MATRIX_KEYPRESSES + +//Vial Keyboard UID +#define VIAL_KEYBOARD_UID {0x0C, 0x9F, 0xA6, 0xD3, 0x31, 0xF6, 0x2F, 0xE3} +#define VIAL_UNLOCK_COMBO_ROWS { 0, 3 } +#define VIAL_UNLOCK_COMBO_COLS { 0, 3 } diff --git a/keyboards/gmmk/numpad/keymaps/vial/keymap.c b/keyboards/gmmk/numpad/keymaps/vial/keymap.c new file mode 100644 index 000000000000..b03daeda1ad3 --- /dev/null +++ b/keyboards/gmmk/numpad/keymaps/vial/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2021 Glorious, LLC +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" + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// NUM / * - +// 7 8 9 + +// 4 5 6 CALC +// 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_VOLU, KC_VOLD) }, + [1] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, + [2] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, + [3] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) } +}; \ No newline at end of file diff --git a/keyboards/gmmk/numpad/keymaps/vial/rules.mk b/keyboards/gmmk/numpad/keymaps/vial/rules.mk new file mode 100644 index 000000000000..eff414674194 --- /dev/null +++ b/keyboards/gmmk/numpad/keymaps/vial/rules.mk @@ -0,0 +1,5 @@ +VIA_ENABLE=yes +VIAL_ENABLE=yes + +VIALRGB_ENABLE=yes +ENCODER_MAP_ENABLE=yes diff --git a/keyboards/gmmk/numpad/mcuconf.h b/keyboards/gmmk/numpad/mcuconf.h new file mode 100644 index 000000000000..e750ba1ed59f --- /dev/null +++ b/keyboards/gmmk/numpad/mcuconf.h @@ -0,0 +1,25 @@ +/* Copyright 2021 Glorious, LLC + * + * 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 000000000000..7deca36b9907 --- /dev/null +++ b/keyboards/gmmk/numpad/numpad.c @@ -0,0 +1,134 @@ +/* Copyright 2021 Glorious, LLC + * + * 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 "numpad.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 matrix_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 false; +} +#endif diff --git a/keyboards/gmmk/numpad/numpad.h b/keyboards/gmmk/numpad/numpad.h new file mode 100644 index 000000000000..9e45cd948de0 --- /dev/null +++ b/keyboards/gmmk/numpad/numpad.h @@ -0,0 +1,41 @@ +/* Copyright 2021 Glorious, LLC +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 ___ KC_NO + +// NUM / * - +// 7 8 9 + +// 4 5 6 CALC +// 1 2 3 RET +// 0 . + +// clang-format off +#define LAYOUT( \ + k00, k01, k02, k03,\ + k10, k11, k12, k13,\ + k20, k21, k22, k23,\ + k30, k31, k32, k33,\ + k40, k43 \ +)\ +{\ + { k00, k01, k02, k03 },\ + { k10, k11, k12, k13 },\ + { k20, k21, k22, k23 },\ + { k30, k31, k32, k33 },\ + { k40, ___, ___, k43 } \ +} +// clang-format on \ 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 000000000000..bf465d2239f2 --- /dev/null +++ b/keyboards/gmmk/numpad/rules.mk @@ -0,0 +1,26 @@ +# MCU name +MCU = WB32F3G71 + +# Bootloader selection +BOOTLOADER = wb32-dfu + +# 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 +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = AW20216 + +EEPROM_DRIVER = wear_leveling +WEAR_LEVELING_DRIVER = spi_flash + +LTO_ENABLE = yes \ No newline at end of file From f0b17ab196bb71826344d16813b457b19f5ca67d Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 8 Mar 2023 15:26:44 -0500 Subject: [PATCH 02/34] Fix Product URL --- keyboards/gmmk/numpad/info.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/gmmk/numpad/info.json b/keyboards/gmmk/numpad/info.json index 879d6e9e3e61..3e841aa300fd 100644 --- a/keyboards/gmmk/numpad/info.json +++ b/keyboards/gmmk/numpad/info.json @@ -1,7 +1,7 @@ { "keyboard_name": "GMMK Numpad", "manufacturer": "Glorious", - "url": "https://www.pcgamingrace.com/products/glorious-gmmk-pro-75-barebone-black-reservation", + "url": "https://www.gloriousgaming.com/products/gmmk-numpad", "maintainer": "GloriousThrall", "usb": { "vid": "0x320F", From 56a3098733de499131e4d4e01ea770df9262ca9f Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 8 Mar 2023 15:36:45 -0500 Subject: [PATCH 03/34] Fix License Headers --- keyboards/gmmk/numpad/config.h | 3 ++- keyboards/gmmk/numpad/halconf.h | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/keyboards/gmmk/numpad/config.h b/keyboards/gmmk/numpad/config.h index c70775e2156e..c9bb68d99380 100644 --- a/keyboards/gmmk/numpad/config.h +++ b/keyboards/gmmk/numpad/config.h @@ -1,4 +1,5 @@ -/* Copyright 2021 Gigahawk +/* 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 diff --git a/keyboards/gmmk/numpad/halconf.h b/keyboards/gmmk/numpad/halconf.h index 2d426a0f1422..d7419b7190b9 100644 --- a/keyboards/gmmk/numpad/halconf.h +++ b/keyboards/gmmk/numpad/halconf.h @@ -1,3 +1,19 @@ +/* Copyright 2021 Glorious, LLC + * + * 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 From 1f89a6dc48de41a1d3e366e820ed9422acd3a546 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 8 Mar 2023 21:04:23 -0500 Subject: [PATCH 04/34] Remove Vial, add Readme, Remove duplicate defines --- keyboards/gmmk/numpad/config.h | 32 +---------- keyboards/gmmk/numpad/info.json | 11 ++++ keyboards/gmmk/numpad/keymaps/via/config.h | 2 +- keyboards/gmmk/numpad/keymaps/via/keymap.c | 1 + keyboards/gmmk/numpad/keymaps/vial/config.h | 30 ---------- keyboards/gmmk/numpad/keymaps/vial/keymap.c | 62 --------------------- keyboards/gmmk/numpad/keymaps/vial/rules.mk | 5 -- keyboards/gmmk/numpad/readme.md | 29 ++++++++++ 8 files changed, 43 insertions(+), 129 deletions(-) delete mode 100644 keyboards/gmmk/numpad/keymaps/vial/config.h delete mode 100644 keyboards/gmmk/numpad/keymaps/vial/keymap.c delete mode 100644 keyboards/gmmk/numpad/keymaps/vial/rules.mk create mode 100644 keyboards/gmmk/numpad/readme.md diff --git a/keyboards/gmmk/numpad/config.h b/keyboards/gmmk/numpad/config.h index c9bb68d99380..a512efc7cc71 100644 --- a/keyboards/gmmk/numpad/config.h +++ b/keyboards/gmmk/numpad/config.h @@ -17,32 +17,16 @@ #pragma once -#define MATRIX_ROWS 5 -#define MATRIX_COLS 4 - #define MATRIX_ROW_PINS \ { A3, A4, A5, A6, A7 } #define MATRIX_COL_PINS \ { B7, B1, B10, B11 } -/* COL2ROW or ROW2COL */ -#define DIODE_DIRECTION ROW2COL - -/* Hold ESC on start up to clear EEPROM and boot into bootloader mode */ -#define BOOTMAGIC_LITE_ROW 0 -#define BOOTMAGIC_LITE_COLUMN 0 - #define TAP_CODE_DELAY 10 -#define ENCODERS_PAD_A \ - { A1 } -#define ENCODERS_PAD_B \ - { A2 } #define SLIDER_PIN B0 -/* 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 #define SPI_DRIVER SPIDQ @@ -63,9 +47,6 @@ #define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN B6 #define WEAR_LEVELING_BACKING_SIZE 2048 -// 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_GRADIENT_LEFT_RIGHT @@ -95,10 +76,8 @@ #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 @@ -110,13 +89,4 @@ #define ENABLE_RGB_MATRIX_SPLASH #define ENABLE_RGB_MATRIX_MULTISPLASH #define ENABLE_RGB_MATRIX_SOLID_SPLASH -#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH - -/* 1000Hz USB polling - it's the default on stock firmware */ -// #define USB_POLLING_INTERVAL_MS 1 - -/* Set debounce time to 5ms */ -#define DEBOUNCE 5 - -/* Force NKRO on boot up regardless of the setting saved in the EEPROM (uncomment to enable it) */ -// #define FORCE_NKRO \ No newline at end of file +#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH \ No newline at end of file diff --git a/keyboards/gmmk/numpad/info.json b/keyboards/gmmk/numpad/info.json index 3e841aa300fd..eecd2ed5b877 100644 --- a/keyboards/gmmk/numpad/info.json +++ b/keyboards/gmmk/numpad/info.json @@ -8,6 +8,17 @@ "pid": "0x5088", "device_version": "0.0.1" }, + "encoder": { + "rotary": [ + {"pin_a": "A1", "pin_b": "A2"} + ] + }, + "bootmagic": { + "matrix": [0, 0] + }, + "processor": "WB32F3G71", + "bootloader": "wb32-dfu", + "diode_direction": "ROW2COL", "layouts": { "LAYOUT": { "layout": [ diff --git a/keyboards/gmmk/numpad/keymaps/via/config.h b/keyboards/gmmk/numpad/keymaps/via/config.h index 5936a756f0b2..ec7923e366d3 100644 --- a/keyboards/gmmk/numpad/keymaps/via/config.h +++ b/keyboards/gmmk/numpad/keymaps/via/config.h @@ -1,5 +1,5 @@ /* Copyright 2021 Gigahawk - * Modified 2021 by usrfriendly for vial-qmk + * 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 diff --git a/keyboards/gmmk/numpad/keymaps/via/keymap.c b/keyboards/gmmk/numpad/keymaps/via/keymap.c index b03daeda1ad3..988b4716f334 100644 --- a/keyboards/gmmk/numpad/keymaps/via/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/via/keymap.c @@ -1,4 +1,5 @@ /* 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 diff --git a/keyboards/gmmk/numpad/keymaps/vial/config.h b/keyboards/gmmk/numpad/keymaps/vial/config.h deleted file mode 100644 index 98aa8f7d9773..000000000000 --- a/keyboards/gmmk/numpad/keymaps/vial/config.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2021 Gigahawk - * Modified 2021 by usrfriendly for vial-qmk - * - * 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 DRIVER_1_LED_TOTAL 31 -#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL) - -//enable RGB Matrix Effects for Vial -#define RGB_MATRIX_FRAMEBUFFER_EFFECTS -#define RGB_MATRIX_KEYPRESSES - -//Vial Keyboard UID -#define VIAL_KEYBOARD_UID {0x0C, 0x9F, 0xA6, 0xD3, 0x31, 0xF6, 0x2F, 0xE3} -#define VIAL_UNLOCK_COMBO_ROWS { 0, 3 } -#define VIAL_UNLOCK_COMBO_COLS { 0, 3 } diff --git a/keyboards/gmmk/numpad/keymaps/vial/keymap.c b/keyboards/gmmk/numpad/keymaps/vial/keymap.c deleted file mode 100644 index b03daeda1ad3..000000000000 --- a/keyboards/gmmk/numpad/keymaps/vial/keymap.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright 2021 Glorious, LLC -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" - -// clang-format off -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -// NUM / * - -// 7 8 9 + -// 4 5 6 CALC -// 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_VOLU, KC_VOLD) }, - [1] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, - [2] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, - [3] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) } -}; \ No newline at end of file diff --git a/keyboards/gmmk/numpad/keymaps/vial/rules.mk b/keyboards/gmmk/numpad/keymaps/vial/rules.mk deleted file mode 100644 index eff414674194..000000000000 --- a/keyboards/gmmk/numpad/keymaps/vial/rules.mk +++ /dev/null @@ -1,5 +0,0 @@ -VIA_ENABLE=yes -VIAL_ENABLE=yes - -VIALRGB_ENABLE=yes -ENCODER_MAP_ENABLE=yes diff --git a/keyboards/gmmk/numpad/readme.md b/keyboards/gmmk/numpad/readme.md new file mode 100644 index 000000000000..4e0296255fd3 --- /dev/null +++ b/keyboards/gmmk/numpad/readme.md @@ -0,0 +1,29 @@ +# GMMK NUMPAD + +A 17 Key macropad made ans old by Glorious LLC, equiped 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` + +## Broken + +* Slider does not function +* Rotary input push button (mapped to gpio) \ No newline at end of file From afe4ab9cf46f63d807d36b3e657e22afaaffa8b8 Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 9 Mar 2023 13:37:45 -0500 Subject: [PATCH 05/34] Port Keymap, Remove Duplicate config.h --- keyboards/gmmk/numpad/config.h | 6 ---- keyboards/gmmk/numpad/info.json | 40 ++++++++++++---------- keyboards/gmmk/numpad/keymaps/via/config.h | 21 ------------ keyboards/gmmk/numpad/numpad.h | 21 ------------ 4 files changed, 22 insertions(+), 66 deletions(-) delete mode 100644 keyboards/gmmk/numpad/keymaps/via/config.h diff --git a/keyboards/gmmk/numpad/config.h b/keyboards/gmmk/numpad/config.h index a512efc7cc71..31945fe165ea 100644 --- a/keyboards/gmmk/numpad/config.h +++ b/keyboards/gmmk/numpad/config.h @@ -17,11 +17,6 @@ #pragma once -#define MATRIX_ROW_PINS \ - { A3, A4, A5, A6, A7 } -#define MATRIX_COL_PINS \ - { B7, B1, B10, B11 } - #define TAP_CODE_DELAY 10 #define SLIDER_PIN B0 @@ -41,7 +36,6 @@ #define DRIVER_COUNT 1 #define DRIVER_1_LED_TOTAL 31 -#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL) #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL) #define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN B6 diff --git a/keyboards/gmmk/numpad/info.json b/keyboards/gmmk/numpad/info.json index eecd2ed5b877..e0fb0934ecc1 100644 --- a/keyboards/gmmk/numpad/info.json +++ b/keyboards/gmmk/numpad/info.json @@ -19,31 +19,35 @@ "processor": "WB32F3G71", "bootloader": "wb32-dfu", "diode_direction": "ROW2COL", + "matrix_pins": { + "rows": ["A3", "A4", "A5", "A6", "A7"], + "cols": ["B7", "B1", "B10", "B11"] + }, "layouts": { "LAYOUT": { "layout": [ - {"x": 0,"y": 0}, - {"x": 1,"y": 0}, - {"x": 2,"y": 0}, - {"x": 3,"y": 0}, + {"label": "NUM", "x": 0, "y": 0, "matrix": [0, 0]}, + {"label": "/", "x": 1, "y": 0, "matrix": [0, 1]}, + {"label": "*", "x": 2, "y": 0, "matrix": [0, 2]}, + {"label": "-", "x": 3, "y": 0, "matrix": [0, 3]}, - {"x": 0,"y": 1}, - {"x": 1,"y": 1}, - {"x": 2,"y": 1}, - {"x": 3,"y": 1,"h": 2}, + {"label": "7", "x": 0, "y": 1, "matrix": [1, 0]}, + {"label": "8", "x": 1, "y": 1, "matrix": [1, 1]}, + {"label": "9", "x": 2, "y": 1, "matrix": [1, 2]}, + {"label": "+", "x": 3, "y": 1, "h": 2, "matrix": [1, 3]}, - {"x": 0,"y": 2}, - {"x": 1,"y": 2}, - {"x": 2,"y": 2}, - {"x": 3,"y": 2}, + {"label": "4", "x": 0, "y": 2, "matrix": [2, 0]}, + {"label": "5", "x": 1, "y": 2, "matrix": [2, 1]}, + {"label": "6", "x": 2, "y": 2, "matrix": [2, 2]}, + {"label": "CALC", "x": 3, "y": 2, "matrix": [2, 3]}, - {"x": 0,"y": 3}, - {"x": 1,"y": 3}, - {"x": 2,"y": 3}, - {"x": 3,"y": 3,"h": 2}, + {"label": "1", "x": 0, "y": 3, "matrix": [3, 0]}, + {"label": "2", "x": 1, "y": 3, "matrix": [3, 1]}, + {"label": "3", "x": 2, "y": 3, "matrix": [3, 2]}, + {"label": "RET", "x": 3, "y": 3, "h": 2, "matrix": [3, 3]}, - {"x": 0,"y": 4,"w": 2}, - {"x": 3,"y": 4} + {"label": "0", "x": 0, "y": 4, "w": 2, "matrix": [4, 0]}, + {"label": ".", "x": 3, "y": 4, "matrix": [4, 3]} ] } } diff --git a/keyboards/gmmk/numpad/keymaps/via/config.h b/keyboards/gmmk/numpad/keymaps/via/config.h deleted file mode 100644 index ec7923e366d3..000000000000 --- a/keyboards/gmmk/numpad/keymaps/via/config.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright 2021 Gigahawk - * 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 DRIVER_1_LED_TOTAL 31 -#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL) diff --git a/keyboards/gmmk/numpad/numpad.h b/keyboards/gmmk/numpad/numpad.h index 9e45cd948de0..a93237b22ca1 100644 --- a/keyboards/gmmk/numpad/numpad.h +++ b/keyboards/gmmk/numpad/numpad.h @@ -17,25 +17,4 @@ along with this program. If not, see . #define ___ KC_NO -// NUM / * - -// 7 8 9 + -// 4 5 6 CALC -// 1 2 3 RET -// 0 . - -// clang-format off -#define LAYOUT( \ - k00, k01, k02, k03,\ - k10, k11, k12, k13,\ - k20, k21, k22, k23,\ - k30, k31, k32, k33,\ - k40, k43 \ -)\ -{\ - { k00, k01, k02, k03 },\ - { k10, k11, k12, k13 },\ - { k20, k21, k22, k23 },\ - { k30, k31, k32, k33 },\ - { k40, ___, ___, k43 } \ -} // clang-format on \ No newline at end of file From f7be6954970f639a9c3da1c0e9571a7046b089df Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 9 Mar 2023 14:05:42 -0500 Subject: [PATCH 06/34] Duplicate Encoder Config --- keyboards/gmmk/numpad/keymaps/default/keymap.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/keyboards/gmmk/numpad/keymaps/default/keymap.c b/keyboards/gmmk/numpad/keymaps/default/keymap.c index dece68e7d213..3957ebb6467b 100644 --- a/keyboards/gmmk/numpad/keymaps/default/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/default/keymap.c @@ -42,15 +42,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { RGB_TOG, QK_BOOT ) }; -// clang-format on - -#ifdef ENCODER_ENABLE -bool encoder_update_user(uint8_t index, bool clockwise) { - if (!clockwise) { - tap_code(KC_VOLU); - } else { - tap_code(KC_VOLD); - } - return true; -} -#endif From 9ef126d025875ea365b0021a35caab955afb3bb0 Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 9 Mar 2023 14:05:51 -0500 Subject: [PATCH 07/34] Clean Up Code --- keyboards/gmmk/numpad/info.json | 36 ++++++++++++++++----------------- keyboards/gmmk/numpad/numpad.h | 4 ---- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/keyboards/gmmk/numpad/info.json b/keyboards/gmmk/numpad/info.json index e0fb0934ecc1..c21b64a7b81c 100644 --- a/keyboards/gmmk/numpad/info.json +++ b/keyboards/gmmk/numpad/info.json @@ -26,28 +26,28 @@ "layouts": { "LAYOUT": { "layout": [ - {"label": "NUM", "x": 0, "y": 0, "matrix": [0, 0]}, - {"label": "/", "x": 1, "y": 0, "matrix": [0, 1]}, - {"label": "*", "x": 2, "y": 0, "matrix": [0, 2]}, - {"label": "-", "x": 3, "y": 0, "matrix": [0, 3]}, + {"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", "x": 0, "y": 1, "matrix": [1, 0]}, - {"label": "8", "x": 1, "y": 1, "matrix": [1, 1]}, - {"label": "9", "x": 2, "y": 1, "matrix": [1, 2]}, - {"label": "+", "x": 3, "y": 1, "h": 2, "matrix": [1, 3]}, + {"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", "x": 0, "y": 2, "matrix": [2, 0]}, - {"label": "5", "x": 1, "y": 2, "matrix": [2, 1]}, - {"label": "6", "x": 2, "y": 2, "matrix": [2, 2]}, - {"label": "CALC", "x": 3, "y": 2, "matrix": [2, 3]}, + {"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", "x": 0, "y": 3, "matrix": [3, 0]}, - {"label": "2", "x": 1, "y": 3, "matrix": [3, 1]}, - {"label": "3", "x": 2, "y": 3, "matrix": [3, 2]}, - {"label": "RET", "x": 3, "y": 3, "h": 2, "matrix": [3, 3]}, + {"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", "x": 0, "y": 4, "w": 2, "matrix": [4, 0]}, - {"label": ".", "x": 3, "y": 4, "matrix": [4, 3]} + {"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/numpad.h b/keyboards/gmmk/numpad/numpad.h index a93237b22ca1..6c29a43c7b6c 100644 --- a/keyboards/gmmk/numpad/numpad.h +++ b/keyboards/gmmk/numpad/numpad.h @@ -14,7 +14,3 @@ along with this program. If not, see . #pragma once #include "quantum.h" - -#define ___ KC_NO - -// clang-format on \ No newline at end of file From 3bfc15baa54fcfbf5c5242194c92d7edab69f697 Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 9 Mar 2023 14:31:34 -0500 Subject: [PATCH 08/34] Code Cleanup --- keyboards/gmmk/numpad/config.h | 3 +-- keyboards/gmmk/numpad/keymaps/default/keymap.c | 1 - keyboards/gmmk/numpad/keymaps/via/keymap.c | 1 - keyboards/gmmk/numpad/numpad.c | 9 +++------ keyboards/gmmk/numpad/numpad.h | 16 ---------------- keyboards/gmmk/numpad/rules.mk | 6 ------ 6 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 keyboards/gmmk/numpad/numpad.h diff --git a/keyboards/gmmk/numpad/config.h b/keyboards/gmmk/numpad/config.h index 31945fe165ea..79d42c3fb62b 100644 --- a/keyboards/gmmk/numpad/config.h +++ b/keyboards/gmmk/numpad/config.h @@ -35,8 +35,7 @@ #define DRIVER_COUNT 1 -#define DRIVER_1_LED_TOTAL 31 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 31 #define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN B6 #define WEAR_LEVELING_BACKING_SIZE 2048 diff --git a/keyboards/gmmk/numpad/keymaps/default/keymap.c b/keyboards/gmmk/numpad/keymaps/default/keymap.c index 3957ebb6467b..7d501429113a 100644 --- a/keyboards/gmmk/numpad/keymaps/default/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/default/keymap.c @@ -15,7 +15,6 @@ along with this program. If not, see . */ #include QMK_KEYBOARD_H -#include "analog.h" // clang-format off diff --git a/keyboards/gmmk/numpad/keymaps/via/keymap.c b/keyboards/gmmk/numpad/keymaps/via/keymap.c index 988b4716f334..eea7e48c9214 100644 --- a/keyboards/gmmk/numpad/keymaps/via/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/via/keymap.c @@ -13,7 +13,6 @@ along with this program. If not, see . */ #include QMK_KEYBOARD_H -#include "analog.h" // clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/gmmk/numpad/numpad.c b/keyboards/gmmk/numpad/numpad.c index 7deca36b9907..d6f2a92f5a6b 100644 --- a/keyboards/gmmk/numpad/numpad.c +++ b/keyboards/gmmk/numpad/numpad.c @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -#include "numpad.h" +#include "quantum.h" #ifdef RGB_MATRIX_ENABLE @@ -110,7 +110,7 @@ led_config_t g_led_config = {{ } }; # ifdef DRIVER_1_PW_EN -void matrix_init_user(void) { +void matrix_init_kb(void) { wait_ms(2000); setPinOutput(DRIVER_1_PW_EN); writePinHigh(DRIVER_1_PW_EN); @@ -121,14 +121,11 @@ void matrix_init_user(void) { #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 false; + return true; } #endif diff --git a/keyboards/gmmk/numpad/numpad.h b/keyboards/gmmk/numpad/numpad.h deleted file mode 100644 index 6c29a43c7b6c..000000000000 --- a/keyboards/gmmk/numpad/numpad.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright 2021 Glorious, LLC -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" diff --git a/keyboards/gmmk/numpad/rules.mk b/keyboards/gmmk/numpad/rules.mk index bf465d2239f2..a46f84556d1d 100644 --- a/keyboards/gmmk/numpad/rules.mk +++ b/keyboards/gmmk/numpad/rules.mk @@ -1,9 +1,3 @@ -# MCU name -MCU = WB32F3G71 - -# Bootloader selection -BOOTLOADER = wb32-dfu - # Build Options # change yes to no to disable # From 42c8ad9091cf16faa95aa0a01519ef42e627e7a6 Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 9 Mar 2023 14:41:22 -0500 Subject: [PATCH 09/34] Fix RGB --- keyboards/gmmk/numpad/numpad.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/keyboards/gmmk/numpad/numpad.c b/keyboards/gmmk/numpad/numpad.c index d6f2a92f5a6b..dcd8851a356d 100644 --- a/keyboards/gmmk/numpad/numpad.c +++ b/keyboards/gmmk/numpad/numpad.c @@ -110,10 +110,12 @@ led_config_t g_led_config = {{ } }; # ifdef DRIVER_1_PW_EN + void matrix_init_kb(void) { wait_ms(2000); setPinOutput(DRIVER_1_PW_EN); writePinHigh(DRIVER_1_PW_EN); + matrix_init_user(); } # endif From e7f9f9cebf0f172821ee897c430704ded7da2207 Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 9 Mar 2023 16:13:20 -0500 Subject: [PATCH 10/34] encoder_update_user --- keyboards/gmmk/numpad/numpad.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/keyboards/gmmk/numpad/numpad.c b/keyboards/gmmk/numpad/numpad.c index dcd8851a356d..ad8f800c83f7 100644 --- a/keyboards/gmmk/numpad/numpad.c +++ b/keyboards/gmmk/numpad/numpad.c @@ -123,6 +123,9 @@ void matrix_init_kb(void) { #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 { From e60e917812027a2b44cf71e6d97f3c0666826af1 Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 9 Mar 2023 16:23:22 -0500 Subject: [PATCH 11/34] Reverse Encoder --- keyboards/gmmk/numpad/info.json | 2 +- keyboards/gmmk/numpad/keymaps/via/keymap.c | 8 ++++---- keyboards/gmmk/numpad/numpad.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/keyboards/gmmk/numpad/info.json b/keyboards/gmmk/numpad/info.json index c21b64a7b81c..ff202e46dba6 100644 --- a/keyboards/gmmk/numpad/info.json +++ b/keyboards/gmmk/numpad/info.json @@ -10,7 +10,7 @@ }, "encoder": { "rotary": [ - {"pin_a": "A1", "pin_b": "A2"} + {"pin_a": "A2", "pin_b": "A1"} ] }, "bootmagic": { diff --git a/keyboards/gmmk/numpad/keymaps/via/keymap.c b/keyboards/gmmk/numpad/keymaps/via/keymap.c index eea7e48c9214..d84ae693083d 100644 --- a/keyboards/gmmk/numpad/keymaps/via/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/via/keymap.c @@ -55,8 +55,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // clang-format on const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { - [0] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, - [1] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, - [2] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, - [3] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) } + [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) } }; \ No newline at end of file diff --git a/keyboards/gmmk/numpad/numpad.c b/keyboards/gmmk/numpad/numpad.c index ad8f800c83f7..7b55c56cc682 100644 --- a/keyboards/gmmk/numpad/numpad.c +++ b/keyboards/gmmk/numpad/numpad.c @@ -126,7 +126,7 @@ bool encoder_update_kb(uint8_t index, bool clockwise) { if (!encoder_update_user(index, clockwise)) { return false; } - if (!clockwise) { + if (clockwise) { tap_code_delay(KC_VOLU, 10); } else { tap_code_delay(KC_VOLD, 10); From c3af9b3f7f92799af5eeb83246665fa9f1fc9929 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 11 Mar 2023 12:06:26 -0500 Subject: [PATCH 12/34] Moving RGB Init to pre_init_user --- keyboards/gmmk/numpad/numpad.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/keyboards/gmmk/numpad/numpad.c b/keyboards/gmmk/numpad/numpad.c index 7b55c56cc682..8c83c73570bd 100644 --- a/keyboards/gmmk/numpad/numpad.c +++ b/keyboards/gmmk/numpad/numpad.c @@ -111,11 +111,10 @@ led_config_t g_led_config = {{ # ifdef DRIVER_1_PW_EN -void matrix_init_kb(void) { +void keyboard_pre_init_user(void) { wait_ms(2000); setPinOutput(DRIVER_1_PW_EN); writePinHigh(DRIVER_1_PW_EN); - matrix_init_user(); } # endif From 8c6caec94896565744f3fdd03f9360371482e530 Mon Sep 17 00:00:00 2001 From: Cameron Varley Date: Sat, 11 Mar 2023 12:25:22 -0500 Subject: [PATCH 13/34] Update keyboards/gmmk/numpad/readme.md Co-authored-by: Sergey Vlasov --- keyboards/gmmk/numpad/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/gmmk/numpad/readme.md b/keyboards/gmmk/numpad/readme.md index 4e0296255fd3..f120259c52ec 100644 --- a/keyboards/gmmk/numpad/readme.md +++ b/keyboards/gmmk/numpad/readme.md @@ -1,6 +1,6 @@ # GMMK NUMPAD -A 17 Key macropad made ans old by Glorious LLC, equiped with a WB32 microcontroller, with support for a rotary encoder. +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 From a1ea35f005dac340d6582d39f3b0d69b88c59f29 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 11 Mar 2023 12:52:43 -0500 Subject: [PATCH 14/34] Update keyboards/gmmk/numpad/readme.md --- keyboards/gmmk/numpad/readme.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/keyboards/gmmk/numpad/readme.md b/keyboards/gmmk/numpad/readme.md index f120259c52ec..84d40797e736 100644 --- a/keyboards/gmmk/numpad/readme.md +++ b/keyboards/gmmk/numpad/readme.md @@ -22,8 +22,11 @@ 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 ## Broken * Slider does not function -* Rotary input push button (mapped to gpio) \ No newline at end of file +* Rotary input push button (mapped to gpio) +* Bluetooth functionality \ No newline at end of file From 8c1c49ec2fe8abd8251aba05fad7914cdf2c0de8 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 11 Mar 2023 13:26:39 -0500 Subject: [PATCH 15/34] Lower wait to 1000ms --- keyboards/gmmk/numpad/numpad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/gmmk/numpad/numpad.c b/keyboards/gmmk/numpad/numpad.c index 8c83c73570bd..f618d60f272a 100644 --- a/keyboards/gmmk/numpad/numpad.c +++ b/keyboards/gmmk/numpad/numpad.c @@ -112,7 +112,7 @@ led_config_t g_led_config = {{ # ifdef DRIVER_1_PW_EN void keyboard_pre_init_user(void) { - wait_ms(2000); + wait_ms(1000); setPinOutput(DRIVER_1_PW_EN); writePinHigh(DRIVER_1_PW_EN); } From 0ba9c4b3e4a96a0dd83b103ab3b173612cef8619 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 11 Mar 2023 17:29:41 -0500 Subject: [PATCH 16/34] Slider Working --- keyboards/gmmk/numpad/halconf.h | 2 +- .../gmmk/numpad/keymaps/default/keymap.c | 18 +++++++++++++++++- keyboards/gmmk/numpad/keymaps/via/keymap.c | 19 ++++++++++++++++++- keyboards/gmmk/numpad/mcuconf.h | 2 +- keyboards/gmmk/numpad/numpad.c | 2 +- keyboards/gmmk/numpad/readme.md | 5 ++++- keyboards/gmmk/numpad/rules.mk | 7 ++++++- 7 files changed, 48 insertions(+), 7 deletions(-) diff --git a/keyboards/gmmk/numpad/halconf.h b/keyboards/gmmk/numpad/halconf.h index d7419b7190b9..617715bd43d3 100644 --- a/keyboards/gmmk/numpad/halconf.h +++ b/keyboards/gmmk/numpad/halconf.h @@ -19,7 +19,7 @@ #define HAL_USE_SPI TRUE #define SPI_USE_WAIT TRUE #define SPI_SELECT_MODE SPI_SELECT_MODE_PAD -// #define HAL_USE_ADC TRUE +#define HAL_USE_ADC TRUE #include_next \ No newline at end of file diff --git a/keyboards/gmmk/numpad/keymaps/default/keymap.c b/keyboards/gmmk/numpad/keymaps/default/keymap.c index 7d501429113a..80b76a56b150 100644 --- a/keyboards/gmmk/numpad/keymaps/default/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/default/keymap.c @@ -15,7 +15,8 @@ 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] = { @@ -41,3 +42,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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 matrix_scan_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 index d84ae693083d..083c39d9713b 100644 --- a/keyboards/gmmk/numpad/keymaps/via/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/via/keymap.c @@ -13,6 +13,8 @@ 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] = { @@ -59,4 +61,19 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { [1] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, [2] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, [3] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) } -}; \ No newline at end of file +}; + +// 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 matrix_scan_user(void) { + slider(); +} \ No newline at end of file diff --git a/keyboards/gmmk/numpad/mcuconf.h b/keyboards/gmmk/numpad/mcuconf.h index e750ba1ed59f..1bcceb296c7e 100644 --- a/keyboards/gmmk/numpad/mcuconf.h +++ b/keyboards/gmmk/numpad/mcuconf.h @@ -22,4 +22,4 @@ #define WB32_SPI_USE_QSPI TRUE // #undef WB32_ADC_USE_ADC1 -// #define WB32_ADC_USE_ADC1 TRUE \ No newline at end of file +#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 index f618d60f272a..8c83c73570bd 100644 --- a/keyboards/gmmk/numpad/numpad.c +++ b/keyboards/gmmk/numpad/numpad.c @@ -112,7 +112,7 @@ led_config_t g_led_config = {{ # ifdef DRIVER_1_PW_EN void keyboard_pre_init_user(void) { - wait_ms(1000); + wait_ms(2000); setPinOutput(DRIVER_1_PW_EN); writePinHigh(DRIVER_1_PW_EN); } diff --git a/keyboards/gmmk/numpad/readme.md b/keyboards/gmmk/numpad/readme.md index 84d40797e736..e3cd9d18ad98 100644 --- a/keyboards/gmmk/numpad/readme.md +++ b/keyboards/gmmk/numpad/readme.md @@ -25,8 +25,11 @@ Enter the bootloader in 3 ways: * **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 setup to use [Midi2Vol](https://github.com/jesusvallejo/Midi2Vol) + ## Broken -* Slider does not function * Rotary input push button (mapped to gpio) * Bluetooth functionality \ No newline at end of file diff --git a/keyboards/gmmk/numpad/rules.mk b/keyboards/gmmk/numpad/rules.mk index a46f84556d1d..3230e9176c9d 100644 --- a/keyboards/gmmk/numpad/rules.mk +++ b/keyboards/gmmk/numpad/rules.mk @@ -11,10 +11,15 @@ 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 \ No newline at end of file +LTO_ENABLE = yes + +SRC += analog.c \ No newline at end of file From a7fd263f0d260ba19980296d9ad3972d0cdb758b Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 11 Mar 2023 19:00:45 -0500 Subject: [PATCH 17/34] Encoder Button --- keyboards/gmmk/numpad/config.h | 1 + keyboards/gmmk/numpad/keymaps/default/keymap.c | 12 ++++++++++++ keyboards/gmmk/numpad/keymaps/via/keymap.c | 12 ++++++++++++ keyboards/gmmk/numpad/numpad.c | 16 ++++++++++++++++ keyboards/gmmk/numpad/readme.md | 5 ++++- 5 files changed, 45 insertions(+), 1 deletion(-) diff --git a/keyboards/gmmk/numpad/config.h b/keyboards/gmmk/numpad/config.h index 79d42c3fb62b..c7f8d9e73fcf 100644 --- a/keyboards/gmmk/numpad/config.h +++ b/keyboards/gmmk/numpad/config.h @@ -20,6 +20,7 @@ #define TAP_CODE_DELAY 10 #define SLIDER_PIN B0 +#define ENCODER_PUSHBUTTON_PIN B8 #define LOCKING_SUPPORT_ENABLE #define LOCKING_RESYNC_ENABLE diff --git a/keyboards/gmmk/numpad/keymaps/default/keymap.c b/keyboards/gmmk/numpad/keymaps/default/keymap.c index 80b76a56b150..8ae3a273045c 100644 --- a/keyboards/gmmk/numpad/keymaps/default/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/default/keymap.c @@ -54,6 +54,18 @@ void slider(void) { midi_send_cc(&midi_device, 2, 0x3E, 0x7F + (analogReadPin(SLIDER_PIN) >> 3)); } +extern int16_t enc; +extern int16_t encPrev; + void matrix_scan_user(void) { + if (enc != encPrev) { + if (enc < 1) { + register_code16(KC_MUTE); + } + else { + unregister_code16(KC_MUTE); + } + } + 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 index 083c39d9713b..12aae0e76471 100644 --- a/keyboards/gmmk/numpad/keymaps/via/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/via/keymap.c @@ -74,6 +74,18 @@ void slider(void) { midi_send_cc(&midi_device, 2, 0x3E, 0x7F + (analogReadPin(SLIDER_PIN) >> 3)); } +extern int16_t enc; +extern int16_t encPrev; + void matrix_scan_user(void) { + if (enc != encPrev) { + if (enc < 1) { + register_code16(KC_MUTE); + } + else { + unregister_code16(KC_MUTE); + } + } + slider(); } \ No newline at end of file diff --git a/keyboards/gmmk/numpad/numpad.c b/keyboards/gmmk/numpad/numpad.c index 8c83c73570bd..ba080b04ddd6 100644 --- a/keyboards/gmmk/numpad/numpad.c +++ b/keyboards/gmmk/numpad/numpad.c @@ -120,6 +120,22 @@ void keyboard_pre_init_user(void) { #endif +void keyboard_pre_init_kb(void) { + // Encoder pins + setPinInput(ENCODER_PUSHBUTTON_PIN); + keyboard_pre_init_user(); +} + +int16_t enc = 1; +int16_t encPrev = 1; + +void matrix_scan_kb(void) { + encPrev = enc; + enc = readPin(ENCODER_PUSHBUTTON_PIN); + + matrix_scan_user(); +} + #ifdef ENCODER_ENABLE bool encoder_update_kb(uint8_t index, bool clockwise) { if (!encoder_update_user(index, clockwise)) { diff --git a/keyboards/gmmk/numpad/readme.md b/keyboards/gmmk/numpad/readme.md index e3cd9d18ad98..00edf4ec8ae8 100644 --- a/keyboards/gmmk/numpad/readme.md +++ b/keyboards/gmmk/numpad/readme.md @@ -29,7 +29,10 @@ Enter the bootloader in 3 ways: The slider is currently setup to use [Midi2Vol](https://github.com/jesusvallejo/Midi2Vol) +## Encoder Button + +The Button is set to mute by default + ## Broken -* Rotary input push button (mapped to gpio) * Bluetooth functionality \ No newline at end of file From f83145fa179abf81c7dd0adb374b5da696f23259 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 11 Mar 2023 22:29:34 -0500 Subject: [PATCH 18/34] Fix: Encoder Push --- keyboards/gmmk/numpad/keymaps/default/keymap.c | 3 +-- keyboards/gmmk/numpad/keymaps/via/keymap.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/keyboards/gmmk/numpad/keymaps/default/keymap.c b/keyboards/gmmk/numpad/keymaps/default/keymap.c index 8ae3a273045c..fa29fda3ce28 100644 --- a/keyboards/gmmk/numpad/keymaps/default/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/default/keymap.c @@ -60,10 +60,9 @@ extern int16_t encPrev; void matrix_scan_user(void) { if (enc != encPrev) { if (enc < 1) { - register_code16(KC_MUTE); + tap_code_delay(KC_MUTE, 10); } else { - unregister_code16(KC_MUTE); } } diff --git a/keyboards/gmmk/numpad/keymaps/via/keymap.c b/keyboards/gmmk/numpad/keymaps/via/keymap.c index 12aae0e76471..0f40572372b5 100644 --- a/keyboards/gmmk/numpad/keymaps/via/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/via/keymap.c @@ -80,10 +80,9 @@ extern int16_t encPrev; void matrix_scan_user(void) { if (enc != encPrev) { if (enc < 1) { - register_code16(KC_MUTE); + tap_code_delay(KC_MUTE, 10); } else { - unregister_code16(KC_MUTE); } } From 562261867a62396856b34252431c635767b6e628 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 11 Mar 2023 22:47:45 -0500 Subject: [PATCH 19/34] Enable Midi Advanced --- keyboards/gmmk/numpad/config.h | 1 + keyboards/gmmk/numpad/readme.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/keyboards/gmmk/numpad/config.h b/keyboards/gmmk/numpad/config.h index c7f8d9e73fcf..ce8048c0eef5 100644 --- a/keyboards/gmmk/numpad/config.h +++ b/keyboards/gmmk/numpad/config.h @@ -20,6 +20,7 @@ #define TAP_CODE_DELAY 10 #define SLIDER_PIN B0 +#define MIDI_ADVANCED #define ENCODER_PUSHBUTTON_PIN B8 #define LOCKING_SUPPORT_ENABLE diff --git a/keyboards/gmmk/numpad/readme.md b/keyboards/gmmk/numpad/readme.md index 00edf4ec8ae8..d44efbf599fb 100644 --- a/keyboards/gmmk/numpad/readme.md +++ b/keyboards/gmmk/numpad/readme.md @@ -27,7 +27,7 @@ Enter the bootloader in 3 ways: ## Slider -The slider is currently setup to use [Midi2Vol](https://github.com/jesusvallejo/Midi2Vol) +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 From 972056ab4de73d800c275d8726f76296e0fc2d47 Mon Sep 17 00:00:00 2001 From: Cameron Varley Date: Thu, 16 Mar 2023 04:18:00 -0400 Subject: [PATCH 20/34] Update keyboards/gmmk/numpad/keymaps/default/keymap.c Co-authored-by: Drashna Jaelre --- keyboards/gmmk/numpad/keymaps/default/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/gmmk/numpad/keymaps/default/keymap.c b/keyboards/gmmk/numpad/keymaps/default/keymap.c index fa29fda3ce28..6bec8594c926 100644 --- a/keyboards/gmmk/numpad/keymaps/default/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/default/keymap.c @@ -57,7 +57,7 @@ void slider(void) { extern int16_t enc; extern int16_t encPrev; -void matrix_scan_user(void) { +void housekeeping_task_user(void) { if (enc != encPrev) { if (enc < 1) { tap_code_delay(KC_MUTE, 10); From e87a652ed4bbbc0d78dcc41f3e850452e61f88b5 Mon Sep 17 00:00:00 2001 From: Cameron Varley Date: Thu, 16 Mar 2023 04:18:10 -0400 Subject: [PATCH 21/34] Update keyboards/gmmk/numpad/keymaps/via/keymap.c Co-authored-by: Drashna Jaelre --- keyboards/gmmk/numpad/keymaps/via/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/gmmk/numpad/keymaps/via/keymap.c b/keyboards/gmmk/numpad/keymaps/via/keymap.c index 0f40572372b5..ff8e29164937 100644 --- a/keyboards/gmmk/numpad/keymaps/via/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/via/keymap.c @@ -77,7 +77,7 @@ void slider(void) { extern int16_t enc; extern int16_t encPrev; -void matrix_scan_user(void) { +void housekeeping_task_user(void) { if (enc != encPrev) { if (enc < 1) { tap_code_delay(KC_MUTE, 10); From 61c900d15467398115117b1ad95675d6b96a896f Mon Sep 17 00:00:00 2001 From: Cameron Varley Date: Thu, 16 Mar 2023 04:18:21 -0400 Subject: [PATCH 22/34] Update keyboards/gmmk/numpad/numpad.c Co-authored-by: Drashna Jaelre --- keyboards/gmmk/numpad/numpad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/gmmk/numpad/numpad.c b/keyboards/gmmk/numpad/numpad.c index ba080b04ddd6..693d833c9be3 100644 --- a/keyboards/gmmk/numpad/numpad.c +++ b/keyboards/gmmk/numpad/numpad.c @@ -129,7 +129,7 @@ void keyboard_pre_init_kb(void) { int16_t enc = 1; int16_t encPrev = 1; -void matrix_scan_kb(void) { +void housekeeping_task_kb(void) { encPrev = enc; enc = readPin(ENCODER_PUSHBUTTON_PIN); From 2f7a64e5852963dd969223bff8c1149639f82463 Mon Sep 17 00:00:00 2001 From: Cameron Varley Date: Thu, 16 Mar 2023 04:19:58 -0400 Subject: [PATCH 23/34] Update keyboards/gmmk/numpad/numpad.c Co-authored-by: Drashna Jaelre --- keyboards/gmmk/numpad/numpad.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/keyboards/gmmk/numpad/numpad.c b/keyboards/gmmk/numpad/numpad.c index 693d833c9be3..d705d731de1c 100644 --- a/keyboards/gmmk/numpad/numpad.c +++ b/keyboards/gmmk/numpad/numpad.c @@ -132,8 +132,6 @@ int16_t encPrev = 1; void housekeeping_task_kb(void) { encPrev = enc; enc = readPin(ENCODER_PUSHBUTTON_PIN); - - matrix_scan_user(); } #ifdef ENCODER_ENABLE From d62b9d2cbfdb80f34e0debf4f1e6b4c8df7216d9 Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 16 Mar 2023 04:40:46 -0400 Subject: [PATCH 24/34] Update Headers --- keyboards/gmmk/numpad/halconf.h | 1 + keyboards/gmmk/numpad/keymaps/default/keymap.c | 1 + keyboards/gmmk/numpad/mcuconf.h | 1 + keyboards/gmmk/numpad/numpad.c | 1 + 4 files changed, 4 insertions(+) diff --git a/keyboards/gmmk/numpad/halconf.h b/keyboards/gmmk/numpad/halconf.h index 617715bd43d3..b6b68a4e6336 100644 --- a/keyboards/gmmk/numpad/halconf.h +++ b/keyboards/gmmk/numpad/halconf.h @@ -1,4 +1,5 @@ /* 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 diff --git a/keyboards/gmmk/numpad/keymaps/default/keymap.c b/keyboards/gmmk/numpad/keymaps/default/keymap.c index 6bec8594c926..11491e1258d5 100644 --- a/keyboards/gmmk/numpad/keymaps/default/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/default/keymap.c @@ -1,4 +1,5 @@ /* 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 diff --git a/keyboards/gmmk/numpad/mcuconf.h b/keyboards/gmmk/numpad/mcuconf.h index 1bcceb296c7e..a07efdbffb8c 100644 --- a/keyboards/gmmk/numpad/mcuconf.h +++ b/keyboards/gmmk/numpad/mcuconf.h @@ -1,4 +1,5 @@ /* 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 diff --git a/keyboards/gmmk/numpad/numpad.c b/keyboards/gmmk/numpad/numpad.c index d705d731de1c..f0b96cf31a6e 100644 --- a/keyboards/gmmk/numpad/numpad.c +++ b/keyboards/gmmk/numpad/numpad.c @@ -1,4 +1,5 @@ /* 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 From e45d852775e6f8962d5e41a179b5b5adec4fbf92 Mon Sep 17 00:00:00 2001 From: Cameron Varley Date: Mon, 20 Mar 2023 23:32:45 -0400 Subject: [PATCH 25/34] Update keyboards/gmmk/numpad/info.json Co-authored-by: Drashna Jaelre --- keyboards/gmmk/numpad/info.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/keyboards/gmmk/numpad/info.json b/keyboards/gmmk/numpad/info.json index ff202e46dba6..d5ea534b67e1 100644 --- a/keyboards/gmmk/numpad/info.json +++ b/keyboards/gmmk/numpad/info.json @@ -13,9 +13,6 @@ {"pin_a": "A2", "pin_b": "A1"} ] }, - "bootmagic": { - "matrix": [0, 0] - }, "processor": "WB32F3G71", "bootloader": "wb32-dfu", "diode_direction": "ROW2COL", From 8c0d31c3f49e4e4def1a5884492587cf10b561f9 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 20 Mar 2023 23:42:15 -0400 Subject: [PATCH 26/34] remove uneeded code --- .../gmmk/numpad/keymaps/default/keymap.c | 2 -- keyboards/gmmk/numpad/keymaps/via/keymap.c | 2 -- keyboards/gmmk/numpad/post_config.h | 21 +++++++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 keyboards/gmmk/numpad/post_config.h diff --git a/keyboards/gmmk/numpad/keymaps/default/keymap.c b/keyboards/gmmk/numpad/keymaps/default/keymap.c index 11491e1258d5..810335c72775 100644 --- a/keyboards/gmmk/numpad/keymaps/default/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/default/keymap.c @@ -63,8 +63,6 @@ void housekeeping_task_user(void) { if (enc < 1) { tap_code_delay(KC_MUTE, 10); } - else { - } } slider(); diff --git a/keyboards/gmmk/numpad/keymaps/via/keymap.c b/keyboards/gmmk/numpad/keymaps/via/keymap.c index ff8e29164937..a2b601eef9b6 100644 --- a/keyboards/gmmk/numpad/keymaps/via/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/via/keymap.c @@ -82,8 +82,6 @@ void housekeeping_task_user(void) { if (enc < 1) { tap_code_delay(KC_MUTE, 10); } - else { - } } slider(); diff --git a/keyboards/gmmk/numpad/post_config.h b/keyboards/gmmk/numpad/post_config.h new file mode 100644 index 000000000000..6ee57f4439ef --- /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 From 29b5080f96a7134f5634d5992de8f62076e29b5e Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 21 Mar 2023 01:28:41 -0400 Subject: [PATCH 27/34] Add Matrix for push encoder (but no encoder push yet) --- keyboards/gmmk/numpad/config.h | 1 - keyboards/gmmk/numpad/keymaps/via/keymap.c | 9 -- keyboards/gmmk/numpad/matrix.c | 133 +++++++++++++++++++++ keyboards/gmmk/numpad/numpad.c | 14 --- keyboards/gmmk/numpad/rules.mk | 3 +- 5 files changed, 135 insertions(+), 25 deletions(-) create mode 100644 keyboards/gmmk/numpad/matrix.c diff --git a/keyboards/gmmk/numpad/config.h b/keyboards/gmmk/numpad/config.h index ce8048c0eef5..96557addc3f9 100644 --- a/keyboards/gmmk/numpad/config.h +++ b/keyboards/gmmk/numpad/config.h @@ -21,7 +21,6 @@ #define SLIDER_PIN B0 #define MIDI_ADVANCED -#define ENCODER_PUSHBUTTON_PIN B8 #define LOCKING_SUPPORT_ENABLE #define LOCKING_RESYNC_ENABLE diff --git a/keyboards/gmmk/numpad/keymaps/via/keymap.c b/keyboards/gmmk/numpad/keymaps/via/keymap.c index a2b601eef9b6..9d9b288dcd36 100644 --- a/keyboards/gmmk/numpad/keymaps/via/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/via/keymap.c @@ -74,15 +74,6 @@ void slider(void) { midi_send_cc(&midi_device, 2, 0x3E, 0x7F + (analogReadPin(SLIDER_PIN) >> 3)); } -extern int16_t enc; -extern int16_t encPrev; - void housekeeping_task_user(void) { - if (enc != encPrev) { - if (enc < 1) { - tap_code_delay(KC_MUTE, 10); - } - } - slider(); } \ No newline at end of file diff --git a/keyboards/gmmk/numpad/matrix.c b/keyboards/gmmk/numpad/matrix.c new file mode 100644 index 000000000000..61f667e6a481 --- /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 +#if defined(__AVR__) +#include +#endif +#include "wait.h" +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "debounce.h" +#include QMK_KEYBOARD_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 (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/numpad.c b/keyboards/gmmk/numpad/numpad.c index f0b96cf31a6e..ed4fed266782 100644 --- a/keyboards/gmmk/numpad/numpad.c +++ b/keyboards/gmmk/numpad/numpad.c @@ -121,20 +121,6 @@ void keyboard_pre_init_user(void) { #endif -void keyboard_pre_init_kb(void) { - // Encoder pins - setPinInput(ENCODER_PUSHBUTTON_PIN); - keyboard_pre_init_user(); -} - -int16_t enc = 1; -int16_t encPrev = 1; - -void housekeeping_task_kb(void) { - encPrev = enc; - enc = readPin(ENCODER_PUSHBUTTON_PIN); -} - #ifdef ENCODER_ENABLE bool encoder_update_kb(uint8_t index, bool clockwise) { if (!encoder_update_user(index, clockwise)) { diff --git a/keyboards/gmmk/numpad/rules.mk b/keyboards/gmmk/numpad/rules.mk index 3230e9176c9d..4d23ffbfaf30 100644 --- a/keyboards/gmmk/numpad/rules.mk +++ b/keyboards/gmmk/numpad/rules.mk @@ -22,4 +22,5 @@ WEAR_LEVELING_DRIVER = spi_flash LTO_ENABLE = yes -SRC += analog.c \ No newline at end of file +SRC += analog.c \ + matrix.c \ No newline at end of file From 935d5b6191fe253b9567be03b46f22dc4674bfd4 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 21 Mar 2023 02:13:20 -0400 Subject: [PATCH 28/34] Added Working Encoder Push!!!!! --- keyboards/gmmk/numpad/matrix.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/keyboards/gmmk/numpad/matrix.c b/keyboards/gmmk/numpad/matrix.c index 61f667e6a481..077df83e8230 100644 --- a/keyboards/gmmk/numpad/matrix.c +++ b/keyboards/gmmk/numpad/matrix.c @@ -102,7 +102,10 @@ __attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[] // For each row... for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) { // Check row pin state - if (readMatrixPin(row_pins[row_index]) == 0) { + 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; From b5cfdf0b158552ef3d235b5fc8e59a0d12bca7d8 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 21 Mar 2023 02:19:40 -0400 Subject: [PATCH 29/34] Update layout to show where the encoder is --- keyboards/gmmk/numpad/keymaps/via/keymap.c | 2 +- keyboards/gmmk/numpad/readme.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/gmmk/numpad/keymaps/via/keymap.c b/keyboards/gmmk/numpad/keymaps/via/keymap.c index 9d9b288dcd36..aa7730acdd14 100644 --- a/keyboards/gmmk/numpad/keymaps/via/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/via/keymap.c @@ -21,7 +21,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // NUM / * - // 7 8 9 + -// 4 5 6 CALC +// 4 5 6 ENCODER // 1 2 3 RET // 0 . diff --git a/keyboards/gmmk/numpad/readme.md b/keyboards/gmmk/numpad/readme.md index d44efbf599fb..38a819b05419 100644 --- a/keyboards/gmmk/numpad/readme.md +++ b/keyboards/gmmk/numpad/readme.md @@ -31,7 +31,7 @@ The slider is currently compatible with [Midi2Vol](https://github.com/jesusvalle ## Encoder Button -The Button is set to mute by default +The Button is set to KC_CALC by default and is located at 2,3 on the matrix ## Broken From 864a05a86c2b4e2673938cb8adfde3b2af8d4b54 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 21 Mar 2023 02:22:33 -0400 Subject: [PATCH 30/34] Show encoder position on default keymap --- keyboards/gmmk/numpad/keymaps/default/keymap.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/keyboards/gmmk/numpad/keymaps/default/keymap.c b/keyboards/gmmk/numpad/keymaps/default/keymap.c index 810335c72775..aa1829cdd419 100644 --- a/keyboards/gmmk/numpad/keymaps/default/keymap.c +++ b/keyboards/gmmk/numpad/keymaps/default/keymap.c @@ -24,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // NUM / * - // 7 8 9 + -// 4 5 6 CALC +// 4 5 6 ENCODER // 1 2 3 RET // 0 . @@ -55,15 +55,6 @@ void slider(void) { midi_send_cc(&midi_device, 2, 0x3E, 0x7F + (analogReadPin(SLIDER_PIN) >> 3)); } -extern int16_t enc; -extern int16_t encPrev; - void housekeeping_task_user(void) { - if (enc != encPrev) { - if (enc < 1) { - tap_code_delay(KC_MUTE, 10); - } - } - slider(); } \ No newline at end of file From cd15863c21ecda486a7159598200c41a1c5d3312 Mon Sep 17 00:00:00 2001 From: Cameron Varley Date: Tue, 21 Mar 2023 11:07:14 -0400 Subject: [PATCH 31/34] Update keyboards/gmmk/numpad/matrix.c Co-authored-by: Drashna Jaelre --- keyboards/gmmk/numpad/matrix.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/keyboards/gmmk/numpad/matrix.c b/keyboards/gmmk/numpad/matrix.c index 077df83e8230..c7f9d179db70 100644 --- a/keyboards/gmmk/numpad/matrix.c +++ b/keyboards/gmmk/numpad/matrix.c @@ -6,9 +6,6 @@ */ #include #include -#if defined(__AVR__) -#include -#endif #include "wait.h" #include "print.h" #include "debug.h" From a1335c4990cf4582a35baedafaa58a5914abe922 Mon Sep 17 00:00:00 2001 From: Cameron Varley Date: Tue, 21 Mar 2023 11:07:34 -0400 Subject: [PATCH 32/34] Update keyboards/gmmk/numpad/matrix.c Co-authored-by: Drashna Jaelre --- keyboards/gmmk/numpad/matrix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/gmmk/numpad/matrix.c b/keyboards/gmmk/numpad/matrix.c index c7f9d179db70..99adb38f1843 100644 --- a/keyboards/gmmk/numpad/matrix.c +++ b/keyboards/gmmk/numpad/matrix.c @@ -12,7 +12,7 @@ #include "util.h" #include "matrix.h" #include "debounce.h" -#include QMK_KEYBOARD_H +#include "quantum.h" /* matrix state(1:on, 0:off) */ extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values From 00ab7b95cd26b909b0adb76b36e8baeedc17a919 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 21 Mar 2023 11:09:21 -0400 Subject: [PATCH 33/34] update keyboards/gmmk/numpad/config.h --- keyboards/gmmk/numpad/config.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/keyboards/gmmk/numpad/config.h b/keyboards/gmmk/numpad/config.h index 96557addc3f9..6aa0a6c0160f 100644 --- a/keyboards/gmmk/numpad/config.h +++ b/keyboards/gmmk/numpad/config.h @@ -17,8 +17,6 @@ #pragma once -#define TAP_CODE_DELAY 10 - #define SLIDER_PIN B0 #define MIDI_ADVANCED From fe67ef9a88baa642380af475213dbaca92a47a24 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 21 Mar 2023 12:14:35 -0400 Subject: [PATCH 34/34] Add Keyboard Image --- keyboards/gmmk/numpad/readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/keyboards/gmmk/numpad/readme.md b/keyboards/gmmk/numpad/readme.md index 38a819b05419..d40b2b8c5871 100644 --- a/keyboards/gmmk/numpad/readme.md +++ b/keyboards/gmmk/numpad/readme.md @@ -1,5 +1,7 @@ # 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)