From 1522d97c2b74577780fe97a52079d0ab68902ed5 Mon Sep 17 00:00:00 2001 From: Jared Hendry Date: Sun, 19 Apr 2020 19:58:58 -0400 Subject: [PATCH] Add support for YMD75 rev 2 (#8853) --- keyboards/ymd75/README.md | 10 ++--- keyboards/ymd75/config.h | 7 +-- keyboards/ymd75/keymaps/default/keymap.c | 12 ++--- keyboards/ymd75/rev1/config.h | 27 ++++++++++++ keyboards/ymd75/rev1/rev1.c | 34 ++++++++++++++ keyboards/ymd75/rev1/rev1.h | 39 +++++++++++++++++ keyboards/ymd75/rev1/rules.mk | 15 +++++++ keyboards/ymd75/rev2/config.h | 8 ++++ keyboards/ymd75/rev2/rev2.c | 34 ++++++++++++++ keyboards/ymd75/rev2/rev2.h | 18 ++++++++ keyboards/ymd75/rev2/rules.mk | 15 +++++++ keyboards/ymd75/rules.mk | 18 +------- keyboards/ymd75/ymd75.c | 33 -------------- keyboards/ymd75/ymd75.h | 56 +++--------------------- 14 files changed, 208 insertions(+), 118 deletions(-) create mode 100644 keyboards/ymd75/rev1/config.h create mode 100644 keyboards/ymd75/rev1/rev1.c create mode 100644 keyboards/ymd75/rev1/rev1.h create mode 100644 keyboards/ymd75/rev1/rules.mk create mode 100644 keyboards/ymd75/rev2/config.h create mode 100644 keyboards/ymd75/rev2/rev2.c create mode 100644 keyboards/ymd75/rev2/rev2.h create mode 100644 keyboards/ymd75/rev2/rules.mk diff --git a/keyboards/ymd75/README.md b/keyboards/ymd75/README.md index 9a618c594..7c4779c9f 100644 --- a/keyboards/ymd75/README.md +++ b/keyboards/ymd75/README.md @@ -1,19 +1,19 @@ # YMD75 / MT84 -75% keyboard from YMDK. YMDK sell the board and name it "YMD75", however the PCB has "MT84" printed on both sides. +75% keyboard from YMDK. YMDK sell the board and name it "YMD75", however revision 1 of the PCB has "MT84" printed on both sides. * Keyboard Maintainer: [Wayne K Jones](github.com/WarmCatUK) -* Hardware Supported: YMD75/MT84 with the ATmega32a chip. +* Hardware Supported: YMD75/MT84 (rev1 and rev2) with the ATmega32a chip. * Hardware Availability: Make example for this keyboard (after setting up your build environment): - make ymd75:default + make ymd75/rev1:default Flashing example for this keyboard ([after setting up the bootloadHID flashing environment](https://docs.qmk.fm/#/flashing_bootloadhid)) - make ymd75:default:flash + make ymd75/rev1:default:flash -**Reset Key**: Hold down the key located at *Key below the top right key*, commonly programmed as *Backspace* while plugging in the keyboard. +**Reset Key**: Hold down the key located at *Key below the top right key*, commonly programmed as *Backspace* while plugging in the keyboard. On PCB revision 2, enter the bootloader by holding `L_CTRL` while plugging in the keyboard. 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/ymd75/config.h b/keyboards/ymd75/config.h index 8aa2bba41..0ea23bc46 100644 --- a/keyboards/ymd75/config.h +++ b/keyboards/ymd75/config.h @@ -24,16 +24,11 @@ along with this program. If not, see . #define VENDOR_ID 0x20A0 #define PRODUCT_ID 0x422D #define DEVICE_VER 0x0200 + #define MANUFACTURER YMDK #define PRODUCT YMD75 / MT84 #define DESCRIPTION 75% Keyboard -/* matrix size */ -#define MATRIX_ROWS 8 -#define MATRIX_COLS 15 -#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 } -#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 } -#define DIODE_DIRECTION COL2ROW #define BACKLIGHT_PIN D4 #define BACKLIGHT_LEVELS 12 diff --git a/keyboards/ymd75/keymaps/default/keymap.c b/keyboards/ymd75/keymaps/default/keymap.c index 17c5244bd..2b6412468 100644 --- a/keyboards/ymd75/keymaps/default/keymap.c +++ b/keyboards/ymd75/keymaps/default/keymap.c @@ -82,12 +82,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { switch(keycode) { case P_MACRO: - SEND_STRING(SS_DOWN(X_LALT)); - SEND_STRING(SS_TAP(X_KP_1)); - SEND_STRING(SS_TAP(X_KP_5)); - SEND_STRING(SS_TAP(X_KP_6)); - SEND_STRING(SS_UP(X_LALT)); - return false; break; + register_code(KC_LALT); + tap_code(KC_KP_1); + tap_code(KC_KP_5); + tap_code(KC_KP_6); + unregister_code(KC_LALT); + return false; } } return true; diff --git a/keyboards/ymd75/rev1/config.h b/keyboards/ymd75/rev1/config.h new file mode 100644 index 000000000..e9009ee0e --- /dev/null +++ b/keyboards/ymd75/rev1/config.h @@ -0,0 +1,27 @@ +/* +Base Copyright 2017 Luiz Ribeiro +Modified 2017 Andrew Novak +Modified 2018 Wayne Jones (WarmCatUK) + +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 + +/* matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 15 +#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 } +#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 } +#define DIODE_DIRECTION COL2ROW diff --git a/keyboards/ymd75/rev1/rev1.c b/keyboards/ymd75/rev1/rev1.c new file mode 100644 index 000000000..0870a6cc0 --- /dev/null +++ b/keyboards/ymd75/rev1/rev1.c @@ -0,0 +1,34 @@ +/* +Copyright 2017 Luiz Ribeiro + +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 "ymd75.h" + +void keyboard_pre_init_kb(void) { + led_init_ports(); + keyboard_pre_init_user(); +} + +void led_init_ports(void) { + setPinOutput(D1); +} + +bool led_update_kb(led_t led_state) { + if (led_update_user(led_state)) { + writePin(D1, led_state.caps_lock); + } + return true; +} diff --git a/keyboards/ymd75/rev1/rev1.h b/keyboards/ymd75/rev1/rev1.h new file mode 100644 index 000000000..0a426ffa5 --- /dev/null +++ b/keyboards/ymd75/rev1/rev1.h @@ -0,0 +1,39 @@ +/* +Base Copyright 2017 Luiz Ribeiro +Modified 2017 Andrew Novak +Modified 2018 Wayne Jones (WarmCatUK) + +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( \ +K05, K25, K35, K45, K55, K06, KA6, KA7, K07, KB5, KC5, KD5, KE5, KD1, KE1, KE2, \ +K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, KD0, \ +K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, KC3, KD3, K67, \ +K02, K12, K22, K32, K42, K52, K36, KD6, KD7, K37, KA2, KB2, KD2, KE0, \ +K01, K11, K21, K31, K41, K51, K46, KE6, KE7, K47, KA1, KB1, K86, K77, \ +K00, K10, K20, K56, K57, KB0, KC0, K96, K76, K66 \ +){ \ +{ K00, K10, K20, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KB0, KC0, KD0, KC_NO }, \ +{ K01, K11, K21, K31, K41, K51, KC_NO, KC_NO, KC_NO, KC_NO, KA1, KB1, KC_NO, KD1, KE1 }, \ +{ K02, K12, K22, K32, K42, K52, KC_NO, KC_NO, KC_NO, KC_NO, KA2, KB2, KC_NO, KD2, KE2 }, \ +{ K03, K13, K23, K33, K43, K53, KC_NO, KC_NO, KC_NO, KC_NO, KA3, KB3, KC3, KD3, KC_NO }, \ +{ K04, K14, K24, K34, K44, K54, KC_NO, KC_NO, KC_NO, KC_NO, KA4, KB4, KC4, KC_NO, KE4 }, \ +{ K05, KC_NO, K25, K35, K45, K55, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KB5, KC5, KD5, KE5 }, \ +{ K06, K16, K26, K36, K46, K56, K66, K76, K86, K96, KA6, KB6, KC6, KD6, KE6 }, \ +{ K07, K17, K27, K37, K47, K57, K67, K77, KE0, KC_NO, KA7, KB7, KC7, KD7, KE7 } \ +} diff --git a/keyboards/ymd75/rev1/rules.mk b/keyboards/ymd75/rev1/rules.mk new file mode 100644 index 000000000..66ffbb499 --- /dev/null +++ b/keyboards/ymd75/rev1/rules.mk @@ -0,0 +1,15 @@ +# build options +BOOTMAGIC_ENABLE = yes +MOUSEKEY_ENABLE = no +EXTRAKEY_ENABLE = yes +CONSOLE_ENABLE = no +COMMAND_ENABLE = yes +BACKLIGHT_ENABLE = yes +RGBLIGHT_ENABLE = yes +WS2812_DRIVER = i2c +NKRO_ENABLE = no +# Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work + +KEY_LOCK_ENABLE = yes +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend diff --git a/keyboards/ymd75/rev2/config.h b/keyboards/ymd75/rev2/config.h new file mode 100644 index 000000000..9718b19dd --- /dev/null +++ b/keyboards/ymd75/rev2/config.h @@ -0,0 +1,8 @@ +#pragma once + +/* matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 15 +#define MATRIX_ROW_PINS { B7, B6, B5, B4, B3, B0 } +#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 } +#define DIODE_DIRECTION COL2ROW diff --git a/keyboards/ymd75/rev2/rev2.c b/keyboards/ymd75/rev2/rev2.c new file mode 100644 index 000000000..0870a6cc0 --- /dev/null +++ b/keyboards/ymd75/rev2/rev2.c @@ -0,0 +1,34 @@ +/* +Copyright 2017 Luiz Ribeiro + +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 "ymd75.h" + +void keyboard_pre_init_kb(void) { + led_init_ports(); + keyboard_pre_init_user(); +} + +void led_init_ports(void) { + setPinOutput(D1); +} + +bool led_update_kb(led_t led_state) { + if (led_update_user(led_state)) { + writePin(D1, led_state.caps_lock); + } + return true; +} diff --git a/keyboards/ymd75/rev2/rev2.h b/keyboards/ymd75/rev2/rev2.h new file mode 100644 index 000000000..b2dd7b8e1 --- /dev/null +++ b/keyboards/ymd75/rev2/rev2.h @@ -0,0 +1,18 @@ +#pragma once +#include "quantum.h" + +#define LAYOUT( \ + K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, K514, \ + K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K114, K513, \ + K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214, \ + K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K313, K314, \ + K400, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, K414, \ + K500, K501, K502, K505, K506, K507, K508, K509, K510, K511 \ +) { \ + { K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \ + { K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, KC_NO, K114 }, \ + { K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214 }, \ + { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, KC_NO, K313, K314 }, \ + { K400, KC_NO, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, K414 }, \ + { K500, K501, K502, KC_NO, KC_NO, K505, K506, K507, K508, K509, K510, K511, KC_NO, K513, K514 } \ +} diff --git a/keyboards/ymd75/rev2/rules.mk b/keyboards/ymd75/rev2/rules.mk new file mode 100644 index 000000000..66ffbb499 --- /dev/null +++ b/keyboards/ymd75/rev2/rules.mk @@ -0,0 +1,15 @@ +# build options +BOOTMAGIC_ENABLE = yes +MOUSEKEY_ENABLE = no +EXTRAKEY_ENABLE = yes +CONSOLE_ENABLE = no +COMMAND_ENABLE = yes +BACKLIGHT_ENABLE = yes +RGBLIGHT_ENABLE = yes +WS2812_DRIVER = i2c +NKRO_ENABLE = no +# Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work + +KEY_LOCK_ENABLE = yes +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend diff --git a/keyboards/ymd75/rules.mk b/keyboards/ymd75/rules.mk index 9d584b2b4..437f9f4a5 100644 --- a/keyboards/ymd75/rules.mk +++ b/keyboards/ymd75/rules.mk @@ -11,20 +11,4 @@ MCU = atmega32a # ATmega328P USBasp BOOTLOADER = bootloadHID -# build options -BOOTMAGIC_ENABLE = yes -MOUSEKEY_ENABLE = no -EXTRAKEY_ENABLE = yes -CONSOLE_ENABLE = no -COMMAND_ENABLE = yes -BACKLIGHT_ENABLE = yes -RGBLIGHT_ENABLE = yes -WS2812_DRIVER = i2c -NKRO_ENABLE = no -# Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work - -DISABLE_WS2812 = no - -KEY_LOCK_ENABLE = yes -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +DEFAULT_FOLDER = ymd75/rev1 diff --git a/keyboards/ymd75/ymd75.c b/keyboards/ymd75/ymd75.c index 0870a6cc0..2fca021f7 100644 --- a/keyboards/ymd75/ymd75.c +++ b/keyboards/ymd75/ymd75.c @@ -1,34 +1 @@ -/* -Copyright 2017 Luiz Ribeiro - -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 "ymd75.h" - -void keyboard_pre_init_kb(void) { - led_init_ports(); - keyboard_pre_init_user(); -} - -void led_init_ports(void) { - setPinOutput(D1); -} - -bool led_update_kb(led_t led_state) { - if (led_update_user(led_state)) { - writePin(D1, led_state.caps_lock); - } - return true; -} diff --git a/keyboards/ymd75/ymd75.h b/keyboards/ymd75/ymd75.h index 0c9fff58c..afeb09567 100644 --- a/keyboards/ymd75/ymd75.h +++ b/keyboards/ymd75/ymd75.h @@ -1,55 +1,9 @@ -/* -Base Copyright 2017 Luiz Ribeiro -Modified 2017 Andrew Novak -Modified 2018 Wayne Jones (WarmCatUK) - -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 . -*/ - -#ifndef KEYMAP_COMMON_H -#define KEYMAP_COMMON_H +#pragma once #include "quantum.h" -#include "quantum_keycodes.h" -#include "keycode.h" -#include "action.h" - -#define LAYOUT( \ -K05, K25, K35, K45, K55, K06, KA6, KA7, K07, KB5, KC5, KD5, KE5, KD1, KE1, KE2, \ -K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, KD0, \ -K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, KC3, KD3, K67, \ -K02, K12, K22, K32, K42, K52, K36, KD6, KD7, K37, KA2, KB2, KD2, KE0, \ -K01, K11, K21, K31, K41, K51, K46, KE6, KE7, K47, KA1, KB1, K86, K77, \ -K00, K10, K20, K56, K57, KB0, KC0, K96, K76, K66 \ -){ \ -{ K00, K10, K20, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KB0, KC0, KD0, KC_NO }, \ -{ K01, K11, K21, K31, K41, K51, KC_NO, KC_NO, KC_NO, KC_NO, KA1, KB1, KC_NO, KD1, KE1 }, \ -{ K02, K12, K22, K32, K42, K52, KC_NO, KC_NO, KC_NO, KC_NO, KA2, KB2, KC_NO, KD2, KE2 }, \ -{ K03, K13, K23, K33, K43, K53, KC_NO, KC_NO, KC_NO, KC_NO, KA3, KB3, KC3, KD3, KC_NO }, \ -{ K04, K14, K24, K34, K44, K54, KC_NO, KC_NO, KC_NO, KC_NO, KA4, KB4, KC4, KC_NO, KE4 }, \ -{ K05, KC_NO, K25, K35, K45, K55, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KB5, KC5, KD5, KE5 }, \ -{ K06, K16, K26, K36, K46, K56, K66, K76, K86, K96, KA6, KB6, KC6, KD6, KE6 }, \ -{ K07, K17, K27, K37, K47, K57, K67, K77, KE0, KC_NO, KA7, KB7, KC7, KD7, KE7 } \ -} +#if defined(KEYBOARD_ymd75_rev1) + #include "rev1.h" +#elif defined(KEYBOARD_ymd75_rev2) + #include "rev2.h" #endif - - - - - - - - -