diff options
Diffstat (limited to 'keyboards/handwired/tractyl_manuform')
27 files changed, 2148 insertions, 0 deletions
diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/4x6_right.c b/keyboards/handwired/tractyl_manuform/4x6_right/4x6_right.c new file mode 100644 index 0000000000..7ea4d97472 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/4x6_right/4x6_right.c @@ -0,0 +1,67 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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/>. + */ + +#include "4x6_right.h" + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { { + { 24, 23, 18, 17, 10, 9 }, + { 25, 22, 19, 16, 11, 8 }, + { 26, 21, 20, 15, 12, 7 }, + { NO_LED, NO_LED, NO_LED, 14, 13, 6 }, + { NO_LED, NO_LED, NO_LED, 14, 13, 6 }, + { 51, 50, 45, 44, 37, 36 }, + { 52, 49, 46, 43, 38, 35 }, + { 53, 48, 47, 42, 39, 34 }, + { NO_LED, NO_LED, NO_LED, 41, 40, 33 }, + { NO_LED, NO_LED, NO_LED, 41, 40, 33 } +}, { + { 85, 16 }, { 50, 13 }, { 16, 20 }, { 16, 38 }, { 50, 48 }, { 85, 52 }, { 95, 63 }, + { 85, 39 }, { 85, 21 }, { 85, 4 }, { 68, 2 }, { 68, 19 }, { 68, 37 }, { 80, 58 }, + { 60, 55 }, { 50, 35 }, { 50, 13 }, { 50, 0 }, { 33, 3 }, { 33, 20 }, { 33, 37 }, + { 16, 42 }, { 16, 24 }, { 16, 7 }, { 0, 7 }, { 0, 24 }, { 0, 41 }, { 139, 16 }, + { 174, 13 }, { 208, 20 }, { 208, 38 }, { 174, 48 }, { 139, 52 }, { 129, 63 }, { 139, 39 }, + { 139, 21 }, { 139, 4 }, { 156, 2 }, { 156, 19 }, { 156, 37 }, { 144, 58 }, { 164, 55 }, + { 174, 35 }, { 174, 13 }, { 174, 0 }, { 191, 3 }, { 191, 20 }, { 191, 37 }, { 208, 42 }, + { 208, 24 }, { 208, 7 }, { 224, 7 }, { 224, 24 }, { 224, 41 } +}, { + 2, 2, 2, 2, 2, 2, 1, + 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 1, 1, 1, 2, + 2, 2, 2, 2, 2, 1, 4, + 4, 4, 4, 4, 4, 1, 1, + 4, 4, 4, 4, 4, 4, 4, + 4, 4, 1, 1, 1 +} }; +#endif + +#ifdef SWAP_HANDS_ENABLE +const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { + /* Left hand, matrix positions */ + {{5, 5}, {4, 5}, {3, 5}, {2, 5}, {1, 5}, {0, 5}}, + {{5, 6}, {4, 6}, {3, 6}, {2, 6}, {1, 6}, {0, 6}}, + {{5, 7}, {4, 7}, {3, 7}, {2, 7}, {1, 7}, {0, 7}}, + {{5, 8}, {4, 8}, {3, 8}, {2, 8}, {1, 8}, {0, 8}}, + {{5, 9}, {4, 9}, {3, 9}, {2, 9}, {1, 9}, {0, 9}}, + /* Right hand, matrix positions */ + {{5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}}, + {{5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}}, + {{5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}}, + {{5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}}, + {{5, 4}, {4, 4}, {3, 4}, {2, 4}, {1, 4}, {0, 4}} +}; +#endif diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/4x6_right.h b/keyboards/handwired/tractyl_manuform/4x6_right/4x6_right.h new file mode 100644 index 0000000000..66b5880785 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/4x6_right/4x6_right.h @@ -0,0 +1,47 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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 "tractyl_manuform.h" +#include "quantum.h" + +#define ___ KC_NO + +// clang-format off +#define LAYOUT_4x6_right(\ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L32, L33, R32, R33, \ + L34, L35, R31, \ + L44, L45, R41, \ + L42, L43, R42, R43 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05 }, \ + { L10, L11, L12, L13, L14, L15 }, \ + { L20, L21, L22, L23, L24, L25 }, \ + { ___, ___, L32, L33, L34, L35 }, \ + { ___, ___, L42, L43, L44, L45 }, \ + \ + { R00, R01, R02, R03, R04, R05 }, \ + { R10, R11, R12, R13, R14, R15 }, \ + { R20, R21, R22, R23, R24, R25 }, \ + { ___, R31, R32, R33, ___, ___ }, \ + { ___, R41, R42, R43, ___, ___ } \ +} +// clang-format on diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/config.h b/keyboards/handwired/tractyl_manuform/4x6_right/config.h new file mode 100644 index 0000000000..2f29778f33 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/4x6_right/config.h @@ -0,0 +1,91 @@ +/* +Copyright 2012 Jun Wako <wakojun@gmail.com> +Copyright 2015 Jack Humbert + +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" + +#define PRODUCT_ID 0x3537 +#define DEVICE_VER 0x0001 +#define PRODUCT Tractyl Manuform(4x6) + +/* key matrix size */ +// Rows are doubled-up +#define MATRIX_ROWS 10 +#define MATRIX_COLS 6 + +// wiring of each half +#define MATRIX_COL_PINS { C0, C1, C2, C3, C4, C5 } +#define MATRIX_ROW_PINS { A0, A1, A2, A3, A4 } + +#define DIODE_DIRECTION COL2ROW + +// WS2812 RGB LED strip input and number of LEDs +#define RGB_DI_PIN E7 +#define DRIVER_LED_TOTAL 62 +#define RGB_MATRIX_SPLIT { 32, 30 } +#define RGB_DISABLE_WHEN_USB_SUSPENDED +#define RGB_MATRIX_KEYPRESSES +// #define RGB_MATRIX_KEYRELEASES +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 80 + +#define SPLIT_TRANSPORT_MIRROR +#define SPLIT_HAND_PIN A6 + + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +// #define BACKLIGHT_LEVELS 3 + +// #define DEBUG_LED_PIN D6 + +#define ROTATIONAL_TRANSFORM_ANGLE -25 + +/* Bootmagic Lite key configuration */ +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 +#define BOOTMAGIC_LITE_ROW_RIGHT 4 +#define BOOTMAGIC_LITE_COLUMN_RIGHT 5 + +#define AUDIO_PIN C6 +#define AUDIO_PIN_ALT B7 + +#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095 +#define DYNAMIC_KEYMAP_LAYER_COUNT 16 +#define LAYER_STATE_16BIT + +/* serial.c configuration for split keyboard */ +#define SOFT_SERIAL_PIN D3 +#define EE_HANDS + + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION + +#define SERIAL_USE_MULTI_TRANSACTION +#define SPLIT_TRANSACTION_IDS_KB RPC_ID_STATE_SYNC, RPC_ID_SLAVE_STATE diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/info.json b/keyboards/handwired/tractyl_manuform/4x6_right/info.json new file mode 100644 index 0000000000..03a570730f --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/4x6_right/info.json @@ -0,0 +1,75 @@ +{ + "keyboard_name": "Tractyl Manuform 4x6", + "url": "", + "maintainer": "drashna", + "width": 17, + "height": 8, + "layouts": { + "LAYOUT_5x6_right": { + "layout": [ + {"label":"L00", "x":0, "y":0}, + {"label":"L01", "x":1, "y":0}, + {"label":"L02", "x":2, "y":0}, + {"label":"L03", "x":3, "y":0}, + {"label":"L04", "x":4, "y":0}, + {"label":"L05", "x":5, "y":0}, + {"label":"R00", "x":11, "y":0}, + {"label":"R01", "x":12, "y":0}, + {"label":"R02", "x":13, "y":0}, + {"label":"R03", "x":14, "y":0}, + {"label":"R04", "x":15, "y":0}, + {"label":"R05", "x":16, "y":0}, + {"label":"L10", "x":0, "y":1}, + {"label":"L11", "x":1, "y":1}, + {"label":"L12", "x":2, "y":1}, + {"label":"L13", "x":3, "y":1}, + {"label":"L14", "x":4, "y":1}, + {"label":"L15", "x":5, "y":1}, + {"label":"R10", "x":11, "y":1}, + {"label":"R11", "x":12, "y":1}, + {"label":"R12", "x":13, "y":1}, + {"label":"R13", "x":14, "y":1}, + {"label":"R14", "x":15, "y":1}, + {"label":"R15", "x":16, "y":1}, + {"label":"L20", "x":0, "y":2}, + {"label":"L21", "x":1, "y":2}, + {"label":"L22", "x":2, "y":2}, + {"label":"L23", "x":3, "y":2}, + {"label":"L24", "x":4, "y":2}, + {"label":"L25", "x":5, "y":2}, + {"label":"R20", "x":11, "y":2}, + {"label":"R21", "x":12, "y":2}, + {"label":"R22", "x":13, "y":2}, + {"label":"R23", "x":14, "y":2}, + {"label":"R24", "x":15, "y":2}, + {"label":"R25", "x":16, "y":2}, + {"label":"L30", "x":0, "y":3}, + {"label":"L31", "x":1, "y":3}, + {"label":"L32", "x":2, "y":3}, + {"label":"L33", "x":3, "y":3}, + {"label":"L34", "x":4, "y":3}, + {"label":"L35", "x":5, "y":3}, + {"label":"R30", "x":11, "y":3}, + {"label":"R31", "x":12, "y":3}, + {"label":"R32", "x":13, "y":3}, + {"label":"R33", "x":14, "y":3}, + {"label":"R34", "x":15, "y":3}, + {"label":"R35", "x":16, "y":3}, + {"label":"L42", "x":2, "y":4}, + {"label":"L43", "x":3, "y":4}, + {"label":"R42", "x":13, "y":4}, + {"label":"R43", "x":14, "y":4}, + {"label":"L44", "x":4, "y":5}, + {"label":"L45", "x":5, "y":5}, + {"label":"R41", "x":12, "y":5}, + {"label":"L54", "x":6, "y":6}, + {"label":"L55", "x":7, "y":6}, + {"label":"R51", "x":10, "y":6}, + {"label":"L52", "x":6, "y":7}, + {"label":"L53", "x":7, "y":7}, + {"label":"R52", "x":9, "y":7}, + {"label":"R53", "x":10, "y":7} + ] + } + } +} diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/default/keymap.c b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/default/keymap.c new file mode 100644 index 0000000000..d79f60b12c --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/default/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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/>. + */ + +#include QMK_KEYBOARD_H + +enum custom_layers { + _QWERTY, + _LOWER, + _RAISE, +}; + +#define RAISE MO(_RAISE) +#define LOWER MO(_LOWER) + +#define RAISE MO(_RAISE) +#define LOWER MO(_LOWER) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_QWERTY] = LAYOUT_4x6_right( + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINS, + KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_BSLASH, + KC_LBRC,KC_RBRC, KC_PLUS, KC_EQL, + RAISE, KC_SPC, LOWER, + KC_TAB, KC_HOME, KC_ENT, + KC_BSPC,KC_GRV, KC_LGUI,KC_DEL +), + +[_LOWER] = LAYOUT_4x6_right( + _______,_______,_______,_______,_______,KC_LBRC, KC_RBRC, KC_P7, KC_P8, KC_P9, RESET, KC_PLUS, + _______,KC_HOME,KC_PGUP,KC_PGDN,KC_END ,KC_LPRN, KC_RPRN, KC_P4, KC_P5, KC_P6, KC_MINS,KC_PIPE, + _______,_______,_______,_______,_______,_______, _______, KC_P1, KC_P2, KC_P3, KC_EQL, KC_UNDS, + _______,KC_PSCR, _______, KC_P0, + _______,_______, _______, + _______,_______, _______, + _______,_______, _______,_______ +), + +[_RAISE] = LAYOUT_4x6_right( + _______,RESET, _______,_______,_______,KC_LBRC, KC_RBRC,_______,KC_NLCK,KC_INS, KC_SLCK,KC_MUTE, + _______,KC_LEFT,KC_UP ,KC_DOWN,KC_RGHT,KC_LPRN, KC_RPRN,KC_MPRV,KC_MPLY,KC_MNXT,_______,KC_VOLU, + _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,KC_VOLD, + _______,_______, KC_EQL ,_______, + _______,_______, _______, + _______,_______, _______, + _______,_______, _______,_______ +), +}; diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/config.h b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/config.h new file mode 100644 index 0000000000..21bc8e616a --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/config.h @@ -0,0 +1,36 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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 + +// #define USE_I2C +// #define SELECT_SOFT_SERIAL_SPEED 1 +// #define SERIAL_USE_MULTI_TRANSACTION +#define SPLIT_MODS_ENABLE +#define EE_HANDS + +#define TRACKBALL_DPI_OPTIONS { 1200, 1800, 2600, 3400 } + +#define RGBLIGHT_MAX_BRIGHTNESS 60 + +#undef DEBOUNCE +#define DEBOUNCE 10 + +#define SOLENOID_PIN F1 +#define SOLENOID_DEFAULT_DWELL 8 + +#define OLED_DISPLAY_128X64 +#define OLED_BRIGHTNESS 50 diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c new file mode 100644 index 0000000000..28683cef3e --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c @@ -0,0 +1,217 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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/>. + */ + +#include "drashna.h" + +// clang-format off +#define LAYOUT_4x6_right_wrapper(...) LAYOUT_4x6_right(__VA_ARGS__) +#define LAYOUT_4x6_right_base( \ + K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ + K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \ + ) \ + LAYOUT_4x6_right_wrapper( \ + SH_TT, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, SH_TT, \ + LALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \ + OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ + OS_LGUI, OS_LALT, OS_RGUI, OS_RALT, \ + KC_PSCR, KC_GRV, MEH_T(KC_BTN3), \ + KC_SPC, OS_LGUI, KC_ENT, \ + BK_LWER, TT(_MOUSE), TT(_MOUSE), DL_RAIS \ + ) +#define LAYOUT_base_wrapper(...) LAYOUT_4x6_right_base(__VA_ARGS__) + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_DEFAULT_LAYER_1] = LAYOUT_base_wrapper( + _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, + _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, + _________________QWERTY_L3_________________, _________________QWERTY_R3_________________ + ), + + [_DEFAULT_LAYER_2] = LAYOUT_base_wrapper( + ______________COLEMAK_MOD_DH_L1____________, ______________COLEMAK_MOD_DH_R1____________, + ______________COLEMAK_MOD_DH_L2____________, ______________COLEMAK_MOD_DH_R2____________, + ______________COLEMAK_MOD_DH_L3____________, ______________COLEMAK_MOD_DH_R3____________ + ), + [_DEFAULT_LAYER_3] = LAYOUT_base_wrapper( + _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, + _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, + _________________COLEMAK_L3________________, _________________COLEMAK_R3________________ + ), + + [_DEFAULT_LAYER_4] = LAYOUT_base_wrapper( + _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, + _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, + _________________DVORAK_L3_________________, _________________DVORAK_R3_________________ + ), + + [_MOUSE] = LAYOUT_4x6_right( + _______, _______, _______, _______, _______, _______, KC_WH_U, _______, _______, _______, DPI_CONFIG, _______, + _______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, _______, + _______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______ + ), + [_GAMEPAD] = LAYOUT_4x6_right( + KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, _______, _______, _______, _______, _______, _______, + KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, _______, _______, _______, _______, _______, _______, + KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_H, _______, _______, _______, _______, _______, _______, + KC_I, KC_T, TG_GAME, KC_NO, + KC_V, KC_O, _______, + KC_SPC, KC_P, _______, + KC_H, KC_LGUI, _______, _______ + ), + [_DIABLO] = LAYOUT_4x6_right( + KC_TAB, KC_S, KC_I, KC_F, KC_M, KC_T, _______, _______, _______, _______, _______, _______, + KC_Q, KC_1, KC_2, KC_3, KC_4, KC_G, _______, _______, _______, _______, _______, _______, + KC_LCTL, KC_D3_1, KC_D3_2, KC_D3_3, KC_D3_4, KC_Z, _______, _______, _______, _______, _______, _______, + KC_F, KC_L, KC_NO, TG_DBLO, + KC_DIABLO_CLEAR, KC_F, _______, + SFT_T(KC_SPC), KC_J, _______, + ALT_T(KC_Q), KC_LGUI, _______, _______ + ), + [_LOWER] = LAYOUT_4x6_right_wrapper( + KC_F12, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_F11, + _______, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE, + _______, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______, + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______ + ), + [_RAISE] = LAYOUT_4x6_right_wrapper( + KC_F12, _________________RAISE_L1__________________, _________________RAISE_R1__________________, KC_F11, + _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, + _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______, + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______ + ), + [_ADJUST] = LAYOUT_4x6_right_wrapper( + KC_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RST, + VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EEP_RST, + UC_MOD, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, TG_MODS, + HPT_DWLI, HPT_DWLD, TG_GAME, TG_DBLO, + HPT_TOG, HPT_BUZ, KC_NUKE, + _______, _______, _______, + _______, _______, KC_NUKE, _______ + ), +}; +// clang-format on + +#ifdef POINTING_DEVICE_ENABLE +static uint16_t mouse_timer = 0; +static uint16_t mouse_debounce_timer = 0; +static uint8_t mouse_keycode_tracker = 0; +bool tap_toggling = false; + +void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) { + if ((x || y) && timer_elapsed(mouse_timer) > 125) { + mouse_timer = timer_read(); + if (!layer_state_is(_MOUSE) && !(layer_state_is(_GAMEPAD) || layer_state_is(_DIABLO)) && timer_elapsed(mouse_debounce_timer) > 125) { + layer_on(_MOUSE); + } + } + +# ifdef TAPPING_TERM_PER_KEY + if (timer_elapsed(mouse_debounce_timer) > get_tapping_term(KC_BTN1, NULL) +# else + if (timer_elapsed(mouse_debounce_timer) > TAPPING_TERM +# endif + || (layer_state_is(_GAMEPAD) || layer_state_is(_DIABLO))) { + mouse_report->x = x; + mouse_report->y = y; + } +# ifdef OLED_DRIVER_ENABLE + if (x || y) oled_timer = timer_read32(); +# endif +} + +void matrix_scan_keymap(void) { + if (timer_elapsed(mouse_timer) > 650 && layer_state_is(_MOUSE) && !mouse_keycode_tracker && !tap_toggling) { + layer_off(_MOUSE); + } + if (tap_toggling) { + if (!layer_state_is(_MOUSE)) { + layer_on(_MOUSE); + } + } +} + +bool process_record_keymap(uint16_t keycode, keyrecord_t* record) { + switch (keycode) { + case TT(_MOUSE): + { + if (record->event.pressed) { + mouse_keycode_tracker++; + } else { +# if TAPPING_TOGGLE != 0 + if (record->tap.count == TAPPING_TOGGLE) { + tap_toggling ^= 1; +# if TAPPING_TOGGLE == 1 + if (!tap_toggling) mouse_keycode_tracker -= record->tap.count + 1; +# else + if (!tap_toggling) mouse_keycode_tracker -= record->tap.count; +# endif + } else { + mouse_keycode_tracker--; + } +# endif + } + mouse_timer = timer_read(); + break; + } + case MO(_MOUSE): + case DPI_CONFIG: + case KC_MS_UP ... KC_MS_WH_RIGHT: + record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--; + mouse_timer = timer_read(); + break; + default: + if (layer_state_is(_MOUSE) && !mouse_keycode_tracker) { + layer_off(_MOUSE); + } + mouse_keycode_tracker = 0; + mouse_debounce_timer = timer_read(); + break; + } + return true; +} + +layer_state_t layer_state_set_keymap(layer_state_t state) { + if (layer_state_cmp(state, _GAMEPAD) || layer_state_cmp(state, _DIABLO)) { + state |= (1UL << _MOUSE); + } + return state; +} +#endif + +void matrix_init_keymap(void) { +#ifdef AUDIO_ENABLE + extern audio_config_t audio_config; + + if (!is_keyboard_master()) { + audio_stop_all(); + audio_config.enable = false; + } +#endif +} + +void keyboard_post_init_keymap(void) { matrix_init_keymap(); } diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/rules.mk b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/rules.mk new file mode 100644 index 0000000000..d658d45bfc --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/rules.mk @@ -0,0 +1,9 @@ +RGBLIGHT_STARTUP_ANIMATION = yes +AUDIO_ENABLE = yes +HAPTIC_ENABLE = no +COMMAND_ENABLE = no +TAP_DANCE_ENABLE = yes +UNICODE_ENABLE = yes +OLED_DRIVER_ENABLE = yes +WPM_ENABLE = yes +# DEBOUNCE_TYPE = sym_eager_pk diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/readme.md b/keyboards/handwired/tractyl_manuform/4x6_right/readme.md new file mode 100644 index 0000000000..b6e38dc845 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/4x6_right/readme.md @@ -0,0 +1,21 @@ +# Drashna's Dactyl Manuform (5x6) with a right side trackball + +![](https://preview.redd.it/zwt91036m3y51.jpg?width=960&crop=smart&auto=webp&s=e030deb7d8285c95a1a30c69a7e7a71f750e87bb) + +It's a Dactyl Manuform with an integrated thumb based trackball, using the pmw3360 optical sensor. + +It's powered by 2x Teensy++ 2.0's, using Drashna's [Teensy VBUS Hack](https://docs.qmk.fm/#/feature_split_keyboard?id=hardware-considerations-and-mods) for better detection. + + +* Keyboard Maintainer: [Drashna Jael're](https://github.com/drashna) +* Hardware Supported: [Design files](https://gitlab.com/keyboards1/dm_r_track/-/tree/master/boolean), [Teensy++ 2.0 (2x)](https://www.pjrc.com/store/teensypp.html), [PMW3360 Optical Sensor](https://www.tindie.com/products/jkicklighter/pmw3360-motion-sensor/) + +Make example for this keyboard (after setting up your build environment): + + make handwired/dactyl_manuform/5x6_right_trackball:default + +Flashing example for this keyboard: + + make handwired/dactyl_manuform/5x6_right_trackball:default:flash + +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). diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/rules.mk b/keyboards/handwired/tractyl_manuform/4x6_right/rules.mk new file mode 100644 index 0000000000..460802a1bf --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/4x6_right/rules.mk @@ -0,0 +1,33 @@ +# MCU name +MCU = at90usb1286 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output +RGB_MATRIX_ENABLE = no +RGB_MATRIX_DRIVER = WS2812 + + +POINTING_DEVICE_ENABLE = yes +MOUSE_SHARED_EP = no + +SPLIT_KEYBOARD = yes + +SRC += drivers/sensors/pmw3360.c +QUANTUM_LIB_SRC += spi_master.c tm_sync.c diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.c b/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.c new file mode 100644 index 0000000000..af9cbda49d --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.c @@ -0,0 +1,39 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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/>. + */ + +#include "5x6_right.h" + +#ifdef SWAP_HANDS_ENABLE +const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { + /* Left hand, matrix positions */ + {{5, 6}, {4, 6}, {3, 6}, {2, 6}, {1, 6}, {0, 6}}, + {{5, 7}, {4, 7}, {3, 7}, {2, 7}, {1, 7}, {0, 7}}, + {{5, 8}, {4, 8}, {3, 8}, {2, 8}, {1, 8}, {0, 8}}, + {{5, 9}, {4, 9}, {3, 9}, {2, 9}, {1, 9}, {0, 9}}, + {{5, 10}, {4, 10}, {3, 10}, {2, 10}, {1, 10}, {0, 10}}, + {{5, 11}, {4, 11}, {3, 11}, {2, 11}, {1, 11}, {0, 11}}, + /* Right hand, matrix positions */ + {{5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}}, + {{5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}}, + {{5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}}, + {{5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}}, + {{5, 4}, {4, 4}, {3, 4}, {2, 4}, {1, 4}, {0, 4}}, + {{5, 5}, {4, 5}, {3, 5}, {2, 5}, {1, 5}, {0, 5}}}; + +# ifdef ENCODER_MAP_ENABLE +const uint8_t PROGMEM encoder_hand_swap_config[NUM_ENCODERS] = {1, 0}; +# endif +#endif diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.h b/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.h new file mode 100644 index 0000000000..90dc46d7e2 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.h @@ -0,0 +1,50 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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 "tractyl_manuform.h" +#include "quantum.h" + +#define ___ KC_NO + +// clang-format off +#define LAYOUT_5x6_right(\ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35, \ + L42, L43, R42, R43, \ + L44, L45, R41, \ + L54, L55, R51, \ + L52, L53, R52, R53 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05 }, \ + { L10, L11, L12, L13, L14, L15 }, \ + { L20, L21, L22, L23, L24, L25 }, \ + { L30, L31, L32, L33, L34, L35 }, \ + { ___, ___, L42, L43, L44, L45 }, \ + { ___, ___, L52, L53, L54, L55 }, \ + \ + { R00, R01, R02, R03, R04, R05 }, \ + { R10, R11, R12, R13, R14, R15 }, \ + { R20, R21, R22, R23, R24, R25 }, \ + { R30, R31, R32, R33, R34, R35 }, \ + { ___, R41, R42, R43, ___, ___ }, \ + { ___, R51, R52, R53, ___, ___ } \ +} +// clang-format on diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/config.h new file mode 100644 index 0000000000..915582c07e --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/config.h @@ -0,0 +1,92 @@ +/* +Copyright 2012 Jun Wako <wakojun@gmail.com> +Copyright 2015 Jack Humbert + +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" + +#define PRODUCT_ID 0x3536 +#define DEVICE_VER 0x0001 +#define PRODUCT Tractyl Manuform(5x6) + +/* key matrix size */ +// Rows are doubled-up +#define MATRIX_ROWS 12 +#define MATRIX_COLS 6 + +// wiring of each half +#define MATRIX_COL_PINS \ + { C0, C1, C2, C3, C4, C5 } +#define MATRIX_ROW_PINS \ + { F7, F6, F5, F4, F3, F2 } + +#define DIODE_DIRECTION COL2ROW + +// WS2812 RGB LED strip input and number of LEDs +#define RGB_DI_PIN E7 +#define RGBLED_NUM 20 +#define RGBLIGHT_SPLIT +#define RGBLED_SPLIT \ + { 10, 10 } +#define RGBLIGHT_SLEEP +// #define RGBW +#define RGBLIGHT_LIMIT_VAL 100 +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +// #define BACKLIGHT_LEVELS 3 + +#define DEBUG_LED_PIN D6 + +#define ROTATIONAL_TRANSFORM_ANGLE -25 + +/* Bootmagic Lite key configuration */ +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 +#define BOOTMAGIC_LITE_ROW_RIGHT 6 +#define BOOTMAGIC_LITE_COLUMN_RIGHT 5 + +#define AUDIO_PIN C6 +#define AUDIO_PIN_ALT B7 + +#define DYNAMIC_KEYMAP_LAYER_COUNT 16 +#define LAYER_STATE_16BIT + +/* serial.c configuration for split keyboard */ +#define SOFT_SERIAL_PIN D2 +#define EE_HANDS + +#define ENCODERS_PAD_A \ + { D5 } +#define ENCODERS_PAD_B \ + { D6 } +#define ENCODER_RESOLUTION 4 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION + +#define SERIAL_USE_MULTI_TRANSACTION +#define SPLIT_TRANSACTION_IDS_KB RPC_ID_STATE_SYNC, RPC_ID_SLAVE_STATE diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/info.json b/keyboards/handwired/tractyl_manuform/5x6_right/info.json new file mode 100644 index 0000000000..b6d4db4e7b --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/info.json @@ -0,0 +1,75 @@ +{ + "keyboard_name": "Tractyl Manuform 5x6", + "url": "", + "maintainer": "drashna", + "width": 17, + "height": 8, + "layouts": { + "LAYOUT_5x6_right": { + "layout": [ + {"label":"L00", "x":0, "y":0}, + {"label":"L01", "x":1, "y":0}, + {"label":"L02", "x":2, "y":0}, + {"label":"L03", "x":3, "y":0}, + {"label":"L04", "x":4, "y":0}, + {"label":"L05", "x":5, "y":0}, + {"label":"R00", "x":11, "y":0}, + {"label":"R01", "x":12, "y":0}, + {"label":"R02", "x":13, "y":0}, + {"label":"R03", "x":14, "y":0}, + {"label":"R04", "x":15, "y":0}, + {"label":"R05", "x":16, "y":0}, + {"label":"L10", "x":0, "y":1}, + {"label":"L11", "x":1, "y":1}, + {"label":"L12", "x":2, "y":1}, + {"label":"L13", "x":3, "y":1}, + {"label":"L14", "x":4, "y":1}, + {"label":"L15", "x":5, "y":1}, + {"label":"R10", "x":11, "y":1}, + {"label":"R11", "x":12, "y":1}, + {"label":"R12", "x":13, "y":1}, + {"label":"R13", "x":14, "y":1}, + {"label":"R14", "x":15, "y":1}, + {"label":"R15", "x":16, "y":1}, + {"label":"L20", "x":0, "y":2}, + {"label":"L21", "x":1, "y":2}, + {"label":"L22", "x":2, "y":2}, + {"label":"L23", "x":3, "y":2}, + {"label":"L24", "x":4, "y":2}, + {"label":"L25", "x":5, "y":2}, + {"label":"R20", "x":11, "y":2}, + {"label":"R21", "x":12, "y":2}, + {"label":"R22", "x":13, "y":2}, + {"label":"R23", "x":14, "y":2}, + {"label":"R24", "x":15, "y":2}, + {"label":"R25", "x":16, "y":2}, + {"label":"L30", "x":0, "y":3}, + {"label":"L31", "x":1, "y":3}, + {"label":"L32", "x":2, "y":3}, + {"label":"L33", "x":3, "y":3}, + {"label":"L34", "x":4, "y":3}, + {"label":"L35", "x":5, "y":3}, + {"label":"R30", "x":11, "y":3}, + {"label":"R31", "x":12, "y":3}, + {"label":"R32", "x":13, "y":3}, + {"label":"R33", "x":14, "y":3}, + {"label":"R34", "x":15, "y":3}, + {"label":"R35", "x":16, "y":3}, + {"label":"L42", "x":2, "y":4}, + {"label":"L43", "x":3, "y":4}, + {"label":"R42", "x":13, "y":4}, + {"label":"R43", "x":14, "y":4}, + {"label":"L44", "x":4, "y":5}, + {"label":"L45", "x":5, "y":5}, + {"label":"R41", "x":12, "y":5}, + {"label":"L54", "x":6, "y":6}, + {"label":"L55", "x":7, "y":6}, + {"label":"R51", "x":10, "y":6}, + {"label":"L52", "x":6, "y":7}, + {"label":"L53", "x":7, "y":7}, + {"label":"R52", "x":9, "y":7}, + {"label":"R53", "x":10, "y":7} + ] + } + } +} diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/default/keymap.c b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/default/keymap.c new file mode 100644 index 0000000000..30dafdf516 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/default/keymap.c @@ -0,0 +1,63 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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/>. + */ + +#include QMK_KEYBOARD_H + +enum custom_layers { + _QWERTY, + _LOWER, + _RAISE, +}; + + +#define RAISE MO(_RAISE) +#define LOWER MO(_LOWER) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT_5x6_right( + KC_ESC , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 ,KC_BSPC, + KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P ,KC_MINS, + KC_LSFT, KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L ,KC_SCLN,KC_QUOT, + KC_LCTL, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M ,KC_COMM,KC_DOT ,KC_SLSH,KC_BSLASH, + KC_LBRC,KC_RBRC, KC_PLUS, KC_EQL, + RAISE,KC_SPC, LOWER, + KC_TAB,KC_HOME, KC_DEL, + KC_BSPC, KC_GRV, KC_LGUI, KC_ENT + ), + + [_LOWER] = LAYOUT_5x6_right( + KC_TILD,KC_EXLM, KC_AT ,KC_HASH,KC_DLR ,KC_PERC, KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RPRN,KC_DEL, + _______,_______,_______,_______,_______,KC_LBRC, KC_RBRC, KC_P7 , KC_P8 , KC_P9 ,_______,KC_PLUS, + _______,KC_HOME,KC_PGUP,KC_PGDN,KC_END ,KC_LPRN, KC_RPRN, KC_P4 , KC_P5 , KC_P6 ,KC_MINS,KC_PIPE, + _______,_______,_______,_______,_______,_______, _______, KC_P1 , KC_P2 , KC_P3 ,KC_EQL ,KC_UNDS, + _______,KC_PSCR, _______, KC_P0, + _______,_______, _______, + _______,_______, _______, + _______,_______, _______,_______ + + ), + + [_RAISE] = LAYOUT_5x6_right( + KC_F12 , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 ,KC_F10 ,KC_F11 , + _______,_______,_______,_______,_______,KC_LBRC, KC_RBRC,_______,KC_NLCK,KC_INS ,KC_SLCK,KC_MUTE, + _______,KC_LEFT,KC_UP ,KC_DOWN,KC_RGHT,KC_LPRN, KC_RPRN,KC_MPRV,KC_MPLY,KC_MNXT,_______,KC_VOLU, + _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,KC_VOLD, + _______,_______, KC_EQL ,_______, + _______,_______, _______, + _______,_______, _______, + _______,_______, _______,_______ + ), +}; diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h new file mode 100644 index 0000000000..21bc8e616a --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h @@ -0,0 +1,36 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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 + +// #define USE_I2C +// #define SELECT_SOFT_SERIAL_SPEED 1 +// #define SERIAL_USE_MULTI_TRANSACTION +#define SPLIT_MODS_ENABLE +#define EE_HANDS + +#define TRACKBALL_DPI_OPTIONS { 1200, 1800, 2600, 3400 } + +#define RGBLIGHT_MAX_BRIGHTNESS 60 + +#undef DEBOUNCE +#define DEBOUNCE 10 + +#define SOLENOID_PIN F1 +#define SOLENOID_DEFAULT_DWELL 8 + +#define OLED_DISPLAY_128X64 +#define OLED_BRIGHTNESS 50 diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c new file mode 100644 index 0000000000..a57da64d54 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c @@ -0,0 +1,251 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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/>. + */ + +#include "drashna.h" + +// clang-format off +#define LAYOUT_5x6_right_wrapper(...) LAYOUT_5x6_right(__VA_ARGS__) +#define LAYOUT_5x6_right_base( \ + K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ + K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \ + ) \ + LAYOUT_5x6_right_wrapper( \ + KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, UC_IRNY, \ + SH_TT, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, SH_TT, \ + LALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \ + OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ + OS_LALT, OS_LGUI, OS_RGUI, OS_RALT, \ + KC_MUTE, KC_GRV, KC_BTN3, \ + KC_SPC, OS_LGUI, KC_ENT, \ + BK_LWER, TT(_MOUSE), TT(_MOUSE), DL_RAIS \ + ) +#define LAYOUT_base_wrapper(...) LAYOUT_5x6_right_base(__VA_ARGS__) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_DEFAULT_LAYER_1] = LAYOUT_base_wrapper( + _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, + _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, + _________________QWERTY_L3_________________, _________________QWERTY_R3_________________ + ), + + [_DEFAULT_LAYER_2] = LAYOUT_base_wrapper( + ______________COLEMAK_MOD_DH_L1____________, ______________COLEMAK_MOD_DH_R1____________, + ______________COLEMAK_MOD_DH_L2____________, ______________COLEMAK_MOD_DH_R2____________, + ______________COLEMAK_MOD_DH_L3____________, ______________COLEMAK_MOD_DH_R3____________ + ), + [_DEFAULT_LAYER_3] = LAYOUT_base_wrapper( + _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, + _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, + _________________COLEMAK_L3________________, _________________COLEMAK_R3________________ + ), + + [_DEFAULT_LAYER_4] = LAYOUT_base_wrapper( + _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, + _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, + _________________DVORAK_L3_________________, _________________DVORAK_R3_________________ + ), + + [_MOUSE] = LAYOUT_5x6_right( + _______, _______, _______, _______, _______, _______, DPI_CONFIG, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, KC_WH_U, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, _______, + _______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______, + _______, _______, _______, _______, + _______, _______, KC_BTN3, + _______, _______, _______, + _______, _______, _______, _______ + ), + [_GAMEPAD] = LAYOUT_5x6_right( + KC_ESC, KC_NO, KC_1, KC_2, KC_3, KC_4, DPI_CONFIG, _______, _______, _______, _______, _______, + KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, _______, _______, _______, _______, _______, _______, + KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, _______, _______, _______, _______, _______, _______, + KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_H, _______, _______, _______, _______, _______, _______, + KC_I, KC_T, TG_GAME, KC_NO, + KC_V, KC_O, _______, + KC_SPC, KC_P, _______, + KC_H, KC_LGUI, _______, _______ + ), + [_DIABLO] = LAYOUT_5x6_right( + KC_ESC, KC_V, KC_D, KC_LALT, KC_NO, KC_NO, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, + KC_TAB, KC_S, KC_I, KC_F, KC_M, KC_T, _______, _______, _______, _______, _______, _______, + KC_Q, KC_1, KC_2, KC_3, KC_4, KC_G, _______, _______, _______, _______, _______, _______, + KC_LCTL, KC_D3_1, KC_D3_2, KC_D3_3, KC_D3_4, KC_Z, _______, _______, _______, _______, _______, _______, + KC_F, KC_L, KC_NO, TG_DBLO, + KC_DIABLO_CLEAR, KC_F, _______, + SFT_T(KC_SPC), KC_J, _______, + ALT_T(KC_Q), KC_LGUI, _______, _______ + ), + [_LOWER] = LAYOUT_5x6_right_wrapper( + KC_F12, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11, + _______, _________________LOWER_L1__________________, _________________LOWER_R1__________________, _______, + _______, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE, + _______, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______, + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______ + ), + [_RAISE] = LAYOUT_5x6_right_wrapper( + KC_F12, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11, + KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______, + _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, + _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______, + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______ + ), + [_ADJUST] = LAYOUT_5x6_right_wrapper( + KC_MAKE, ___________________BLANK___________________, _________________ADJUST_R1_________________, KC_RST, + VRSN, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, EEP_RST, + UC_MOD, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG_MODS, + _______, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY, + HPT_DWLI, HPT_DWLD, TG_GAME, TG_DBLO, + HPT_TOG, HPT_BUZ, KC_NUKE, + _______, _______, _______, + _______, _______, KC_NUKE, _______ + ), +}; + +#define BASE_ENCODERS { { KC_VOLD, KC_VOLU }, { KC_WH_D, KC_WH_U } } + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_DEFAULT_LAYER_1] = BASE_ENCODERS, + [_DEFAULT_LAYER_2] = BASE_ENCODERS, + [_DEFAULT_LAYER_3] = BASE_ENCODERS, + [_DEFAULT_LAYER_4] = BASE_ENCODERS, + [_GAMEPAD] = { { _______, _______ }, { _______, _______ } }, + [_DIABLO] = { { _______, _______ }, { _______, _______ } }, + [_MOUSE] = { { _______, _______ }, { KC_WH_D, KC_WH_U } }, + [_MEDIA] = { { _______, _______ }, { _______, _______ } }, + [_RAISE] = { { _______, _______ }, { KC_PGDN, KC_PGUP } }, + [_LOWER] = { { RGB_MOD, RGB_RMOD}, { RGB_HUD, RGB_HUI } }, + [_ADJUST] = { { CK_DOWN, CK_UP }, { _______, _______ } }, +}; +#else +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { + tap_code_delay(clockwise ? KC_VOLU : KC_VOLD, 5); + } else if (index == 1) { + tap_code_delay(clockwise ? KC_WH_U : KC_WH_D, 5); + } + return false; +} +#endif +// clang-format on + +#ifdef POINTING_DEVICE_ENABLE +static uint16_t mouse_timer = 0; +static uint16_t mouse_debounce_timer = 0; +static uint8_t mouse_keycode_tracker = 0; +bool tap_toggling = false; + +void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) { + if ((x || y) && timer_elapsed(mouse_timer) > 125) { + mouse_timer = timer_read(); + if (!layer_state_is(_MOUSE) && !(layer_state_is(_GAMEPAD) || layer_state_is(_DIABLO)) && timer_elapsed(mouse_debounce_timer) > 125) { + layer_on(_MOUSE); + } + } + +# ifdef TAPPING_TERM_PER_KEY + if (timer_elapsed(mouse_debounce_timer) > get_tapping_term(KC_BTN1, NULL) +# else + if (timer_elapsed(mouse_debounce_timer) > TAPPING_TERM +# endif + || (layer_state_is(_GAMEPAD) || layer_state_is(_DIABLO))) { + mouse_report->x = x; + mouse_report->y = y; + } +# ifdef OLED_DRIVER_ENABLE + if (x || y) oled_timer = timer_read32(); +# endif +} + +void matrix_scan_keymap(void) { + if (timer_elapsed(mouse_timer) > 650 && layer_state_is(_MOUSE) && !mouse_keycode_tracker && !tap_toggling) { + layer_off(_MOUSE); + } + if (tap_toggling) { + if (!layer_state_is(_MOUSE)) { + layer_on(_MOUSE); + } + } +} + +bool process_record_keymap(uint16_t keycode, keyrecord_t* record) { + switch (keycode) { + case TT(_MOUSE): + { + if (record->event.pressed) { + mouse_keycode_tracker++; + } else { +# if TAPPING_TOGGLE != 0 + if (record->tap.count == TAPPING_TOGGLE) { + tap_toggling ^= 1; +# if TAPPING_TOGGLE == 1 + if (!tap_toggling) mouse_keycode_tracker -= record->tap.count + 1; +# else + if (!tap_toggling) mouse_keycode_tracker -= record->tap.count; +# endif + } else { + mouse_keycode_tracker--; + } +# endif + } + mouse_timer = timer_read(); + break; + } + case MO(_MOUSE): + case DPI_CONFIG: + case KC_MS_UP ... KC_MS_WH_RIGHT: + record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--; + mouse_timer = timer_read(); + break; + default: + if (IS_NOEVENT(record->event)) break; + if (layer_state_is(_MOUSE) && !mouse_keycode_tracker) { + layer_off(_MOUSE); + } + mouse_keycode_tracker = 0; + mouse_debounce_timer = timer_read(); + break; + } + return true; +} + +layer_state_t layer_state_set_keymap(layer_state_t state) { + if (layer_state_cmp(state, _GAMEPAD) || layer_state_cmp(state, _DIABLO)) { + state |= ((layer_state_t)1 << _MOUSE); + } + return state; +} +#endif + +void matrix_init_keymap(void) { +#ifdef AUDIO_ENABLE + extern audio_config_t audio_config; + + if (!is_keyboard_master()) { + audio_stop_all(); + audio_config.enable = false; + } +#endif +} + +void keyboard_post_init_keymap(void) { matrix_init_keymap(); } diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rgblight_breathe_table.h b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rgblight_breathe_table.h new file mode 100644 index 0000000000..fb921079bf --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rgblight_breathe_table.h @@ -0,0 +1,117 @@ +#pragma once + +#define RGBLIGHT_EFFECT_BREATHE_TABLE + +// clang-format off + +// Breathing center: 1.85 +// Breathing max: 100 + +const uint8_t PROGMEM rgblight_effect_breathe_table[] = { +#if RGBLIGHT_BREATHE_TABLE_SIZE == 256 + 0x0D, 0x0E, 0x0E, 0x0F, 0x0F, 0x10, 0x10, 0x11, + 0x11, 0x12, 0x13, 0x13, 0x14, 0x14, 0x15, 0x16, + 0x16, 0x17, 0x18, 0x18, 0x19, 0x19, 0x1A, 0x1B, + 0x1B, 0x1C, 0x1D, 0x1E, 0x1E, 0x1F, 0x20, 0x20, + 0x21, 0x22, 0x22, 0x23, 0x24, 0x25, 0x25, 0x26, + 0x27, 0x28, 0x28, 0x29, 0x2A, 0x2B, 0x2B, 0x2C, + 0x2D, 0x2E, 0x2E, 0x2F, 0x30, 0x31, 0x31, 0x32, + 0x33, 0x34, 0x34, 0x35, 0x36, 0x37, 0x38, 0x38, + 0x39, 0x3A, 0x3B, 0x3B, 0x3C, 0x3D, 0x3D, 0x3E, + 0x3F, 0x40, 0x40, 0x41, 0x42, 0x42, 0x43, 0x44, + 0x44, 0x45, 0x46, 0x46, 0x47, 0x48, 0x48, 0x49, + 0x4A, 0x4A, 0x4B, 0x4B, 0x4C, 0x4C, 0x4D, 0x4D, + 0x4E, 0x4E, 0x4F, 0x4F, 0x50, 0x50, 0x51, 0x51, + 0x51, 0x52, 0x52, 0x53, 0x53, 0x53, 0x54, 0x54, + 0x54, 0x54, 0x55, 0x55, 0x55, 0x55, 0x55, 0x56, + 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, + 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, + 0x56, 0x55, 0x55, 0x55, 0x55, 0x55, 0x54, 0x54, + 0x54, 0x54, 0x53, 0x53, 0x53, 0x52, 0x52, 0x51, + 0x51, 0x51, 0x50, 0x50, 0x4F, 0x4F, 0x4E, 0x4E, + 0x4D, 0x4D, 0x4C, 0x4C, 0x4B, 0x4B, 0x4A, 0x4A, + 0x49, 0x48, 0x48, 0x47, 0x46, 0x46, 0x45, 0x44, + 0x44, 0x43, 0x42, 0x42, 0x41, 0x40, 0x40, 0x3F, + 0x3E, 0x3D, 0x3D, 0x3C, 0x3B, 0x3B, 0x3A, 0x39, + 0x38, 0x38, 0x37, 0x36, 0x35, 0x34, 0x34, 0x33, + 0x32, 0x31, 0x31, 0x30, 0x2F, 0x2E, 0x2E, 0x2D, + 0x2C, 0x2B, 0x2B, 0x2A, 0x29, 0x28, 0x28, 0x27, + 0x26, 0x25, 0x25, 0x24, 0x23, 0x22, 0x22, 0x21, + 0x20, 0x20, 0x1F, 0x1E, 0x1E, 0x1D, 0x1C, 0x1B, + 0x1B, 0x1A, 0x19, 0x19, 0x18, 0x18, 0x17, 0x16, + 0x16, 0x15, 0x14, 0x14, 0x13, 0x13, 0x12, 0x11, + 0x11, 0x10, 0x10, 0x0F, 0x0F, 0x0E, 0x0E, 0x0D +#endif + +#if RGBLIGHT_BREATHE_TABLE_SIZE == 128 + 0x0D, 0x0E, 0x0F, 0x10, + 0x11, 0x13, 0x14, 0x15, + 0x16, 0x18, 0x19, 0x1A, + 0x1B, 0x1D, 0x1E, 0x20, + 0x21, 0x22, 0x24, 0x25, + 0x27, 0x28, 0x2A, 0x2B, + 0x2D, 0x2E, 0x30, 0x31, + 0x33, 0x34, 0x36, 0x38, + 0x39, 0x3B, 0x3C, 0x3D, + 0x3F, 0x40, 0x42, 0x43, + 0x44, 0x46, 0x47, 0x48, + 0x4A, 0x4B, 0x4C, 0x4D, + 0x4E, 0x4F, 0x50, 0x51, + 0x51, 0x52, 0x53, 0x54, + 0x54, 0x55, 0x55, 0x55, + 0x56, 0x56, 0x56, 0x56, + 0x56, 0x56, 0x56, 0x56, + 0x56, 0x55, 0x55, 0x54, + 0x54, 0x53, 0x53, 0x52, + 0x51, 0x50, 0x4F, 0x4E, + 0x4D, 0x4C, 0x4B, 0x4A, + 0x49, 0x48, 0x46, 0x45, + 0x44, 0x42, 0x41, 0x40, + 0x3E, 0x3D, 0x3B, 0x3A, + 0x38, 0x37, 0x35, 0x34, + 0x32, 0x31, 0x2F, 0x2E, + 0x2C, 0x2B, 0x29, 0x28, + 0x26, 0x25, 0x23, 0x22, + 0x20, 0x1F, 0x1E, 0x1C, + 0x1B, 0x19, 0x18, 0x17, + 0x16, 0x14, 0x13, 0x12, + 0x11, 0x10, 0x0F, 0x0E +#endif + +#if RGBLIGHT_BREATHE_TABLE_SIZE == 64 + 0x0D, 0x0F, + 0x11, 0x14, + 0x16, 0x19, + 0x1B, 0x1E, + 0x21, 0x24, + 0x27, 0x2A, + 0x2D, 0x30, + 0x33, 0x36, + 0x39, 0x3C, + 0x3F, 0x42, + 0x44, 0x47, + 0x4A, 0x4C, + 0x4E, 0x50, + 0x51, 0x53, + 0x54, 0x55, + 0x56, 0x56, + 0x56, 0x56, + 0x56, 0x55, + 0x54, 0x53, + 0x51, 0x4F, + 0x4D, 0x4B, + 0x49, 0x46, + 0x44, 0x41, + 0x3E, 0x3B, + 0x38, 0x35, + 0x32, 0x2F, + 0x2C, 0x29, + 0x26, 0x23, + 0x20, 0x1E, + 0x1B, 0x18, + 0x16, 0x13, + 0x11, 0x0F +#endif +}; + +static const int table_scale = 256 / sizeof(rgblight_effect_breathe_table); diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk new file mode 100644 index 0000000000..b95b166d8d --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk @@ -0,0 +1,12 @@ +RGBLIGHT_ENABLE = yes +RGBLIGHT_STARTUP_ANIMATION = yes +AUDIO_ENABLE = yes +HAPTIC_ENABLE = no +COMMAND_ENABLE = no +TAP_DANCE_ENABLE = yes +UNICODE_ENABLE = yes +OLED_DRIVER_ENABLE = yes +WPM_ENABLE = yes +ENCODER_ENABLE = yes +ENCODER_MAP_ENABLE = yes +# DEBOUNCE_TYPE = sym_eager_pk diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/readme.md b/keyboards/handwired/tractyl_manuform/5x6_right/readme.md new file mode 100644 index 0000000000..b6e38dc845 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/readme.md @@ -0,0 +1,21 @@ +# Drashna's Dactyl Manuform (5x6) with a right side trackball + +![](https://preview.redd.it/zwt91036m3y51.jpg?width=960&crop=smart&auto=webp&s=e030deb7d8285c95a1a30c69a7e7a71f750e87bb) + +It's a Dactyl Manuform with an integrated thumb based trackball, using the pmw3360 optical sensor. + +It's powered by 2x Teensy++ 2.0's, using Drashna's [Teensy VBUS Hack](https://docs.qmk.fm/#/feature_split_keyboard?id=hardware-considerations-and-mods) for better detection. + + +* Keyboard Maintainer: [Drashna Jael're](https://github.com/drashna) +* Hardware Supported: [Design files](https://gitlab.com/keyboards1/dm_r_track/-/tree/master/boolean), [Teensy++ 2.0 (2x)](https://www.pjrc.com/store/teensypp.html), [PMW3360 Optical Sensor](https://www.tindie.com/products/jkicklighter/pmw3360-motion-sensor/) + +Make example for this keyboard (after setting up your build environment): + + make handwired/dactyl_manuform/5x6_right_trackball:default + +Flashing example for this keyboard: + + make handwired/dactyl_manuform/5x6_right_trackball:default:flash + +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). diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk new file mode 100644 index 0000000000..efd1368575 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk @@ -0,0 +1,31 @@ +# MCU name +MCU = at90usb1286 + +# Bootloader selection +BOOTLOADER = halfkay + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output +SWAP_HANDS_ENABLE = yes + +POINTING_DEVICE_ENABLE = yes +MOUSE_SHARED_EP = no + +SPLIT_KEYBOARD = yes + +SRC += drivers/sensors/pmw3360.c +QUANTUM_LIB_SRC += spi_master.c tm_sync.c diff --git a/keyboards/handwired/tractyl_manuform/config.h b/keyboards/handwired/tractyl_manuform/config.h new file mode 100644 index 0000000000..e6ab57da9e --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/config.h @@ -0,0 +1,43 @@ +/* +Copyright 2012 Jun Wako <wakojun@gmail.com> +Copyright 2015 Jack Humbert + +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 0x44DD +#define MANUFACTURER Drashna + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +#define USB_POLLING_INTERVAL_MS 1 + +/* 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 diff --git a/keyboards/handwired/tractyl_manuform/post_config.h b/keyboards/handwired/tractyl_manuform/post_config.h new file mode 100644 index 0000000000..147e928735 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/post_config.h @@ -0,0 +1,96 @@ +/* +Copyright 2012 Jun Wako <wakojun@gmail.com> +Copyright 2015 Jack Humbert + +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 + +// mouse config +# ifndef MOUSEKEY_MOVE_DELTA +# ifndef MK_KINETIC_SPEED +# define MOUSEKEY_MOVE_DELTA 5 +# else +# define MOUSEKEY_MOVE_DELTA 25 +# endif +# endif +# ifndef MOUSEKEY_DELAY +# ifndef MK_KINETIC_SPEED +# define MOUSEKEY_DELAY 300 +# else +# define MOUSEKEY_DELAY 8 +# endif +# endif +# ifndef MOUSEKEY_INTERVAL +# ifndef MK_KINETIC_SPEED +# define MOUSEKEY_INTERVAL 50 +# else +# define MOUSEKEY_INTERVAL 20 +# endif +# endif +# ifndef MOUSEKEY_MAX_SPEED +# define MOUSEKEY_MAX_SPEED 7 +# endif +# ifndef MOUSEKEY_TIME_TO_MAX +# define MOUSEKEY_TIME_TO_MAX 60 +# endif +# ifndef MOUSEKEY_INITIAL_SPEED +# define MOUSEKEY_INITIAL_SPEED 100 +# endif +# ifndef MOUSEKEY_BASE_SPEED +# define MOUSEKEY_BASE_SPEED 1000 +# endif +# ifndef MOUSEKEY_DECELERATED_SPEED +# define MOUSEKEY_DECELERATED_SPEED 400 +# endif +# ifndef MOUSEKEY_ACCELERATED_SPEED +# define MOUSEKEY_ACCELERATED_SPEED 3000 +# endif + + +// mouse scroll config +# ifndef MOUSEKEY_WHEEL_DELAY +# define MOUSEKEY_WHEEL_DELAY 15 +# endif +# ifndef MOUSEKEY_WHEEL_DELTA +# define MOUSEKEY_WHEEL_DELTA 1 +# endif +# ifndef MOUSEKEY_WHEEL_INTERVAL +# define MOUSEKEY_WHEEL_INTERVAL 50 +# endif +# ifndef MOUSEKEY_WHEEL_MAX_SPEED +# define MOUSEKEY_WHEEL_MAX_SPEED 8 +# endif +# ifndef MOUSEKEY_WHEEL_TIME_TO_MAX +# define MOUSEKEY_WHEEL_TIME_TO_MAX 80 +# endif + +# ifndef MOUSEKEY_WHEEL_INITIAL_MOVEMENTS +# define MOUSEKEY_WHEEL_INITIAL_MOVEMENTS 8 +# endif +# ifndef MOUSEKEY_WHEEL_BASE_MOVEMENTS +# define MOUSEKEY_WHEEL_BASE_MOVEMENTS 48 +# endif +# ifndef MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS +# define MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS 48 +# endif +# ifndef MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS +# define MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS 8 +# endif + + +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif diff --git a/keyboards/handwired/tractyl_manuform/readme.md b/keyboards/handwired/tractyl_manuform/readme.md new file mode 100644 index 0000000000..3221da0e9d --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/readme.md @@ -0,0 +1,159 @@ +Dactyl Manuform (4x5, 5x6, 5x7, 6x6) +====== +the [Dactyl-Manuform](https://github.com/tshort/dactyl-keyboard) is a split curved keyboard based on the design of [adereth dactyl](https://github.com/adereth/dactyl-keyboard) and thumb cluster design of the [manuform](https://geekhack.org/index.php?topic=46015.0) keyboard, the hardware is similar to the let's split keyboard. all information needed for making one is in the first link. +![Imgur](https://i.imgur.com/7y0Vbyd.jpg) + + +## First Time Setup + +Download or clone the `qmk_firmware` repo and navigate to its top level directory. Once your build environment is setup, you'll be able to generate the default .hex using: + +Depending on your Layout chose one of the follwing commands: + +``` +$ make handwired/dactyl_manuform/YOUR_LAYOUT:YOUR_KEYMAP_NAME +``` + +example: +``` +$ make handwired/dactyl_manuform/4x5:default +``` + +If everything worked correctly you will see a file: + +``` +dactyl_manuform_YOUR_LAYOUT_YOUR_KEYMAP_NAME.hex +``` + +For more information on customizing keymaps, take a look at the primary documentation for [Customizing Your Keymap](/docs/faq_keymap.md) in the main readme.md. + + +## Keymaps + +### [Keymaps 4x5](/keyboards/handwired/dactyl_manuform/4x5/keymaps/) + +#### Default +Simple QWERTY layout with 3 Layers. +#### Dvorak + +### [Keymaps 5x6](/keyboards/handwired/dactyl_manuform/5x6/keymaps/) + +#### Default +Just a copy of the Impstyle keymap. Feel free to adjust it. + +#### Impstyle +A simple QWERTY keymap with 3 Layers. Both sides are connected via serial and the Left ist the master. + +### [Keymaps 5x7 aka almost Ergodox](/keyboards/handwired/dactyl_manuform/5x7/keymaps/) +#### Default +Keymap of Loligagger from geekhack. + +### [Keymaps 6x6](/keyboards/handwired/dactyl_manuform/6x6/keymaps/) + +#### Default +Simple QWERTY layout with 3 Layers. + +## Required Hardware + +Apart from diodes and key switches for the keyboard matrix in each half, you +will need: + +* 2 Arduino Pro Micros. You can find these on AliExpress for ≈3.50USD each. +* 2 TRRS sockets and 1 TRRS cable, or 2 TRS sockets and 1 TRS cable + +Alternatively, you can use any sort of cable and socket that has at least 3 +wires. If you want to use I2C to communicate between halves, you will need a +cable with at least 4 wires and 2x 4.7kΩ pull-up resistors + +## Optional Hardware +A speaker can be hooked-up to either side to the `5` (`C6`) pin and `GND`, and turned on via `AUDIO_ENABLE`. + +## Wiring + +The 3 wires of the TRS/TRRS cable need to connect GND, VCC, and digital pin 3 (i.e. +PD0 on the ATmega32u4) between the two Pro Micros. + +Next, wire your key matrix to any of the remaining 17 IO pins of the pro micro +and modify the `matrix.c` accordingly. + +The wiring for serial: + +![serial wiring](https://i.imgur.com/C3D1GAQ.png) + +The wiring for i2c: + +![i2c wiring](https://i.imgur.com/Hbzhc6E.png) + +The pull-up resistors may be placed on either half. It is also possible +to use 4 resistors and have the pull-ups in both halves, but this is +unnecessary in simple use cases. + +You can change your configuration between serial and i2c by modifying your `config.h` file. + +## Notes on Software Configuration + +the keymaps in here are for the 4x5 layout of the keyboard only. + +## Flashing + +To flash your firmware take a look at: [Flashing Instructions and Bootloader Information](https://docs.qmk.fm/#/flashing) + + +## Choosing which board to plug the USB cable into (choosing Master) + +Because the two boards are identical, the firmware has logic to differentiate the left and right board. + +It uses two strategies to figure things out: looking at the EEPROM (memory on the chip) or looking if the current board has the usb cable. + +The EEPROM approach requires additional setup (flashing the eeprom) but allows you to swap the usb cable to either side. + +The USB cable approach is easier to setup and if you just want the usb cable on the left board, you do not need to do anything extra. + +### Setting the left hand as master + +If you always plug the usb cable into the left board, nothing extra is needed as this is the default. Comment out `EE_HANDS` and comment out `I2C_MASTER_RIGHT` or `MASTER_RIGHT` if for some reason it was set. + +### Setting the right hand as master + +If you always plug the usb cable into the right board, add an extra flag to your `config.h` +``` + #define MASTER_RIGHT +``` + +### Setting EE_hands to use either hands as master + +If you define `EE_HANDS` in your `config.h`, you will need to set the +EEPROM for the left and right halves. + +The EEPROM is used to store whether the +half is left handed or right handed. This makes it so that the same firmware +file will run on both hands instead of having to flash left and right handed +versions of the firmware to each half. To flash the EEPROM file for the left +half run: +``` +make handwired/dactyl_promicro:default:dfu-split-left +make handwired/dactyl_promicro:default:dfu-split-right +``` + +After you have flashed the EEPROM, you then need to set `EE_HANDS` in your config.h, rebuild the hex files and reflash. + +Note that you need to program both halves, but you have the option of using +different keymaps for each half. You could program the left half with a QWERTY +layout and the right half with a Colemak layout using bootmagic's default layout option. +Then if you connect the left half to a computer by USB the keyboard will use QWERTY and Colemak when the +right half is connected. + + +Notes on Using Pro Micro 3.3V +----------------------------- + +Do update the `F_CPU` parameter in `rules.mk` to `8000000` which reflects +the frequency on the 3.3V board. + +Also, if the slave board is producing weird characters in certain columns, +update the following line in `matrix.c` to the following: + +``` +// wait_us(30); // without this wait read unstable value. +wait_us(300); // without this wait read unstable value. +``` diff --git a/keyboards/handwired/tractyl_manuform/tm_sync.c b/keyboards/handwired/tractyl_manuform/tm_sync.c new file mode 100644 index 0000000000..f0a611206d --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/tm_sync.c @@ -0,0 +1,132 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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/>. + */ + +#ifdef SPLIT_TRANSACTION_IDS_KB + +# include "tractyl_manuform.h" +# include "transactions.h" +# include <string.h> +# include "drivers/sensors/pmw3360.h" + +kb_runtime_config_t kb_state; +kb_slave_data_t kb_slave; + +void slave_state_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) { + if (target2initiator_buffer_size == sizeof(kb_slave)) { + memcpy(target2initiator_buffer, &kb_slave, sizeof(kb_slave)); + if (kb_slave.mouse_x > 127) { + kb_slave.mouse_x -= 127; + } else if (kb_slave.mouse_x < -127) { + kb_slave.mouse_x += 127; + } else { + kb_slave.mouse_x = 0; + } + + if (kb_slave.mouse_y > 127) { + kb_slave.mouse_y -= 127; + } else if (kb_slave.mouse_y < -127) { + kb_slave.mouse_y += 127; + } else { + kb_slave.mouse_y = 0; + } + } +} + +void pointer_state_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) { + if (initiator2target_buffer_size == sizeof(kb_state)) { + memcpy(&kb_state, initiator2target_buffer, sizeof(kb_state)); + } +} + +void keyboard_post_init_kb(void) { + // Register keyboard state sync split transaction + transaction_register_rpc(RPC_ID_STATE_SYNC, pointer_state_sync); + transaction_register_rpc(RPC_ID_SLAVE_STATE, slave_state_sync); + + keyboard_post_init_user(); +} + +void kb_state_update(void) { +# ifdef POINTING_DEVICE_ENABLE + if (is_keyboard_master() && !is_keyboard_left()) { + static uint16_t cpi = 0; + if (cpi != kb_state.device_cpi) { + cpi = kb_state.device_cpi; + pmw_set_cpi(cpi); + } + } +# endif +} + +void kb_post_state_update(void) { +# ifdef POINTING_DEVICE_ENABLE + if (is_keyboard_master() && is_keyboard_left()) { + report_mouse_t temp_report = pointing_device_get_report(); + temp_report.x = kb_slave.mouse_x; + temp_report.y = kb_slave.mouse_y; + pointing_device_set_report(temp_report); + } +# endif +} + +void kb_state_sync(void) { + if (is_keyboard_master()) { + // Keep track of the last state, so that we can tell if we need to propagate to slave + static kb_runtime_config_t last_kb_state; + static uint32_t last_sync = 0; + static uint32_t mouse_sync = 0; + bool needs_sync = false; + + // Check if the state values are different + if (memcmp(&kb_state, &last_kb_state, sizeof(kb_runtime_config_t))) { + needs_sync = true; + memcpy(&last_kb_state, &kb_state, sizeof(kb_runtime_config_t)); + } + // Send to slave every 500ms regardless of state change + if (timer_elapsed32(last_sync) > 500) { + needs_sync = true; + } + + // Perform the sync if requested + if (needs_sync) { + if (transaction_rpc_send(RPC_ID_STATE_SYNC, sizeof(kb_runtime_config_t), &kb_state)) { + last_sync = timer_read32(); + } + } + + if (is_keyboard_left()) { + if (timer_elapsed32(mouse_sync) >= 5) { + // always sync slave data, since it may contain device reports. + if (transaction_rpc_recv(RPC_ID_SLAVE_STATE, sizeof(kb_slave_data_t), &kb_slave)) { + if (kb_slave.mouse_x >= -127 && kb_slave.mouse_x <= 127 && kb_slave.mouse_y >= -127 && kb_slave.mouse_y <= 127) { + mouse_sync = timer_read32(); + } + } + } + } + } +} + +void housekeeping_task_kb(void) { + // Update kb_state so we can send to slave + kb_state_update(); + + // Data sync from master to slave + kb_state_sync(); + + kb_post_state_update(); +} +#endif diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c new file mode 100644 index 0000000000..49a8336829 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c @@ -0,0 +1,218 @@ +/* Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + * + * 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/>. + */ + +#include "tractyl_manuform.h" +#include "transactions.h" +#include <string.h> +#include "drivers/sensors/pmw3360.h" + +#ifndef TRACKBALL_DPI_OPTIONS +# define TRACKBALL_DPI_OPTIONS \ + { 1200, 1600, 2400 } +# ifndef TRACKBALL_DPI_DEFAULT +# define TRACKBALL_DPI_DEFAULT 1 +# endif +#endif +#ifndef TRACKBALL_DPI_DEFAULT +# define TRACKBALL_DPI_DEFAULT 0 +#endif + +extern kb_runtime_config_t kb_state; +extern kb_slave_data_t kb_slave; + +keyboard_config_t keyboard_config; +uint16_t dpi_array[] = TRACKBALL_DPI_OPTIONS; +#define DPI_OPTION_SIZE (sizeof(dpi_array) / sizeof(uint16_t)) + +bool BurstState = false; // init burst state for Trackball module +uint16_t MotionStart = 0; // Timer for accel, 0 is resting state + +__attribute__((weak)) void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) { + mouse_report->x = x; + mouse_report->y = y; +} + +__attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) { + report_pmw_t data = pmw_read_burst(); + if (data.isOnSurface && data.isMotion) { + // Reset timer if stopped moving + if (!data.isMotion) { + if (MotionStart != 0) MotionStart = 0; + return; + } + + // Set timer if new motion + if ((MotionStart == 0) && data.isMotion) { + if (debug_mouse) dprintf("Starting motion.\n"); + MotionStart = timer_read(); + } + + if (debug_mouse) { dprintf("Delt] d: %d t: %u\n", abs(data.dx) + abs(data.dy), MotionStart); } + if (debug_mouse) { dprintf("Pre ] X: %d, Y: %d\n", data.dx, data.dy); } +#if defined(PROFILE_LINEAR) + float scale = float(timer_elaspsed(MotionStart)) / 1000.0; + data.dx *= scale; + data.dy *= scale; +#elif defined(PROFILE_INVERSE) + // TODO +#else + // no post processing +#endif + + // Wrap to HID size + data.dx = constrain(data.dx, -127, 127); + data.dy = constrain(data.dy, -127, 127); + if (debug_mouse) dprintf("Cons] X: %d, Y: %d\n", data.dx, data.dy); + // dprintf("Elapsed:%u, X: %f Y: %\n", i, pgm_read_byte(firmware_data+i)); + + mouse_report->x = -data.dx; + mouse_report->y = data.dy; + } +} + +bool process_record_kb(uint16_t keycode, keyrecord_t* record) { + if (!process_record_user(keycode, record)) { return false; } + +#ifdef POINTING_DEVICE_ENABLE + if (keycode == DPI_CONFIG && record->event.pressed) { + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + keyboard_config.dpi_config = (keyboard_config.dpi_config - 1) % DPI_OPTION_SIZE; + } else { + keyboard_config.dpi_config = (keyboard_config.dpi_config + 1) % DPI_OPTION_SIZE; + } + eeconfig_update_kb(keyboard_config.raw); + trackball_set_cpi(dpi_array[keyboard_config.dpi_config]); + } +#endif + +/* If Mousekeys is disabled, then use handle the mouse button + * keycodes. This makes things simpler, and allows usage of + * the keycodes in a consistent manner. But only do this if + * Mousekeys is not enable, so it's not handled twice. + */ +#ifndef MOUSEKEY_ENABLE + if (IS_MOUSEKEY_BUTTON(keycode)) { + report_mouse_t currentReport = pointing_device_get_report(); + if (record->event.pressed) { + currentReport.buttons |= 1 << (keycode - KC_MS_BTN1); + } else { + currentReport.buttons &= ~(1 << (keycode - KC_MS_BTN1)); + } + pointing_device_set_report(currentReport); + pointing_device_send(); + } +#endif + + return true; +} + +// Hardware Setup +void keyboard_pre_init_kb(void) { + // debug_enable = true; + // debug_matrix = true; + // debug_mouse = true; + // debug_encoder = true; + + /* Ground all output pins connected to ground. This provides additional + * pathways to ground. If you're messing with this, know this: driving ANY + * of these pins high will cause a short. On the MCU. Ka-blooey. + */ + + // This is the debug LED. +#if defined(DEBUG_LED_PIN) + setPinOutput(DEBUG_LED_PIN); + writePin(DEBUG_LED_PIN, debug_enable); +#endif + + keyboard_pre_init_user(); +} + +#ifdef POINTING_DEVICE_ENABLE +void pointing_device_init(void) { + if (!is_keyboard_left()) { + // initialize ball sensor + pmw_spi_init(); + } + trackball_set_cpi(dpi_array[keyboard_config.dpi_config]); +} + +static bool has_report_changed(report_mouse_t new, report_mouse_t old) { return (new.buttons != old.buttons) || (new.x&& new.x != old.x) || (new.y&& new.y != old.y) || (new.h&& new.h != old.h) || (new.v&& new.v != old.v); } + +void pointing_device_task(void) { + report_mouse_t mouse_report = pointing_device_get_report(); + if (!is_keyboard_left()) { process_mouse(&mouse_report); } + + pointing_device_set_report(mouse_report); + pointing_device_send(); +} +#endif + +void eeconfig_init_kb(void) { + keyboard_config.dpi_config = TRACKBALL_DPI_DEFAULT; +#ifdef POINTING_DEVICE_ENABLE + trackball_set_cpi(dpi_array[keyboard_config.dpi_config]); +#endif + eeconfig_update_kb(keyboard_config.raw); + eeconfig_init_user(); +} + +void matrix_init_kb(void) { + // is safe to just read DPI setting since matrix init + // comes before pointing device init. + keyboard_config.raw = eeconfig_read_kb(); + if (keyboard_config.dpi_config > DPI_OPTION_SIZE) { eeconfig_init_kb(); } + matrix_init_user(); +} + +#ifdef POINTING_DEVICE_ENABLE +void pointing_device_send(void) { + static report_mouse_t old_report = {}; + report_mouse_t mouseReport = pointing_device_get_report(); + if (is_keyboard_master()) { + int8_t x = mouseReport.x, y = mouseReport.y; + mouseReport.x = 0; + mouseReport.y = 0; + process_mouse_user(&mouseReport, x, y); + if (has_report_changed(mouseReport, old_report)) { host_mouse_send(&mouseReport); } + } else { + master_mouse_send(mouseReport.x, mouseReport.y); + } + mouseReport.x = 0; + mouseReport.y = 0; + mouseReport.v = 0; + mouseReport.h = 0; + old_report = mouseReport; + pointing_device_set_report(mouseReport); +} +#endif + +#ifdef POINTING_DEVICE_ENABLE +void master_mouse_send(int8_t x, int8_t y) { +#ifdef SPLIT_TRANSACTION_IDS_KB + kb_slave.mouse_x += x; + kb_slave.mouse_y += y; +#endif +} +void trackball_set_cpi(uint16_t cpi) { + if (!is_keyboard_left()) { + pmw_set_cpi(cpi); + } else { +#ifdef SPLIT_TRANSACTION_IDS_KB + kb_state.device_cpi = cpi; +#endif + } +} +#endif diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.h b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h new file mode 100644 index 0000000000..151e496fc6 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h @@ -0,0 +1,55 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * + * 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 "quantum.h" +#include "pointing_device.h" + +#if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right) +# include "5x6_right.h" +#elif defined(KEYBOARD_handwired_tractyl_manuform_4x6_right) +# include "4x6_right.h" +#endif + +void process_mouse(report_mouse_t* mouse_report); +void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y); + +typedef union { + uint32_t raw; + struct { + uint8_t dpi_config; + }; +} keyboard_config_t; + +extern keyboard_config_t keyboard_config; + +enum ploopy_keycodes { + DPI_CONFIG = SAFE_RANGE, + KEYMAP_SAFE_RANGE, +}; + +void master_mouse_send(int8_t x, int8_t y); +void trackball_set_cpi(uint16_t cpi); + +typedef struct { + uint16_t device_cpi; +} kb_runtime_config_t; + +typedef struct { + int16_t mouse_x; + int16_t mouse_y; +} kb_slave_data_t; |