diff options
Diffstat (limited to 'keyboards/dumbpad')
-rw-r--r-- | keyboards/dumbpad/v3x/config.h | 84 | ||||
-rw-r--r-- | keyboards/dumbpad/v3x/info.json | 18 | ||||
-rw-r--r-- | keyboards/dumbpad/v3x/keymaps/default/keymap.c | 81 | ||||
-rw-r--r-- | keyboards/dumbpad/v3x/keymaps/deveth0/keymap.c | 104 | ||||
-rw-r--r-- | keyboards/dumbpad/v3x/keymaps/via/keymap.c | 81 | ||||
-rw-r--r-- | keyboards/dumbpad/v3x/keymaps/via/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/dumbpad/v3x/readme.md | 27 | ||||
-rw-r--r-- | keyboards/dumbpad/v3x/rules.mk | 23 | ||||
-rw-r--r-- | keyboards/dumbpad/v3x/v3x.c | 121 | ||||
-rw-r--r-- | keyboards/dumbpad/v3x/v3x.h | 33 |
10 files changed, 573 insertions, 0 deletions
diff --git a/keyboards/dumbpad/v3x/config.h b/keyboards/dumbpad/v3x/config.h new file mode 100644 index 0000000000..c64409c967 --- /dev/null +++ b/keyboards/dumbpad/v3x/config.h @@ -0,0 +1,84 @@ +/* +Copyright 2022 imchipwood && deveth0 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#pragma once + +#include "config_common.h" + + +/* Column/Row IO definitions */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 5 +#define MATRIX_ROW_PINS { F4, F5, F6, F7 } +#define MATRIX_COL_PINS { C6, D7, E6, B4, B5 } +#define UNUSED_PINS + +/* Single rotary encoder */ +#define ENCODERS_PAD_A { B2 } +#define ENCODERS_PAD_B { D4 } + +/* Onboard LEDs */ +#define LED_00 B1 +#define LED_01 B3 +#define LED_02 B6 + +/* Bootmagic - hold down rotary encoder pushbutton while plugging in to enter bootloader */ +#define BOOTMAGIC_LITE_ROW 3 +#define BOOTMAGIC_LITE_COLUMN 0 + +#define RGB_DI_PIN D1 +#define DRIVER_LED_TOTAL 16 + +// Cleanup RGB +#ifdef RGB_MATRIX_ENABLE + +#define RGB_DISABLE_TIMEOUT 300000 // 5 minutes (5 * 60 * 1000ms) +#define RGB_DISABLE_WHEN_USB_SUSPENDED + +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS // Heatmap, Rain +#define RGB_MATRIX_KEYPRESSES + +#define ENABLE_RGB_MATRIX_ALPHAS_MODS +#define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +#define ENABLE_RGB_MATRIX_BREATHING +#define ENABLE_RGB_MATRIX_BAND_SAT +#define ENABLE_RGB_MATRIX_BAND_VAL +#define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +#define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +#define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +#define ENABLE_RGB_MATRIX_RAINDROPS +#define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +#define ENABLE_RGB_MATRIX_PIXEL_RAIN +#define ENABLE_RGB_MATRIX_PIXEL_FLOW +#define ENABLE_RGB_MATRIX_PIXEL_FRACTAL +// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined +#define ENABLE_RGB_MATRIX_TYPING_HEATMAP +#define ENABLE_RGB_MATRIX_DIGITAL_RAIN +// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +#define ENABLE_RGB_MATRIX_SPLASH +#define ENABLE_RGB_MATRIX_MULTISPLASH +#define ENABLE_RGB_MATRIX_SOLID_SPLASH +#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH + +#endif diff --git a/keyboards/dumbpad/v3x/info.json b/keyboards/dumbpad/v3x/info.json new file mode 100644 index 0000000000..f29108fb39 --- /dev/null +++ b/keyboards/dumbpad/v3x/info.json @@ -0,0 +1,18 @@ +{ + "keyboard_name": "dumbpad/v3x", + "url": "https://www.github.com/imchipwood/dumbpad", + "maintainer": "imchipwood", + "usb": { + "device_version": "0.1.0" + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, + {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, + {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, + {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3} + ] + } + } +}
\ No newline at end of file diff --git a/keyboards/dumbpad/v3x/keymaps/default/keymap.c b/keyboards/dumbpad/v3x/keymaps/default/keymap.c new file mode 100644 index 0000000000..b96e0e71ce --- /dev/null +++ b/keyboards/dumbpad/v3x/keymaps/default/keymap.c @@ -0,0 +1,81 @@ +/* +Copyright 2022 imchipwood && deveth0 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include QMK_KEYBOARD_H + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + BASE LAYER - Num Pad + /-----------------------------------------------------` + | | 7 | 8 | 9 | - | + | |---------|---------|---------|---------| + | | 4 | 5 | 6 | + | + | |---------|---------|---------|---------| + | | 1 | 2 | 3 | * | + |-------------|---------|---------|---------|---------| + | Mute | TT(1) | 0 | | Enter | + \-----------------------------------------------------' + */ + [0] = LAYOUT( + KC_P7, KC_P8, KC_P9, KC_PMNS, + KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_P1, KC_P2, KC_P3, KC_PAST, + KC_MUTE, TT(1), KC_P0, _______, KC_ENTER + ), + /* + SUB LAYER - RGB controls, Modes on encoder + /-----------------------------------------------------` + | | On/Off | Bright- | Bright+ | Reset | + | |---------|---------|---------|---------| + | | | Hue- | Hue+ | | + | |---------|---------|---------|---------| + | | | Sat- | Sat+ | | + |-------------|---------|---------|---------|---------| + | | TT(1) | Effect- | Effect+ | | + \-----------------------------------------------------' + */ + [1] = LAYOUT( + RGB_TOG, RGB_VAD, RGB_VAI, RESET, + KC_NO, RGB_HUD, RGB_HUI, KC_NO, + KC_NO, RGB_SAD, RGB_SAI, KC_NO, + KC_NO, _______, RGB_SPD, RGB_SPI, KC_NO + ), +}; +// clang-format on + +bool encoder_update_user(uint8_t index, bool clockwise) { + switch (get_highest_layer(layer_state)) { + case 0: + // main layer, volume + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + break; + default: + // rgb control layer, effects + if (clockwise) { + rgblight_step(); + } else { + rgblight_step_reverse(); + } + break; + } + return true; +} diff --git a/keyboards/dumbpad/v3x/keymaps/deveth0/keymap.c b/keyboards/dumbpad/v3x/keymaps/deveth0/keymap.c new file mode 100644 index 0000000000..b95e6270e8 --- /dev/null +++ b/keyboards/dumbpad/v3x/keymaps/deveth0/keymap.c @@ -0,0 +1,104 @@ +/* +Copyright 2022 imchipwood && deveth0 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include QMK_KEYBOARD_H + +#define MUTE_HOLD_DELAY 400 +static uint16_t mute_hold_timer = 0; + +enum custom_keycodes { + MUTE_TEAMS = SAFE_RANGE, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + BASE LAYER - Media Controls + /------------------------------------------------------------------------------------` + | | Media Prev | Media Pause | Media Next | | + | |--------------------|-------------------|------------------|---------| + | | Teams - Mute | | | | + | |--------------------|-------------------|------------------|---------| + | | | | | | + |-------------|--------------------|-------------------|------------------|---------| + | Mute | TT(1) | | | Enter | + \------------------------------------------------------------------------------------' + */ + [0] = LAYOUT( + KC_MPRV, KC_MPLY, KC_MNXT, KC_NO, + KC_NO, KC_NO, KC_NO, KC_NO, + MUTE_TEAMS, KC_NO, KC_NO, KC_NO, + KC_MUTE, TT(1), KC_NO, KC_NO, KC_NO + ), + /* + SUB LAYER - RGB controls, Modes on encoder + /-----------------------------------------------------` + | | On/Off | Bright- | Bright+ | Reset | + | |---------|---------|---------|---------| + | | | Hue- | Hue+ | | + | |---------|---------|---------|---------| + | | | Sat- | Sat+ | | + |-------------|---------|---------|---------|---------| + | | TT(1) | Effect- | Effect+ | | + \-----------------------------------------------------' + */ + [1] = LAYOUT( + RGB_TOG, RGB_VAD, RGB_VAI, RESET, + KC_NO, RGB_HUD, RGB_HUI, KC_NO, + KC_NO, RGB_SAD, RGB_SAI, KC_NO, + KC_NO, _______, RGB_SPD, RGB_SPI, KC_NO + ), +}; +// clang-format on + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + // props to https://www.reddit.com/r/olkb/comments/oewbr2/comment/h49z38r + switch (keycode) { + case MUTE_TEAMS: + if (record->event.pressed) { // when keycode MUTE_TEAMS is pressed + mute_hold_timer = timer_read(); // mark the time the key was pressed + tap_code16(LCTL(LSFT(KC_M))); // tap Ctrl + Shift + M (mute shortcut) + } else { // when keycode MUTE_TEAMS is released + if (timer_elapsed(mute_hold_timer) > MUTE_HOLD_DELAY) // if held longer than MUTE_HOLD_DELAY + tap_code16(LCTL(LSFT(KC_M))); // tap the mute shortcut again + } // otherwise do nothing + break; + } + return true; +}; + +bool encoder_update_user(uint8_t index, bool clockwise) { + switch (get_highest_layer(layer_state)) { + case 0: + // main layer, volume + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + break; + default: + // rgb control layer, effects + if (clockwise) { + rgblight_step(); + } else { + rgblight_step_reverse(); + } + break; + } + return true; +} diff --git a/keyboards/dumbpad/v3x/keymaps/via/keymap.c b/keyboards/dumbpad/v3x/keymaps/via/keymap.c new file mode 100644 index 0000000000..b96e0e71ce --- /dev/null +++ b/keyboards/dumbpad/v3x/keymaps/via/keymap.c @@ -0,0 +1,81 @@ +/* +Copyright 2022 imchipwood && deveth0 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include QMK_KEYBOARD_H + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + BASE LAYER - Num Pad + /-----------------------------------------------------` + | | 7 | 8 | 9 | - | + | |---------|---------|---------|---------| + | | 4 | 5 | 6 | + | + | |---------|---------|---------|---------| + | | 1 | 2 | 3 | * | + |-------------|---------|---------|---------|---------| + | Mute | TT(1) | 0 | | Enter | + \-----------------------------------------------------' + */ + [0] = LAYOUT( + KC_P7, KC_P8, KC_P9, KC_PMNS, + KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_P1, KC_P2, KC_P3, KC_PAST, + KC_MUTE, TT(1), KC_P0, _______, KC_ENTER + ), + /* + SUB LAYER - RGB controls, Modes on encoder + /-----------------------------------------------------` + | | On/Off | Bright- | Bright+ | Reset | + | |---------|---------|---------|---------| + | | | Hue- | Hue+ | | + | |---------|---------|---------|---------| + | | | Sat- | Sat+ | | + |-------------|---------|---------|---------|---------| + | | TT(1) | Effect- | Effect+ | | + \-----------------------------------------------------' + */ + [1] = LAYOUT( + RGB_TOG, RGB_VAD, RGB_VAI, RESET, + KC_NO, RGB_HUD, RGB_HUI, KC_NO, + KC_NO, RGB_SAD, RGB_SAI, KC_NO, + KC_NO, _______, RGB_SPD, RGB_SPI, KC_NO + ), +}; +// clang-format on + +bool encoder_update_user(uint8_t index, bool clockwise) { + switch (get_highest_layer(layer_state)) { + case 0: + // main layer, volume + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + break; + default: + // rgb control layer, effects + if (clockwise) { + rgblight_step(); + } else { + rgblight_step_reverse(); + } + break; + } + return true; +} diff --git a/keyboards/dumbpad/v3x/keymaps/via/rules.mk b/keyboards/dumbpad/v3x/keymaps/via/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/dumbpad/v3x/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/dumbpad/v3x/readme.md b/keyboards/dumbpad/v3x/readme.md new file mode 100644 index 0000000000..96b0537946 --- /dev/null +++ b/keyboards/dumbpad/v3x/readme.md @@ -0,0 +1,27 @@ +# dumbpad v3.x - rgb & hotswap + +![dumbpad](https://i.imgur.com/ND03FiFl.png) + +A 4x4 numpad/macropad with a rotary encoder to the left of the bottom row of keys. + +- Keyboard Maintainer: [imchipwood](https://github.com/imchipwood) // [deveth0](https://github.com/deveth0) +- Hardware repository: [dumbpad on github](https://github.com/imchipwood/dumbpad) +- PCB Revisions Supported: v3.1 + +Make example for this keyboard (after setting up your build environment): + + make dumbpad/v3x:default + +Flashing example for this keyboard: + + make dumbpad/v3x:default:flash + +## Bootloader + +Enter the bootloader in 3 ways: + +- **Bootmagic reset**: Hold down the encoder and plug in the keyboard +- **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead +- **Keycode in layout**: Press the key mapped to `RESET` if it is available + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/dumbpad/v3x/rules.mk b/keyboards/dumbpad/v3x/rules.mk new file mode 100644 index 0000000000..832bd6d67f --- /dev/null +++ b/keyboards/dumbpad/v3x/rules.mk @@ -0,0 +1,23 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = no # 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 = no # 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 = WS2812 diff --git a/keyboards/dumbpad/v3x/v3x.c b/keyboards/dumbpad/v3x/v3x.c new file mode 100644 index 0000000000..4a8ba12c47 --- /dev/null +++ b/keyboards/dumbpad/v3x/v3x.c @@ -0,0 +1,121 @@ +/* Copyright 2022 imchipwood && deveth0 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "v3x.h" + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = {{// Key Matrix to LED Index + {NO_LED, 0, 1, 2, 3}, + {NO_LED, 7, 6, 5, 4}, + {NO_LED, 8, 9, 10, 11}, + {NO_LED, 15, 14, 13, 12}}, + {// LED Index to Physical Position + {0, 0}, + {75, 0}, + {149, 0}, + {224, 0}, + + {224, 21}, + {149, 21}, + {75, 21}, + {0, 21}, + + {0, 43}, + {75, 43}, + {149, 43}, + {224, 43}, + + {224, 64}, + {149, 64}, + {75, 64}, + {0, 64}}, + {// LED Index to Flag + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}}; +#endif + +void keyboard_pre_init_kb(void) { + // Set LED IO as outputs + setPinOutput(LED_00); + setPinOutput(LED_01); + setPinOutput(LED_02); + keyboard_pre_init_user(); +} + +void shutdown_user() { + // Shutdown LEDs + writePinLow(LED_00); + writePinLow(LED_01); + writePinLow(LED_02); +} + +layer_state_t layer_state_set_kb(layer_state_t state) { + // Layer LEDs act as binary indication of current layer + uint8_t layer = get_highest_layer(state); + writePin(LED_00, layer & 0b1); + writePin(LED_01, (layer >> 1) & 0b1); + uprintf("%d string", layer); + return layer_state_set_user(state); +} + +// Optional override functions below. +// You can leave any or all of these undefined. +// These are only required if you want to perform custom actions. + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + uint8_t led_delay_ms = 80; + for (int i = 0; i < 2; i++) { + writePinHigh(LED_00); + writePinHigh(LED_01); + writePinHigh(LED_02); + wait_ms(led_delay_ms); + writePinLow(LED_00); + writePinLow(LED_01); + writePinLow(LED_02); + if (i < 1) { + wait_ms(led_delay_ms); + } + } + + matrix_init_user(); +} + +bool led_update_kb(led_t led_state) { + if (!led_update_user(led_state)) return false; + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + writePin(LED_02, !led_state.num_lock); + return true; +} + +#ifdef ENCODER_ENABLE +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { + return false; + } + switch (get_highest_layer(layer_state)) { + case 0: + // main layer, volume + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + break; + } + return true; +} +#endif diff --git a/keyboards/dumbpad/v3x/v3x.h b/keyboards/dumbpad/v3x/v3x.h new file mode 100644 index 0000000000..f939b6a594 --- /dev/null +++ b/keyboards/dumbpad/v3x/v3x.h @@ -0,0 +1,33 @@ +/* Copyright 2022 imchipwood && deveth0 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +#include "quantum.h" + + +#define LAYOUT( \ + k01, k02, k03, k04, \ + k11, k12, k13, k14, \ + k21, k22, k23, k24, \ + k30, k31, k32, k33, k34 \ +) \ +{ \ + { KC_NO, k01, k02, k03, k04 }, \ + { KC_NO, k11, k12, k13, k14 }, \ + { KC_NO, k21, k22, k23, k24 }, \ + { k30, k31, k32, k33, k34 }, \ +} |