Skip to content

Commit 28e5969

Browse files
authored
Merge pull request qmk#8897 from Maartenwut/ta-65-encoder
Add encoder support to ta-65
2 parents 5924675 + 5c9c456 commit 28e5969

File tree

3 files changed

+58
-26
lines changed

3 files changed

+58
-26
lines changed

keyboards/maartenwut/ta65/config.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2424
#define PRODUCT_ID 0x7465
2525
#define DEVICE_VER 0x0001
2626
#define MANUFACTURER Maartenwut
27-
#define PRODUCT TA-65
27+
#define PRODUCT ta-65
2828
#define DESCRIPTION A universal 65% PCB with underglow.
2929

3030
/* key matrix size */
@@ -37,6 +37,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
3737
#define MATRIX_COL_PINS {D2,D1,D0,D3,D5,C7,C6,B6,B5,F0,F1,F4,F5,F6,F7,B0}
3838
#define UNUSED_PINS
3939

40+
#define ENCODERS_PAD_A { B2 }
41+
#define ENCODERS_PAD_B { B1 }
42+
43+
/* Uncomment if your encoder doesn't react to every turn or skips */
44+
//#define ENCODER_RESOLUTION 2
45+
4046
/* COL2ROW or ROW2COL */
4147
#define DIODE_DIRECTION COL2ROW
4248

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,38 @@
11
#include QMK_KEYBOARD_H
22

3-
// Each layer gets a name for readability, which is then used in the keymap matrix below.
4-
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
5-
// Layer names don't all need to be of the same length, obviously, and you can also skip them
6-
// entirely and just use numbers.
7-
#define _MA 0
8-
93
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
104

11-
[_MA] = LAYOUT_all(
12-
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_BSLS, KC_BSPC, KC_GRV,
13-
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_DEL,
14-
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_BSLS, KC_ENT, KC_PGUP,
15-
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_PGDN,
16-
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_APP, KC_RCTRL, KC_LEFT, KC_DOWN, KC_RGHT)
5+
[0] = LAYOUT_all(
6+
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_BSLS, KC_BSPC, KC_INS,
7+
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_DEL,
8+
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_BSLS, KC_ENT, KC_PGUP,
9+
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_PGDN,
10+
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_RCTRL, KC_LEFT, KC_DOWN, KC_RGHT),
11+
12+
[1] = LAYOUT_all(
13+
RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
14+
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
15+
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
16+
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
17+
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
18+
1719
};
20+
21+
void encoder_update_user(uint8_t index, bool clockwise) {
22+
switch(get_highest_layer(layer_state)){
23+
case 1: //Layer 1
24+
if (!clockwise) { // Remove ! to reverse direction
25+
tap_code(KC_WH_U);
26+
} else {
27+
tap_code(KC_WH_D);
28+
}
29+
break;
30+
default: //Layer 0
31+
if (!clockwise) {
32+
tap_code(KC_VOLU);
33+
} else {
34+
tap_code(KC_VOLD);
35+
}
36+
break;
37+
}
38+
}

keyboards/maartenwut/ta65/rules.mk

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,24 @@ MCU = atmega32u4
1212
BOOTLOADER = qmk-dfu
1313

1414
# Build Options
15-
# comment out to disable the options.
15+
# change yes to no to disable
1616
#
17-
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
18-
MOUSEKEY_ENABLE = yes # Mouse keys
19-
EXTRAKEY_ENABLE = yes # Audio control and System control
20-
CONSOLE_ENABLE = no # Console for debug
21-
COMMAND_ENABLE = no # Commands for debug and configuration
22-
NKRO_ENABLE = no # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
23-
RGBLIGHT_ENABLE = yes # Enable keyboard underlight functionality
24-
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
25-
MIDI_ENABLE = no # MIDI controls
26-
AUDIO_ENABLE = no
27-
UNICODE_ENABLE = no # Unicode
28-
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
17+
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
18+
MOUSEKEY_ENABLE = yes # Mouse keys
19+
EXTRAKEY_ENABLE = yes # Audio control and System control
20+
CONSOLE_ENABLE = yes # Console for debug
21+
COMMAND_ENABLE = no # Commands for debug and configuration
22+
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
23+
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
24+
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
25+
NKRO_ENABLE = no # USB Nkey Rollover
26+
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
27+
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
28+
MIDI_ENABLE = no # MIDI support
29+
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
30+
AUDIO_ENABLE = no # Audio output on port C6
31+
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
32+
HD44780_ENABLE = no # Enable support for HD44780 based LCDs
33+
ENCODER_ENABLE = yes
2934

3035
LAYOUTS = 65_ansi 65_iso

0 commit comments

Comments
 (0)