diff --git a/keyboards/diverge3/config.h b/keyboards/diverge3/config.h new file mode 100644 index 00000000..db3c6a6f --- /dev/null +++ b/keyboards/diverge3/config.h @@ -0,0 +1,192 @@ +/* +Copyright 2017 IslandMan93 + +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 . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x1257 +#define DEVICE_VER 0x0001 +#define MANUFACTURER UniKeyboard +#define PRODUCT diverge3 +#define DESCRIPTION Split 72 key keyboard + +/* key matrix size */ +#define MATRIX_ROWS 10 +#define MATRIX_COLS 8 +// SERIAL is the only supported +#define USE_SERIAL + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ +#define MATRIX_ROW_PINS { D4, D7, E6, B4, B5 } +#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, B6 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ +#define DIODE_DIRECTION ROW2COL + +// #define BACKLIGHT_PIN B7 +// #define BACKLIGHT_BREATHING +// #define BACKLIGHT_LEVELS 3 + + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. + * This is userful for the Windows task manager shortcut (ctrl+shift+esc). + */ +// #define GRAVE_ESC_CTRL_OVERRIDE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* control how magic key switches layers */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false + +/* override magic key keymap */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM +//#define MAGIC_KEY_HELP1 H +//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_DEBUG D +//#define MAGIC_KEY_DEBUG_MATRIX X +//#define MAGIC_KEY_DEBUG_KBD K +//#define MAGIC_KEY_DEBUG_MOUSE M +//#define MAGIC_KEY_VERSION V +//#define MAGIC_KEY_STATUS S +//#define MAGIC_KEY_CONSOLE C +//#define MAGIC_KEY_LAYER0_ALT1 ESC +//#define MAGIC_KEY_LAYER0_ALT2 GRAVE +//#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER1 1 +//#define MAGIC_KEY_LAYER2 2 +//#define MAGIC_KEY_LAYER3 3 +//#define MAGIC_KEY_LAYER4 4 +//#define MAGIC_KEY_LAYER5 5 +//#define MAGIC_KEY_LAYER6 6 +//#define MAGIC_KEY_LAYER7 7 +//#define MAGIC_KEY_LAYER8 8 +//#define MAGIC_KEY_LAYER9 9 +//#define MAGIC_KEY_BOOTLOADER PAUSE +//#define MAGIC_KEY_LOCK CAPS +//#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_NKRO N +//#define MAGIC_KEY_SLEEP_LED Z + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +//#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 1 + +#endif diff --git a/keyboards/diverge3/diverge3.c b/keyboards/diverge3/diverge3.c new file mode 100644 index 00000000..4143b142 --- /dev/null +++ b/keyboards/diverge3/diverge3.c @@ -0,0 +1,16 @@ +/* Copyright 2017 IslandMan93 + * + * 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 . + */ +#include "diverge3.h" diff --git a/keyboards/diverge3/diverge3.h b/keyboards/diverge3/diverge3.h new file mode 100644 index 00000000..0d508677 --- /dev/null +++ b/keyboards/diverge3/diverge3.h @@ -0,0 +1,51 @@ +/* Copyright 2017 IslandMan93 + * + * 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 . + */ +#ifndef DIVERGE3_H +#define DIVERGE3_H + +#include "quantum.h" + +#ifdef USE_I2C +#include +#ifdef __AVR__ + #include + #include +#endif +#endif + +// This a shortcut to help you visually see your layout. +// The second converts the arguments into a two-dimensional array +// Used to create a keymap using only KC_ prefixed keys +#define KC_KEYMAP( \ + L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \ + L10, L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16, \ + L20, L21, L22, L23, L24, L25, L26, R20, R21, R22, R23, R24, R25, R26, \ + L30, L31, L32, L33, L34, L35, L36, R30, R31, R32, R33, R34, R35, R36, \ + L40, L41, L42, L43, L44, LT0, LT1, LT2, RT2, RT1, RT0, R40, R41, R42, R43, R44 \ + ) \ + { \ + { KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##L06, KC_NO }, \ + { KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##L16, KC_NO }, \ + { KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##L26, KC_NO }, \ + { KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##L36, KC_NO }, \ + { KC_##L40, KC_##L41, KC_##L42, KC_##L43, KC_##L44, KC_##LT0, KC_##LT1, KC_##LT2 }, \ + { KC_##R06, KC_##R05, KC_##R04, KC_##R03, KC_##R02, KC_##R01, KC_##R00, KC_NO }, \ + { KC_##R16, KC_##R15, KC_##R14, KC_##R13, KC_##R12, KC_##R11, KC_##R10, KC_NO }, \ + { KC_##R26, KC_##R25, KC_##R24, KC_##R23, KC_##R22, KC_##R21, KC_##R20, KC_NO }, \ + { KC_##R36, KC_##R35, KC_##R34, KC_##R33, KC_##R32, KC_##R31, KC_##R30, KC_NO }, \ + { KC_##R44, KC_##R43, KC_##R42, KC_##R41, KC_##R40, KC_##RT0, KC_##RT1, KC_##RT2 } \ + } +#endif diff --git a/keyboards/diverge3/keymaps/default/config.h b/keyboards/diverge3/keymaps/default/config.h new file mode 100644 index 00000000..87ce06b3 --- /dev/null +++ b/keyboards/diverge3/keymaps/default/config.h @@ -0,0 +1,27 @@ +/* Copyright 2017 IslandMan93 + * + * 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 . + */ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +// place overrides here +#define MASTER_RIGHT +#define PERMISSIVE_HOLD +#define TAPPING_TERM 150 + +#endif diff --git a/keyboards/diverge3/keymaps/default/keymap.c b/keyboards/diverge3/keymaps/default/keymap.c new file mode 100644 index 00000000..c24a6328 --- /dev/null +++ b/keyboards/diverge3/keymaps/default/keymap.c @@ -0,0 +1,161 @@ +/* Copyright 2017 IslandMan93 + * + * 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 . + */ +#include "diverge3.h" +#include "action_layer.h" +#include "eeconfig.h" + +//**************** Definitions needed for quad function to work *********************// +enum { + SE_TAP_DANCE = 0 +}; +//Enums used to clearly convey the state of the tap dance +enum { + SINGLE_TAP = 1, + SINGLE_HOLD = 2, + DOUBLE_TAP = 3, + DOUBLE_HOLD = 4, + DOUBLE_SINGLE_TAP = 5 //send SINGLE_TAP twice - NOT DOUBLE_TAP + // Add more enums here if you want for triple, quadruple, etc. +}; + +typedef struct { + bool is_press_action; + int state; +} tap; + +int cur_dance (qk_tap_dance_state_t *state) { + if (state->count == 1) { + //If count = 1, and it has been interrupted - it doesn't matter if it is pressed or not: Send SINGLE_TAP + if (state->interrupted || state->pressed==0) return SINGLE_TAP; + else return SINGLE_HOLD; + } + //If count = 2, and it has been interrupted - assume that user is trying to type the letter associated + //with single tap. In example below, that means to send `xx` instead of `Escape`. + else if (state->count == 2) { + if (state->interrupted) return DOUBLE_SINGLE_TAP; + else if (state->pressed) return DOUBLE_HOLD; + else return DOUBLE_TAP; + } + else return 6; //magic number. At some point this method will expand to work for more presses +} + +//**************** Definitions needed for quad function to work *********************// +// Backspace Shift TD +//instanalize an instance of 'tap' for the 'x' tap dance. +static tap se_tap_state = { + .is_press_action = true, + .state = 0 +}; + +void se_finished (qk_tap_dance_state_t *state, void *user_data) { + se_tap_state.state = cur_dance(state); + switch (se_tap_state.state) { + case SINGLE_TAP: register_code(KC_SPC); break; + case SINGLE_HOLD: register_code(KC_ENT); break; + default: register_code(KC_SPC); unregister_code(KC_SPC); register_code(KC_SPC); + //Last case is for fast typing. Assuming your key is `f`: + //For example, when typing the word `buffer`, and you want to make sure that you send `ff` and not `Esc`. + //In order to type `ff` when typing fast, the next character will have to be hit within the `TAPPING_TERM`, which by default is 200ms. + } +} + +void se_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (se_tap_state.state) { + case SINGLE_TAP: unregister_code(KC_SPC); break; + case SINGLE_HOLD: unregister_code(KC_ENT); break; + default: unregister_code(KC_SPC); + } + se_tap_state.state = 0; +} + +qk_tap_dance_action_t tap_dance_actions[] = { + [SE_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, se_finished, se_reset) +}; + +// KEYMAP +extern keymap_config_t keymap_config; + +#define _QWERTY 0 +#define _LOWER 1 + +enum custom_keycodes { + PAREN_MACRO = SAFE_RANGE, + ARROW_MACRO, + PSELF_MACRO +}; + +// Make layer undefined do nothing +#define KC_ KC_TRNS + +// Macros +#define KC_PMAC PAREN_MACRO +#define KC_AMAC ARROW_MACRO + +// Holds for layer +#define KC_DEL1 LT(_LOWER, KC_DEL) +#define KC_TAB1 LT(_LOWER, KC_TAB) + +// Space on tap, enter on hold. +#define KC_SPNT TD(SE_TAP_DANCE) + +#define KC_BSHT SFT_T(KC_BSPC) + +// Jumps the cursor a word right or left +#define KC_WRDRT LCTL(KC_RIGHT) +#define KC_WRDLT LCTL(KC_LEFT) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = KC_KEYMAP( + //,----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + ESC, 1 , 2 , 3 , 4 , 5 ,MUTE, MPLY, 6 , 7 , 8 , 9 , 0 ,PSCR, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + GRV, Q , W , E , R , T ,VOLD, VOLU, Y , U , I , O , P ,CAPS, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + TAB, A , S , D , F , G ,PGDN, PGUP, H , J , K , L ,SCLN,BSLS, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + LSFT, Z , X , C , V , B ,WRDLT, WRDRT, N , M ,COMM,DOT ,SLSH,QUOT, + //|----+----+----+----+----+----+----+----|||----+----+----+----+----+----+----+----| + LCTL,LGUI, APP,LALT,HOME,SPNT,DEL1,BSHT , ENT ,TAB1,BSHT,END ,DOWN, UP ,LEFT,RIGHT + ), + + [_LOWER] = KC_KEYMAP( + //,----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , F1 , F2 , F3 , F4 , F5 ,F11 , F12, F6 , F7 , F8 , F9 , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + TILD,EXLM, AT ,HASH,DLR ,PERC, , ,CIRC,AMPR,ASTR, , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , ,LBRC,LPRN,UNDS,LCBR, , ,RCBR, EQL,RPRN,RBRC,COLN, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , ,PMAC,MINS,AMAC, , , ,PLUS, , , , , + //|----+----+----+----+----+----+----+----|||----+----+----+----+----+----+----+----| + , , , , , , , , , , , , , , , + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + switch(keycode) { + case PAREN_MACRO: + SEND_STRING("()"); + return false; break; + case ARROW_MACRO: + SEND_STRING("->"); + return false; break; + } + } + return true; +}; diff --git a/keyboards/diverge3/keymaps/default/readme.md b/keyboards/diverge3/keymaps/default/readme.md new file mode 100644 index 00000000..c2e698b3 --- /dev/null +++ b/keyboards/diverge3/keymaps/default/readme.md @@ -0,0 +1,6 @@ +# The default keymap for diverge3 + +Just a keymap that I use for programming. + +The focus is to have the thumbs do all the work for spacing/backspacing, shifting, and symbols. +Also there is some duplicated functionality on the left hand for when editing with a mouse. diff --git a/keyboards/diverge3/keymaps/default/rules.mk b/keyboards/diverge3/keymaps/default/rules.mk new file mode 100644 index 00000000..e5ddcae8 --- /dev/null +++ b/keyboards/diverge3/keymaps/default/rules.mk @@ -0,0 +1 @@ +TAP_DANCE_ENABLE = yes diff --git a/keyboards/diverge3/readme.md b/keyboards/diverge3/readme.md new file mode 100644 index 00000000..f8ad69a2 --- /dev/null +++ b/keyboards/diverge3/readme.md @@ -0,0 +1,16 @@ +# diverge3 + +A split 5x7 keyboard with 3 thumb keys. Made by [Unikeyboard](https://unikeyboard.io). + +Keyboard Maintainer: [IslandMan93](https://github.com/islandman93) +Hardware Supported: Pro Micro +Hardware Availability: [Diverge 3](https://unikeyboard.io/product/diverge/) + +Make example for this keyboard (after setting up your build environment): + + make diverge3:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. + +# Reflashing Animus +Reflashing the stock firmware is pretty easy. Just follow the same steps in the [original guide](https://imgur.com/a/8UapN). You will have to manually reset the Pro Micro (by shorting the GND and RST) during the upload step. Then reapply your keymap through Arbites. \ No newline at end of file diff --git a/keyboards/diverge3/rules.mk b/keyboards/diverge3/rules.mk new file mode 100644 index 00000000..aa745305 --- /dev/null +++ b/keyboards/diverge3/rules.mk @@ -0,0 +1,73 @@ +SRC += ../lets_split/matrix.c \ + ../lets_split/serial.c \ + ../lets_split/split_util.c + +# MCU name +#MCU = at90usb1286 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +# OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +CUSTOM_MATRIX = yes