~ruther/qmk_firmware

26ce66e30675ebc785ac3e2e6bd1deeb479cb7e1 — Rys Sommefeldt 5 years ago c1970e2
[Keyboard] Update COD67 support to complete it and add a personal map (#7291)

* Update docs for default keymap

* Update COD67 docs with fixes and macOS details

* Add a personal COD67 2-layer map with RGB control

* Enable RGB, NKRO and change firmware format to bin

* Swap k0D and k48 to fix backspace on the top row

* Add RGB config and tidy up a bit

* Finish default map because merlin was full of bbq

* Whoops, rogue tabs

* Typo fix in the main COD67 readme

* Remove empty function defs in keymap

* Swap how the backspace key relocation happens

* Fix PRODUCT_ID and add a link to software PWM docs

* Disable NKRO and bootmagic and enable mouse keys

* Better header guard

* Whoops, forgot to remote the #endif
M keyboards/gray_studio/cod67/cod67.h => keyboards/gray_studio/cod67/cod67.h +2 -2
@@ 19,11 19,11 @@
#include "quantum.h"

#define LAYOUT( \
  K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
  K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K48, \
  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, \
  K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D \
  K40, K41, K42, K43, K44, K45, K46, K47, K0D, K49, K4A, K4B, K4C, K4D \
) \
{ \
    { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \

M keyboards/gray_studio/cod67/config.h => keyboards/gray_studio/cod67/config.h +19 -128
@@ 15,18 15,17 @@ You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef CONFIG_H
#define CONFIG_H
#pragma once

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID       0xFEED
#define PRODUCT_ID      0x0000
#define PRODUCT_ID      0x0C0D
#define DEVICE_VER      0x0001
#define MANUFACTURER    Gray
#define PRODUCT         cod67
#define DESCRIPTION     60% Custom Keyboard
#define MANUFACTURER    Gray Studio
#define PRODUCT         COD67
#define DESCRIPTION     60% custom keyboard

/* key matrix size */
#define MATRIX_ROWS 5


@@ 49,135 48,27 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
/* COL2ROW, ROW2COL*/
#define DIODE_DIRECTION COL2ROW

/* D4 is not a PWM pin, but look at timer assisted software PWM if you want something other than toggle
 * https://docs.qmk.fm/#/feature_backlight?id=timer-assisted-pwm-implementation
 */
#define BACKLIGHT_PIN D4
#define BACKLIGHT_LEVELS 3

#define RGB_DI_PIN B2
#ifdef RGB_DI_PIN
  #define RGBLED_NUM 20
  #define RGBLIGHT_HUE_STEP 8
  #define RGBLIGHT_SAT_STEP 8
  #define RGBLIGHT_VAL_STEP 8
  #define RGBLIGHT_LIMIT_VAL 255
  #define RGBLIGHT_SLEEP
  #define RGBLIGHT_ANIMATIONS
#endif

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5

/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST

/* number of backlight levels */

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
 * This is userful for the Windows task manager shortcut (ctrl+shift+esc).
 */
// #define GRAVE_ESC_CTRL_OVERRIDE

/*
 * Force NKRO
 *
 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
 * makefile for this to work.)
 *
 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
 * until the next keyboard reset.
 *
 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
 * fully operational during normal computer usage.
 *
 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
 * power-up.
 *
 */
//#define FORCE_NKRO

/*
 * Magic Key Options
 *
 * Magic keys are hotkey commands that allow control over firmware functions of
 * the keyboard. They are best used in combination with the HID Listen program,
 * found here: https://www.pjrc.com/teensy/hid_listen.html
 *
 * The options below allow the magic key functionality to be changed. This is
 * useful if your keyboard/keypad is missing keys and you want magic key support.
 *
 */

/* control how magic key switches layers */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS  true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS  true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false

/* override magic key keymap */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
//#define MAGIC_KEY_HELP1          H
//#define MAGIC_KEY_HELP2          SLASH
//#define MAGIC_KEY_DEBUG          D
//#define MAGIC_KEY_DEBUG_MATRIX   X
//#define MAGIC_KEY_DEBUG_KBD      K
//#define MAGIC_KEY_DEBUG_MOUSE    M
//#define MAGIC_KEY_VERSION        V
//#define MAGIC_KEY_STATUS         S
//#define MAGIC_KEY_CONSOLE        C
//#define MAGIC_KEY_LAYER0_ALT1    ESC
//#define MAGIC_KEY_LAYER0_ALT2    GRAVE
//#define MAGIC_KEY_LAYER0         0
//#define MAGIC_KEY_LAYER1         1
//#define MAGIC_KEY_LAYER2         2
//#define MAGIC_KEY_LAYER3         3
//#define MAGIC_KEY_LAYER4         4
//#define MAGIC_KEY_LAYER5         5
//#define MAGIC_KEY_LAYER6         6
//#define MAGIC_KEY_LAYER7         7
//#define MAGIC_KEY_LAYER8         8
//#define MAGIC_KEY_LAYER9         9
//#define MAGIC_KEY_BOOTLOADER     PAUSE
//#define MAGIC_KEY_LOCK           CAPS
//#define MAGIC_KEY_EEPROM         E
//#define MAGIC_KEY_NKRO           N
//#define MAGIC_KEY_SLEEP_LED      Z

/*
 * Feature disable options
 *  These options are also useful to firmware size reduction.
 */

/* disable debug print */
//#define NO_DEBUG

/* disable print */
//#define NO_PRINT

/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION

/*
 * MIDI options
 */

/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1

/* enable basic MIDI features:
   - MIDI notes can be sent when in Music mode is on
*/
//#define MIDI_BASIC

/* enable advanced MIDI features:
   - MIDI notes can be added to the keymap
   - Octave shift and transpose
   - Virtual sustain, portamento, and modulation wheel
   - etc.
*/
//#define MIDI_ADVANCED

/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 1

#endif

M keyboards/gray_studio/cod67/keymaps/default/keymap.c => keyboards/gray_studio/cod67/keymaps/default/keymap.c +4 -4
@@ 19,10 19,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

	LAYOUT(
		KC_GESC, 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_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
		KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
		KC_TRNS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, 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, KC_TRNS)
		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_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_TRNS, KC_ENT,
		KC_LSFT, 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, KC_TRNS, KC_TRNS, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RGUI, KC_LEFT, KC_DOWN, KC_RGHT)

};


M keyboards/gray_studio/cod67/keymaps/default/readme.md => keyboards/gray_studio/cod67/keymaps/default/readme.md +5 -1
@@ 1,1 1,5 @@
# The default keymap for cod67
# The default keymap for a COD67

The default map only implements the default layer from the map on [ydkb.io](http://ydkb.io).

If you want an example of a multi-layer map, look at [rys's map](../rys).

A keyboards/gray_studio/cod67/keymaps/rys/keymap.c => keyboards/gray_studio/cod67/keymaps/rys/keymap.c +23 -0
@@ 0,0 1,23 @@
#include QMK_KEYBOARD_H

enum layers {
    _TOP,
    _FN
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    [_TOP] = 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_BSPC,
        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_ENT,
        KC_LSFT,    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_LALT, KC_LGUI, _______, _______,  KC_SPC, _______, _______, _______, KC_RGUI, MO(_FN), KC_LEFT, KC_DOWN, KC_RGHT
    ),
    [_FN] = LAYOUT(
        _______,   KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,  KC_F10,  KC_F11,  KC_F12, _______,
        _______, RGB_TOG, RGB_MOD,RGB_RMOD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
        _______, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_TOGG,
        _______, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
        _______, _______, _______, _______, _______,   RESET, _______, _______, _______, _______, _______, _______, _______, _______
    )
};

A keyboards/gray_studio/cod67/keymaps/rys/readme.md => keyboards/gray_studio/cod67/keymaps/rys/readme.md +5 -0
@@ 0,0 1,5 @@
# Rys's keymap for a COD67

The COD67 supports really nice RGB underglow which you can see through the mid diffuser. I've put control for that on layer 1, along with reset on `Space`, backlight toggle on `Enter`, and the function row. The board supports all of the QMK RGB effects.

Look at the excellent [RGB Lighting](https://docs.qmk.fm/#/feature_rgblight) docs on the QMK site for more controls.

M keyboards/gray_studio/cod67/readme.md => keyboards/gray_studio/cod67/readme.md +25 -10
@@ 1,30 1,45 @@
# Gray COD67

The Gray COD67 is a 60% keyboard with a modern and bold design. It features 20 RGB Underglow LED lights and a unique diffuser placement. The COD67 has the most stunning RGB light strip for a custom mechanical keyboard. It also features a center mounted USB C port. 
The Gray COD67 is a 60% keyboard with a modern and bold design. It features 20 RGB Underglow LED lights and a unique diffuser placement. The COD67 has the most stunning RGB light strip for a custom mechanical keyboard. It also features a center mounted USB C port.

There were only 75 units made worldwide. 
There were only 75 units made worldwide.

Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin)  
Hardware Supported: Gray COD67  
Hardware Availability: [Zfrontier](https://en.zfrontier.com/products/cod67)  

At this time, flashing ONLY works on Windows systems. 
## Bootloader mode

To put in bootloader mode, hold the `Esc` key while plugging in the USB cable. 
To put in bootloader mode, hold the `Esc` key while plugging in the USB cable.

The COD67 will show up as a drive. 
## Making firmware

Make example for this keyboard (after setting up your build environment):

    make gray_studio/cod67:default:bin
    make gray_studio/cod67:default

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).

Rename the resulting `.bin` file to `cod67.bin`.
## Flashing in Windows

Drag and drop `cod67.bin` to the drive, overwriting the previous `cod67.bin` stored on it. 
After putting your COD67 in bootloader mode, it will show up as a drive.

Press the `Esc` key again to reset the board. You are now ready to type!
* Rename the resulting `.bin` file to `COD67.BIN`.
* Drag and drop your new `COD67.BIN` to the drive, overwriting the previous `COD67.BIN` stored on it.
* Wait a few seconds for it to write. The caps lock LED flashes rapidly while writing.
* Press the `Esc` key again to reset the board. You are now ready to type!

## Flashing in macOS

After putting your COD67 in bootloader mode, it will show up as a drive.

* Rename the resulting `.bin` file to `COD67.BIN`.
* Drag the existing `COD67.BIN` file from the drive to the Trash in Finder.
* Empty the Trash in Finder. It's important you do that due to how macOS handles hidden `.Trashes` on removable drives. It needs to be empty to free up flash space.
* Drag and drop your new `COD67.BIN` to the drive.
* Wait a few seconds for it to write. The caps lock LED flashes rapidly while writing.
* Press the `Esc` key or eject the drive in Finder to reset the board. You are now ready to type!

## Notes
The backlight pin is attached to a non PWM pin `D4` so backlight is only on/off. 

The backlight pin is attached to a non PWM pin `D4` so the backlight is only on/off.

M keyboards/gray_studio/cod67/rules.mk => keyboards/gray_studio/cod67/rules.mk +7 -3
@@ 11,19 11,23 @@ MCU = atmega32u4
#   ATmega328P   USBasp
BOOTLOADER = atmel-dfu # actually lufa-ms

# Mass storage bootloader on the COD67 uses bin files
FIRMWARE_FORMAT = bin

# Build Options
#   change yes to no to disable
#
BOOTMAGIC_ENABLE = no      # Virtual DIP switch configuration(+1000)
BOOTMAGIC_ENABLE = no       # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes       # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes       # Audio control and System control(+450)
CONSOLE_ENABLE = yes        # Console for debug(+400)
CONSOLE_ENABLE = no         # Console for debug(+400)
COMMAND_ENABLE = yes        # 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 = no       # Enable keyboard backlight functionality on B7 by default
BACKLIGHT_ENABLE = yes      # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes       # Enable RGB underglow
MIDI_ENABLE = no            # MIDI support (+2400 to 4200, depending on config)
UNICODE_ENABLE = no         # Unicode
BLUETOOTH_ENABLE = no       # Enable Bluetooth with the Adafruit EZ-Key HID