Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DecenTKL numpad #24696

Merged
merged 10 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 150 additions & 0 deletions keyboards/decent/numpad/keyboard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
{
"manufacturer": "Bertrand Le roy",
"keyboard_name": "DecenTKL NumPad",
"maintainer": "bleroy",
"bootloader": "rp2040",
"diode_direction": "COL2ROW",
"features": {
"encoder": false,
"bootmagic": true,
"rgb_matrix": true,
"oled": false,
"command": false,
"console": false,
"extrakey": false,
"mousekey": false,
"nkro": false
bleroy marked this conversation as resolved.
Show resolved Hide resolved
},
"matrix_pins": {
"cols": ["GP0", "GP1", "GP2", "GP3"],
"rows": ["GP4", "GP5", "GP6", "GP7", "GP8", "GP9"]
},
"processor": "RP2040",
"url": "https://github.com/bleroy/3d-junkyard/blob/main/DecenTKL/",
"tags": ["ansi", "numpad", "rgb", "atari", "joystick"],
"usb": {
"device_version": "1.0.0",
"pid": "0x0000",
"vid": "0xFEED"
},
"i2c": {
},
bleroy marked this conversation as resolved.
Show resolved Hide resolved
"ws2812": {
"pin": "GP20",
"driver": "vendor"
},
"layouts": {
"LAYOUT_default": {
bleroy marked this conversation as resolved.
Show resolved Hide resolved
"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, "label": "+"},
bleroy marked this conversation as resolved.
Show resolved Hide resolved

{"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, "label": "Enter"},
bleroy marked this conversation as resolved.
Show resolved Hide resolved

{"matrix": [5, 0], "x": 0, "y": 5, "label": "0"},
bleroy marked this conversation as resolved.
Show resolved Hide resolved
{"matrix": [5, 2], "x": 2, "y": 5, "label": "."}
]
}
},
"rgb_matrix": {
"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"
}
}
bleroy marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 12 additions & 0 deletions keyboards/decent/numpad/keymaps/default/config.h
bleroy marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once

#define BOOTMAGIC_ROW 1
#define BOOTMAGIC_COLUMN 0
#define RGB_MATRIX_SLEEP

#define RGB_MATRIX_LED_COUNT 22
#define RGB_MATRIX_CENTER {37, 42}

bleroy marked this conversation as resolved.
Show resolved Hide resolved
#define JOYSTICK_AXIS_COUNT 4
#define JOYSTICK_BUTTON_COUNT 10
#define JOYSTICK_HAS_HAT
bleroy marked this conversation as resolved.
Show resolved Hide resolved
142 changes: 142 additions & 0 deletions keyboards/decent/numpad/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H
#include "analog.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_default(
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_default(
S(KC_F11), S(KC_F12),

_______, RGB_M_B, RGB_M_R, RGB_VAD,
_______, RGB_HUI, _______, RGB_VAI,
RGB_SPD, RGB_M_SW, RGB_SPI,
RGB_RMOD, RGB_HUD, RGB_MOD, QK_BOOT,
bleroy marked this conversation as resolved.
Show resolved Hide resolved
RGB_TOG, _______
),
};

joystick_config_t joystick_axes[JOYSTICK_AXIS_COUNT] = {
bleroy marked this conversation as resolved.
Show resolved Hide resolved
[0] = JOYSTICK_AXIS_VIRTUAL,
[1] = JOYSTICK_AXIS_VIRTUAL,
[2] = JOYSTICK_AXIS_VIRTUAL,
[3] = JOYSTICK_AXIS_VIRTUAL
};

void keyboard_post_init_user(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);
}

void set_button_state(int btn, bool state) {
if (state) {
unregister_joystick_button(btn);
}
else {
register_joystick_button(btn);
}
}

void matrix_scan_user(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);
}
int 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_user(uint8_t led_min, uint8_t led_max) {
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;
}
73 changes: 73 additions & 0 deletions keyboards/decent/numpad/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# DecenTKL NumPad

![decentkl](https://github.com/bleroy/3d-junkyard/blob/main/DecenTKL/Media/DecenTKL-logo.png)
bleroy marked this conversation as resolved.
Show resolved Hide resolved

*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/
* /─────────/─────────/
* ┌───────┬───────┬───────┬───────┐
* │ │Breathe│Rainbow│Bright-│
* ├───────┼───────┼───────┼───────┤
* │ │ Hue + │ │Bright+│
* ├───────┼───────┼───────┤ │
* │Speed -│ Swirl │Speed +│ │
* ├───────┼───────┼───────┼───────┤
* │Mode - │ Hue - │Mode + │ │
* ├───────┴───────┼───────┤BootSel│
* │ on / off │ │ │
* └───────────────┴───────┴───────┘
*/
```
2 changes: 2 additions & 0 deletions keyboards/decent/numpad/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
JOYSTICK_ENABLE = yes
bleroy marked this conversation as resolved.
Show resolved Hide resolved
ANALOG_DRIVER_REQUIRED = yes
Loading
Loading