diff options
author | Nick Brassel <nick@tzarc.org> | 2020-03-05 07:26:25 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-05 07:26:25 +1100 |
commit | 607e2f6c310f2404933e791561912a0a35587aae (patch) | |
tree | 8eae614841491b53bf0383b16aa0ac38f76a0f85 | |
parent | 2d1081c29638cd84428c40502ab35461403b107e (diff) |
YD60MQ refactor and Configurator layout support (#8313)
* refactor yd60mq.h
- four-space indent
- use K<row><col> base32hex notation
- rename LAYOUT to LAYOUT_all (with alias for backwards compatibility)
* refactor yd60mq.c to use led_update_kb()
* align rules.mk to AVR template
* refactor default keymap
Also correct positions for KC_NUHS and KC_NUBS.
* update readme
* add Configurator layout support
* initialize the Caps Lock LED pin properly
-rw-r--r-- | keyboards/yd60mq/info.json | 83 | ||||
-rw-r--r-- | keyboards/yd60mq/keymaps/default/keymap.c | 32 | ||||
-rw-r--r-- | keyboards/yd60mq/readme.md | 15 | ||||
-rw-r--r-- | keyboards/yd60mq/rules.mk | 28 | ||||
-rw-r--r-- | keyboards/yd60mq/yd60mq.c | 23 | ||||
-rw-r--r-- | keyboards/yd60mq/yd60mq.h | 23 |
6 files changed, 148 insertions, 56 deletions
diff --git a/keyboards/yd60mq/info.json b/keyboards/yd60mq/info.json new file mode 100644 index 0000000000..79d5e9d981 --- /dev/null +++ b/keyboards/yd60mq/info.json @@ -0,0 +1,83 @@ +{ + "keyboard_name": "YD60MQ", + "url": "", + "maintainer": "qmk", + "width": 15, + "height": 5, + "layouts": { + "LAYOUT_all": { + "key_count": 69, + "layout": [ + {"label":"Esc", "x":0, "y":0}, + {"label":"1", "x":1, "y":0}, + {"label":"2", "x":2, "y":0}, + {"label":"3", "x":3, "y":0}, + {"label":"4", "x":4, "y":0}, + {"label":"5", "x":5, "y":0}, + {"label":"6", "x":6, "y":0}, + {"label":"7", "x":7, "y":0}, + {"label":"8", "x":8, "y":0}, + {"label":"9", "x":9, "y":0}, + {"label":"0", "x":10, "y":0}, + {"label":"-", "x":11, "y":0}, + {"label":"=", "x":12, "y":0}, + {"label":"\\", "x":13, "y":0}, + {"label":"`", "x":14, "y":0}, + {"label":"Tab", "x":0, "y":1, "w":1.5}, + {"label":"Q", "x":1.5, "y":1}, + {"label":"W", "x":2.5, "y":1}, + {"label":"E", "x":3.5, "y":1}, + {"label":"R", "x":4.5, "y":1}, + {"label":"T", "x":5.5, "y":1}, + {"label":"Y", "x":6.5, "y":1}, + {"label":"U", "x":7.5, "y":1}, + {"label":"I", "x":8.5, "y":1}, + {"label":"O", "x":9.5, "y":1}, + {"label":"P", "x":10.5, "y":1}, + {"label":"[", "x":11.5, "y":1}, + {"label":"]", "x":12.5, "y":1}, + {"label":"\\", "x":13.5, "y":1, "w":1.5}, + {"label":"Caps", "x":0, "y":2, "w":1.75}, + {"label":"A", "x":1.75, "y":2}, + {"label":"S", "x":2.75, "y":2}, + {"label":"D", "x":3.75, "y":2}, + {"label":"F", "x":4.75, "y":2}, + {"label":"G", "x":5.75, "y":2}, + {"label":"H", "x":6.75, "y":2}, + {"label":"J", "x":7.75, "y":2}, + {"label":"K", "x":8.75, "y":2}, + {"label":"L", "x":9.75, "y":2}, + {"label":";", "x":10.75, "y":2}, + {"label":"\"", "x":11.75, "y":2}, + {"label":"ISO Hash", "x":12.75, "y":2}, + {"label":"Enter", "x":13.75, "y":2, "w":1.25}, + {"label":"Shift", "x":0, "y":3}, + {"label":"ISO \\", "x":1, "y":3}, + {"label":"Z", "x":2, "y":3}, + {"label":"X", "x":3, "y":3}, + {"label":"C", "x":4, "y":3}, + {"label":"V", "x":5, "y":3}, + {"label":"B", "x":6, "y":3}, + {"label":"N", "x":7, "y":3}, + {"label":"M", "x":8, "y":3}, + {"label":",", "x":9, "y":3}, + {"label":".", "x":10, "y":3}, + {"label":"/", "x":11, "y":3}, + {"label":"Shift", "x":12, "y":3}, + {"label":"Up", "x":13, "y":3}, + {"label":"Del", "x":14, "y":3}, + {"label":"Ctrl", "x":0, "y":4, "w":1.25}, + {"label":"GUI", "x":1.25, "y":4, "w":1.25}, + {"label":"Alt", "x":2.5, "y":4, "w":1.25}, + {"label":"MO(1)", "x":3.75, "y":4, "w":2.25}, + {"label":"Space", "x":6, "y":4, "w":1.25}, + {"label":"MO(1)", "x":7.25, "y":4, "w":2.75}, + {"label":"Alt", "x":10, "y":4}, + {"label":"Ctrl", "x":11, "y":4}, + {"label":"Left", "x":12, "y":4}, + {"label":"Down", "x":13, "y":4}, + {"label":"Right", "x":14, "y":4} + ] + } + } +} diff --git a/keyboards/yd60mq/keymaps/default/keymap.c b/keyboards/yd60mq/keymaps/default/keymap.c index a5a0145eec..2ba4416262 100644 --- a/keyboards/yd60mq/keymaps/default/keymap.c +++ b/keyboards/yd60mq/keymaps/default/keymap.c @@ -2,24 +2,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - LAYOUT( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, - KC_LSFT, KC_NUHS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_DEL, - KC_LCTL, KC_LGUI, KC_LALT, MO(1), KC_SPC, MO(1), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + [0] = LAYOUT_all( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_DEL, + KC_LCTL, KC_LGUI, KC_LALT, MO(1), KC_SPC, MO(1), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), - LAYOUT( - RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_DEL, - KC_TRNS, RGB_TOG, KC_UP, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BL_DEC, BL_TOGG, BL_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + [1] = LAYOUT_all( + RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_DEL, + _______, RGB_TOG, KC_UP, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, + _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, BL_DEC, BL_TOGG, BL_INC, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), }; - -void matrix_init_user(void) { -} - -void matrix_scan_user(void) { -} diff --git a/keyboards/yd60mq/readme.md b/keyboards/yd60mq/readme.md index 78f442d889..0802c9d16f 100644 --- a/keyboards/yd60mq/readme.md +++ b/keyboards/yd60mq/readme.md @@ -1,20 +1,19 @@ -YD60MQ -====== +# YD60MQ ![YD60MQ PCB](https://ae01.alicdn.com/kf/HTB1PVQ2X_HuK1RkSndVq6xVwpXaO.jpg) Customizable 60% PCB by [YMDK](https://ymdk.aliexpress.com/store/429151?spm=2114.10010108.0.0.3ab23641lIkgzm). -Keyboard Maintainer: QMK Community -Hardware Supported: YD60MQ -Hardware Availability: YMDK - [AliExpress](https://www.aliexpress.com/item/YMDK-60-YD60MQ-QMK-Programmable-Underglow-RGB-Led-PCB-Plate-Stabilizers-For-DIY-Mechanical-Keyboard-Interchange/32869207240.html) +* Keyboard Maintainer: QMK Community +* Hardware Supported: YD60MQ PCB, ATmega32U4 +* Hardware Availability: [YMDK on AliExpress](https://www.aliexpress.com/i/32869207240.html) Make example for this keyboard (after setting up your build environment): make yd60mq:default -The keyboard uses a DFU bootloader. To make a keymap and use dfu-util to flash it: +The keyboard uses a DFU bootloader. To make a keymap and use dfu to flash it: - make yd60mq:default:dfu + make yd60mq:default:flash -See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. +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/yd60mq/rules.mk b/keyboards/yd60mq/rules.mk index c1f1f22ba3..5159ae59f7 100644 --- a/keyboards/yd60mq/rules.mk +++ b/keyboards/yd60mq/rules.mk @@ -12,15 +12,21 @@ MCU = atmega32u4 BOOTLOADER = atmel-dfu # Build Options -# comment out to disable the options. +# change yes to no to disable # -BOOTMAGIC_ENABLE = yes # 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 -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -AUDIO_ENABLE = no -RGBLIGHT_ENABLE = yes +BOOTMAGIC_ENABLE = yes # 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 = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +MIDI_ENABLE = no # MIDI support +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches +HD44780_ENABLE = no # Enable support for HD44780 based LCDs diff --git a/keyboards/yd60mq/yd60mq.c b/keyboards/yd60mq/yd60mq.c index 6e391046e5..a39af530d7 100644 --- a/keyboards/yd60mq/yd60mq.c +++ b/keyboards/yd60mq/yd60mq.c @@ -1,12 +1,19 @@ #include "yd60mq.h" -void led_set_kb(uint8_t usb_led) { - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { - setPinOutput(F4); - writePinLow(F4); - } else { - setPinInput(F4); - } +void matrix_init_kb(void){ + setPinOutput(F4); + writePinHigh(F4); +} - led_set_user(usb_led); +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if (res) { + // writePin sets the pin high for 1 and low for 0. + // In this example the pins are inverted, setting + // it low/0 turns it on, and high/1 turns the LED off. + // This behavior depends on whether the LED is between the pin + // and VCC or the pin and GND. + writePin(F4, !led_state.caps_lock); + } + return res; } diff --git a/keyboards/yd60mq/yd60mq.h b/keyboards/yd60mq/yd60mq.h index 5f5d8a2422..850cf8d22c 100644 --- a/keyboards/yd60mq/yd60mq.h +++ b/keyboards/yd60mq/yd60mq.h @@ -2,17 +2,18 @@ #include "quantum.h" -#define LAYOUT( \ - 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, K113, \ - K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, \ - K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, K314, \ - K400, K401, K402, K403, K407, K408, K409, K410, K411, K412, K413 \ +#define LAYOUT_all( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \ + K40, K41, K42, K43, K47, K48, K49, K4A, K4B, K4C, K4D \ ) { \ - { 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, K113, KC_NO }, \ - { K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, KC_NO }, \ - { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, K314 }, \ - { K400, K401, K402, K403, KC_NO, KC_NO, KC_NO, K407, K408, K409, K410, K411, K412, K413, KC_NO } \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, KC_NO }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, KC_NO }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \ + { K40, K41, K42, K43, KC_NO, KC_NO, KC_NO, K47, K48, K49, K4A, K4B, K4C, K4D, KC_NO } \ } +#define LAYOUT LAYOUT_all |