From e941ae38110c616884acbb7447350b150cdb9d4d Mon Sep 17 00:00:00 2001 From: Simon Arlott <70171+nomis@users.noreply.github.com> Date: Wed, 17 Mar 2021 01:39:09 +0000 Subject: [PATCH] [Keyboard] Add YMDK NP24 (ATmega32U4 with 6 RGB LEDs) (#12120) --- keyboards/ymdk/np24/u4rgb6/config.h | 55 ++++++++++ keyboards/ymdk/np24/u4rgb6/info.json | 102 ++++++++++++++++++ .../ymdk/np24/u4rgb6/keymaps/default/keymap.c | 49 +++++++++ .../np24/u4rgb6/keymaps/default/readme.md | 29 +++++ keyboards/ymdk/np24/u4rgb6/readme.md | 18 ++++ keyboards/ymdk/np24/u4rgb6/rules.mk | 24 +++++ keyboards/ymdk/np24/u4rgb6/u4rgb6.c | 16 +++ keyboards/ymdk/np24/u4rgb6/u4rgb6.h | 67 ++++++++++++ 8 files changed, 360 insertions(+) create mode 100644 keyboards/ymdk/np24/u4rgb6/config.h create mode 100644 keyboards/ymdk/np24/u4rgb6/info.json create mode 100644 keyboards/ymdk/np24/u4rgb6/keymaps/default/keymap.c create mode 100644 keyboards/ymdk/np24/u4rgb6/keymaps/default/readme.md create mode 100644 keyboards/ymdk/np24/u4rgb6/readme.md create mode 100644 keyboards/ymdk/np24/u4rgb6/rules.mk create mode 100644 keyboards/ymdk/np24/u4rgb6/u4rgb6.c create mode 100644 keyboards/ymdk/np24/u4rgb6/u4rgb6.h diff --git a/keyboards/ymdk/np24/u4rgb6/config.h b/keyboards/ymdk/np24/u4rgb6/config.h new file mode 100644 index 000000000..dc86ae344 --- /dev/null +++ b/keyboards/ymdk/np24/u4rgb6/config.h @@ -0,0 +1,55 @@ +/* Copyright 2021 Simon Arlott + * + * 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 . + */ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x594D +#define PRODUCT_ID 0x5024 +#define DEVICE_VER 0x0406 +#define MANUFACTURER YMDK +#define PRODUCT NP24 U4 RGB6 + +/* key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 4 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { B3, B6, B2, B1, D7, B4 } +#define MATRIX_COL_PINS { F5, F4, D3, D2 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION ROW2COL + +/* LED indicator pins */ +#define LED_NUM_LOCK_PIN C6 +#define LED_PIN_ON_STATE 0 + +/* number of backlight levels */ +#define BACKLIGHT_PIN B7 +#ifdef BACKLIGHT_PIN +# define BACKLIGHT_LEVELS 31 +#endif + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +#define RGB_DI_PIN E2 +#ifdef RGB_DI_PIN +# define RGBLED_NUM 6 +# define RGBLIGHT_ANIMATIONS +#endif diff --git a/keyboards/ymdk/np24/u4rgb6/info.json b/keyboards/ymdk/np24/u4rgb6/info.json new file mode 100644 index 000000000..313eeabff --- /dev/null +++ b/keyboards/ymdk/np24/u4rgb6/info.json @@ -0,0 +1,102 @@ +{ + "keyboard_name": "YMDK NP24 U4 RGB6", + "maintainer": "qmk", + "width": 4, + "height": 6.25, + "layouts": { + "LAYOUT_ortho_6x4": { + "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": 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_ortho_4x6": { + "layout": [ + {"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": { + "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} + ] + } + } +} diff --git a/keyboards/ymdk/np24/u4rgb6/keymaps/default/keymap.c b/keyboards/ymdk/np24/u4rgb6/keymaps/default/keymap.c new file mode 100644 index 000000000..48ec3599d --- /dev/null +++ b/keyboards/ymdk/np24/u4rgb6/keymaps/default/keymap.c @@ -0,0 +1,49 @@ +/* Copyright 2021 Simon Arlott + * + * 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 . + */ +#include QMK_KEYBOARD_H + +enum layer_names { + L_NUM, + L_BL, + L_RGB +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [L_NUM] = LAYOUT_ortho_6x4( + KC_ESC, KC_CALC, MO(L_BL),MO(L_RGB), + 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_P0, KC_PDOT, KC_PENT + ), + [L_BL] = LAYOUT_ortho_6x4( + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, BL_ON, _______, BL_INC, + _______, BL_TOGG, _______, BL_INC, + _______, BL_OFF, _______, BL_DEC, + BL_BRTG, _______, _______, BL_DEC + ), + [L_RGB] = LAYOUT_ortho_6x4( + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, RGB_MOD, _______, RGB_VAI, + _______, RGB_TOG, _______, RGB_VAI, + _______, RGB_RMOD,_______, RGB_VAD, + RGB_M_R, _______, _______, RGB_VAD + ) +}; diff --git a/keyboards/ymdk/np24/u4rgb6/keymaps/default/readme.md b/keyboards/ymdk/np24/u4rgb6/keymaps/default/readme.md new file mode 100644 index 000000000..7bcf47f3a --- /dev/null +++ b/keyboards/ymdk/np24/u4rgb6/keymaps/default/readme.md @@ -0,0 +1,29 @@ +# The default keymap for the YMDK NP24 keypad + +Not the manufacturer default, which has F1, F2, F3, Fn on the top row. +The function layer for the top row was: RGB_MOD, BL_STEP, ______, ______. + +``` +Base Layer Function Layer 1 Function Layer 2 + .-----. .-----. .-----. + | USB | | USB | | USB | +,-------------------------------. ,-------------------------------. ,-------------------------------. +| Esc | Calc | Fn 1 | Fn 2 | | | |▒▒▒▒▒▒▒| | | | | |▒▒▒▒▒▒▒| +| | | | | | | |▒▒▒▒▒▒▒| | | | | |▒▒▒▒▒▒▒| +|-------+-------+-------+-------| |-------+-------+-------+-------| |-------+-------+-------+-------| +| Num | / | * | - | | | | | | | | | | | +| Lock | | | | | | | | | | | | | | +|-------+-------+-------+-------| |-------+-------+-------+-------| |-------+-------+-------+-------| +| 7 | 8 | 9 | + | | | BL | | BL | | |Mode | |Bright | +| Home | Up | PgUp | | | | On | | Inc | | |Forward| |Inc | +|-------+-------+-------+-------| |-------+-------+-------+-------| |-------+-------+-------+-------| +| 4 | 5 | 6 | + | | | BL | | BL | | |Toggle | |Bright | +| Left | | Right | | | | Togg | | Inc | | |On/Off | |Inc | +|-------+-------+-------+-------| |-------+-------+-------+-------| |-------+-------+-------+-------| +| 1 | 2 | 3 | Ent | | | BL | | BL | | |Mode | |Bright | +| End | Down | PgDn | | | | Off | | Dec | | |Back | |Dec | +|-------+-------+-------+-------| |-------+-------+-------+-------| |-------+-------+-------+-------| +| 0 | 0 | . | Ent | | BL | | | BL | |Mode | | |Bright | +| Ins | Ins | Del | | | Breath| | | Dec | |Rainbow| | |Dec | +`-------------------------------' `-------------------------------' `-------------------------------' +``` diff --git a/keyboards/ymdk/np24/u4rgb6/readme.md b/keyboards/ymdk/np24/u4rgb6/readme.md new file mode 100644 index 000000000..53e74f2de --- /dev/null +++ b/keyboards/ymdk/np24/u4rgb6/readme.md @@ -0,0 +1,18 @@ +# YMDK NP24 U4 RGB6 + +24 key number-pad with 6 RGB LEDs on the bottom (black PCB) sold by YMDK on Aliexpress (https://ymdk.aliexpress.com/store/429151). + +Not to be confused with the 8 RGB LED version (white PCB) that has an ATmega32A ("ymdk_np21"). + +* Keyboard Maintainer: [QMK Community](https://github.com/qmk) +* Hardware Supported: ATmega32U4 + +Make example for this keyboard (after setting up your build environment): + + make ymdk/np24/u4rgb6:default + +Flashing example for this keyboard: + + make ymdk/np24/u4rgb6: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). diff --git a/keyboards/ymdk/np24/u4rgb6/rules.mk b/keyboards/ymdk/np24/u4rgb6/rules.mk new file mode 100644 index 000000000..625a433f9 --- /dev/null +++ b/keyboards/ymdk/np24/u4rgb6/rules.mk @@ -0,0 +1,24 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = no # USB Nkey Rollover +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output + +LAYOUTS = ortho_6x4 numpad_6x4 ortho_4x6 diff --git a/keyboards/ymdk/np24/u4rgb6/u4rgb6.c b/keyboards/ymdk/np24/u4rgb6/u4rgb6.c new file mode 100644 index 000000000..edd0c0552 --- /dev/null +++ b/keyboards/ymdk/np24/u4rgb6/u4rgb6.c @@ -0,0 +1,16 @@ +/* Copyright 2021 Simon Arlott + * + * 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 . + */ +#include "u4rgb6.h" diff --git a/keyboards/ymdk/np24/u4rgb6/u4rgb6.h b/keyboards/ymdk/np24/u4rgb6/u4rgb6.h new file mode 100644 index 000000000..83ec48688 --- /dev/null +++ b/keyboards/ymdk/np24/u4rgb6/u4rgb6.h @@ -0,0 +1,67 @@ +/* Copyright 2017 Luiz Ribeiro + * Copyright 2021 Simon Arlott + * + * 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 . + */ +#pragma once + +#include "quantum.h" + +#define XXX KC_NO + +#define LAYOUT_ortho_6x4( \ + k00, k10, k20, k30, \ + k01, k11, k21, k31, \ + k02, k12, k22, k32, \ + k03, k13, k23, k33, \ + k04, k14, k24, k34, \ + k05, k15, k25, k35 \ +) { \ + { k00, k10, k20, k30 }, \ + { k01, k11, k21, k31 }, \ + { k02, k12, k22, k32 }, \ + { k03, k13, k23, k33 }, \ + { k04, k14, k24, k34 }, \ + { k05, k15, k25, k35 } \ +} + +#define LAYOUT_ortho_4x6( \ + k00, k01, k02, k03, k04, k05, \ + k10, k11, k12, k13, k14, k15, \ + k20, k21, k22, k23, k24, k25, \ + k30, k31, k32, k33, k34, k35 \ +) { \ + { k00, k10, k20, k30 }, \ + { k01, k11, k21, k31 }, \ + { k02, k12, k22, k32 }, \ + { k03, k13, k23, k33 }, \ + { k04, k14, k24, k34 }, \ + { k05, k15, k25, k35 } \ +} + +#define LAYOUT_numpad_6x4( \ + k00, k10, k20, k30, \ + k01, k11, k21, k31, \ + k02, k12, k22, \ + k03, k13, k23, k33, \ + k04, k14, k24, \ + k15, k25, k35 \ +) { \ + { k00, k10, k20, k30 }, \ + { k01, k11, k21, k31 }, \ + { k02, k12, k22, XXX }, \ + { k03, k13, k23, k33 }, \ + { k04, k14, k24, XXX }, \ + { XXX, k15, k25, k35 } \ +}