Skip to content

Commit

Permalink
[Keyboard] YMDK NP21 refactor (qmk#10181)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored Sep 1, 2020
1 parent 96715cf commit 4f50a48
Show file tree
Hide file tree
Showing 7 changed files with 290 additions and 162 deletions.
119 changes: 104 additions & 15 deletions keyboards/ymdk_np21/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,121 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#include "config_common.h"

#define VENDOR_ID 0x20A0
#define PRODUCT_ID 0x422D
#define DEVICE_VER 0x0200
#define MANUFACTURER YMDK
#define PRODUCT NP21
/* USB Device descriptor parameter */
#define VENDOR_ID 0x594D // "YM"
#define PRODUCT_ID 0x5021 // "P" 21
#define DEVICE_VER 0x0200
#define MANUFACTURER YMDK
#define PRODUCT NP21

/* matrix size */
/* key matrix size */
#define MATRIX_ROWS 4
#define MATRIX_COLS 6

/*
* Keyboard Matrix Assignments
*
* Change this to how you wired your keyboard
* COLS: AVR pins used for columns, left to right
* ROWS: AVR pins used for rows, top to bottom
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
#define MATRIX_ROW_PINS { B0, B1, B2, B3 }
#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5 }

/* COL2ROW or ROW2COL */
/* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW

#define BACKLIGHT_PIN D4
#define BACKLIGHT_LEVELS 12
#define BACKLIGHT_BREATHING

#define TAPPING_TOGGLE 3

#define USB_MAX_POWER_CONSUMPTION 100

/* RGB underglow */
// The RGB_DI_PIN value seems to be shared between all PS2AVRGB boards.
// The same pin is used on the JJ40, at least.
#define RGBLED_NUM 5
#define RGB_DI_PIN E2 // NOTE: for PS2AVRGB boards, underglow commands are sent via I2C to 0xB0.
//#define RGBLIGHT_HUE_STEP 8
//#define RGBLIGHT_SAT_STEP 8
//#define RGBLIGHT_VAL_STEP 8
//#define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
//#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
/*== all animations enable ==*/
#define RGBLIGHT_ANIMATIONS
/*== or choose animations ==*/
//#define RGBLIGHT_EFFECT_BREATHING
//#define RGBLIGHT_EFFECT_RAINBOW_MOOD
//#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
//#define RGBLIGHT_EFFECT_SNAKE
//#define RGBLIGHT_EFFECT_KNIGHT
//#define RGBLIGHT_EFFECT_CHRISTMAS
//#define RGBLIGHT_EFFECT_STATIC_GRADIENT
//#define RGBLIGHT_EFFECT_RGB_TEST
//#define RGBLIGHT_EFFECT_ALTERNATING
/*== customize breathing effect ==*/
/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
//#define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
/*==== use exp() and sin() ====*/
//#define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
//#define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5

/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
* This is useful for the Windows task manager shortcut (ctrl+shift+esc).
*/
//#define GRAVE_ESC_CTRL_OVERRIDE

/*
* Force NKRO
*
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
* makefile for this to work.)
*
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
* until the next keyboard reset.
*
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
* fully operational during normal computer usage.
*
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
* power-up.
*
*/
//#define FORCE_NKRO

/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/

/* disable debug print */
//#define NO_DEBUG

/* disable print */
//#define NO_PRINT

/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT

/* disable these deprecated features by default */
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION

/* Bootmagic Lite key configuration */
//#define BOOTMAGIC_LITE_ROW 0
//#define BOOTMAGIC_LITE_COLUMN 0

#define USB_MAX_POWER_CONSUMPTION 100
140 changes: 89 additions & 51 deletions keyboards/ymdk_np21/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,63 +6,101 @@
"LAYOUT_ortho_6x4": {
"width": 4,
"height": 6.25,
"key_count": 24,
"layout": [
{"label":"K06", "x":0, "y":0},
{"label":"K16", "x":1, "y":0},
{"label":"K26", "x":2, "y":0},
{"label":"K36", "x":3, "y":0},
{"label":"K05", "x":0, "y":1.25},
{"label":"K15", "x":1, "y":1.25},
{"label":"K25", "x":2, "y":1.25},
{"label":"K35", "x":3, "y":1.25},
{"label":"K04", "x":0, "y":2.25},
{"label":"K14", "x":1, "y":2.25},
{"label":"K24", "x":2, "y":2.25},
{"label":"K34", "x":3, "y":2.25},
{"label":"K03", "x":0, "y":3.25},
{"label":"K13", "x":1, "y":3.25},
{"label":"K23", "x":2, "y":3.25},
{"label":"K33", "x":3, "y":3.25},
{"label":"K02", "x":0, "y":4.25},
{"label":"K12", "x":1, "y":4.25},
{"label":"K22", "x":2, "y":4.25},
{"label":"K32", "x":3, "y":4.25},
{"label":"K01", "x":0, "y":5.25},
{"label":"K11", "x":1, "y":5.25},
{"label":"K21", "x":2, "y":5.25},
{"label":"K31", "x":3, "y":5.25}
{"x": 0, "y": 0},
{"x": 1, "y": 0},
{"x": 2, "y": 0},
{"x": 3, "y": 0},

{"x": 0, "y": 1.25},
{"x": 1, "y": 1.25},
{"x": 2, "y": 1.25},
{"x": 3, "y": 1.25},

{"x": 0, "y": 2.25},
{"x": 1, "y": 2.25},
{"x": 2, "y": 2.25},
{"x": 3, "y": 2.25},

{"x": 0, "y": 3.25},
{"x": 1, "y": 3.25},
{"x": 2, "y": 3.25},
{"x": 3, "y": 3.25},

{"x": 0, "y": 4.25},
{"x": 1, "y": 4.25},
{"x": 2, "y": 4.25},
{"x": 3, "y": 4.25},

{"x": 0, "y": 5.25},
{"x": 1, "y": 5.25},
{"x": 2, "y": 5.25},
{"x": 3, "y": 5.25}
]
},
"LAYOUT": {
"LAYOUT_ortho_4x6": {
"width": 6.25,
"height": 4,
"key_count": 24,
"layout": [
{"label":"K01", "x":0, "y":0},
{"label":"K02", "x":1, "y":0},
{"label":"K03", "x":2, "y":0},
{"label":"K04", "x":3, "y":0},
{"label":"K05", "x":4, "y":0},
{"label":"K06", "x":5.25, "y":0},
{"label":"K11", "x":0, "y":1},
{"label":"K12", "x":1, "y":1},
{"label":"K13", "x":2, "y":1},
{"label":"K14", "x":3, "y":1},
{"label":"K15", "x":4, "y":1},
{"label":"K16", "x":5.25, "y":1},
{"label":"K21", "x":0, "y":2},
{"label":"K22", "x":1, "y":2},
{"label":"K23", "x":2, "y":2},
{"label":"K24", "x":3, "y":2},
{"label":"K25", "x":4, "y":2},
{"label":"K26", "x":5.25, "y":2},
{"label":"K31", "x":0, "y":3},
{"label":"K32", "x":1, "y":3},
{"label":"K33", "x":2, "y":3},
{"label":"K34", "x":3, "y":3},
{"label":"K35", "x":4, "y":3},
{"label":"K36", "x":5.25, "y":3}
{"x": 0, "y": 0},
{"x": 1, "y": 0},
{"x": 2, "y": 0},
{"x": 3, "y": 0},
{"x": 4, "y": 0},
{"x": 5.25, "y": 0},

{"x": 0, "y": 1},
{"x": 1, "y": 1},
{"x": 2, "y": 1},
{"x": 3, "y": 1},
{"x": 4, "y": 1},
{"x": 5.25, "y": 1},

{"x": 0, "y": 2},
{"x": 1, "y": 2},
{"x": 2, "y": 2},
{"x": 3, "y": 2},
{"x": 4, "y": 2},
{"x": 5.25, "y": 2},

{"x": 0, "y": 3},
{"x": 1, "y": 3},
{"x": 2, "y": 3},
{"x": 3, "y": 3},
{"x": 4, "y": 3},
{"x": 5.25, "y": 3}
]
},
"LAYOUT_numpad_6x4": {
"width": 4,
"height": 6.25,
"layout": [
{"x": 0, "y": 0},
{"x": 1, "y": 0},
{"x": 2, "y": 0},
{"x": 3, "y": 0},

{"x": 0, "y": 1.25},
{"x": 1, "y": 1.25},
{"x": 2, "y": 1.25},
{"x": 3, "y": 1.25},

{"x": 0, "y": 2.25},
{"x": 1, "y": 2.25},
{"x": 2, "y": 2.25},

{"x": 0, "y": 3.25},
{"x": 1, "y": 3.25},
{"x": 2, "y": 3.25},
{"x": 3, "y": 2.25, "h": 2},

{"x": 0, "y": 4.25},
{"x": 1, "y": 4.25},
{"x": 2, "y": 4.25},

{"x": 0, "y": 5.25, "w": 2},
{"x": 2, "y": 5.25},
{"x": 3, "y": 4.25, "h": 2}
]
}
}
Expand Down
44 changes: 19 additions & 25 deletions keyboards/ymdk_np21/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
#include QMK_KEYBOARD_H

#define _NP 0
#define _BL 1

enum custom_keycodes {
NP = SAFE_RANGE,
BL
enum layer_names {
_NP,
_BL
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty */

[_NP] = LAYOUT_ortho_6x4(
KC_ESC, KC_TAB, KC_BSPC, MO(_BL),
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_P1, KC_P2, KC_P3, KC_PENT,
KC_P0, KC_DOT, KC_PDOT, KC_PENT
),

[_BL] = LAYOUT_ortho_6x4(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, BL_ON, _______, BL_INC,
_______, BL_TOGG, _______, BL_INC,
_______, BL_OFF, _______, BL_DEC,
BL_BRTG, _______, _______, BL_DEC
)
[_NP] = LAYOUT_ortho_6x4(
KC_ESC, KC_TAB, KC_BSPC, MO(_BL),
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_P1, KC_P2, KC_P3, KC_PENT,
KC_P0, KC_DOT, KC_PDOT, KC_PENT
),

[_BL] = LAYOUT_ortho_6x4(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, BL_ON, _______, BL_INC,
_______, BL_TOGG, _______, BL_INC,
_______, BL_OFF, _______, BL_DEC,
BL_BRTG, _______, _______, BL_DEC
)
};
50 changes: 25 additions & 25 deletions keyboards/ymdk_np21/keymaps/default/readme.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# default
# The default keymap for the YMDK NP21 keypad

The default keymap for the YMDK NP21 keypad.

Base Layer Function Layer
.-----. .-----.
| USB | | USB |
,-------------------------------. ,-------------------------------.
| Esc | Tab | Back | Fn | | | | |▒▒▒▒▒▒▒|
| | | Space | | | | | |▒▒▒▒▒▒▒|
|-------+-------+-------+-------| |-------+-------+-------+-------|
| Num | / | * | - | | | | | |
| Lock | | | | | | | | |
|-------+-------+-------+-------| |-------+-------+-------+-------|
| 7 | 8 | 9 | + | | | BL | | BL |
| Home | Up | PgUp | | | | On | | Inc |
|-------+-------+-------+-------| |-------+-------+-------+-------|
| 4 | 5 | 6 | + | | | BL | | BL |
| Left | | Right | | | | Togg | | Inc |
|-------+-------+-------+-------| |-------+-------+-------+-------|
| 1 | 2 | 3 | Ent | | | BL | | BL |
| End | Down | PgDn | | | | Off | | Dec |
|-------+-------+-------+-------| |-------+-------+-------+-------|
| 0 | . | . | Ent | | BL | | | BL |
| Ins | | Del | | | Brthg | | | Dec |
`-------------------------------' `-------------------------------'
```
Base Layer Function Layer
.-----. .-----.
| USB | | USB |
,-------------------------------. ,-------------------------------.
| Esc | Tab | Back | Fn | | | | |▒▒▒▒▒▒▒|
| | | Space | | | | | |▒▒▒▒▒▒▒|
|-------+-------+-------+-------| |-------+-------+-------+-------|
| Num | / | * | - | | | | | |
| Lock | | | | | | | | |
|-------+-------+-------+-------| |-------+-------+-------+-------|
| 7 | 8 | 9 | + | | | BL | | BL |
| Home | Up | PgUp | | | | On | | Inc |
|-------+-------+-------+-------| |-------+-------+-------+-------|
| 4 | 5 | 6 | + | | | BL | | BL |
| Left | | Right | | | | Togg | | Inc |
|-------+-------+-------+-------| |-------+-------+-------+-------|
| 1 | 2 | 3 | Ent | | | BL | | BL |
| End | Down | PgDn | | | | Off | | Dec |
|-------+-------+-------+-------| |-------+-------+-------+-------|
| 0 | . | . | Ent | | BL | | | BL |
| Ins | | Del | | | Brthg | | | Dec |
`-------------------------------' `-------------------------------'
```
File renamed without changes.
Loading

0 comments on commit 4f50a48

Please sign in to comment.