Skip to content

Commit 32d6a8b

Browse files
authored
adds DZ60 support (#1734)
* adds support for dz60 * fix dz60 readme
1 parent 0c33527 commit 32d6a8b

File tree

6 files changed

+260
-0
lines changed

6 files changed

+260
-0
lines changed

keyboards/dz60/config.h

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#ifndef CONFIG_H
2+
#define CONFIG_H
3+
4+
#include "config_common.h"
5+
6+
/* USB Device descriptor parameter */
7+
#define VENDOR_ID 0xFEED
8+
#define PRODUCT_ID 0x2260
9+
#define DEVICE_VER 0x0001
10+
#define MANUFACTURER KBDFans
11+
#define PRODUCT DZ60
12+
#define DESCRIPTION DZ60 Keyboard
13+
14+
/* key matrix size */
15+
#define MATRIX_ROWS 5
16+
#define MATRIX_COLS 15
17+
18+
/* key matrix pins */
19+
#define MATRIX_ROW_PINS { D0, D1, D2, D3, D5 }
20+
#define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B7, D4, B1, B0, B5, B4, D7, D6, B3, F4 }
21+
#define UNUSED_PINS
22+
23+
/* COL2ROW or ROW2COL */
24+
#define DIODE_DIRECTION COL2ROW
25+
26+
/* number of backlight levels */
27+
#define BACKLIGHT_PIN B6
28+
#define BACKLIGHT_LEVELS 5
29+
30+
/* Set 0 if debouncing isn't needed */
31+
#define DEBOUNCING_DELAY 5
32+
33+
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
34+
#define LOCKING_SUPPORT_ENABLE
35+
36+
/* Locking resynchronize hack */
37+
#define LOCKING_RESYNC_ENABLE
38+
39+
/* key combination for command */
40+
#define IS_COMMAND() ( \
41+
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
42+
)
43+
44+
/* prevent stuck modifiers */
45+
#define PREVENT_STUCK_MODIFIERS
46+
47+
#define RGB_DI_PIN E2
48+
#define RGBLIGHT_ANIMATIONS
49+
#define RGBLED_NUM 20
50+
#define RGBLIGHT_HUE_STEP 8
51+
#define RGBLIGHT_SAT_STEP 8
52+
#define RGBLIGHT_VAL_STEP 8
53+
54+
#endif

keyboards/dz60/dz60.c

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "dz60.h"
2+
3+
void led_set_kb(uint8_t usb_led) {
4+
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
5+
DDRB |= (1 << 2); PORTB &= ~(1 << 2);
6+
} else {
7+
DDRB &= ~(1 << 2); PORTB &= ~(1 << 2);
8+
}
9+
}

keyboards/dz60/dz60.h

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#ifndef DZ60_H
2+
#define DZ60_H
3+
4+
#include "quantum.h"
5+
6+
// 标准配列
7+
#define KEYMAP( \
8+
K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \
9+
K100, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \
10+
K200, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, \
11+
K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K313, K314, \
12+
K400, K401, K403, K404, K406, K408, K410, K411, K412, K413, K414 \
13+
) { \
14+
{ K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \
15+
{ K100, KC_NO, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114 }, \
16+
{ K200, KC_NO, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, KC_NO }, \
17+
{ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, KC_NO, K313, K314 }, \
18+
{ K400, K401, KC_NO, K403, K404, KC_NO, K406, KC_NO, K408, KC_NO, K410, K411, K412, K413, K414 } \
19+
}
20+
21+
#define KEYMAP_HHKB( \
22+
K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \
23+
K100, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \
24+
K200, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, \
25+
K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K313, K314, \
26+
K401, K403, K406, K410, K411 \
27+
) { \
28+
{ K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \
29+
{ K100, KC_NO, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114 }, \
30+
{ K200, KC_NO, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, KC_NO }, \
31+
{ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, KC_NO, K313, K314 }, \
32+
{ KC_NO, K401, KC_NO, K403, KC_NO, KC_NO, K406, KC_NO, KC_NO, KC_NO, K410, K411, KC_NO, KC_NO, KC_NO } \
33+
}
34+
35+
#define KEYMAP_2_SHIFTS( \
36+
K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \
37+
K100, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \
38+
K200, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, \
39+
K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, K314, \
40+
K400, K401, K403, K404, K406, K408, K410, K411, K412, K413, K414 \
41+
) { \
42+
{ K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \
43+
{ K100, KC_NO, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114 }, \
44+
{ K200, KC_NO, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, KC_NO }, \
45+
{ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, K314 }, \
46+
{ K400, K401, KC_NO, K403, K404, KC_NO, K406, KC_NO, K408, KC_NO, K410, K411, K412, K413, K414 } \
47+
}
48+
49+
// 带方向配列
50+
#define KEYMAP_DIRECTIONAL( \
51+
K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \
52+
K100, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \
53+
K200, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, \
54+
K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K312, K313, K314, \
55+
K400, K401, K403, K404, K406, K408, K410, K411, K412, K413, K414 \
56+
) { \
57+
{ K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \
58+
{ K100, KC_NO, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114 }, \
59+
{ K200, KC_NO, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, KC_NO }, \
60+
{ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, KC_NO, K312, K313, K314 }, \
61+
{ K400, K401, KC_NO, K403, K404, KC_NO, K406, KC_NO, K408, KC_NO, K410, K411, K412, K413, K414 } \
62+
}
63+
64+
65+
#endif
+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#include "dz60.h"
2+
3+
#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
4+
5+
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
6+
7+
KEYMAP(
8+
F(0), 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_NO, KC_BSPC,
9+
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,
10+
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,
11+
KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO,
12+
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(2), KC_NO, MO(1), KC_RCTL),
13+
14+
KEYMAP(
15+
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_TRNS, KC_DEL,
16+
KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET,
17+
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,
18+
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BL_DEC, BL_TOGG, BL_INC, BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
19+
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
20+
21+
KEYMAP(
22+
KC_TRNS, M(1), M(2), M(3), M(4), M(5), M(6), M(7), M(8), M(9), M(10), M(11), M(12), KC_TRNS, KC_TRNS,
23+
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,
24+
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,
25+
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,
26+
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
27+
};
28+
29+
enum function_id {
30+
SHIFT_ESC,
31+
};
32+
33+
const uint16_t PROGMEM fn_actions[] = {
34+
[0] = ACTION_FUNCTION(SHIFT_ESC),
35+
};
36+
37+
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
38+
static uint8_t shift_esc_shift_mask;
39+
switch (id) {
40+
case SHIFT_ESC:
41+
shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
42+
if (record->event.pressed) {
43+
if (shift_esc_shift_mask) {
44+
add_key(KC_GRV);
45+
send_keyboard_report();
46+
} else {
47+
add_key(KC_ESC);
48+
send_keyboard_report();
49+
}
50+
} else {
51+
if (shift_esc_shift_mask) {
52+
del_key(KC_GRV);
53+
send_keyboard_report();
54+
} else {
55+
del_key(KC_ESC);
56+
send_keyboard_report();
57+
}
58+
}
59+
break;
60+
}
61+
}

keyboards/dz60/readme.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# DZ60
2+
3+
![dz60](https://cdn.shopify.com/s/files/1/1473/3902/files/1_6525343b-ee62-47e8-882a-05e316136a3f.jpg?v=1501657073)
4+
5+
A customizable 60% keyboard.
6+
7+
Keyboard Maintainer: QMK Community
8+
Hardware Supported: DZ60
9+
Hardware Availability: [kbdfans](https://kbdfans.myshopify.com/collections/pcb/products/dz60-60-pcb?variant=40971616717)
10+
11+
Make example for this keyboard (after setting up your build environment):
12+
13+
make dz60-default
14+
15+
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.

keyboards/dz60/rules.mk

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# MCU name
2+
MCU = atmega32u4
3+
4+
# Processor frequency.
5+
# This will define a symbol, F_CPU, in all source code files equal to the
6+
# processor frequency in Hz. You can then use this symbol in your source code to
7+
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
8+
# automatically to create a 32-bit value in your source code.
9+
#
10+
# This will be an integer division of F_USB below, as it is sourced by
11+
# F_USB after it has run through any CPU prescalers. Note that this value
12+
# does not *change* the processor frequency - it should merely be updated to
13+
# reflect the processor speed set externally so that the code can use accurate
14+
# software delays.
15+
F_CPU = 16000000
16+
17+
#
18+
# LUFA specific
19+
#
20+
# Target architecture (see library "Board Types" documentation).
21+
ARCH = AVR8
22+
23+
# Input clock frequency.
24+
# This will define a symbol, F_USB, in all source code files equal to the
25+
# input clock frequency (before any prescaling is performed) in Hz. This value may
26+
# differ from F_CPU if prescaling is used on the latter, and is required as the
27+
# raw input clock is fed directly to the PLL sections of the AVR for high speed
28+
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
29+
# at the end, this will be done automatically to create a 32-bit value in your
30+
# source code.
31+
#
32+
# If no clock division is performed on the input clock inside the AVR (via the
33+
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
34+
F_USB = $(F_CPU)
35+
36+
# Interrupt driven control endpoint task(+60)
37+
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
38+
39+
40+
# Boot Section Size in *bytes*
41+
OPT_DEFS += -DBOOTLOADER_SIZE=4096
42+
43+
44+
# Build Options
45+
# comment out to disable the options.
46+
#
47+
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
48+
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
49+
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
50+
CONSOLE_ENABLE = no # Console for debug(+400)
51+
COMMAND_ENABLE = no # Commands for debug and configuration
52+
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
53+
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
54+
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
55+
AUDIO_ENABLE = no
56+
RGBLIGHT_ENABLE = yes

0 commit comments

Comments
 (0)