Compare commits

...

18 Commits

Author SHA1 Message Date
Isaac Rex
42caa28367
Merge 7c2c6971b7 into c843ad1268 2024-11-19 14:15:54 -08:00
Isaac Rex
7c2c6971b7 renamed info.json, removed rules.mk 2024-07-29 18:39:12 -05:00
Isaac Rex
237176c3c6 Merge branch 'master' into nifty-numpad-dev 2024-07-29 18:32:44 -05:00
Isaac Rex
6134084d8c Merge remote-tracking branch 'upstream/master' 2024-07-29 18:30:43 -05:00
Isaac Rex
e875b87726 Added config.h to idle_rgb_example 2024-03-16 08:27:34 -05:00
Isaac Rex
dabe97f984 Added Nifty Numpad 2024-02-04 19:10:16 -06:00
Isaac Rex
954a8bc3e2 Merge remote-tracking branch 'parent/master' 2024-02-04 06:28:08 -06:00
Isaac Rex
f0e35c8ca4 Merge remote-tracking branch 'upstream/master' 2024-01-22 17:11:00 -06:00
Isaac Rex
1c1624ce1a Merge remote-tracking branch 'parent/master' 2023-12-12 19:33:25 -06:00
Isaac Rex
b3815ed70f Merge remote-tracking branch 'upstream/master' 2023-10-04 18:51:16 -05:00
Isaac Rex
5165ed2953 Merge remote-tracking branch 'upstream/master' 2023-09-02 16:45:38 -05:00
Isaac Rex
bcfceaa41d Updated Nifty Numpad readme
Updated Cadence keymap

Updated vscode settings to match QMK master
2023-09-02 16:38:22 -05:00
Isaac Rex
9ea6afa4ee Fixed qmk_firmware submodule issue 2023-08-13 11:32:41 -05:00
Isaac Rex
1865f13a6d Added a default and VIA keymap, moved cadence to its own keymap 2023-08-13 11:32:41 -05:00
Isaac Rex
6348682d3f Updated available effects 2023-08-13 11:32:41 -05:00
Isaac Rex
cfd52ca463 Fixed double repo 2023-08-13 11:32:41 -05:00
Isaac Rex
4fa53a71fd Initial commit of Nifty Numpad keyboard 2023-08-13 11:32:41 -05:00
Isaac Rex
8c45f66b2b Initial commit of Nifty Numpad keyboard 2023-08-13 11:32:40 -05:00
12 changed files with 823 additions and 0 deletions

View File

@ -0,0 +1,6 @@
// Copyright 2023 Isaac Rex (@Acliad)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define EECONFIG_KB_DATA_SIZE 10

View File

@ -0,0 +1,150 @@
{
"manufacturer": "Isaac Rex",
"keyboard_name": "Nifty Numpad",
"maintainer": "Acliad",
"bootloader": "rp2040",
"diode_direction": "ROW2COL",
"features": {
"bootmagic": true,
"command": false,
"console": false,
"extrakey": true,
"mousekey": true,
"nkro": true,
"rgb_matrix": true
},
"matrix_pins": {
"cols": ["GP17", "GP18", "GP15", "GP13", "GP14", "GP12"],
"rows": ["GP20", "GP21", "GP22", "GP23", "GP24", "GP25"]
},
"processor": "RP2040",
"rgb_matrix": {
"driver": "ws2812",
"default": {
"animation": "solid_color",
"hue": 127,
"speed": 100
},
"animations": {
"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,
"gradient_up_down": true,
"jellybean_raindrops": true,
"multisplash": true,
"rainbow_beacon": true,
"rainbow_moving_chevron": true,
"rainbow_pinwheels": true,
"raindrops": 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,
"typing_heatmap": false
},
"layout": [
{"matrix": [0, 0], "x": 0, "y": 0, "flags": 4},
{"matrix": [0, 1], "x": 43, "y": 0, "flags": 4},
{"matrix": [0, 2], "x": 96, "y": 0, "flags": 4},
{"matrix": [0, 3], "x": 139, "y": 0, "flags": 4},
{"matrix": [0, 4], "x": 181, "y": 0, "flags": 4},
{"matrix": [0, 5], "x": 224, "y": 0, "flags": 4},
{"matrix": [1, 0], "x": 0, "y": 17, "flags": 4},
{"matrix": [1, 1], "x": 43, "y": 17, "flags": 4},
{"matrix": [1, 2], "x": 96, "y": 17, "flags": 4},
{"matrix": [1, 3], "x": 139, "y": 17, "flags": 4},
{"matrix": [1, 4], "x": 181, "y": 17, "flags": 4},
{"matrix": [1, 5], "x": 224, "y": 17, "flags": 4},
{"matrix": [2, 0], "x": 0, "y": 29, "flags": 4},
{"matrix": [2, 1], "x": 43, "y": 29, "flags": 4},
{"matrix": [2, 2], "x": 96, "y": 29, "flags": 4},
{"matrix": [2, 3], "x": 139, "y": 29, "flags": 4},
{"matrix": [2, 4], "x": 181, "y": 29, "flags": 4},
{"matrix": [2, 5], "x": 224, "y": 35, "flags": 4},
{"matrix": [3, 0], "x": 0, "y": 41, "flags": 4},
{"matrix": [3, 1], "x": 43, "y": 41, "flags": 4},
{"matrix": [3, 2], "x": 96, "y": 41, "flags": 4},
{"matrix": [3, 3], "x": 139, "y": 41, "flags": 4},
{"matrix": [3, 4], "x": 181, "y": 41, "flags": 4},
{"matrix": [4, 0], "x": 0, "y": 52, "flags": 4},
{"matrix": [4, 1], "x": 43, "y": 52, "flags": 4},
{"matrix": [4, 2], "x": 96, "y": 52, "flags": 4},
{"matrix": [4, 3], "x": 139, "y": 52, "flags": 4},
{"matrix": [4, 4], "x": 181, "y": 52, "flags": 4},
{"matrix": [4, 5], "x": 224, "y": 58, "flags": 4},
{"matrix": [5, 0], "x": 0, "y": 64, "flags": 4},
{"matrix": [5, 1], "x": 43, "y": 64, "flags": 4},
{"matrix": [5, 2], "x": 117, "y": 64, "flags": 4},
{"matrix": [5, 3], "x": 181, "y": 64, "flags": 4}
]
},
"url": "https://gitlab.com/Acliad/nifty-numpad",
"usb": {
"device_version": "1.0.0",
"pid": "0x0000",
"vid": "0x4E4E"
},
"ws2812": {
"driver": "vendor",
"pin": "GP19"
},
"layouts": {
"LAYOUT_numpad_6x6": {
"layout": [
{"label": "F13", "matrix": [0, 0], "x": 0, "y": 0},
{"label": "F19", "matrix": [0, 1], "x": 1, "y": 0},
{"label": "BACKSPACE", "matrix": [0, 2], "x": 2.25, "y": 0},
{"label": "TASK VIEW", "matrix": [0, 3], "x": 3.25, "y": 0},
{"label": "EXPLORER", "matrix": [0, 4], "x": 4.25, "y": 0},
{"label": "SCREENSHOT", "matrix": [0, 5], "x": 5.25, "y": 0},
{"label": "F14", "matrix": [1, 0], "x": 0, "y": 1.5},
{"label": "F20", "matrix": [1, 1], "x": 1, "y": 1.5},
{"label": "NUM LOCK", "matrix": [1, 2], "x": 2.25, "y": 1.5},
{"label": "/", "matrix": [1, 3], "x": 3.25, "y": 1.5},
{"label": "*", "matrix": [1, 4], "x": 4.25, "y": 1.5},
{"label": "-", "matrix": [1, 5], "x": 5.25, "y": 1.5},
{"label": "F15", "matrix": [2, 0], "x": 0, "y": 2.5},
{"label": "F21", "matrix": [2, 1], "x": 1, "y": 2.5},
{"label": "7", "matrix": [2, 2], "x": 2.25, "y": 2.5},
{"label": "8", "matrix": [2, 3], "x": 3.25, "y": 2.5},
{"label": "9", "matrix": [2, 4], "x": 4.25, "y": 2.5},
{"label": "+", "matrix": [2, 5], "x": 5.25, "y": 2.5, "h": 2},
{"label": "F16", "matrix": [3, 0], "x": 0, "y": 3.5},
{"label": "F22", "matrix": [3, 1], "x": 1, "y": 3.5},
{"label": "4", "matrix": [3, 2], "x": 2.25, "y": 3.5},
{"label": "5", "matrix": [3, 3], "x": 3.25, "y": 3.5},
{"label": "6", "matrix": [3, 4], "x": 4.25, "y": 3.5},
{"label": "F17", "matrix": [4, 0], "x": 0, "y": 4.5},
{"label": "F23", "matrix": [4, 1], "x": 1, "y": 4.5},
{"label": "1", "matrix": [4, 2], "x": 2.25, "y": 4.5},
{"label": "2", "matrix": [4, 3], "x": 3.25, "y": 4.5},
{"label": "3", "matrix": [4, 4], "x": 4.25, "y": 4.5},
{"label": "ENTER", "matrix": [4, 5], "x": 5.25, "y": 4.5, "h": 2},
{"label": "F18", "matrix": [5, 0], "x": 0, "y": 5.5},
{"label": "F24", "matrix": [5, 1], "x": 1, "y": 5.5},
{"label": "0", "matrix": [5, 2], "x": 2.25, "y": 5.5, "w": 2},
{"label": ".", "matrix": [5, 4], "x": 4.25, "y": 5.5}
]
}
}
}

View File

@ -0,0 +1,83 @@
// Copyright 2023 Isaac Rex (@Acliad)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
// Layers
// NOTE: LAYER_RGB is defined in nifty_numpad.h
enum LAYERS {
LAYER_BL,
};
// Setup keymap
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* SCN -> Screenshot
* WIN -> Task View
* EXP -> Open Explorer
* BCK -> Backspace
*
* F13F19 BCKWINEXPSCN
*
*
* F14F20 Num / * -
*
* F15F21 7 8 9
* +
* F16F22 4 5 6
*
* F17F23 1 2 3
* Ent
* F18F24 0 .
*
*/
[LAYER_BL] = LAYOUT_numpad_6x6(
KC_F13, KC_F19, LT(LAYER_RGB, KC_BSPC), RGUI(KC_TAB), RGUI(KC_E), RGUI(RSFT(KC_S)),
KC_F14, KC_F20, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
KC_F15, KC_F21, KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_F16, KC_F22, KC_P4, KC_P5, KC_P6,
KC_F17, KC_F23, KC_P1, KC_P2, KC_P3, KC_PENT,
KC_F18, KC_F24, KC_P0, KC_PDOT
),
/*
* HUI -> Hue Increase
* HUD -> Hue Decrease
*
* SAI -> Saturation Increase
* SAD -> Saturation Decrease
*
* VAI -> Value Increase
* VAD -> Value Decrease
*
* SPI -> Speed Increase
* SPD -> Speed Decrease
*
* DEF -> Set default effect mode
* IEF -> Set idle effect mode
*
* ___ -> Base Layer Function
*
* ______ ___HUISAIVAI
*
*
* ______ NumHUDSADVAD
*
* ______ ___DEFIEF
* SPI
* ______ _________
*
* ______ _________
* SPD
* ______ ___ ___
*
*/
[LAYER_RGB] = LAYOUT_numpad_6x6(
_______, _______, _______, RGB_HUI, RGB_SAI, RGB_VAI,
_______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD,
_______, _______, _______, RGB_MOD, _______, RGB_SPI,
_______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, RGB_SPD,
_______, _______, _______, _______
)
};

View File

@ -0,0 +1,6 @@
// Copyright 2023 Isaac Rex (@Acliad)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define TAPPING_TERM 200

View File

@ -0,0 +1,175 @@
// Copyright 2023 Isaac Rex (@Acliad)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
// Layers
// NOTE: LAYER_RGB is defined in nifty_numpad.h
enum LAYERS {
LAYER_BL = 0,
LAYER_MOD,
};
// Layer Indicator LED index
#define _NUM_LED_INDEX 8
// Tap Dance Declarations
enum {
TD_NUM_TOGGLE = 0,
TD_EDIT_GEN_TOGGLE,
TD_M1,
TD_M2,
TD_M3,
TD_M4,
TD_M5,
TD_M6,
TD_M7,
TD_M8,
TD_M9,
TD_M10,
TD_M11,
TD_M12,
};
// TD function for 1 tap, toggle layer; 2 taps, press numlock
void tap_dance_num_toggle(tap_dance_state_t *state, void *user_data){
switch(state->count){
case 1:
layer_invert(LAYER_MOD);
break;
case 2:
tap_code16(KC_NUM);
break;
}
}
// Tap Dance Definitions
tap_dance_action_t tap_dance_actions[] = {
[TD_NUM_TOGGLE] = ACTION_TAP_DANCE_FN(tap_dance_num_toggle),
[TD_M1] = ACTION_TAP_DANCE_DOUBLE(KC_F13, LCTL(KC_F13)),
[TD_M2] = ACTION_TAP_DANCE_DOUBLE(KC_F14, LCTL(KC_F14)),
[TD_M3] = ACTION_TAP_DANCE_DOUBLE(KC_F15, LCTL(KC_F15)),
[TD_M4] = ACTION_TAP_DANCE_DOUBLE(KC_F16, LCTL(KC_F16)),
[TD_M5] = ACTION_TAP_DANCE_DOUBLE(KC_F17, LCTL(KC_F17)),
[TD_M6] = ACTION_TAP_DANCE_DOUBLE(KC_F18, LCTL(KC_F18)),
[TD_M7] = ACTION_TAP_DANCE_DOUBLE(KC_F19, LCTL(KC_F19)),
[TD_M8] = ACTION_TAP_DANCE_DOUBLE(KC_F20, LCTL(KC_F20)),
[TD_M9] = ACTION_TAP_DANCE_DOUBLE(KC_F21, LCTL(KC_F21)),
[TD_M10] = ACTION_TAP_DANCE_DOUBLE(KC_F22, LCTL(KC_F22)),
[TD_M11] = ACTION_TAP_DANCE_DOUBLE(KC_F23, LCTL(KC_F23)),
[TD_M12] = ACTION_TAP_DANCE_DOUBLE(KC_F24, LCTL(KC_F24))
};
// Setup keymap
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* BCK -> Backspace
* WIN -> Task View
* EXP -> Open Explorer
* SCN -> Screenshot
*
* F13F19 BCKWINEXPSCN
*
*
* F14F20 Num / * -
*
* F15F21 7 8 9
* +
* F16F22 4 5 6
*
* F17F23 1 2 3
* Ent
* F18F24 0 .
*
*/
[LAYER_BL] = LAYOUT_numpad_6x6(
TD(TD_M1), TD(TD_M7) , LT(LAYER_RGB, KC_BSPC), RGUI(KC_TAB), RGUI(KC_E), RGUI(RSFT(KC_S)),
TD(TD_M2), TD(TD_M8) , TD(TD_NUM_TOGGLE), KC_PSLS, KC_PAST, KC_PMNS,
TD(TD_M3), TD(TD_M9) , KC_P7, KC_P8, KC_P9, KC_PPLS,
TD(TD_M4), TD(TD_M10), KC_P4, KC_P5, KC_P6,
TD(TD_M5), TD(TD_M11), KC_P1, KC_P2, KC_P3, KC_PENT,
TD(TD_M6), TD(TD_M12), KC_P0, KC_PDOT
),
/*
*
* F13F19 F9 F10F11F12
*
*
* ______ ___~/ ~* ___
*
* ______ ~7 ~8 ~9
* ___
* ______ ~4 ~5 ~6
*
* ______ ~1 ~2 ~3
* ___
* ______ ~0 ~.
*
*/
[LAYER_MOD] = LAYOUT_numpad_6x6(
_______, _______, KC_F9, KC_F10, KC_F11, KC_F12,
_______, _______, TD(TD_NUM_TOGGLE), RCTL(KC_PSLS), RCTL(KC_PAST), _______,
_______, _______, RCTL(KC_P7), RCTL(KC_P8), RCTL(KC_P9), _______,
_______, _______, RCTL(KC_P4), RCTL(KC_P5), RCTL(KC_P6),
_______, _______, RCTL(KC_P1), RCTL(KC_P2), RCTL(KC_P3), _______,
_______, _______, RCTL(KC_P0), RCTL(KC_PDOT)
),
/*
* HUI -> Hue Increase
* HUD -> Hue Decrease
*
* SAI -> Saturation Increase
* SAD -> Saturation Decrease
*
* VAI -> Value Increase
* VAD -> Value Decrease
*
* SPI -> Speed Increase
* SPD -> Speed Decrease
*
* DEF -> Set default effect mode
* IEF -> Set idle effect mode
*
* ___ -> Base Layer Function
*
* ______ ___HUISAIVAI
*
*
* ______ NumHUDSADVAD
*
* ______ ___DEFIEF
* SPI
* ______ _________
*
* ______ _________
* SPD
* ______ ___ ___
*
*/
[LAYER_RGB] = LAYOUT_numpad_6x6(
_______, _______, _______, RGB_HUI, RGB_SAI, RGB_VAI,
_______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD,
_______, _______, _______, RGB_DEF, RGB_IEF, RGB_SPI,
_______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, RGB_SPD,
_______, _______, _______, _______
)
};
// Set the layer toggle key to an indication of the active layer. This is a
// bit janky and should be done better, but I'm trying to avoid scope creep.
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (layer_state_is(LAYER_MOD) && !rgb_matrix_idle_mode()) {
// Get a hue that contrasts with current hue
uint8_t hue = rgb_matrix_get_hue() + 127;
// Make sure saturation is high enough to distiguish between hues
uint8_t sat = 255;
uint8_t val = MIN((uint16_t) rgb_matrix_get_val() + 50, 255);
RGB rgb = hsv_to_rgb((HSV) {hue, sat, val});
rgb_matrix_set_color(_NUM_LED_INDEX, rgb.r, rgb.g, rgb.b);
}
return false;
}

View File

@ -0,0 +1,2 @@
TAP_DANCE_ENABLE=yes
RGB_IDLE_ENABLE=yes

View File

@ -0,0 +1,81 @@
// Copyright 2023 Isaac Rex (@Acliad)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
// NOTE: LAYER_RGB is defined in nifty_numpad.h
enum LAYERS {
LAYER_BL = 0,
};
// Setup keymap
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* BCK -> Backspace
* WIN -> Task View
* EXP -> Open Explorer
* SCN -> Screenshot
*
* F13F19 BCKWINEXPSCN
*
*
* F14F20 Num / * -
*
* F15F21 7 8 9
* +
* F16F22 4 5 6
*
* F17F23 1 2 3
* Ent
* F18F24 0 .
*
*/
[LAYER_BL] = LAYOUT_numpad_6x6(
KC_F13, KC_F19, LT(LAYER_RGB, KC_BSPC), RGUI(KC_TAB), RGUI(KC_E), RGUI(RSFT(KC_S)),
KC_F14, KC_F20, MT(MOD_RCTL, KC_NUM), KC_PSLS, KC_PAST, KC_PMNS,
KC_F15, KC_F21, KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_F16, KC_F22, KC_P4, KC_P5, KC_P6,
KC_F17, KC_F23, KC_P1, KC_P2, KC_P3, KC_PENT,
KC_F18, KC_F24, KC_P0, KC_PDOT
),
/*
* HUI -> Hue Increase
* HUD -> Hue Decrease
*
* SAI -> Saturation Increase
* SAD -> Saturation Decrease
*
* VAI -> Value Increase
* VAD -> Value Decrease
*
* SPI -> Speed Increase
* SPD -> Speed Decrease
*
* MOD -> RGB Mode (effect cycle)
*
* ___ -> Base Layer Function
*
* ______ ___HUISAIVAI
*
*
* ______ NumHUDSADVAD
*
* ______ ___MOD___
* SPI
* ______ _________
*
* ______ _________
* SPD
* ______ ___ ___
*
*/
[LAYER_RGB] = LAYOUT_numpad_6x6(
_______, _______, _______, RGB_HUI, RGB_SAI, RGB_VAI,
_______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD,
_______, _______, _______, RGB_MOD, _______, RGB_SPI,
_______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, RGB_SPD,
_______, _______, _______, _______
)
};

View File

@ -0,0 +1 @@
VIA_ENABLE = yes

View File

@ -0,0 +1,229 @@
/* Copyright 2023 Acliad
*
* 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
#ifdef RGB_IDLE_ENABLE
typedef struct {
uint8_t mode;
uint8_t speed;
HSV hsv;
} rgb_matrix_state_t;
_Static_assert(sizeof(rgb_matrix_state_t) == 5, "Invalid size for rgb_matrix_state_t");
typedef struct {
rgb_matrix_state_t active_rgb_matrix;
rgb_matrix_state_t idle_rgb_matrix;
} kb_config_t;
_Static_assert(sizeof(kb_config_t) == EECONFIG_KB_DATA_SIZE, "Invalid size for kb_config_t");
bool rgb_idle_mode = false;
bool rgb_idle_edit_mode = false;
static rgb_matrix_state_t active_rgb_matrix;
static rgb_matrix_state_t idle_rgb_matrix;
static kb_config_t config;
// Returns true if current RGB matrix mode is idle
bool rgb_matrix_idle_mode(void) {
return rgb_idle_mode;
}
// Stores the current mode, HSV, and speed of the RGB matrix into state
void rgb_matrix_state_save(rgb_matrix_state_t* state) {
state->mode = rgb_matrix_get_mode();
state->hsv = rgb_matrix_get_hsv();
state->speed = rgb_matrix_get_speed();
}
// Restores the mode, HSV, and speed of the RGB matrix from previous state
void rgb_matrix_state_restore(rgb_matrix_state_t* state) {
HSV hsv = state->hsv;
rgb_matrix_mode_noeeprom(state->mode);
rgb_matrix_sethsv_noeeprom(hsv.h, hsv.s, hsv.v);
rgb_matrix_set_speed_noeeprom(state->speed);
}
#endif
void housekeeping_task_kb(void) {
#ifdef RGB_IDLE_ENABLE
// Check if enough time has passed since last keypress to go into idle mode
if (last_input_activity_elapsed() > RGB_IDLE_TIMEOUT_MS && !rgb_idle_mode) {
rgb_matrix_state_save(&active_rgb_matrix);
rgb_idle_mode = true;
rgb_matrix_state_restore(&idle_rgb_matrix);
}
#endif
};
layer_state_t layer_state_set_kb(layer_state_t state) {
#ifdef RGB_IDLE_ENABLE
// Track if the last layer was the RGB edit layer
static bool rgb_was_on = false;
if (IS_LAYER_ON_STATE(state, LAYER_RGB)) {
rgb_was_on = true;
}
// Not in RGB edit layer, but previously were
if (!IS_LAYER_ON_STATE(state, LAYER_RGB) && rgb_was_on) {
rgb_was_on = false;
if (rgb_idle_edit_mode) {
// If we were editing the RGB idle mode, we are done now.
// Restore to active mode
rgb_idle_edit_mode = false;
rgb_matrix_state_restore(&active_rgb_matrix);
}
// Done changing stuff, save settings in "EEPROM"
config.active_rgb_matrix = active_rgb_matrix;
config.idle_rgb_matrix = idle_rgb_matrix;
eeconfig_update_kb_datablock(&config);
}
#endif
return layer_state_set_user(state);
}
// Process custom keycodes
bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
#ifdef RGB_IDLE_ENABLE
// If we were idling and a key was pressed, restore active RGB
if (record->event.pressed) {
if (rgb_idle_mode) {
rgb_matrix_state_restore(&active_rgb_matrix);
rgb_idle_mode = false;
}
}
#endif
switch (keycode) {
#ifdef RGB_IDLE_ENABLE
// Handle all the RGB settings
case RGB_DEF:
if (record->event.pressed) {
// Change the RGB matrix state to active if editing idle
if (rgb_idle_edit_mode) {
rgb_matrix_state_restore(&active_rgb_matrix);
rgb_idle_edit_mode = false;
}
rgb_matrix_step_noeeprom();
rgb_matrix_state_save(&active_rgb_matrix);
}
return false;
case RGB_IEF:
if (record->event.pressed) {
// Change the RGB matrix state to idle
if (!rgb_idle_edit_mode) {
rgb_matrix_state_restore(&idle_rgb_matrix);
rgb_idle_edit_mode = true;
} else {
rgb_matrix_step_noeeprom();
rgb_matrix_state_save(&idle_rgb_matrix);
}
}
return false;
case RGB_SAI:
if (record->event.pressed) {
rgb_matrix_increase_sat_noeeprom();
rgb_idle_edit_mode ? rgb_matrix_state_save(&idle_rgb_matrix) : rgb_matrix_state_save(&active_rgb_matrix);
}
return false;
case RGB_SAD:
if (record->event.pressed) {
rgb_matrix_decrease_sat_noeeprom();
rgb_idle_edit_mode ? rgb_matrix_state_save(&idle_rgb_matrix) : rgb_matrix_state_save(&active_rgb_matrix);
}
return false;
case RGB_VAI:
if (record->event.pressed) {
rgb_matrix_increase_val_noeeprom();
rgb_idle_edit_mode ? rgb_matrix_state_save(&idle_rgb_matrix) : rgb_matrix_state_save(&active_rgb_matrix);
}
return false;
case RGB_VAD:
if (record->event.pressed) {
rgb_matrix_decrease_val_noeeprom();
rgb_idle_edit_mode ? rgb_matrix_state_save(&idle_rgb_matrix) : rgb_matrix_state_save(&active_rgb_matrix);
}
return false;
case RGB_HUI:
if (record->event.pressed) {
rgb_matrix_increase_hue_noeeprom();
rgb_idle_edit_mode ? rgb_matrix_state_save(&idle_rgb_matrix) : rgb_matrix_state_save(&active_rgb_matrix);
}
return false;
case RGB_HUD:
if (record->event.pressed) {
rgb_matrix_decrease_hue_noeeprom();
rgb_idle_edit_mode ? rgb_matrix_state_save(&idle_rgb_matrix) : rgb_matrix_state_save(&active_rgb_matrix);
}
return false;
case RGB_SPI:
if (record->event.pressed) {
rgb_matrix_increase_speed_noeeprom();
rgb_idle_edit_mode ? rgb_matrix_state_save(&idle_rgb_matrix) : rgb_matrix_state_save(&active_rgb_matrix);
}
return false;
case RGB_SPD:
if (record->event.pressed) {
rgb_matrix_decrease_speed_noeeprom();
rgb_idle_edit_mode ? rgb_matrix_state_save(&idle_rgb_matrix) : rgb_matrix_state_save(&active_rgb_matrix);
}
return false;
#endif
}
return process_record_user(keycode, record);
};
void keyboard_post_init_kb(void) {
#ifdef RGB_IDLE_ENABLE
// Read in the RGB Matrices from before
eeconfig_read_kb_datablock(&config);
active_rgb_matrix = config.active_rgb_matrix;
idle_rgb_matrix = config.idle_rgb_matrix;
// Restore the active matrix
rgb_matrix_state_restore(&active_rgb_matrix);
#endif
keyboard_post_init_user();
}
// Setup default EEPROM config values
void eeconfig_init_kb_datablock(void) {
#ifdef RGB_IDLE_ENABLE
rgb_matrix_state_t default_active_rgb_matrix;
rgb_matrix_state_t default_idle_rgb_matrix;
default_active_rgb_matrix.mode = RGB_MATRIX_GRADIENT_UP_DOWN;
default_active_rgb_matrix.hsv = (HSV){127, 255, 100};
default_active_rgb_matrix.speed = 127;
default_idle_rgb_matrix.mode = RGB_MATRIX_BREATHING;
default_idle_rgb_matrix.hsv = (HSV){127, 255, 100};
default_idle_rgb_matrix.speed = 127;
config.active_rgb_matrix = default_active_rgb_matrix;
config.idle_rgb_matrix = default_idle_rgb_matrix;
eeconfig_update_kb_datablock(&config);
# if (EECONFIG_USER_DATA_SIZE) > 0
eeconfig_init_user_datablock();
# endif // EECONFIG_USER_DATA_SIZE
#endif // RGB_IDLE_ENABLE
}

View File

@ -0,0 +1,52 @@
/* Copyright 2023 Acliad
*
* 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"
/*
*
* F13F19 F1 F2 F3 F4
*
*
* F14F20 Num / * -
*
* F15F21 7 8 9
* +
* F16F22 4 5 6
*
* F17F23 1 2 3
* Ent
* F18F24 0 .
*
*/
enum custom_keycodes {
RGB_DEF = QK_KB,
RGB_IEF
};
#define LAYER_RGB (MAX_LAYER - 1)
#ifdef RGB_IDLE_ENABLE
// Custom keycode declarations
#define RGB_IDLE_TIMEOUT_MS (10*60*1000)
// Functions exposed by nifty_numpad.c
bool rgb_matrix_idle_mode(void);
#endif

View File

@ -0,0 +1,3 @@
ifeq ($(strip $(RGB_IDLE_ENABLE)), yes)
OPT_DEFS += -DRGB_IDLE_ENABLE
endif

View File

@ -0,0 +1,35 @@
# Nifty Numpad
![Nifty Numpad](https://i.imgur.com/jfB8tfKh.png)
Nifty Numpad is a full sized numpad with an extra row and two extra columns of macro keys. It was created because I wanted a companion to my TKL keyboard for work. My main workflow involves heavy use of ECAD programs, so the design was tailored for that, but it is generic enough to be nice for many workflows!
The main features are:
- Full sized numpad with row of macro/function keys on the top
- Two extra columns of macro keys
- Cherry MX style socketed switches
- Key Backlights
- 3D printable case (FDM or resin)
### Development Information:
* Keyboard Maintainer: [Isaac Rex](https://github.com/Acliad/)
* Hardware Supported: RP2040
* Hardware Availability: See [The GitLab Page](https://gitlab.com/Acliad/nifty-numpad) for full details
Make example for this keyboard (after setting up your build environment):
make nifty_numpad:default
Flashing example for this keyboard:
make nifty_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 2 ways:
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (top left) and plug in the keyboard
* **Physical reset button**: Press the `RST` button while holding the `BOOT_SEL` button on the back of the PCB