Skip to content

Commit

Permalink
Keyboard: Add YMD96 instructions for Linux + Backlight Fixes (qmk#3908)
Browse files Browse the repository at this point in the history
* Add flashing instructions for Linux

* Make device/manufacturer name consistent for ymd96

* Disable command mode by default for YMD96

* Add function call to fix backlight for YMD96

* Add personal YMD96 config

* Replace include with QMK macro

* Move KEYMAP macro to keymap-level folder

* Move custom KEYMAP macro to global LAYOUT_iso macro

* Change transparent keymappings to global definition

* Remove unecessary import and change to pragma once

 - (instead of repeated ifdef)

* Remove global keymap/layout definition
  • Loading branch information
AnthonyWharton authored and yamad committed Mar 21, 2019
1 parent 6185499 commit 4bda5b4
Show file tree
Hide file tree
Showing 9 changed files with 159 additions and 24 deletions.
18 changes: 12 additions & 6 deletions keyboards/ymd96/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,23 @@ This firmware was modified from [ps2avrGB](https://github.com/qmk/qmk_firmware/t

## Installing and Building

Since the YMD96 uses an ATmega32a chip instead of the 32u4, you need to download [HIDBootFlash v.1.0](http://vusb.wikidot.com/project:hidbootflash) for Windows. If anyone knows of a Linux/Mac bootflasher that works, edit this readme!
Since the YMD96 uses an ATmega32a chip instead of the 32u4, you need to download [HIDBootFlash v.1.0](http://vusb.wikidot.com/project:hidbootflash) for Windows. For Linux you can use the [bootloadHID](https://www.obdev.at/products/vusb/bootloadhid.html) utility (which will require building). Arch Linux users can alternatively install this from the [AUR](https://aur.archlinux.org/packages/bootloadhid/).
On Windows, I use [MINGw](http://www.mingw.org/) to compile the keymaps. On Linux, you can simply use the terminal.

Once you have those two pieces of software:
Build the keyboard with
Build the keyboard by navigating to the root folder of the QMK repo and running
```
$ make ymd96-default
```
If you make your own layout, change the `default` word to whatever your layout is.
$ make ymd96:default
```
If you make your own layout, change the `default` word to whatever your layout is.

And flash the compiled hex file with `HIDBootFlash`. Simply put the board in flashing mode by plugging it in while holding control, and click `find device`. Then you can specify the .hex file and flash it to the device.
To flash the compiled hex file, simply put the board in flashing mode by plugging it in while holding control.
In `HIDBootFlash` first click `find device`, then you can specify the .hex file and flash it to the device.
For `bootloadHID`, from a terminal that is in the same folder as your firmware file, run
```
$ sudo bootloadHID ymd96_default.hex
```
Again replacing default with your custom keymap name if required.

## Troubleshooting

Expand Down
1 change: 0 additions & 1 deletion keyboards/ymd96/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#define VENDOR_ID 0x20A0
#define PRODUCT_ID 0x422D
// TODO: share these strings with usbconfig.h
// Edit usbconfig.h to change these.
#define MANUFACTURER ymdkey
#define PRODUCT ymd96
Expand Down
16 changes: 16 additions & 0 deletions keyboards/ymd96/keymaps/AnthonyWharton/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Personal Config by @AnthonyWharton

The keymap and layout macro's in the main repository are for the following
keyboard:

![@AnthonyWharton's YMD96](https://i.imgur.com/uhKmkBz.jpg)

**Note:** This setup has locking Caps Lock and Num Lock keys, so if you wish
to use this layout and do not have such keys, you should :

- Change the keys `KC_LCAP` and `KC_LNUM` to `KC_CAPS` and `KC_NUMLOCK`
respectively.
- Remove the `LOCKING_SUPPORT_ENABLE` and `LOCKING_RESYNC_ENABLE` lines
from `config.h`.

For any other questions, find my latest contact information on my github page.
62 changes: 62 additions & 0 deletions keyboards/ymd96/keymaps/AnthonyWharton/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
Base Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
Modified 2017 Andrew Novak <ndrw.nvk@gmail.com>
Modified 2018 Anthony Wharton <th3ant@gmail.com>
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 <http://www.gnu.org/licenses/>.
*/

#pragma once

#define VENDOR_ID 0x20A0
#define PRODUCT_ID 0x422D
// Edit usbconfig.h to change these.
#define MANUFACTURER ymdkey
#define PRODUCT ymd96

/* Matrix Size */
#define MATRIX_ROWS 8
#define MATRIX_COLS 15
#define DIODE_DIRECTION COL2ROW

/* Required for MX Locks installed */
#define LOCKING_SUPPORT_ENABLE
#define LOCKING_RESYNC_ENABLE

#define PREVENT_STUCK_MODIFIERS
#define TAPPING_TOGGLE 3
#define NO_UART 1

#define BACKLIGHT_LEVELS 12

/* RGB Underglow */
// The RGB_DI_PING value seems to be shared between all PS2AVRGB boards.
// The same pin is used on the JJ40, at least.
#define RGBLED_NUM 18
#define RGB_DI_PIN E2 // NOTE: for PS2AVRGB boards, underglow commands are send
// via I2C to 0xB0

#define RGBLIGHT_ANIMATIONS

#define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1.0-2.7
#define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 1-255
#define RGBLIGHT_EFFECT_SNAKE_LENGTH 7
#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3
#define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0
#define RGBLIGHT_EFFECT_KNIGHT_LED_NUM RGBLED_NUM
#define RGBLIGHT_EFFECT_CHRISTMAS_STEP 1
#define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 500

/* key combination for command */
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
47 changes: 47 additions & 0 deletions keyboards/ymd96/keymaps/AnthonyWharton/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
Base Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
Modified 2017 Andrew Novak <ndrw.nvk@gmail.com>
Modified 2018 Anthony Wharton <th3ant@gmail.com>
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 LicensezZZ
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include QMK_KEYBOARD_H

#define _DEFLT 0
#define _RAISE 1


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

/* Layer 0, default layer */
[_DEFLT] = LAYOUT_iso(
KC_ESC, 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_PSCR, KC_HOME, KC_END, KC_INS, KC_DEL, KC_PGUP, \
KC_GRV, 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_BSPC, KC_LNUM, KC_PSLS, KC_PAST, KC_PGDN, \
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_ENT, KC_P7, KC_P8, KC_P9, KC_PMNS, \
KC_LCAP, 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_P4, KC_P5, KC_P6, KC_PPLS, \
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_P1, KC_P2, KC_P3, KC_PENT, \
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_RAISE), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT \
),

/* Layer 1, raise layer */
[_RAISE] = LAYOUT_iso(
_______, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, _______, KC_PAUS, KC_SLCK, _______, _______, _______, \
_______, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW,RGB_M_SN,RGB_M_K, RGB_M_X, RGB_M_G, BL_OFF, BL_ON, BL_DEC, BL_INC, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAD, RGB_VAI, KC_MUTE, _______, KC_VOLU, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, BL_TOGG, KC_MPRV, KC_MPLY, KC_MNXT, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, _______, KC_VOLD, _______, KC_LOCK, \
_______, _______, KC_RALT, _______, _______, _______, KC_HOME, KC_PGDN, KC_END, _______, _______ \
)
};
12 changes: 0 additions & 12 deletions keyboards/ymd96/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,8 @@ void matrix_init(void) {
matrix[row] = 0x00;
matrix_debouncing[row] = 0x00;
}
/*}

matrix_init_quantum(); // missing from original port by Luiz
void matrix_set_row_status(uint8_t row) {
DDRB = (1 << row);
PORTB = ~(1 << row);
}*/


/*uint8_t bit_reverse(uint8_t x) {
x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
return x;*/
}

uint8_t matrix_scan(void) {
Expand Down
2 changes: 1 addition & 1 deletion keyboards/ymd96/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ BOOTMAGIC_ENABLE = no
MOUSEKEY_ENABLE = no
EXTRAKEY_ENABLE = yes
CONSOLE_ENABLE = no
COMMAND_ENABLE = yes
COMMAND_ENABLE = no

BACKLIGHT_ENABLE = yes
BACKLIGHT_CUSTOM_DRIVER = yes
Expand Down
8 changes: 4 additions & 4 deletions keyboards/ymd96/usbconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ section at the end of this file).
#define USB_CFG_DEVICE_VERSION 0x00, 0x02
/* Version number of the device: Minor number first, then major number.
*/
#define USB_CFG_VENDOR_NAME 'w', 'i', 'n', 'k', 'e', 'y', 'l', 'e', 's', 's', '.', 'k', 'r'
#define USB_CFG_VENDOR_NAME_LEN 13
#define USB_CFG_VENDOR_NAME 'y','m','d','k','e','y'
#define USB_CFG_VENDOR_NAME_LEN 6
/* These two values define the vendor name returned by the USB device. The name
* must be given as a list of characters under single quotes. The characters
* are interpreted as Unicode (UTF-16) entities.
Expand All @@ -252,8 +252,8 @@ section at the end of this file).
* obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
* details.
*/
#define USB_CFG_DEVICE_NAME 'p', 's', '2', 'a', 'v', 'r', 'G', 'B'
#define USB_CFG_DEVICE_NAME_LEN 8
#define USB_CFG_DEVICE_NAME 'y','m','d','9','6'
#define USB_CFG_DEVICE_NAME_LEN 5
/* Same as above for the device name. If you don't want a device name, undefine
* the macros. See the file USB-IDs-for-free.txt before you assign a name if
* you use a shared VID/PID.
Expand Down
17 changes: 17 additions & 0 deletions keyboards/ymd96/ymd96.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,22 @@ K411, K410, K409, K408, K404, K405, K406, K407, K403, K402, K401, K400 \
{ K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411 }, \
}

#define LAYOUT_iso( \
K0500, K0502, K0503, K0504, K0505, K0600, K0610, K0710, K0700, K0511, K0512, K0513, K0514, K0113, K0214, K0013, K0706, K0709, K0708, \
K0400, K0401, K0402, K0403, K0404, K0405, K0601, K0611, K0711, K0701, K0410, K0411, K0412, K0414, K0406, K0407, K0408, K0409, \
K0300, K0301, K0302, K0303, K0304, K0305, K0602, K0612, K0712, K0702, K0310, K0311, K0312, K0213, K0306, K0307, K0308, K0309, \
K0200, K0201, K0202, K0203, K0204, K0205, K0603, K0613, K0713, K0703, K0210, K0211, K0212, K0206, K0207, K0208, K0209, \
K0100, K0003, K0101, K0102, K0103, K0104, K0105, K0604, K0614, K0714, K0704, K0110, K0111, K0608, K0106, K0107, K0108, K0009, \
K0000, K0001, K0002, K0605, K0705, K0011, K0606, K0607, K0609, K0006, K0008 \
) { \
{ K0000, K0001, K0002, K0003, KC_NO, KC_NO, K0006, KC_NO, K0008, K0009, KC_NO, K0011, KC_NO, K0013, KC_NO, }, \
{ K0100, K0101, K0102, K0103, K0104, K0105, K0106, K0107, K0108, KC_NO, K0110, K0111, KC_NO, K0113, KC_NO, }, \
{ K0200, K0201, K0202, K0203, K0204, K0205, K0206, K0207, K0208, K0209, K0210, K0211, K0212, K0213, K0214, }, \
{ K0300, K0301, K0302, K0303, K0304, K0305, K0306, K0307, K0308, K0309, K0310, K0311, K0312, KC_NO, KC_NO, }, \
{ K0400, K0401, K0402, K0403, K0404, K0405, K0406, K0407, K0408, K0409, K0410, K0411, K0412, KC_NO, K0414, }, \
{ K0500, KC_NO, K0502, K0503, K0504, K0505, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K0511, K0512, K0513, K0514, }, \
{ K0600, K0601, K0602, K0603, K0604, K0605, K0606, K0607, K0608, K0609, K0610, K0611, K0612, K0613, K0614, }, \
{ K0700, K0701, K0702, K0703, K0704, K0705, K0706, KC_NO, K0708, K0709, K0710, K0711, K0712, K0713, K0714 } \
}

#endif

0 comments on commit 4bda5b4

Please sign in to comment.