Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Keyboard: XD68 65% ATMega32U4 based #7395

Merged
merged 15 commits into from
Dec 16, 2019
113 changes: 113 additions & 0 deletions keyboards/xd68/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
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/>.
*/

#ifndef CONFIG_H
fauxpark marked this conversation as resolved.
Show resolved Hide resolved
#define CONFIG_H
fauxpark marked this conversation as resolved.
Show resolved Hide resolved

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

#endif
fauxpark marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions keyboards/xd68/keymaps/default/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "../../config.h"
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved

#define BACKLIGHT_BREATHING
#define BREATHING_PERIOD 6
48 changes: 48 additions & 0 deletions keyboards/xd68/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -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_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, \
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved
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 |
* |----------------------------------------------------------------|
* | | |Up | | | | | | | | | | | | |
* |----------------------------------------------------------------|
* | |<- |Dn | ->| | | | | | | | | | |
* |----------------------------------------------------------------|
* |HUI |SAI|VAI|RGBMOD|BL-|BL |BL+| | | | |Play |V+ |Mut |
* |----------------------------------------------------------------|
* |HUD |SAD |VAD | RGB_Tog | | | | <M|V- |M> |
* `----------------------------------------------------------------'
*/
[_FL] = LAYOUT_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, \
_______,_______, 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, \
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved
RGB_HUD, RGB_SAD, RGB_VAD, RGB_TOG, _______, _______, KC_TRNS, KC_MPRV, KC_VOLD, KC_MNXT
),
};
5 changes: 5 additions & 0 deletions keyboards/xd68/keymaps/default/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# XD68 layout for ISO UK

```
make xd68:iso-uk
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved
```
4 changes: 4 additions & 0 deletions keyboards/xd68/keymaps/iso-uk/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "../../config.h"
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved

#define BACKLIGHT_BREATHING
#define BREATHING_PERIOD 6
48 changes: 48 additions & 0 deletions keyboards/xd68/keymaps/iso-uk/keymap.c
Original file line number Diff line number Diff line change
@@ -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_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|
* |----------------------------------------------------------------|
* | | | ↑ | | | | | | | | | | | | |
* |------------------------------------------------------- -----|
* | | ← | ↓ | → | | | | | | | | | | | |
* |----------------------------------------------------------------|
* |HUI |SAI|VAI |RGBMOD| L+|LED| L-| | | | | |Play|V+|Mut|
* |----------------------------------------------------------------|
* |HUD |SAD |VAD | RGB_Tog | | | | <M | V-| M> |
* `----------------------------------------------------------------'
*/
[_FL] = LAYOUT_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, \
_______, _______, 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
)
};
5 changes: 5 additions & 0 deletions keyboards/xd68/keymaps/iso-uk/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# XD68 layout for ISO UK

```
make xd68:iso-uk
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved
```
53 changes: 53 additions & 0 deletions keyboards/xd68/readme.md
Original file line number Diff line number Diff line change
@@ -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 # default ansi layout
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved
make xd68:iso-uk # 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 |~ ` |
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved
|----------------------------------------------------------------|
|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |Del |
|------------------------------------------------------- -----|
|CAPS | A| S| D| F| G| H| J| K| L| ;| '| #|Entr|PgUp|
|----------------------------------------------------------------|
|Shift| \ | Z| X| C| V| B| N| M| ,| .| /|Rshift|Up|PgDn|
|----------------------------------------------------------------|
|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).

33 changes: 33 additions & 0 deletions keyboards/xd68/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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 = no # Virtual DIP switch configuration(+1000)
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved
CONSOLE_ENABLE = no # Console for debug(+400)
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved
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 (+2400 to 4200, depending on config)
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved
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 = LAYOUT_ansi LAYOUT_iso
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved

31 changes: 31 additions & 0 deletions keyboards/xd68/xd68.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "xd68.h"
#include "led.h"
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved

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();
};
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved

void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
matrix_scan_user();
};
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved

void led_init_ports(void) {
// * Set our LED pins as output
DDRB |= (1<<2);
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved
}

void led_set_kb(uint8_t usb_led) {
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
// Turn capslock on
PORTB &= ~(1<<2);
} else {
// Turn capslock off
PORTB |= (1<<2);
}
led_set_user(usb_led);
noroadsleft marked this conversation as resolved.
Show resolved Hide resolved
}
Loading