mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-25 04:43:02 +00:00
Added a default and VIA keymap, moved cadence to its own keymap
This commit is contained in:
parent
6348682d3f
commit
1865f13a6d
@ -1,6 +1,6 @@
|
||||
{
|
||||
"manufacturer": "Isaac Rex",
|
||||
"keyboard_name": "nifty_numpad",
|
||||
"keyboard_name": "Nifty Numpad",
|
||||
"maintainer": "Isaac Rex",
|
||||
"bootloader": "rp2040",
|
||||
"diode_direction": "ROW2COL",
|
||||
@ -21,7 +21,7 @@
|
||||
"usb": {
|
||||
"device_version": "1.0.0",
|
||||
"pid": "0x0000",
|
||||
"vid": "0xFEED"
|
||||
"vid": "0x4E4E"
|
||||
},
|
||||
"layouts": {
|
||||
"LAYOUT_numpad_6x6": {
|
||||
@ -32,32 +32,37 @@
|
||||
{"matrix": [0, 3], "x": 3, "y": 0},
|
||||
{"matrix": [0, 4], "x": 4, "y": 0},
|
||||
{"matrix": [0, 5], "x": 5, "y": 0},
|
||||
|
||||
{"matrix": [1, 0], "x": 0, "y": 1},
|
||||
{"matrix": [1, 1], "x": 1, "y": 1},
|
||||
{"matrix": [1, 2], "x": 2, "y": 1},
|
||||
{"matrix": [1, 3], "x": 3, "y": 1},
|
||||
{"matrix": [1, 4], "x": 4, "y": 1},
|
||||
{"matrix": [1, 5], "x": 5, "y": 1},
|
||||
|
||||
{"matrix": [2, 0], "x": 0, "y": 2},
|
||||
{"matrix": [2, 1], "x": 1, "y": 2},
|
||||
{"matrix": [2, 2], "x": 2, "y": 2},
|
||||
{"matrix": [2, 3], "x": 3, "y": 2},
|
||||
{"matrix": [2, 4], "x": 4, "y": 2},
|
||||
{"matrix": [2, 5], "x": 5, "y": 2, "h": 2},
|
||||
|
||||
{"matrix": [3, 0], "x": 0, "y": 3},
|
||||
{"matrix": [3, 1], "x": 1, "y": 3},
|
||||
{"matrix": [3, 2], "x": 2, "y": 3},
|
||||
{"matrix": [3, 3], "x": 3, "y": 3},
|
||||
{"matrix": [3, 4], "x": 4, "y": 3},
|
||||
|
||||
{"matrix": [4, 0], "x": 0, "y": 4},
|
||||
{"matrix": [4, 1], "x": 1, "y": 4},
|
||||
{"matrix": [4, 2], "x": 2, "y": 4},
|
||||
{"matrix": [4, 3], "x": 3, "y": 4},
|
||||
{"matrix": [4, 4], "x": 4, "y": 4},
|
||||
{"matrix": [4, 5], "x": 5, "y": 4, "h": 2},
|
||||
|
||||
{"matrix": [5, 0], "x": 0, "y": 5},
|
||||
{"matrix": [5, 1], "x": 1, "y": 5},
|
||||
{"matrix": [5, 3], "x": 3, "y": 5, "w": 2},
|
||||
{"matrix": [5, 3], "x": 2, "y": 5, "w": 2},
|
||||
{"matrix": [5, 4], "x": 4, "y": 5}
|
||||
]
|
||||
}
|
||||
|
297
keyboards/nifty_numpad/keymaps/cadence/keymap.c
Normal file
297
keyboards/nifty_numpad/keymaps/cadence/keymap.c
Normal file
@ -0,0 +1,297 @@
|
||||
// Copyright 2021 QMK / NachoxMacho
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "nifty_numpad.h"
|
||||
#include "quantum.h"
|
||||
|
||||
// Custom String Definitions
|
||||
#define STR_EDIT_GEN "emg"
|
||||
#define STR_EDIT_PLACE "emp"
|
||||
#define STR_EDIT_ETCH "eme"
|
||||
#define STR_EDIT_SHAPE "ems"
|
||||
#define STR_ROUTE "xx"
|
||||
#define STR_SLIDE "dd"
|
||||
#define STR_VIA "vv"
|
||||
#define STR_MEASURE "me"
|
||||
#define STR_SHOW "sh"
|
||||
#define STR_UPDATE_SHAPES "sup"
|
||||
#define STR_ROTATE "rr"
|
||||
#define STR_MIRROR "ff"
|
||||
#define STR_PAM "pam"
|
||||
#define STR_MOVE "mm"
|
||||
|
||||
// Layer Defines
|
||||
#define _LAYER_BL 0
|
||||
#define _LAYER_CAD 1
|
||||
#define _LAYER_RGB 15
|
||||
|
||||
#define _LAYER_CAD_LED_INDEX 8
|
||||
|
||||
#define TAPPING_TERM 200
|
||||
|
||||
// Custom keycode declarations
|
||||
enum cadence_keycodes {
|
||||
EDIT_GEN = RGB_IEF + 1,
|
||||
EDIT_PLACE,
|
||||
EDIT_ETCH,
|
||||
EDIT_SHAPE,
|
||||
ROUTE,
|
||||
SLIDE,
|
||||
VIA,
|
||||
MEASURE,
|
||||
SHOW,
|
||||
UPDATE_SHAPES,
|
||||
ROTATE,
|
||||
MIRROR,
|
||||
PAM,
|
||||
MOVE
|
||||
};
|
||||
|
||||
// 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_CAD);
|
||||
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 LED map
|
||||
led_config_t g_led_config = { {
|
||||
// Key Matrix to LED Index
|
||||
{ 0, 1, 2, 3, 4, 5 },
|
||||
{ 6, 7, 8, 9, 10, 11 },
|
||||
{ 12, 13, 14, 15, 16, 17 },
|
||||
{ 18, 19, 20, 21, 22, NO_LED },
|
||||
{ 23, 24, 25, 26, 27, 28 },
|
||||
{ 29, 30, 31, NO_LED, 32, NO_LED }
|
||||
}, {
|
||||
// LED Index to Physical Position
|
||||
{ 0, 0}, { 43, 0}, { 96, 0}, {139, 0}, {181, 0}, {224, 0},
|
||||
{ 0, 17}, { 43, 17}, { 96, 17}, {139, 17}, {181, 17}, {224, 17},
|
||||
{ 0, 29}, { 43, 29}, { 96, 29}, {139, 29}, {181, 29}, {224, 35},
|
||||
{ 0, 41}, { 43, 41}, { 96, 41}, {139, 41}, {181, 41}, { 0, 52},
|
||||
{ 43, 52}, { 96, 52}, {139, 52}, {181, 52}, {224, 58}, { 0, 64},
|
||||
{ 43, 64}, {117, 64}, {181, 64}
|
||||
}, {
|
||||
// LED Index to Flag
|
||||
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
|
||||
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
|
||||
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
|
||||
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
|
||||
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
|
||||
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT
|
||||
} };
|
||||
|
||||
// Setup keymap
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/*
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F13│F19│ │F1 │F2 │F3 │F4 │
|
||||
* └───┴───┘ └───┴───┴───┴───┘
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F14│F20│ │Num│ / │ * │ - │
|
||||
* ├───┼───┤ ├───┼───┼───┼───┤
|
||||
* │F15│F21│ │ 7 │ 8 │ 9 │ │
|
||||
* ├───┼───┤ ├───┼───┼───┤ + │
|
||||
* │F16│F22│ │ 4 │ 5 │ 6 │ │
|
||||
* ├───┼───┤ ├───┼───┼───┼───┤
|
||||
* │F17│F23│ │ 1 │ 2 │ 3 │ │
|
||||
* ├───┼───│ ├───┴───┼───┤Ent│
|
||||
* │F18│F24│ │ 0 │ . │ │
|
||||
* └───┴───┘ └───────┴───┴───┘
|
||||
*/
|
||||
[_LAYER_BL] = LAYOUT_numpad_6x6(
|
||||
TD(TD_M1), TD(TD_M12), LT(_LAYER_RGB, KC_F1), KC_F2, KC_F3, KC_F4,
|
||||
TD(TD_M2), TD(TD_M11), TD(TD_NUM_TOGGLE), KC_PSLS, KC_PAST, KC_PMNS,
|
||||
TD(TD_M3), TD(TD_M10), KC_P7, KC_P8, KC_P9, KC_PPLS,
|
||||
TD(TD_M4), TD(TD_M9), KC_P4, KC_P5, KC_P6,
|
||||
TD(TD_M5), TD(TD_M8), KC_P1, KC_P2, KC_P3, KC_PENT,
|
||||
TD(TD_M6), TD(TD_M7), KC_P0, KC_PDOT
|
||||
),
|
||||
|
||||
/*
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F13│F19│ │F1 │F2 │F3 │F4 │
|
||||
* └───┴───┘ └───┴───┴───┴───┘
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F14│F20│ │Num│ / │ * │ - │
|
||||
* ├───┼───┤ ├───┼───┼───┼───┤
|
||||
* │F15│F21│ │ 7 │ 8 │ 9 │ │
|
||||
* ├───┼───┤ ├───┼───┼───┤ + │
|
||||
* │F16│F22│ │ 4 │ 5 │ 6 │ │
|
||||
* ├───┼───┤ ├───┼───┼───┼───┤
|
||||
* │F17│F23│ │ 1 │ 2 │ 3 │ │
|
||||
* ├───┼───│ ├───┴───┼───┤Ent│
|
||||
* │F18│F24│ │ 0 │ . │ │
|
||||
* └───┴───┘ └───────┴───┴───┘
|
||||
*/
|
||||
[_LAYER_CAD] = LAYOUT_numpad_6x6(
|
||||
_______, _______, EDIT_GEN, EDIT_PLACE, EDIT_ETCH, EDIT_SHAPE,
|
||||
_______, _______, TD(TD_NUM_TOGGLE), _______, _______, _______,
|
||||
_______, _______, ROUTE, SLIDE, VIA, KC_F8,
|
||||
_______, _______, MEASURE, SHOW, UPDATE_SHAPES,
|
||||
_______, _______, ROTATE, MIRROR, PAM, KC_F6,
|
||||
_______, _______, MOVE, KC_F9
|
||||
),
|
||||
|
||||
/*
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F13│F19│ │F1 │F2 │F3 │F4 │
|
||||
* └───┴───┘ └───┴───┴───┴───┘
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F14│F20│ │Num│ / │ * │ - │
|
||||
* ├───┼───┤ ├───┼───┼───┼───┤
|
||||
* │F15│F21│ │ 7 │ 8 │ 9 │ │
|
||||
* ├───┼───┤ ├───┼───┼───┤ + │
|
||||
* │F16│F22│ │ 4 │ 5 │ 6 │ │
|
||||
* ├───┼───┤ ├───┼───┼───┼───┤
|
||||
* │F17│F23│ │ 1 │ 2 │ 3 │ │
|
||||
* ├───┼───│ ├───┴───┼───┤Ent│
|
||||
* │F18│F24│ │ 0 │ . │ │
|
||||
* └───┴───┘ └───────┴───┴───┘
|
||||
*/
|
||||
[_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_CAD) && !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(_LAYER_CAD_LED_INDEX, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Process custom keycodes
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
switch (keycode) {
|
||||
|
||||
// Custom macro strings for Cadence
|
||||
case EDIT_GEN:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_EDIT_GEN);
|
||||
}
|
||||
break;
|
||||
case EDIT_PLACE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_EDIT_PLACE);
|
||||
}
|
||||
break;
|
||||
case EDIT_ETCH:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_EDIT_ETCH);
|
||||
}
|
||||
break;
|
||||
case EDIT_SHAPE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_EDIT_SHAPE);
|
||||
}
|
||||
break;
|
||||
case ROUTE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_ROUTE);
|
||||
}
|
||||
break;
|
||||
case SLIDE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_SLIDE);
|
||||
}
|
||||
break;
|
||||
case VIA:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_VIA);
|
||||
}
|
||||
break;
|
||||
case MEASURE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_MEASURE);
|
||||
}
|
||||
break;
|
||||
case SHOW:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_SHOW);
|
||||
}
|
||||
break;
|
||||
case UPDATE_SHAPES:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_UPDATE_SHAPES);
|
||||
}
|
||||
break;
|
||||
case ROTATE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_ROTATE);
|
||||
}
|
||||
break;
|
||||
case MIRROR:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_MIRROR);
|
||||
}
|
||||
break;
|
||||
case PAM:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_PAM);
|
||||
}
|
||||
break;
|
||||
case MOVE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_MOVE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
};
|
6
keyboards/nifty_numpad/keymaps/cadence/rules.mk
Normal file
6
keyboards/nifty_numpad/keymaps/cadence/rules.mk
Normal file
@ -0,0 +1,6 @@
|
||||
TAP_DANCE_ENABLE=yes
|
||||
RGB_IDLE_ENABLE=yes
|
||||
|
||||
ifeq ($(strip $(RGB_IDLE_ENABLE)), yes)
|
||||
OPT_DEFS += -DRGB_IDLE_ENABLE
|
||||
endif
|
@ -5,27 +5,14 @@
|
||||
#include "nifty_numpad.h"
|
||||
#include "quantum.h"
|
||||
|
||||
// Custom String Definitions
|
||||
#define STR_EDIT_GEN "emg"
|
||||
#define STR_EDIT_PLACE "emp"
|
||||
#define STR_EDIT_ETCH "eme"
|
||||
#define STR_EDIT_SHAPE "ems"
|
||||
#define STR_ROUTE "xx"
|
||||
#define STR_SLIDE "dd"
|
||||
#define STR_VIA "vv"
|
||||
#define STR_MEASURE "me"
|
||||
#define STR_SHOW "sh"
|
||||
#define STR_UPDATE_SHAPES "sup"
|
||||
#define STR_ROTATE "rr"
|
||||
#define STR_MIRROR "ff"
|
||||
#define STR_PAM "pam"
|
||||
#define STR_MOVE "mm"
|
||||
|
||||
// Layer Defines
|
||||
#define _LAYER_BL 0
|
||||
#define _LAYER_CAD 1
|
||||
#define _LAYER_1 1
|
||||
|
||||
#define _LAYER_CAD_LED_INDEX 8
|
||||
// Layer Indicator LED index
|
||||
#define _NUM_LED_INDEX 8
|
||||
|
||||
#define TAPPING_TERM 200
|
||||
|
||||
// Tap Dance Declarations
|
||||
enum {
|
||||
@ -49,7 +36,7 @@ enum {
|
||||
void tap_dance_num_toggle(tap_dance_state_t *state, void *user_data){
|
||||
switch(state->count){
|
||||
case 1:
|
||||
layer_invert(_LAYER_CAD);
|
||||
layer_invert(_LAYER_1);
|
||||
break;
|
||||
case 2:
|
||||
tap_code16(KC_NUM);
|
||||
@ -105,8 +92,12 @@ led_config_t g_led_config = { {
|
||||
// Setup keymap
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/*
|
||||
* SCN -> Screenshot
|
||||
* WIN -> Task View
|
||||
* EXP -> Open Explorer
|
||||
* BCK -> Backspace
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F13│F19│ │F1 │F2 │F3 │F4 │
|
||||
* │F13│F19│ │SCN│WIN│EXP│BCK│
|
||||
* └───┴───┘ └───┴───┴───┴───┘
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F14│F20│ │Num│ / │ * │ - │
|
||||
@ -121,53 +112,69 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
* └───┴───┘ └───────┴───┴───┘
|
||||
*/
|
||||
[_LAYER_BL] = LAYOUT_numpad_6x6(
|
||||
TD(TD_M1), TD(TD_M12), LT(_LAYER_RGB, KC_F1), KC_F2, KC_F3, KC_F4,
|
||||
TD(TD_M2), TD(TD_M11), TD(TD_NUM_TOGGLE), KC_PSLS, KC_PAST, KC_PMNS,
|
||||
TD(TD_M3), TD(TD_M10), KC_P7, KC_P8, KC_P9, KC_PPLS,
|
||||
TD(TD_M4), TD(TD_M9), KC_P4, KC_P5, KC_P6,
|
||||
TD(TD_M5), TD(TD_M8), KC_P1, KC_P2, KC_P3, KC_PENT,
|
||||
TD(TD_M6), TD(TD_M7), KC_P0, KC_PDOT
|
||||
TD(TD_M1), TD(TD_M12), LT(_LAYER_RGB, KC_BSPC), RGUI(KC_TAB), RGUI(KC_E), RGUI(RSFT(KC_S)),
|
||||
TD(TD_M2), TD(TD_M11), TD(TD_NUM_TOGGLE), KC_PSLS, KC_PAST, KC_PMNS,
|
||||
TD(TD_M3), TD(TD_M10), KC_P7, KC_P8, KC_P9, KC_PPLS,
|
||||
TD(TD_M4), TD(TD_M9), KC_P4, KC_P5, KC_P6,
|
||||
TD(TD_M5), TD(TD_M8), KC_P1, KC_P2, KC_P3, KC_PENT,
|
||||
TD(TD_M6), TD(TD_M7), KC_P0, KC_PDOT
|
||||
),
|
||||
|
||||
/*
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F13│F19│ │F1 │F2 │F3 │F4 │
|
||||
* │F13│F19│ │F9 │F10│F11│F12│
|
||||
* └───┴───┘ └───┴───┴───┴───┘
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F14│F20│ │Num│ / │ * │ - │
|
||||
* │___│___│ │___│~/ │~* │___│
|
||||
* ├───┼───┤ ├───┼───┼───┼───┤
|
||||
* │F15│F21│ │ 7 │ 8 │ 9 │ │
|
||||
* ├───┼───┤ ├───┼───┼───┤ + │
|
||||
* │F16│F22│ │ 4 │ 5 │ 6 │ │
|
||||
* │___│___│ │~7 │~8 │~9 │ │
|
||||
* ├───┼───┤ ├───┼───┼───┤___│
|
||||
* │___│___│ │~4 │~5 │~6 │ │
|
||||
* ├───┼───┤ ├───┼───┼───┼───┤
|
||||
* │F17│F23│ │ 1 │ 2 │ 3 │ │
|
||||
* ├───┼───│ ├───┴───┼───┤Ent│
|
||||
* │F18│F24│ │ 0 │ . │ │
|
||||
* │___│___│ │~1 │~2 │~3 │ │
|
||||
* ├───┼───│ ├───┴───┼───┤___│
|
||||
* │___│___│ │~0 │~. │ │
|
||||
* └───┴───┘ └───────┴───┴───┘
|
||||
*/
|
||||
[_LAYER_CAD] = LAYOUT_numpad_6x6(
|
||||
_______, _______, EDIT_GEN, EDIT_PLACE, EDIT_ETCH, EDIT_SHAPE,
|
||||
_______, _______, TD(TD_NUM_TOGGLE), _______, _______, _______,
|
||||
_______, _______, ROUTE, SLIDE, VIA, KC_F8,
|
||||
_______, _______, MEASURE, SHOW, UPDATE_SHAPES,
|
||||
_______, _______, ROTATE, MIRROR, PAM, KC_F6,
|
||||
_______, _______, MOVE, KC_F9
|
||||
[_LAYER_1] = 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
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F13│F19│ │F1 │F2 │F3 │F4 │
|
||||
* │___│___│ │___│HUI│SAI│VAI│
|
||||
* └───┴───┘ └───┴───┴───┴───┘
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F14│F20│ │Num│ / │ * │ - │
|
||||
* │___│___│ │Num│HUD│SAD│VAD│
|
||||
* ├───┼───┤ ├───┼───┼───┼───┤
|
||||
* │F15│F21│ │ 7 │ 8 │ 9 │ │
|
||||
* ├───┼───┤ ├───┼───┼───┤ + │
|
||||
* │F16│F22│ │ 4 │ 5 │ 6 │ │
|
||||
* │___│___│ │___│DEF│IEF│ │
|
||||
* ├───┼───┤ ├───┼───┼───┤SPI│
|
||||
* │___│___│ │___│___│___│ │
|
||||
* ├───┼───┤ ├───┼───┼───┼───┤
|
||||
* │F17│F23│ │ 1 │ 2 │ 3 │ │
|
||||
* ├───┼───│ ├───┴───┼───┤Ent│
|
||||
* │F18│F24│ │ 0 │ . │ │
|
||||
* │___│___│ │___│___│___│ │
|
||||
* ├───┼───│ ├───┴───┼───┤SPD│
|
||||
* │___│___│ │___ │___│ │
|
||||
* └───┴───┘ └───────┴───┴───┘
|
||||
*/
|
||||
[_LAYER_RGB] = LAYOUT_numpad_6x6(
|
||||
@ -183,94 +190,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
// 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_CAD) && !rgb_matrix_idle_mode()) {
|
||||
if (layer_state_is(_LAYER_1) && !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(_LAYER_CAD_LED_INDEX, rgb.r, rgb.g, rgb.b);
|
||||
rgb_matrix_set_color(_NUM_LED_INDEX, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Process custom keycodes
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
switch (keycode) {
|
||||
|
||||
// Custom macro strings for Cadence
|
||||
case EDIT_GEN:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_EDIT_GEN);
|
||||
}
|
||||
break;
|
||||
case EDIT_PLACE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_EDIT_PLACE);
|
||||
}
|
||||
break;
|
||||
case EDIT_ETCH:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_EDIT_ETCH);
|
||||
}
|
||||
break;
|
||||
case EDIT_SHAPE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_EDIT_SHAPE);
|
||||
}
|
||||
break;
|
||||
case ROUTE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_ROUTE);
|
||||
}
|
||||
break;
|
||||
case SLIDE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_SLIDE);
|
||||
}
|
||||
break;
|
||||
case VIA:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_VIA);
|
||||
}
|
||||
break;
|
||||
case MEASURE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_MEASURE);
|
||||
}
|
||||
break;
|
||||
case SHOW:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_SHOW);
|
||||
}
|
||||
break;
|
||||
case UPDATE_SHAPES:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_UPDATE_SHAPES);
|
||||
}
|
||||
break;
|
||||
case ROTATE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_ROTATE);
|
||||
}
|
||||
break;
|
||||
case MIRROR:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_MIRROR);
|
||||
}
|
||||
break;
|
||||
case PAM:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_PAM);
|
||||
}
|
||||
break;
|
||||
case MOVE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(STR_MOVE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
6
keyboards/nifty_numpad/keymaps/default/rules.mk
Normal file
6
keyboards/nifty_numpad/keymaps/default/rules.mk
Normal file
@ -0,0 +1,6 @@
|
||||
TAP_DANCE_ENABLE=yes
|
||||
RGB_IDLE_ENABLE=yes
|
||||
|
||||
ifeq ($(strip $(RGB_IDLE_ENABLE)), yes)
|
||||
OPT_DEFS += -DRGB_IDLE_ENABLE
|
||||
endif
|
106
keyboards/nifty_numpad/keymaps/via/keymap.c
Normal file
106
keyboards/nifty_numpad/keymaps/via/keymap.c
Normal file
@ -0,0 +1,106 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "nifty_numpad.h"
|
||||
#include "quantum.h"
|
||||
|
||||
// Layer Defines
|
||||
#define _LAYER_BL 0
|
||||
#define _LAYER_RGB 3
|
||||
|
||||
// Setup LED map
|
||||
led_config_t g_led_config = { {
|
||||
// Key Matrix to LED Index
|
||||
{ 0, 1, 2, 3, 4, 5 },
|
||||
{ 6, 7, 8, 9, 10, 11 },
|
||||
{ 12, 13, 14, 15, 16, 17 },
|
||||
{ 18, 19, 20, 21, 22, NO_LED },
|
||||
{ 23, 24, 25, 26, 27, 28 },
|
||||
{ 29, 30, 31, NO_LED, 32, NO_LED }
|
||||
}, {
|
||||
// LED Index to Physical Position
|
||||
{ 0, 0}, { 43, 0}, { 96, 0}, {139, 0}, {181, 0}, {224, 0},
|
||||
{ 0, 17}, { 43, 17}, { 96, 17}, {139, 17}, {181, 17}, {224, 17},
|
||||
{ 0, 29}, { 43, 29}, { 96, 29}, {139, 29}, {181, 29}, {224, 35},
|
||||
{ 0, 41}, { 43, 41}, { 96, 41}, {139, 41}, {181, 41}, { 0, 52},
|
||||
{ 43, 52}, { 96, 52}, {139, 52}, {181, 52}, {224, 58}, { 0, 64},
|
||||
{ 43, 64}, {117, 64}, {181, 64}
|
||||
}, {
|
||||
// LED Index to Flag
|
||||
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
|
||||
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
|
||||
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
|
||||
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
|
||||
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
|
||||
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT
|
||||
} };
|
||||
|
||||
// Setup keymap
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/*
|
||||
* SCN -> Screenshot
|
||||
* WIN -> Task View
|
||||
* EXP -> Open Explorer
|
||||
* BCK -> Backspace
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F13│F19│ │BCK│WIN│EXP│SCN│
|
||||
* └───┴───┘ └───┴───┴───┴───┘
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F14│F20│ │Num│ / │ * │ - │
|
||||
* ├───┼───┤ ├───┼───┼───┼───┤
|
||||
* │F15│F21│ │ 7 │ 8 │ 9 │ │
|
||||
* ├───┼───┤ ├───┼───┼───┤ + │
|
||||
* │F16│F22│ │ 4 │ 5 │ 6 │ │
|
||||
* ├───┼───┤ ├───┼───┼───┼───┤
|
||||
* │F17│F23│ │ 1 │ 2 │ 3 │ │
|
||||
* ├───┼───│ ├───┴───┼───┤Ent│
|
||||
* │F18│F24│ │ 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
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │___│___│ │___│HUI│SAI│VAI│
|
||||
* └───┴───┘ └───┴───┴───┴───┘
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │___│___│ │Num│HUD│SAD│VAD│
|
||||
* ├───┼───┤ ├───┼───┼───┼───┤
|
||||
* │___│___│ │___│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,
|
||||
_______, _______, _______, _______
|
||||
)
|
||||
};
|
1
keyboards/nifty_numpad/keymaps/via/rules.mk
Normal file
1
keyboards/nifty_numpad/keymaps/via/rules.mk
Normal file
@ -0,0 +1 @@
|
||||
VIA_ENABLE = yes
|
@ -17,6 +17,7 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "quantum.h"
|
||||
|
||||
#ifdef RGB_IDLE_ENABLE
|
||||
typedef struct {
|
||||
uint8_t mode;
|
||||
uint8_t speed;
|
||||
@ -54,8 +55,11 @@ void rgb_matrix_state_restore(rgb_matrix_state_t* state){
|
||||
rgb_matrix_sethsv_noeeprom(hsv.h, hsv.s, hsv.v);
|
||||
rgb_matrix_set_speed_noeeprom(state->speed);
|
||||
}
|
||||
#endif
|
||||
|
||||
void matrix_scan_kb(void) {
|
||||
|
||||
#ifdef RGB_IDLE_ENABLE
|
||||
// Check if enough time has passed since last keypress to go into idle mode
|
||||
if ( timer_elapsed32(idle_timer) > RGB_IDLE_TIMEOUT_MS && !rgb_idle_mode ) {
|
||||
rgb_matrix_state_save(&active_rgb_matrix);
|
||||
@ -64,12 +68,15 @@ void matrix_scan_kb(void) {
|
||||
|
||||
rgb_matrix_state_restore(&idle_rgb_matrix);
|
||||
}
|
||||
#endif
|
||||
|
||||
matrix_scan_user();
|
||||
};
|
||||
|
||||
|
||||
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;
|
||||
|
||||
@ -91,6 +98,7 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||
config.idle_rgb_matrix = idle_rgb_matrix;
|
||||
eeconfig_update_kb_datablock(&config);
|
||||
}
|
||||
#endif
|
||||
|
||||
return layer_state_set_user(state);
|
||||
}
|
||||
@ -98,6 +106,7 @@ layer_state_t layer_state_set_kb(layer_state_t 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) {
|
||||
idle_timer = timer_read32();
|
||||
@ -106,10 +115,12 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
rgb_idle_mode = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
switch (keycode) {
|
||||
|
||||
#ifdef RGB_IDLE_ENABLE
|
||||
// Handle all the RGB settings
|
||||
case RGB_DEF:
|
||||
if (record->event.pressed) {
|
||||
@ -191,11 +202,13 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
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;
|
||||
@ -204,12 +217,14 @@ void keyboard_post_init_kb(void) {
|
||||
rgb_matrix_state_restore(&active_rgb_matrix);
|
||||
// Start the idle timer for idle mode
|
||||
idle_timer = timer_read32();
|
||||
#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;
|
||||
|
||||
@ -228,5 +243,6 @@ void eeconfig_init_kb_datablock(void){
|
||||
|
||||
#if (EECONFIG_USER_DATA_SIZE) > 0
|
||||
eeconfig_init_user_datablock();
|
||||
#endif
|
||||
#endif // EECONFIG_USER_DATA_SIZE
|
||||
#endif // RGB_IDLE_ENABLE
|
||||
}
|
||||
|
@ -33,33 +33,6 @@
|
||||
_a < _b ? _a : _b; \
|
||||
})
|
||||
|
||||
// Custom kycode declarations
|
||||
enum custom_keycodes {
|
||||
EDIT_GEN = SAFE_RANGE,
|
||||
EDIT_PLACE,
|
||||
EDIT_ETCH,
|
||||
EDIT_SHAPE,
|
||||
ROUTE,
|
||||
SLIDE,
|
||||
VIA,
|
||||
MEASURE,
|
||||
SHOW,
|
||||
UPDATE_SHAPES,
|
||||
ROTATE,
|
||||
MIRROR,
|
||||
PAM,
|
||||
MOVE,
|
||||
RGB_DEF,
|
||||
RGB_IEF
|
||||
};
|
||||
|
||||
// Layer Defines
|
||||
#define _LAYER_RGB 15
|
||||
|
||||
// Custom Setup
|
||||
#define TAPPING_TERM 200
|
||||
#define RGB_IDLE_TIMEOUT_MS (10*60*1000)
|
||||
|
||||
/*
|
||||
* ┌───┬───┐ ┌───┬───┬───┬───┐
|
||||
* │F13│F19│ │F1 │F2 │F3 │F4 │
|
||||
@ -95,5 +68,18 @@ enum custom_keycodes {
|
||||
{ K50, K51, K52, XXX, K54, XXX} \
|
||||
}
|
||||
|
||||
|
||||
#ifdef RGB_IDLE_ENABLE
|
||||
#define _LAYER_RGB 15
|
||||
// Custom keycode declarations
|
||||
enum custom_keycodes {
|
||||
RGB_DEF = SAFE_RANGE,
|
||||
RGB_IEF
|
||||
};
|
||||
|
||||
#define RGB_IDLE_TIMEOUT_MS (10*60*1000)
|
||||
|
||||
// Functions exposed by nifty_numpad.c
|
||||
bool rgb_matrix_idle_mode(void);
|
||||
bool rgb_matrix_idle_mode(void);
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,3 @@
|
||||
TAP_DANCE_ENABLE=yes
|
||||
RGB_MATRIX_ENABLE=yes
|
||||
RGB_MATRIX_DRIVER=WS2812
|
||||
WS2812_DRIVER=vendor
|
Loading…
Reference in New Issue
Block a user