aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/mt980/config.h48
-rw-r--r--keyboards/mt980/keymaps/default/keymap.c21
-rw-r--r--keyboards/mt980/keymaps/walker/config.h5
-rw-r--r--keyboards/mt980/keymaps/walker/keymap.c135
-rw-r--r--keyboards/mt980/keymaps/walker/rules.mk1
-rw-r--r--keyboards/mt980/mt980.c60
-rw-r--r--keyboards/mt980/mt980.h25
-rw-r--r--keyboards/mt980/readme.md14
-rw-r--r--keyboards/mt980/rules.mk55
9 files changed, 364 insertions, 0 deletions
diff --git a/keyboards/mt980/config.h b/keyboards/mt980/config.h
new file mode 100644
index 000000000..9b5abf919
--- /dev/null
+++ b/keyboards/mt980/config.h
@@ -0,0 +1,48 @@
1#pragma once
2
3#include "config_common.h"
4
5/* USB Device descriptor parameter */
6#define VENDOR_ID 0xFEED
7#define PRODUCT_ID 0x6060
8#define DEVICE_VER 0x0001
9#define MANUFACTURER Wheat Field Peripherals
10#define PRODUCT MT980
11#define DESCRIPTION Keyboard
12
13/* key matrix size */
14#define MATRIX_ROWS 12
15#define MATRIX_COLS 9
16
17/* key matrix pins */
18#define MATRIX_ROW_PINS { B7, B3, B2, B1, B0, E6, F0, F1, F4, F5, F6, F7 }
19#define MATRIX_COL_PINS { D0, D1, D2, D3, D5, D4, D6, D7, B4 }
20#define UNUSED_PINS
21
22/* COL2ROW or ROW2COL */
23#define DIODE_DIRECTION ROW2COL
24
25/* number of backlight levels */
26#define BACKLIGHT_PIN B6
27#ifdef BACKLIGHT_PIN
28#define BACKLIGHT_LEVELS 3
29#endif
30
31/* Set 0 if debouncing isn't needed */
32#define DEBOUNCING_DELAY 5
33
34/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
35#define LOCKING_SUPPORT_ENABLE
36
37/* Locking resynchronize hack */
38#define LOCKING_RESYNC_ENABLE
39
40#define RGB_DI_PIN E2
41#ifdef RGB_DI_PIN
42#define RGBLIGHT_ANIMATIONS
43#define RGBLED_NUM 24
44#define RGBLIGHT_HUE_STEP 8
45#define RGBLIGHT_SAT_STEP 8
46#define RGBLIGHT_VAL_STEP 8
47#define RGBLIGHT_LIMIT_VAL 185
48#endif
diff --git a/keyboards/mt980/keymaps/default/keymap.c b/keyboards/mt980/keymaps/default/keymap.c
new file mode 100644
index 000000000..bdd5a93f2
--- /dev/null
+++ b/keyboards/mt980/keymaps/default/keymap.c
@@ -0,0 +1,21 @@
1#include "mt980.h"
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4
5 [0] = LAYOUT(
6 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_NO, KC_INS, KC_PSCR, KC_PGUP, KC_PGDN,
7 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_BSPC, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
8 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_P7, KC_P8, KC_P9, KC_PPLS,
9 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_P4, KC_P5, KC_P6, KC_PPLS,
10 KC_LSFT, 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_P1, KC_P2, KC_P3, KC_PENT,
11 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT),
12
13 [1] = LAYOUT(
14 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_PAUSE, KC_SLCK, KC_HOME, KC_END,
15 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, RGB_TOG, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
16 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,
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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
18 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, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
19 KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, RGB_RMOD, RGB_VAD, RGB_MOD, KC_TRNS, KC_TRNS, KC_TRNS)
20
21};
diff --git a/keyboards/mt980/keymaps/walker/config.h b/keyboards/mt980/keymaps/walker/config.h
new file mode 100644
index 000000000..0bd395993
--- /dev/null
+++ b/keyboards/mt980/keymaps/walker/config.h
@@ -0,0 +1,5 @@
1#pragma once
2
3#define TAPPING_TERM 200
4#define ONESHOT_TAP_TOGGLE 5
5#define ONESHOT_TIMEOUT 5000
diff --git a/keyboards/mt980/keymaps/walker/keymap.c b/keyboards/mt980/keymaps/walker/keymap.c
new file mode 100644
index 000000000..c1db4f3d3
--- /dev/null
+++ b/keyboards/mt980/keymaps/walker/keymap.c
@@ -0,0 +1,135 @@
1#include "mt980.h"
2
3bool numlock_on = true;
4
5typedef struct {
6 bool is_press_action;
7 int state;
8} tap;
9
10enum {
11 SINGLE_TAP = 1,
12 SINGLE_HOLD = 2,
13 DOUBLE_TAP = 3,
14 DOUBLE_HOLD = 4,
15 TRIPLE_TAP = 5,
16 TRIPLE_HOLD = 6
17};
18
19enum {
20 ALT_L1 = 0
21};
22
23int cur_dance (qk_tap_dance_state_t *state);
24void alt_finished (qk_tap_dance_state_t *state, void *user_data);
25void alt_reset (qk_tap_dance_state_t *state, void *user_data);
26
27const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
28
29 [0] = LAYOUT(
30 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_NO, KC_INS, KC_PSCR, KC_PGUP, KC_PGDN,
31 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_BSPC, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
32 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_P7, KC_P8, KC_P9, KC_PPLS,
33 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_P4, KC_P5, KC_P6, KC_PPLS,
34 KC_LSFT, 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_P1, KC_P2, KC_P3, KC_PENT,
35 KC_LCTL, KC_LGUI, TD(ALT_L1), KC_SPC, KC_RALT, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT),
36
37 [1] = LAYOUT(
38 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_PAUSE, KC_SLCK, KC_HOME, KC_END,
39 KC_TRNS, 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, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
40 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,
41 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,
42 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, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
43 KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, RGB_RMOD, RGB_VAD, RGB_MOD, KC_TRNS, KC_TRNS, KC_TRNS)
44
45};
46
47int cur_dance (qk_tap_dance_state_t *state) {
48 if (state->count == 1) {
49 if (state->pressed) return SINGLE_HOLD;
50 else return SINGLE_TAP;
51 }
52 else if (state->count == 2) {
53 if (state->pressed) return DOUBLE_HOLD;
54 else return DOUBLE_TAP;
55 }
56 else if (state->count == 3) {
57 if (state->interrupted || !state->pressed) return TRIPLE_TAP;
58 else return TRIPLE_HOLD;
59 }
60 else return 8;
61}
62
63static tap alttap_state = {
64 .is_press_action = true,
65 .state = 0
66};
67
68void alt_finished (qk_tap_dance_state_t *state, void *user_data) {
69 alttap_state.state = cur_dance(state);
70 switch (alttap_state.state) {
71 case SINGLE_TAP: set_oneshot_layer(1, ONESHOT_START); clear_oneshot_layer_state(ONESHOT_PRESSED); break;
72 case SINGLE_HOLD: register_code(KC_LALT); break;
73 case DOUBLE_TAP: set_oneshot_layer(1, ONESHOT_START); set_oneshot_layer(1, ONESHOT_PRESSED); break;
74 case DOUBLE_HOLD: register_code(KC_LALT); layer_on(1); break;
75 }
76}
77
78void alt_reset (qk_tap_dance_state_t *state, void *user_data) {
79 switch (alttap_state.state) {
80 case SINGLE_TAP: break;
81 case SINGLE_HOLD: unregister_code(KC_LALT); break;
82 case DOUBLE_TAP: break;
83 case DOUBLE_HOLD: layer_off(1); unregister_code(KC_LALT); break;
84 }
85 alttap_state.state = 0;
86}
87
88qk_tap_dance_action_t tap_dance_actions[] = {
89 [ALT_L1] = ACTION_TAP_DANCE_FN_ADVANCED(NULL,alt_finished, alt_reset)
90};
91
92void led_set_keymap(uint8_t usb_led) {
93 if (usb_led & (1<<USB_LED_NUM_LOCK)) {
94 numlock_on = true;
95 }
96 else {
97 numlock_on = false;
98 }
99}
100
101bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
102 switch (keycode) {
103 case KC_PPLS:
104 if (!numlock_on) {
105 if (get_oneshot_layer() == 1 || layer_state & 0x2) {
106 register_code(KC_HOME);
107 unregister_code(KC_HOME);
108 clear_oneshot_layer_state(ONESHOT_START);
109 }
110 else {
111 register_code(KC_PGUP);
112 unregister_code(KC_PGUP);
113 }
114 return false;
115 }
116 return true;
117 case KC_PENT:
118 if (!numlock_on) {
119 if (get_oneshot_layer() == 1 || layer_state & 0x2) {
120 register_code(KC_END);
121 unregister_code(KC_END);
122 clear_oneshot_layer_state(ONESHOT_START);
123 }
124 else {
125 register_code(KC_PGDN);
126 unregister_code(KC_PGDN);
127 }
128 return false;
129 }
130 return true;
131 default:
132 return true;
133 }
134 return true;
135}
diff --git a/keyboards/mt980/keymaps/walker/rules.mk b/keyboards/mt980/keymaps/walker/rules.mk
new file mode 100644
index 000000000..e5ddcae8d
--- /dev/null
+++ b/keyboards/mt980/keymaps/walker/rules.mk
@@ -0,0 +1 @@
TAP_DANCE_ENABLE = yes
diff --git a/keyboards/mt980/mt980.c b/keyboards/mt980/mt980.c
new file mode 100644
index 000000000..1b03d1aed
--- /dev/null
+++ b/keyboards/mt980/mt980.c
@@ -0,0 +1,60 @@
1#include "mt980.h"
2
3__attribute__ ((weak))
4void matrix_init_keymap(void) {}
5
6__attribute__ ((weak))
7void matrix_scan_keymap(void) {}
8
9__attribute__ ((weak))
10bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
11 return true;
12}
13__attribute__ ((weak))
14uint32_t layer_state_set_keymap (uint32_t state) {
15 return state;
16}
17__attribute__ ((weak))
18void led_set_keymap(uint8_t usb_led) {}
19
20__attribute__ ((weak))
21void action_function_keymap(keyrecord_t *record, uint8_t id, uint8_t opt) {}
22
23void keyboard_pre_init_user(void) {
24 /* Set NUMLOCK indicator pin as output */
25 setPinOutput(C6);
26 /* Set CAPSLOCK indicator pin as output */
27 setPinOutput(C7);
28 /* Set SCROLLOCK indicator pin as output */
29 setPinOutput(B5);
30}
31
32bool process_record_user(uint16_t keycode, keyrecord_t *record) {
33 return process_record_keymap(keycode, record);
34}
35
36void led_set_user(uint8_t usb_led) {
37
38 if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
39 writePinLow(C6);
40 }
41 else {
42 writePinHigh(C6);
43 }
44
45 if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
46 writePinLow(C7);
47 }
48 else {
49 writePinHigh(C7);
50 }
51
52 if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
53 writePinLow(B5);
54 }
55 else {
56 writePinHigh(B5);
57 }
58
59 led_set_keymap(usb_led);
60}
diff --git a/keyboards/mt980/mt980.h b/keyboards/mt980/mt980.h
new file mode 100644
index 000000000..d9804b339
--- /dev/null
+++ b/keyboards/mt980/mt980.h
@@ -0,0 +1,25 @@
1#pragma once
2
3#include "quantum.h"
4
5#define LAYOUT( \
6 K050, K052, K053, K054, K055, K057, K058, K118, K117, K115, K114, K113, K116, K051, K112, K111, K110, K063, \
7 K040, K041, K042, K043, K044, K045, K046, K047, K048, K108, K107, K105, K104, K103, K106, K102, K101, K100, K064, \
8 K030, K031, K032, K033, K034, K035, K036, K037, K038, K098, K097, K095, K094, K084, K096, K092, K091, K090, \
9 K020, K021, K022, K023, K024, K025, K026, K027, K028, K088, K087, K085, K093, K086, K082, K081, K080, \
10 K010, K011, K012, K013, K014, K015, K016, K017, K018, K078, K077, K075, K074, K073, K076, K072, K071, K070, \
11 K000, K001, K002, K006, K008, K007, K005, K004, K003, K066, K062, K061, K060 \
12) { \
13 { K000, K001, K002, K003, K004, K005, K006, K007, K008 }, \
14 { K010, K011, K012, K013, K014, K015, K016, K017, K018 }, \
15 { K020, K021, K022, K023, K024, K025, K026, K027, K028 }, \
16 { K030, K031, K032, K033, K034, K035, K036, K037, K038 }, \
17 { K040, K041, K042, K043, K044, K045, K046, K047, K048 }, \
18 { K050, K051, K052, K053, K054, K055, KC_NO, K057, K058 }, \
19 { K060, K061, K062, K063, K064, KC_NO, K066, KC_NO, KC_NO}, \
20 { K070, K071, K072, K073, K074, K075, K076, K077, K078 }, \
21 { K080, K081, K082, KC_NO, K084, K085, K086, K087, K088 }, \
22 { K090, K091, K092, K093, K094, K095, K096, K097, K098 }, \
23 { K100, K101, K102, K103, K104, K105, K106, K107, K108 }, \
24 { K110, K111, K112, K113, K114, K115, K116, K117, K118 } \
25}
diff --git a/keyboards/mt980/readme.md b/keyboards/mt980/readme.md
new file mode 100644
index 000000000..7bc27c93a
--- /dev/null
+++ b/keyboards/mt980/readme.md
@@ -0,0 +1,14 @@
1# mt980
2
3A mechanical keyboard PCB in the same layout as the Leopold FC980M, sold by Wheat Field Peripherals on Taobao. This PCB requires soldering, except for the arrow cluster and the Escape key switches, which use Kailh hot swap sockets.
4
5Keyboard Maintainer: [walkerstop](https://github.com/walkerstop)
6Hardware Supported: mt980
7Hardware Availability: Taobao store https://shop110310565.taobao.com
8
9Make example for this keyboard (after setting up your build environment):
10
11 make mt980:default
12
13See 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).
14
diff --git a/keyboards/mt980/rules.mk b/keyboards/mt980/rules.mk
new file mode 100644
index 000000000..9a7718aad
--- /dev/null
+++ b/keyboards/mt980/rules.mk
@@ -0,0 +1,55 @@
1# MCU name
2MCU = 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.
15F_CPU = 16000000
16
17#
18# LUFA specific
19#
20# Target architecture (see library "Board Types" documentation).
21ARCH = 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.
34F_USB = $(F_CPU)
35
36# Interrupt driven control endpoint task(+60)
37OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
38
39BOOTLOADER = atmel-dfu
40
41# Build Options
42# comment out to disable the options.
43#
44
45BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000)
46MOUSEKEY_ENABLE = no # Mouse keys(+4700)
47EXTRAKEY_ENABLE = no # Audio control and System control(+450)
48CONSOLE_ENABLE = no # Console for debug(+400)
49COMMAND_ENABLE = no # Commands for debug and configuration
50SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
51NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
52BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
53AUDIO_ENABLE = no
54RGBLIGHT_ENABLE = yes
55KEY_LOCK_ENABLE = no