[Keyboard] YMDK NP21 refactor (#10181)

master
Ryan 2020-09-01 15:30:07 +10:00 committed by GitHub
parent 854a94f383
commit 0032cb026b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 290 additions and 162 deletions

View File

@ -19,32 +19,121 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config_common.h" #include "config_common.h"
#define VENDOR_ID 0x20A0 /* USB Device descriptor parameter */
#define PRODUCT_ID 0x422D #define VENDOR_ID 0x594D // "YM"
#define DEVICE_VER 0x0200 #define PRODUCT_ID 0x5021 // "P" 21
#define MANUFACTURER YMDK #define DEVICE_VER 0x0200
#define PRODUCT NP21 #define MANUFACTURER YMDK
#define PRODUCT NP21
/* matrix size */ /* key matrix size */
#define MATRIX_ROWS 4 #define MATRIX_ROWS 4
#define MATRIX_COLS 6 #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_ROW_PINS { B0, B1, B2, B3 }
#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5 } #define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5 }
/* COL2ROW or ROW2COL */ /* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW #define DIODE_DIRECTION COL2ROW
#define BACKLIGHT_PIN D4 #define BACKLIGHT_PIN D4
#define BACKLIGHT_LEVELS 12 #define BACKLIGHT_LEVELS 12
#define BACKLIGHT_BREATHING #define BACKLIGHT_BREATHING
#define TAPPING_TOGGLE 3 #define RGBLED_NUM 5
//#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 #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_ANIMATIONS

View File

@ -6,63 +6,101 @@
"LAYOUT_ortho_6x4": { "LAYOUT_ortho_6x4": {
"width": 4, "width": 4,
"height": 6.25, "height": 6.25,
"key_count": 24,
"layout": [ "layout": [
{"label":"K06", "x":0, "y":0}, {"x": 0, "y": 0},
{"label":"K16", "x":1, "y":0}, {"x": 1, "y": 0},
{"label":"K26", "x":2, "y":0}, {"x": 2, "y": 0},
{"label":"K36", "x":3, "y":0}, {"x": 3, "y": 0},
{"label":"K05", "x":0, "y":1.25},
{"label":"K15", "x":1, "y":1.25}, {"x": 0, "y": 1.25},
{"label":"K25", "x":2, "y":1.25}, {"x": 1, "y": 1.25},
{"label":"K35", "x":3, "y":1.25}, {"x": 2, "y": 1.25},
{"label":"K04", "x":0, "y":2.25}, {"x": 3, "y": 1.25},
{"label":"K14", "x":1, "y":2.25},
{"label":"K24", "x":2, "y":2.25}, {"x": 0, "y": 2.25},
{"label":"K34", "x":3, "y":2.25}, {"x": 1, "y": 2.25},
{"label":"K03", "x":0, "y":3.25}, {"x": 2, "y": 2.25},
{"label":"K13", "x":1, "y":3.25}, {"x": 3, "y": 2.25},
{"label":"K23", "x":2, "y":3.25},
{"label":"K33", "x":3, "y":3.25}, {"x": 0, "y": 3.25},
{"label":"K02", "x":0, "y":4.25}, {"x": 1, "y": 3.25},
{"label":"K12", "x":1, "y":4.25}, {"x": 2, "y": 3.25},
{"label":"K22", "x":2, "y":4.25}, {"x": 3, "y": 3.25},
{"label":"K32", "x":3, "y":4.25},
{"label":"K01", "x":0, "y":5.25}, {"x": 0, "y": 4.25},
{"label":"K11", "x":1, "y":5.25}, {"x": 1, "y": 4.25},
{"label":"K21", "x":2, "y":5.25}, {"x": 2, "y": 4.25},
{"label":"K31", "x":3, "y":5.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, "width": 6.25,
"height": 4, "height": 4,
"key_count": 24,
"layout": [ "layout": [
{"label":"K01", "x":0, "y":0}, {"x": 0, "y": 0},
{"label":"K02", "x":1, "y":0}, {"x": 1, "y": 0},
{"label":"K03", "x":2, "y":0}, {"x": 2, "y": 0},
{"label":"K04", "x":3, "y":0}, {"x": 3, "y": 0},
{"label":"K05", "x":4, "y":0}, {"x": 4, "y": 0},
{"label":"K06", "x":5.25, "y":0}, {"x": 5.25, "y": 0},
{"label":"K11", "x":0, "y":1},
{"label":"K12", "x":1, "y":1}, {"x": 0, "y": 1},
{"label":"K13", "x":2, "y":1}, {"x": 1, "y": 1},
{"label":"K14", "x":3, "y":1}, {"x": 2, "y": 1},
{"label":"K15", "x":4, "y":1}, {"x": 3, "y": 1},
{"label":"K16", "x":5.25, "y":1}, {"x": 4, "y": 1},
{"label":"K21", "x":0, "y":2}, {"x": 5.25, "y": 1},
{"label":"K22", "x":1, "y":2},
{"label":"K23", "x":2, "y":2}, {"x": 0, "y": 2},
{"label":"K24", "x":3, "y":2}, {"x": 1, "y": 2},
{"label":"K25", "x":4, "y":2}, {"x": 2, "y": 2},
{"label":"K26", "x":5.25, "y":2}, {"x": 3, "y": 2},
{"label":"K31", "x":0, "y":3}, {"x": 4, "y": 2},
{"label":"K32", "x":1, "y":3}, {"x": 5.25, "y": 2},
{"label":"K33", "x":2, "y":3},
{"label":"K34", "x":3, "y":3}, {"x": 0, "y": 3},
{"label":"K35", "x":4, "y":3}, {"x": 1, "y": 3},
{"label":"K36", "x":5.25, "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}
] ]
} }
} }

View File

@ -1,32 +1,26 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
#define _NP 0 enum layer_names {
#define _BL 1 _NP,
_BL
enum custom_keycodes {
NP = SAFE_RANGE,
BL
}; };
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty */ [_NP] = LAYOUT_ortho_6x4(
KC_ESC, KC_TAB, KC_BSPC, MO(_BL),
[_NP] = LAYOUT_ortho_6x4( KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
KC_ESC, KC_TAB, KC_BSPC, MO(_BL), KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_P7, KC_P8, KC_P9, KC_PPLS, KC_P1, KC_P2, KC_P3, KC_PENT,
KC_P4, KC_P5, KC_P6, KC_PPLS, KC_P0, KC_DOT, KC_PDOT, KC_PENT
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
)
[_BL] = LAYOUT_ortho_6x4(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, BL_ON, _______, BL_INC,
_______, BL_TOGG, _______, BL_INC,
_______, BL_OFF, _______, BL_DEC,
BL_BRTG, _______, _______, BL_DEC
)
}; };

View File

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

View File

@ -2,28 +2,20 @@
MCU = atmega32a MCU = atmega32a
# Bootloader selection # Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = bootloadHID BOOTLOADER = bootloadHID
# build options # Build Options
BOOTMAGIC_ENABLE = no # change yes to no to disable
MOUSEKEY_ENABLE = no #
EXTRAKEY_ENABLE = yes BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
CONSOLE_ENABLE = no MOUSEKEY_ENABLE = no # Mouse keys
COMMAND_ENABLE = yes EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
BACKLIGHT_ENABLE = yes COMMAND_ENABLE = yes # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
RGBLIGHT_ENABLE = yes SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
WS2812_DRIVER = i2c WS2812_DRIVER = i2c
KEY_LOCK_ENABLE = yes LAYOUTS = ortho_6x4 numpad_6x4
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

View File

@ -19,31 +19,46 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h" #include "quantum.h"
#define XXX KC_NO
#define LAYOUT_ortho_6x4( \ #define LAYOUT_ortho_6x4( \
K06, K16, K26, K36, \ k00, k10, k20, k30, \
K05, K15, K25, K35, \ k01, k11, k21, k31, \
K04, K14, K24, K34, \ k02, k12, k22, k32, \
K03, K13, K23, K33, \ k03, k13, k23, k33, \
K02, K12, K22, K32, \ k04, k14, k24, k34, \
K01, K11, K21, K31 \ k05, k15, k25, k35 \
) \ ) { \
{ \ { k00, k01, k02, k03, k04, k05 }, \
{ K06, K05, K04, K03, K02, K01 }, \ { k10, k11, k12, k13, k14, k15 }, \
{ K16, K15, K14, K13, K12, K11 }, \ { k20, k21, k22, k23, k24, k25 }, \
{ K26, K25, K24, K23, K22, K21 }, \ { k30, k31, k32, k33, k34, k35 } \
{ K36, K35, K34, K33, K32, K31 } \
} }
#define LAYOUT( \ #define LAYOUT_ortho_4x6( \
K01, K02, K03, K04, K05, K06, \ k05, k04, k03, k02, k01, k00, \
K11, K12, K13, K14, K15, K16, \ k15, k14, k13, k12, k11, k10, \
K21, K22, K23, K24, K25, K26, \ k25, k24, k23, k22, k21, k20, \
K31, K32, K33, K34, K35, K36 \ k35, k34, k33, k32, k31, k30 \
) LAYOUT_ortho_6x4( \ ) { \
K06, K16, K26, K36, \ { k00, k01, k02, k03, k04, k05 }, \
K05, K15, K25, K35, \ { k10, k11, k12, k13, k14, k15 }, \
K04, K14, K24, K34, \ { k20, k21, k22, k23, k24, k25 }, \
K03, K13, K23, K33, \ { k30, k31, k32, k33, k34, k35 } \
K02, K12, K22, K32, \ }
K01, K11, K21, K31 \
) #define LAYOUT_numpad_6x4( \
k00, k10, k20, k30, \
k01, k11, k21, k31, \
k02, k12, k22,\
k03, k13, k23, k33, \
k04, k14, k24, \
k05, k25, k35 \
) { \
{ k00, k01, k02, k03, k04, k05 }, \
{ k10, k11, k12, k13, k14, XXX }, \
{ k20, k21, k22, k23, k24, k25 }, \
{ k30, k31, XXX, k33, XXX, k35 } \
}
#define LAYOUT LAYOUT_ortho_4x6