[Keyboard] XD68 65% ATMega32U4 based (#7395)

* First working draft

* Updated readme.md

* Fixed url

* Typo fix

* RGB + Backlight working

* Fixed matrix for ISO NUHS

* ISO matrix working

* Adding ANSI default layout

* First release commit

* Removed reference to deprecated layout

* Changes from PR #7395 review

* Additional changes as requested for PR #7395

* Additional changes from @noroadsleft review

* Replaced ifndef/endif with pragma

* Adding yanfali's recommended changes
This commit is contained in:
randlor 2019-12-16 05:33:04 +00:00 committed by James Young
parent 3eb82e0470
commit 74dc65ab2e
11 changed files with 401 additions and 0 deletions

110
keyboards/xd68/config.h Normal file
View File

@ -0,0 +1,110 @@
/*
Copyright 2019 Michael Campbell
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
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xCDCD
#define PRODUCT_ID 0x6868
#define DEVICE_VER 0x0001
#define MANUFACTURER xiudi
#define PRODUCT XD68
#define DESCRIPTION XD68 65pc keyboard
/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 15
/*
* 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, D1, D2, D3, D5 }
#define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B6, D4, B1, B7, B5, B4, D7, D6, B3, F7 }
#define UNUSED_PINS
/* COL2ROW, ROW2COL*/
#define DIODE_DIRECTION COL2ROW
#define BACKLIGHT_PIN F5
#define BACKLIGHT_LEVELS 6
/* 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
/* 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
/*
* 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
/*
* 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
// ws2812 options
#define RGB_DI_PIN F6 // pin the DI on the ws2812 is hooked-up to
#define RGBLIGHT_ANIMATIONS // run RGB animations
#define RGBLED_NUM 12 // number of LEDs
#define RGBLIGHT_HUE_STEP 12 // units to step when in/decreasing hue
#define RGBLIGHT_SAT_STEP 25 // units to step when in/decresing saturation
#define RGBLIGHT_VAL_STEP 12 // units to step when in/decreasing value (brightness)

View File

@ -0,0 +1,5 @@
#pragma once
#define BACKLIGHT_BREATHING
#define BREATHING_PERIOD 6

View File

@ -0,0 +1,48 @@
#include QMK_KEYBOARD_H
#define _BL 0
#define _FL 1
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _BL: (Base Layer) Default Layer
* ,----------------------------------------------------------------.
* |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |Home|
* |----------------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |PgUp|
* |----------------------------------------------------------------|
* |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return |PgDn|
* |----------------------------------------------------------------|
* |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Up|End |
* |----------------------------------------------------------------|
* |Ctrl|Win |Alt | Space |App|Ctrl|FN |Lef|Dow|Rig |
* `----------------------------------------------------------------'
*/
[_BL] = LAYOUT_65_ansi(
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_HOME,
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_PGUP,
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_PGDN,
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_END,
KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_APP, KC_RCTRL, MO(_FL), KC_LEFT,KC_DOWN,KC_RGHT
),
/* Keymap _FL: Function Layer
* ,----------------------------------------------------------------.
* |~ `| F1|F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Del |Ins |
* |----------------------------------------------------------------|
* |RESET| |Up | | | | | | | | | | | | |
* |----------------------------------------------------------------|
* | |<- |Dn | ->| | | | | | | | | | |
* |----------------------------------------------------------------|
* |HUI |SAI|VAI|RGBMOD|BL-|BL |BL+| | | | |Play |V+ |Mut |
* |----------------------------------------------------------------|
* |HUD |SAD |VAD | RGB_Tog | | | | <M|V- |M> |
* `----------------------------------------------------------------'
*/
[_FL] = LAYOUT_65_ansi(
KC_GRV, 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, KC_INS,
RESET, _______, KC_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_HUI, RGB_SAI, RGB_VAI, RGB_MOD, BL_DEC, BL_TOGG, BL_INC, _______, _______, _______, _______, KC_MPLY, KC_VOLU, KC_MUTE,
RGB_HUD, RGB_SAD, RGB_VAD, RGB_TOG, _______, _______, KC_TRNS, KC_MPRV, KC_VOLD, KC_MNXT
),
};

View File

@ -0,0 +1,5 @@
# XD68 layout for Default ANSI
```
make xd68:default
```

View File

@ -0,0 +1,4 @@
#pragma once
#define BACKLIGHT_BREATHING
#define BREATHING_PERIOD 6

View File

@ -0,0 +1,48 @@
#include QMK_KEYBOARD_H
#define _BL 0
#define _FL 1
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _BL: (Base Layer) Default Layer
* ,----------------------------------------------------------------.
* |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |Home|
* |----------------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |PgUp|
* |------------------------------------------------------- -----|
* |CAPS | A| S| D| F| G| H| J| K| L| ;| '| #|Entr|PgDn|
* |----------------------------------------------------------------|
* |Shift| \ | Z| X| C| V| B| N| M| ,| .| /|Rshift|Up|End |
* |----------------------------------------------------------------|
* |Ctrl|Win |Alt | Space |App|Ctrl |Fn|Lef|Dow|Rig |
* `----------------------------------------------------------------'
*/
[_BL] = LAYOUT_65_iso(
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_HOME,
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_PGUP,
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_PGDN,
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_END,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_APP, KC_RCTL, MO(_FL), KC_LEFT, KC_DOWN, KC_RGHT
),
/* Keymap _FL1: Function Layer 1
* ,----------------------------------------------------------------.
* |~ `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| Delete| Ins|
* |----------------------------------------------------------------|
* |RESET| | | | | | | | | | | | | | |
* |------------------------------------------------------- -----|
* | | | | | | | | | | | | | | | |
* |----------------------------------------------------------------|
* |HUI |SAI|VAI |RGBMOD| L+|LED| L-| | | | | |Play|V+|Mut|
* |----------------------------------------------------------------|
* |HUD |SAD |VAD | RGB_Tog | | | | <M | V-| M> |
* `----------------------------------------------------------------'
*/
[_FL] = LAYOUT_65_iso(
KC_GRV, 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, KC_INS,
RESET, _______, KC_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_HUI, RGB_SAI, RGB_VAI, RGB_MOD, BL_DEC, BL_TOGG, BL_INC, _______, _______, _______, _______, _______, KC_MPLY, KC_VOLU, KC_MUTE,
RGB_HUD, RGB_SAD, RGB_VAD, RGB_TOG, _______, _______, KC_TRNS, KC_MPRV, KC_VOLD, KC_MNXT
)
};

View File

@ -0,0 +1,5 @@
# XD68 layout for Default ISO
```
make xd68:default_iso
```

53
keyboards/xd68/readme.md Normal file
View File

@ -0,0 +1,53 @@
# XD68
![Kitteh](https://i.imgur.com/qkA5Of5.jpg)
65% board with USB-C, RGB underglow and backlight. Powered by ATM32U4.
![Top View of XD68 Keyboard](https://i.imgur.com/OLkQQ17.jpg)
* Keyboard Maintainer: QMK Community
* Hardware Supported: XD68
* Hardware Availability: [KPRepublic on AliExpress](http://kprepublic.com/products/xiudi-xd68-pcb-65-custom-mechanical-keyboard-support-tkg-tools-underglow-rgb-pcb-programmed-kle-lots-of-layouts)
Make example for this keyboard (after setting up your build environment):
make xd68:default
make xd68:default_iso # default ISO UK layout
## Layouts
### ANSI
```
,----------------------------------------------------------------.
|Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |Home|
|----------------------------------------------------------------|
|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |PgUp|
|----------------------------------------------------------------|
|CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return |PgDn|
|----------------------------------------------------------------|
|Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Up|End |
|----------------------------------------------------------------|
|Ctrl|Win |Alt | Space |App|Ctrl|FN |Lef|Dow|Rig |
`----------------------------------------------------------------'
```
### ISO-UK
```
,----------------------------------------------------------------.
|Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |Home|
|----------------------------------------------------------------|
|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |PgUp|
|------------------------------------------------------- -----|
|CAPS | A| S| D| F| G| H| J| K| L| ;| '| #|Entr|PgDn|
|----------------------------------------------------------------|
|Shift| \ | Z| X| C| V| B| N| M| ,| .| /|Rshift|Up|End |
|----------------------------------------------------------------|
|Ctrl|Win |Alt | Space |Alt| FN|Ctrl|Lef|Dow|Rig |
`----------------------------------------------------------------'
```
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).

32
keyboards/xd68/rules.mk Normal file
View File

@ -0,0 +1,32 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = atmel-dfu
# QMK Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
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 = yes # Commands for debug and configuration
NKRO_ENABLE = yes # 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
MIDI_ENABLE = no # MIDI support
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
LAYOUTS = 65_ansi 65_iso

22
keyboards/xd68/xd68.c Executable file
View File

@ -0,0 +1,22 @@
#include "xd68.h"
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
led_init_ports();
}
void led_init_ports(void) {
// * Set our LED pins as output
setPinOutput(B2);
writePinHigh(B2);
}
bool led_update_kb(led_t led_state) {
if(led_update_user(led_state)) {
writePin(B2, !led_state.caps_lock);
}
return true;
}

69
keyboards/xd68/xd68.h Executable file
View File

@ -0,0 +1,69 @@
#pragma once
#include "quantum.h"
// readability
#define XXX KC_NO
/* XD68 ANSI layout
* ,----------------------------------------------------------------.
* | 00 |01| 02| 03| 04| 05| 06| 07| 08| 09| 0a| 0b| 0c| 0d | 0e |
* |----------------------------------------------------------------|
* | 10 | 11| 12| 13| 14| 15| 16| 17| 18| 19| 1a| 1b| 1c| 1d | 1e |
* |----------------------------------------------------------------|
* | 20 | 21| 22| 23| 24| 25| 26| 27| 28| 29| 2a| 2b| 2d | 2e |
* |----------------------------------------------------------------|
* | 30 | 32| 33| 34| 35| 36| 37| 38| 39| 3a| 3b| 3c| 3d| 3e |
* |----------------------------------------------------------------|
* | 40 | 41 | 42 | 45 | 48| 4a| 4b| 4c| 4d| 4e |
* `----------------------------------------------------------------'
*/
// The first section contains all of the arguments
// The second converts the arguments into a two-dimensional array
#define LAYOUT_65_ansi( \
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, k1e, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2d, k2e, \
k30, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e, \
k40, k41, k42, k45, k48, k4a, k4b, k4c, k4d, k4e \
) \
{ \
{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, k1e}, \
{k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, XXX, k2d, k2e}, \
{k30, XXX, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e}, \
{k40, k41, k42, XXX, XXX, k45, XXX, XXX, k4b, XXX, k48, k4a, k4c, k4d, k4e} \
}
/* XD68 ISO layout
* ,----------------------------------------------------------------.
* | 00 |01| 02| 03| 04| 05| 06| 07| 08| 09| 0a| 0b| 0c| 0d | 0e |
* |----------------------------------------------------------------|
* | 10 | 11| 12| 13| 14| 15| 16| 17| 18| 19| 1a| 1b| 1c| | 1e |
* |------------------------------------------------------. -----|
* | 20 | 21| 22| 23| 24| 25| 26| 27| 28| 29| 2a| 2b| 2c| 2d| 2e |
* |----------------------------------------------------------------|
* | 30 | 31| 32| 33| 34| 35| 36| 37| 38| 39| 3a| 3b| 3c| 3d| 3e |
* |----------------------------------------------------------------|
* | 40 | 41 | 42 | 45 | 48| 4a| 4b| 4c| 4d| 4e |
* `----------------------------------------------------------------'
*/
// The first section contains all of the arguments
// The second converts the arguments into a two-dimensional array
#define LAYOUT_65_iso( \
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, k1e, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, k2e, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e, \
k40, k41, k42, k45, k48, k4a, k4b, k4c, k4d, k4e \
) \
{ \
{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, XXX, k1e}, \
{k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, k2e}, \
{k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e}, \
{k40, k41, k42, XXX, XXX, k45, XXX, XXX, k4b, XXX, k48, k4a, k4c, k4d, k4e} \
}