From ecbbdbcd4e585a9a6b2b47d1dd8e1e3e1d50a254 Mon Sep 17 00:00:00 2001 From: James Young <18669334+noroadsleft@users.noreply.github.com> Date: Sat, 13 Feb 2021 23:17:05 -0800 Subject: [PATCH] [Keyboard] YMDK YMD40 v2 (#11835) * [Keyboard] YMDK YMD40 v2 * fork default keymap into default and factory - factory keymap is as assigned by the extracted JSON provided by the vendor - default keymap is based on the Planck * add AUDIO_SUPPORTED rule per drashna * modify factory keymap's readme Recommend users copy the default keymap instead. --- keyboards/ymdk/ymd40/v2/config.h | 71 +++++++++++++++++++ keyboards/ymdk/ymd40/v2/info.json | 64 +++++++++++++++++ .../ymdk/ymd40/v2/keymaps/default/keymap.c | 55 ++++++++++++++ .../ymdk/ymd40/v2/keymaps/default/readme.md | 1 + .../ymdk/ymd40/v2/keymaps/factory/keymap.c | 32 +++++++++ .../ymdk/ymd40/v2/keymaps/factory/readme.md | 3 + keyboards/ymdk/ymd40/v2/readme.md | 22 ++++++ keyboards/ymdk/ymd40/v2/rules.mk | 28 ++++++++ keyboards/ymdk/ymd40/v2/v2.c | 17 +++++ keyboards/ymdk/ymd40/v2/v2.h | 31 ++++++++ 10 files changed, 324 insertions(+) create mode 100644 keyboards/ymdk/ymd40/v2/config.h create mode 100644 keyboards/ymdk/ymd40/v2/info.json create mode 100644 keyboards/ymdk/ymd40/v2/keymaps/default/keymap.c create mode 100644 keyboards/ymdk/ymd40/v2/keymaps/default/readme.md create mode 100644 keyboards/ymdk/ymd40/v2/keymaps/factory/keymap.c create mode 100644 keyboards/ymdk/ymd40/v2/keymaps/factory/readme.md create mode 100644 keyboards/ymdk/ymd40/v2/readme.md create mode 100644 keyboards/ymdk/ymd40/v2/rules.mk create mode 100644 keyboards/ymdk/ymd40/v2/v2.c create mode 100644 keyboards/ymdk/ymd40/v2/v2.h diff --git a/keyboards/ymdk/ymd40/v2/config.h b/keyboards/ymdk/ymd40/v2/config.h new file mode 100644 index 0000000000..926333f4e6 --- /dev/null +++ b/keyboards/ymdk/ymd40/v2/config.h @@ -0,0 +1,71 @@ +/* Copyright 2021 James Young (@noroadsleft) + * + * 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 // "YM" +#define PRODUCT_ID 0x4440 // "D" + 40 +#define DEVICE_VER 0x0001 +#define MANUFACTURER YMDK +#define PRODUCT YMD40 v2 + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 12 + +/* + * 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 { D0, B3, B2, B1 } +#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } + +#define DIODE_DIRECTION COL2ROW + +#define BACKLIGHT_PIN B6 +#define BACKLIGHT_BREATHING +#define BACKLIGHT_LEVELS 3 + +#if defined(RGBLIGHT_ENABLE) + #define RGB_DI_PIN E2 + #define RGBLED_NUM 8 + #define RGBLIGHT_HUE_STEP 8 + #define RGBLIGHT_SAT_STEP 8 + #define RGBLIGHT_VAL_STEP 8 + #define RGBLIGHT_LIMIT_VAL 150 /* 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 +#endif diff --git a/keyboards/ymdk/ymd40/v2/info.json b/keyboards/ymdk/ymd40/v2/info.json new file mode 100644 index 0000000000..7bb677e209 --- /dev/null +++ b/keyboards/ymdk/ymd40/v2/info.json @@ -0,0 +1,64 @@ +{ + "keyboard_name": "ymd40v2", + "url": "", + "maintainer": "qmk", + "width": 12, + "height": 4, + "layouts": { + "LAYOUT_ortho_4x12": { + "layout": [ + {"label":"K00 (D0,F1)", "x":0, "y":0}, + {"label":"K01 (D0,F0)", "x":1, "y":0}, + {"label":"K02 (D0,B0)", "x":2, "y":0}, + {"label":"K03 (D0,C7)", "x":3, "y":0}, + {"label":"K04 (D0,F4)", "x":4, "y":0}, + {"label":"K05 (D0,F5)", "x":5, "y":0}, + {"label":"K06 (D0,F6)", "x":6, "y":0}, + {"label":"K07 (D0,F7)", "x":7, "y":0}, + {"label":"K08 (D0,D4)", "x":8, "y":0}, + {"label":"K09 (D0,D6)", "x":9, "y":0}, + {"label":"K0A (D0,B4)", "x":10, "y":0}, + {"label":"K0B (D0,D7)", "x":11, "y":0}, + + {"label":"K10 (B3,F1)", "x":0, "y":1}, + {"label":"K11 (B3,F0)", "x":1, "y":1}, + {"label":"K12 (B3,B0)", "x":2, "y":1}, + {"label":"K13 (B3,C7)", "x":3, "y":1}, + {"label":"K14 (B3,F4)", "x":4, "y":1}, + {"label":"K15 (B3,F5)", "x":5, "y":1}, + {"label":"K16 (B3,F6)", "x":6, "y":1}, + {"label":"K17 (B3,F7)", "x":7, "y":1}, + {"label":"K18 (B3,D4)", "x":8, "y":1}, + {"label":"K19 (B3,D6)", "x":9, "y":1}, + {"label":"K1A (B3,B4)", "x":10, "y":1}, + {"label":"K1B (B3,D7)", "x":11, "y":1}, + + {"label":"K20 (B2,F1)", "x":0, "y":2}, + {"label":"K21 (B2,F0)", "x":1, "y":2}, + {"label":"K22 (B2,B0)", "x":2, "y":2}, + {"label":"K23 (B2,C7)", "x":3, "y":2}, + {"label":"K24 (B2,F4)", "x":4, "y":2}, + {"label":"K25 (B2,F5)", "x":5, "y":2}, + {"label":"K26 (B2,F6)", "x":6, "y":2}, + {"label":"K27 (B2,F7)", "x":7, "y":2}, + {"label":"K28 (B2,D4)", "x":8, "y":2}, + {"label":"K29 (B2,D6)", "x":9, "y":2}, + {"label":"K2A (B2,B4)", "x":10, "y":2}, + {"label":"K2B (B2,D7)", "x":11, "y":2}, + + {"label":"K30 (B1,F1)", "x":0, "y":3}, + {"label":"K31 (B1,F0)", "x":1, "y":3}, + {"label":"K32 (B1,B0)", "x":2, "y":3}, + {"label":"K33 (B1,C7)", "x":3, "y":3}, + {"label":"K34 (B1,F4)", "x":4, "y":3}, + {"label":"K35 (B1,F5)", "x":5, "y":3}, + {"label":"K36 (B1,F6)", "x":6, "y":3}, + {"label":"K37 (B1,F7)", "x":7, "y":3}, + {"label":"K38 (B1,D4)", "x":8, "y":3}, + {"label":"K39 (B1,D6)", "x":9, "y":3}, + {"label":"K3A (B1,B4)", "x":10, "y":3}, + {"label":"K3B (B1,D7)", "x":11, "y":3} + ] + } + } +} diff --git a/keyboards/ymdk/ymd40/v2/keymaps/default/keymap.c b/keyboards/ymdk/ymd40/v2/keymaps/default/keymap.c new file mode 100644 index 0000000000..10d9385cf0 --- /dev/null +++ b/keyboards/ymdk/ymd40/v2/keymaps/default/keymap.c @@ -0,0 +1,55 @@ +/* Copyright 2021 James Young (@noroadsleft) + * + * 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 { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT_ortho_4x12( + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, + KC_CAPS, KC_LCTL, KC_LALT, KC_LGUI, MO(1), KC_SPC, KC_SPC, MO(2), KC_UP, KC_LEFT, KC_DOWN, KC_RGHT + ), + [_LOWER] = LAYOUT_ortho_4x12( + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______, + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY + ), + [_RAISE] = LAYOUT_ortho_4x12( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______, + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY + ), + [_ADJUST] = LAYOUT_ortho_4x12( + RESET, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, _______, _______, _______, _______, DEBUG, + _______, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______, + _______, BL_TOGG, BL_DEC, BL_INC, BL_BRTG, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} diff --git a/keyboards/ymdk/ymd40/v2/keymaps/default/readme.md b/keyboards/ymdk/ymd40/v2/keymaps/default/readme.md new file mode 100644 index 0000000000..9528663547 --- /dev/null +++ b/keyboards/ymdk/ymd40/v2/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for YMD40 v2 diff --git a/keyboards/ymdk/ymd40/v2/keymaps/factory/keymap.c b/keyboards/ymdk/ymd40/v2/keymaps/factory/keymap.c new file mode 100644 index 0000000000..3c7de8bc6a --- /dev/null +++ b/keyboards/ymdk/ymd40/v2/keymaps/factory/keymap.c @@ -0,0 +1,32 @@ +/* Copyright 2021 James Young (@noroadsleft) + * + * 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 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_ortho_4x12( + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, + KC_CAPS, KC_LCTL, KC_LALT, KC_LGUI, KC_DEL, KC_SPC, KC_SPC, RGB_MOD, KC_UP, KC_LEFT, KC_DOWN, KC_RGHT + ), + [1] = LAYOUT_ortho_4x12( + RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), +}; diff --git a/keyboards/ymdk/ymd40/v2/keymaps/factory/readme.md b/keyboards/ymdk/ymd40/v2/keymaps/factory/readme.md new file mode 100644 index 0000000000..9233961656 --- /dev/null +++ b/keyboards/ymdk/ymd40/v2/keymaps/factory/readme.md @@ -0,0 +1,3 @@ +# The factory keymap for YMD40 v2 + +This is the keymap assigned by the KBFirmware-format JSON file distributed by the vendor. This is included mainly for reference; if you wish to create your own keymap, the `default` keymap is a better starting point. diff --git a/keyboards/ymdk/ymd40/v2/readme.md b/keyboards/ymdk/ymd40/v2/readme.md new file mode 100644 index 0000000000..153853c9f5 --- /dev/null +++ b/keyboards/ymdk/ymd40/v2/readme.md @@ -0,0 +1,22 @@ +# YMD40 v2 + +![YMD40 v2](https://raw.githubusercontent.com/noroadsleft/qmk_images/master/keyboards/ymdk/ymd40/v2/ymdk_ymd40_v2_00.jpg)\ +[PCB photo](https://raw.githubusercontent.com/noroadsleft/qmk_images/master/keyboards/ymdk/ymd40/v2/ymdk_ymd40_v2_pcb.jpg) + +A 40% ortholinear keyboard with in-switch LED support, underglow, and USB Type C. + +* Keyboard Maintainer: [The QMK Community](https://github.com/qmk) +* Hardware Supported: YMD40v2 PCB (ATmega32U4) +* Hardware Availability: [AliExpress](https://www.aliexpress.com/i/32821953148.html), [ymdkey.com](https://ymdkey.com/collections/40-mini-diy/products/ymd40-v2-diy-kit-qmk-type-c-pcb-cnc-case-plate-for-40-mini-cute-mechanical-keyboard-similar-to-planck-layout) + +Make example for this keyboard (after setting up your build environment): + + make ymdk/ymd40/v2:default + +Flashing example for this keyboard: + + make ymdk/ymd40/v2:default:flash + +To reset the board into bootloader mode, hold the key at the top left of the keyboard while connecting the USB cable (also erases persistent settings). + +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/ymd40/v2/rules.mk b/keyboards/ymdk/ymd40/v2/rules.mk new file mode 100644 index 0000000000..7c7c443c9d --- /dev/null +++ b/keyboards/ymdk/ymd40/v2/rules.mk @@ -0,0 +1,28 @@ +# 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 = yes # 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 + +KEY_LOCK_ENABLE = no # Enable KC_LOCK support + +AUDIO_SUPPORTED = no + +LAYOUTS = ortho_4x12 diff --git a/keyboards/ymdk/ymd40/v2/v2.c b/keyboards/ymdk/ymd40/v2/v2.c new file mode 100644 index 0000000000..54450ccd15 --- /dev/null +++ b/keyboards/ymdk/ymd40/v2/v2.c @@ -0,0 +1,17 @@ +/* Copyright 2021 James Young (@noroadsleft) + * + * 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 "v2.h" diff --git a/keyboards/ymdk/ymd40/v2/v2.h b/keyboards/ymdk/ymd40/v2/v2.h new file mode 100644 index 0000000000..6d524e0735 --- /dev/null +++ b/keyboards/ymdk/ymd40/v2/v2.h @@ -0,0 +1,31 @@ +/* Copyright 2021 James Young (@noroadsleft) + * + * 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 LAYOUT_ortho_4x12( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B }, \ +}