DecenTKL numpad (#24696)
This commit is contained in:
parent
18cca2062e
commit
e6fa351d3b
5 changed files with 379 additions and 0 deletions
8
keyboards/decent/numpad/config.h
Normal file
8
keyboards/decent/numpad/config.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
// Copyright 2023 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#define JOYSTICK_AXIS_COUNT 4
|
||||
#define JOYSTICK_BUTTON_COUNT 10
|
||||
#define JOYSTICK_HAS_HAT
|
148
keyboards/decent/numpad/keyboard.json
Normal file
148
keyboards/decent/numpad/keyboard.json
Normal file
|
@ -0,0 +1,148 @@
|
|||
{
|
||||
"manufacturer": "Bertrand Le roy",
|
||||
"keyboard_name": "DecenTKL NumPad",
|
||||
"maintainer": "bleroy",
|
||||
"url": "https://github.com/bleroy/3d-junkyard/blob/main/DecenTKL/",
|
||||
"tags": ["ansi", "numpad", "rgb", "atari", "joystick"],
|
||||
"bootloader": "rp2040",
|
||||
"diode_direction": "COL2ROW",
|
||||
"features": {
|
||||
"bootmagic": true,
|
||||
"rgb_matrix": true,
|
||||
"extrakey": true,
|
||||
"mousekey": true,
|
||||
"joystick": true
|
||||
},
|
||||
"matrix_pins": {
|
||||
"cols": ["GP0", "GP1", "GP2", "GP3"],
|
||||
"rows": ["GP4", "GP5", "GP6", "GP7", "GP8", "GP9"]
|
||||
},
|
||||
"processor": "RP2040",
|
||||
"usb": {
|
||||
"device_version": "1.0.0",
|
||||
"pid": "0x0000",
|
||||
"vid": "0xFEED"
|
||||
},
|
||||
"ws2812": {
|
||||
"pin": "GP20",
|
||||
"driver": "vendor"
|
||||
},
|
||||
"bootmagic": {
|
||||
"matrix": [1, 0]
|
||||
},
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{"matrix": [0, 0], "x": 0.75, "y": 0, "label": "F11"},
|
||||
{"matrix": [0, 1], "x": 2.25, "y": 0, "label": "F12"},
|
||||
|
||||
{"matrix": [1, 0], "x": 0, "y": 1, "label": "Num"},
|
||||
{"matrix": [1, 1], "x": 1, "y": 1, "label": "/"},
|
||||
{"matrix": [1, 2], "x": 2, "y": 1, "label": "*"},
|
||||
{"matrix": [1, 3], "x": 3, "y": 1, "label": "-"},
|
||||
|
||||
{"matrix": [2, 0], "x": 0, "y": 2, "label": "7"},
|
||||
{"matrix": [2, 1], "x": 1, "y": 2, "label": "8"},
|
||||
{"matrix": [2, 2], "x": 2, "y": 2, "label": "9"},
|
||||
{"matrix": [2, 3], "x": 3, "y": 2, "h": 2, "label": "+"},
|
||||
|
||||
{"matrix": [3, 0], "x": 0, "y": 3, "label": "4"},
|
||||
{"matrix": [3, 1], "x": 1, "y": 3, "label": "5"},
|
||||
{"matrix": [3, 2], "x": 2, "y": 3, "label": "6"},
|
||||
|
||||
{"matrix": [4, 0], "x": 0, "y": 4, "label": "1"},
|
||||
{"matrix": [4, 1], "x": 1, "y": 4, "label": "2"},
|
||||
{"matrix": [4, 2], "x": 2, "y": 4, "label": "3"},
|
||||
{"matrix": [4, 3], "x": 3, "y": 4, "h": 2, "label": "Enter"},
|
||||
|
||||
{"matrix": [5, 0], "x": 0, "y": 5, "w": 2, "label": "0"},
|
||||
{"matrix": [5, 2], "x": 2, "y": 5, "label": "."}
|
||||
]
|
||||
}
|
||||
},
|
||||
"rgb_matrix": {
|
||||
"center_point": [37, 42],
|
||||
"max_brightness": 125,
|
||||
"sleep": true,
|
||||
"animations": {
|
||||
"alphas_mods": true,
|
||||
"band_pinwheel_sat": true,
|
||||
"band_pinwheel_val": true,
|
||||
"band_sat": true,
|
||||
"band_spiral_sat": true,
|
||||
"band_spiral_val": true,
|
||||
"band_val": true,
|
||||
"breathing": true,
|
||||
"cycle_all": true,
|
||||
"cycle_left_right": true,
|
||||
"cycle_out_in": true,
|
||||
"cycle_out_in_dual": true,
|
||||
"cycle_pinwheel": true,
|
||||
"cycle_spiral": true,
|
||||
"cycle_up_down": true,
|
||||
"digital_rain": true,
|
||||
"dual_beacon": true,
|
||||
"flower_blooming": true,
|
||||
"gradient_left_right": true,
|
||||
"gradient_up_down": true,
|
||||
"hue_breathing": true,
|
||||
"hue_pendulum": true,
|
||||
"hue_wave": true,
|
||||
"jellybean_raindrops": true,
|
||||
"multisplash": true,
|
||||
"pixel_flow": true,
|
||||
"pixel_fractal": true,
|
||||
"pixel_rain": true,
|
||||
"rainbow_beacon": true,
|
||||
"rainbow_moving_chevron": true,
|
||||
"rainbow_pinwheels": true,
|
||||
"raindrops": true,
|
||||
"riverflow": true,
|
||||
"solid_multisplash": true,
|
||||
"solid_reactive": true,
|
||||
"solid_reactive_cross": true,
|
||||
"solid_reactive_multicross": true,
|
||||
"solid_reactive_multinexus": true,
|
||||
"solid_reactive_multiwide": true,
|
||||
"solid_reactive_nexus": true,
|
||||
"solid_reactive_simple": true,
|
||||
"solid_reactive_wide": true,
|
||||
"solid_splash": true,
|
||||
"splash": true,
|
||||
"starlight": true,
|
||||
"starlight_dual_hue": true,
|
||||
"starlight_dual_sat": true,
|
||||
"typing_heatmap": true
|
||||
},
|
||||
"layout": [
|
||||
{"matrix": [0, 0], "x": 56, "y": 0, "flags": 4},
|
||||
{"matrix": [0, 1], "x": 169, "y": 0, "flags": 4},
|
||||
|
||||
{"matrix": [1, 0], "x": 0, "y": 20, "flags": 4},
|
||||
{"matrix": [1, 1], "x": 75, "y": 20, "flags": 4},
|
||||
{"matrix": [1, 2], "x": 150, "y": 20, "flags": 4},
|
||||
{"matrix": [1, 3], "x": 224, "y": 20, "flags": 4},
|
||||
|
||||
{"matrix": [2, 0], "x": 0, "y": 31, "flags": 4},
|
||||
{"matrix": [2, 1], "x": 75, "y": 31, "flags": 4},
|
||||
{"matrix": [2, 2], "x": 150, "y": 31, "flags": 4},
|
||||
{"x": 224, "y": 31, "flags": 2},
|
||||
|
||||
{"matrix": [3, 0], "x": 0, "y": 42, "flags": 4},
|
||||
{"matrix": [3, 1], "x": 75, "y": 42, "flags": 4},
|
||||
{"matrix": [3, 2], "x": 150, "y": 42, "flags": 4},
|
||||
{"matrix": [3, 3], "x": 224, "y": 42, "flags": 4},
|
||||
|
||||
{"matrix": [4, 0], "x": 0, "y": 53, "flags": 4},
|
||||
{"matrix": [4, 1], "x": 75, "y": 53, "flags": 4},
|
||||
{"matrix": [4, 2], "x": 150, "y": 53, "flags": 4},
|
||||
{"x": 224, "y": 53, "flags": 2},
|
||||
|
||||
{"matrix": [5, 0], "x": 0, "y": 64, "flags": 4},
|
||||
{"x": 85, "y": 75, "flags": 2},
|
||||
{"matrix": [5, 2], "x": 150, "y": 64, "flags": 4},
|
||||
{"matrix": [5, 3], "x": 224, "y": 64, "flags": 4}
|
||||
],
|
||||
"driver": "ws2812"
|
||||
}
|
||||
}
|
41
keyboards/decent/numpad/keymaps/default/keymap.c
Normal file
41
keyboards/decent/numpad/keymaps/default/keymap.c
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Copyright 2023 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/*
|
||||
* /─────/─────/
|
||||
* /F11 /F12 /
|
||||
* /─────/─────/
|
||||
* ┌───┬───┬───┬───┐
|
||||
* │Num│ / │ * │ - │
|
||||
* ├───┼───┼───┼───┤
|
||||
* │ 7 │ 8 │ 9 │ + │
|
||||
* ├───┼───┼───┤ │
|
||||
* │ 4 │ 5 │ 6 │ │
|
||||
* ├───┼───┼───┼───┤
|
||||
* │ 1 │ 2 │ 3 │Ent│
|
||||
* ├───┴───┼───┤ er│
|
||||
* │ 0 │ . │ │
|
||||
* └───────┴───┴───┘
|
||||
*/
|
||||
[0] = LAYOUT(
|
||||
KC_F11, KC_F12,
|
||||
|
||||
MO(1), KC_KP_SLASH, KC_KP_ASTERISK, KC_KP_MINUS,
|
||||
KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_PLUS,
|
||||
KC_KP_4, KC_KP_5, KC_KP_6,
|
||||
KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_ENTER,
|
||||
KC_KP_0, KC_KP_DOT
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
S(KC_F11), S(KC_F12),
|
||||
|
||||
_______, _______, _______, RM_VALD,
|
||||
_______, RM_HUEU, _______, RM_VALU,
|
||||
RM_SPDD, _______, RM_SPDU,
|
||||
RM_PREV, RM_HUED, RM_NEXT, QK_BOOT,
|
||||
RM_TOGG, _______
|
||||
),
|
||||
};
|
111
keyboards/decent/numpad/numpad.c
Normal file
111
keyboards/decent/numpad/numpad.c
Normal file
|
@ -0,0 +1,111 @@
|
|||
// Copyright 2024 B. Le Roy
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "quantum.h"
|
||||
#include "analog.h"
|
||||
|
||||
joystick_config_t joystick_axes[JOYSTICK_AXIS_COUNT] = {
|
||||
[0] = JOYSTICK_AXIS_VIRTUAL,
|
||||
[1] = JOYSTICK_AXIS_VIRTUAL,
|
||||
[2] = JOYSTICK_AXIS_VIRTUAL,
|
||||
[3] = JOYSTICK_AXIS_VIRTUAL
|
||||
};
|
||||
|
||||
void keyboard_post_init_kb(void) {
|
||||
gpio_set_pin_input_high(GP10); // Up1
|
||||
gpio_set_pin_input_high(GP11); // Down1
|
||||
gpio_set_pin_input_high(GP12); // Left1
|
||||
gpio_set_pin_input_high(GP13); // Right1
|
||||
gpio_set_pin_input_high(GP14); // Fire1
|
||||
gpio_set_pin_input_high(GP15);
|
||||
gpio_set_pin_input_high(GP16);
|
||||
gpio_set_pin_input_high(GP17);
|
||||
gpio_set_pin_input_high(GP18);
|
||||
gpio_set_pin_input_high(GP19);
|
||||
|
||||
keyboard_post_init_user();
|
||||
}
|
||||
|
||||
void set_button_state(int btn, bool state) {
|
||||
if (state) {
|
||||
unregister_joystick_button(btn);
|
||||
}
|
||||
else {
|
||||
register_joystick_button(btn);
|
||||
}
|
||||
}
|
||||
|
||||
void housekeeping_task_kb(void) {
|
||||
set_button_state(0, gpio_read_pin(GP16));
|
||||
set_button_state(1, gpio_read_pin(GP18));
|
||||
set_button_state(2, gpio_read_pin(GP17));
|
||||
set_button_state(3, gpio_read_pin(GP15));
|
||||
set_button_state(4, gpio_read_pin(GP14));
|
||||
set_button_state(5, gpio_read_pin(GP19));
|
||||
bool up = !gpio_read_pin(10);
|
||||
bool down = !gpio_read_pin(11);
|
||||
bool left = !gpio_read_pin(12);
|
||||
bool right = !gpio_read_pin(13);
|
||||
if (up) {
|
||||
if (left) {
|
||||
joystick_set_hat(7);
|
||||
}
|
||||
else if (right) {
|
||||
joystick_set_hat(1);
|
||||
}
|
||||
else {
|
||||
joystick_set_hat(0);
|
||||
}
|
||||
}
|
||||
else if (down) {
|
||||
if (left) {
|
||||
joystick_set_hat(5);
|
||||
}
|
||||
else if (right) {
|
||||
joystick_set_hat(3);
|
||||
}
|
||||
else {
|
||||
joystick_set_hat(4);
|
||||
}
|
||||
}
|
||||
else if (left) {
|
||||
joystick_set_hat(6);
|
||||
}
|
||||
else if (right) {
|
||||
joystick_set_hat(2);
|
||||
}
|
||||
else {
|
||||
joystick_set_hat(-1);
|
||||
}
|
||||
int16_t analog = analogReadPin(GP26);
|
||||
joystick_set_axis(0, analog);
|
||||
analog = analogReadPin(GP27);
|
||||
joystick_set_axis(1, analog);
|
||||
analog = analogReadPin(GP28);
|
||||
joystick_set_axis(2, analog);
|
||||
analog = analogReadPin(GP29);
|
||||
joystick_set_axis(3, analog);
|
||||
}
|
||||
|
||||
bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
|
||||
if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (get_highest_layer(layer_state) > 0) {
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; ++row) {
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; ++col) {
|
||||
uint8_t index = g_led_config.matrix_co[row][col];
|
||||
|
||||
if (index >= led_min && index < led_max && index != NO_LED &&
|
||||
keymap_key_to_keycode(layer, (keypos_t){col,row}) > KC_TRNS) {
|
||||
rgb_matrix_set_color(index, RGB_GREEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
71
keyboards/decent/numpad/readme.md
Normal file
71
keyboards/decent/numpad/readme.md
Normal file
|
@ -0,0 +1,71 @@
|
|||
# DecenTKL NumPad
|
||||
|
||||
*A numeric pad to go with the DecenTKL keyboard*
|
||||
|
||||
This numeric pad also includes a 3-port USB hub, enabling the connection of the TKL
|
||||
keyboard on the back of the pad.
|
||||
|
||||
The pad also has two Atari joystick ports.
|
||||
|
||||
* Keyboard Maintainer: [Bertrand Le roy](https://github.com/bleroy/3d-junkyard/blob/main/DecenTKL/)
|
||||
* Hardware Supported: DecenTKL (RP2040-based)
|
||||
* Hardware Availability: Custom built but open-source
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make decent/numpad:default
|
||||
|
||||
Flashing example for this keyboard:
|
||||
|
||||
make decent/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
|
||||
|
||||
Press the Num key or the button on the back of the board while connecting the pad.
|
||||
|
||||
## Special commands
|
||||
|
||||
Num + Enter: go into bootloader mode without unplugging the keyboard
|
||||
|
||||
## Layout
|
||||
```C
|
||||
/*
|
||||
* /─────/─────/
|
||||
* /F11 /F12 /
|
||||
* /─────/─────/
|
||||
* ┌───┬───┬───┬───┐
|
||||
* │Num│ / │ * │ - │
|
||||
* ├───┼───┼───┼───┤
|
||||
* │ 7 │ 8 │ 9 │ + │
|
||||
* ├───┼───┼───┤ │
|
||||
* │ 4 │ 5 │ 6 │ │
|
||||
* ├───┼───┼───┼───┤
|
||||
* │ 1 │ 2 │ 3 │Ent│
|
||||
* ├───┴───┼───┤ er│
|
||||
* │ 0 │ . │ │
|
||||
* └───────┴───┴───┘
|
||||
*/
|
||||
```
|
||||
|
||||
While holding the Num key:
|
||||
|
||||
```C
|
||||
/*
|
||||
* /─────────/─────────/
|
||||
* /Shift+F11/Shift+F12/
|
||||
* /─────────/─────────/
|
||||
* ┌───────┬───────┬───────┬───────┐
|
||||
* │ │ │ │Bright-│
|
||||
* ├───────┼───────┼───────┼───────┤
|
||||
* │ │ Hue + │ │Bright+│
|
||||
* ├───────┼───────┼───────┤ │
|
||||
* │Speed -│ Swirl │Speed +│ │
|
||||
* ├───────┼───────┼───────┼───────┤
|
||||
* │Mode - │ Hue - │Mode + │ │
|
||||
* ├───────┴───────┼───────┤BootSel│
|
||||
* │ on / off │ │ │
|
||||
* └───────────────┴───────┴───────┘
|
||||
*/
|
||||
```
|
Loading…
Add table
Reference in a new issue