From 90bcc136a527ce4eb464c18c301b606742659942 Mon Sep 17 00:00:00 2001 From: wanleg <32079073+wanleg@users.noreply.github.com> Date: Wed, 21 Feb 2018 15:38:32 -0800 Subject: [PATCH] my planck layout personal planck layout --- keyboards/planck/keymaps/wanleg/config.h | 87 +++++++ keyboards/planck/keymaps/wanleg/keymap.c | 291 +++++++++++++++++++++++ keyboards/planck/keymaps/wanleg/rules.mk | 71 ++++++ 3 files changed, 449 insertions(+) create mode 100644 keyboards/planck/keymaps/wanleg/config.h create mode 100644 keyboards/planck/keymaps/wanleg/keymap.c create mode 100644 keyboards/planck/keymaps/wanleg/rules.mk diff --git a/keyboards/planck/keymaps/wanleg/config.h b/keyboards/planck/keymaps/wanleg/config.h new file mode 100644 index 0000000000..e4a911af95 --- /dev/null +++ b/keyboards/planck/keymaps/wanleg/config.h @@ -0,0 +1,87 @@ +/* +Copyright 2012 Jun Wako + +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 0x6060 +#define MANUFACTURER OLKB +#define PRODUCT The Planck Keyboard +#define DESCRIPTION A compact ortholinear keyboard + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 12 + +/* Planck PCB default pin-out */ +#define MATRIX_ROW_PINS { D0, D5, B5, B6 } +#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } +#define UNUSED_PINS + +#define AUDIO_VOICES +#define C6_AUDIO + +#define BACKLIGHT_PIN B7 + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* 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 + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* + * 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 +#define PREVENT_STUCK_MODIFIERS + +#include QMK_SUBPROJECT_CONFIG_H + +#endif diff --git a/keyboards/planck/keymaps/wanleg/keymap.c b/keyboards/planck/keymaps/wanleg/keymap.c new file mode 100644 index 0000000000..01cc5be23f --- /dev/null +++ b/keyboards/planck/keymaps/wanleg/keymap.c @@ -0,0 +1,291 @@ +/* Copyright 2017 REPLACE_WITH_YOUR_NAME + * + * 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 "planck.h" + +/* Add this line to config.h +#define PREVENT_STUCK_MODIFIERS +*/ + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +#define _GK 0 +#define gDIR 1 +#define gNUM 2 +#define gETC 3 +#define _QW 4 +#define _LW 5 +#define _RS 6 +#define nada 7 + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +/////////////// TAP DANCE SECTION START /////////////// +//Tap Dance Declarations (list of my tap dance configurations) +enum { + TD_SFT_CAPS = 0 + ,TD_Q_ESC + ,ENT_TAP_DANCE + ,DEL_TAP_DANCE +}; + +///// QUAD FUNCTION TAP DANCE GENERAL SETUP SECTION START ///// +///// (no need to edit this section) ///// +//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) return SINGLE_TAP; + if (state->interrupted) 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 `ff` 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 +} +///// QUAD FUNCTION TAP DANCE GENERAL SETUP SECTION END ///// +///// QUAD FUNCTION TAP DANCE PERSONALIZATION SECTION START ///// +//instanalize an instance of 'tap' for the 'ENT' tap dance. +static tap ENTtap_state = { + .is_press_action = true, + .state = 0 +}; + +void ENT_finished (qk_tap_dance_state_t *state, void *user_data) { + ENTtap_state.state = cur_dance(state); + switch (ENTtap_state.state) { + case SINGLE_TAP: register_code(KC_SPC); break; + case SINGLE_HOLD: register_code(KC_LSFT); break; + case DOUBLE_TAP: register_code(KC_ENT); break; + case DOUBLE_HOLD: register_code(KC_NO); break; // setting double hold to do nothing (change this if you want) + case DOUBLE_SINGLE_TAP: 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 ENT_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (ENTtap_state.state) { + case SINGLE_TAP: unregister_code(KC_SPC); break; + case SINGLE_HOLD: unregister_code(KC_LSFT); break; + case DOUBLE_TAP: unregister_code(KC_ENT); break; + case DOUBLE_HOLD: unregister_code(KC_NO); + case DOUBLE_SINGLE_TAP: unregister_code(KC_SPC); + } + ENTtap_state.state = 0; +} + +//instanalize an instance of 'tap' for the 'DEL' tap dance. +static tap DELtap_state = { + .is_press_action = true, + .state = 0 +}; + +void DEL_finished (qk_tap_dance_state_t *state, void *user_data) { + DELtap_state.state = cur_dance(state); + switch (DELtap_state.state) { + case SINGLE_TAP: register_code(KC_BSPC); break; + case SINGLE_HOLD: register_code(KC_LCTL); break; + case DOUBLE_TAP: register_code(KC_DEL); break; + case DOUBLE_HOLD: register_code(KC_NO); break; + case DOUBLE_SINGLE_TAP: register_code(KC_BSPC); unregister_code(KC_BSPC); register_code(KC_BSPC); + } +} + +void DEL_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (DELtap_state.state) { + case SINGLE_TAP: unregister_code(KC_BSPC); break; + case SINGLE_HOLD: unregister_code(KC_LCTL); break; + case DOUBLE_TAP: unregister_code(KC_DEL); break; + case DOUBLE_HOLD: unregister_code(KC_NO); + case DOUBLE_SINGLE_TAP: unregister_code(KC_BSPC); + } + DELtap_state.state = 0; +} +///// QUAD FUNCTION TAP DANCE PERSONALIZATION SECTION END ///// + +//Tap Dance Definitions +//THIS SECTION HAS TO BE AT THE END OF THE TAP DANCE SECTION +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_SFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS) +// Other declarations would go here, separated by commas, if you have them + ,[TD_Q_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_ESC) + ,[ENT_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ENT_finished, ENT_reset) + ,[DEL_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, DEL_finished, DEL_reset) +}; + +//In Layer declaration, add tap dance item in place of a key code +//TD(TD_SFT_CAPS) + +///////////// TAP DANCE SECTION END /////////////// + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + +/* myQwerty + * .-----------------------------------------------------------------------------------------------------------. + * | ESC | Q | W | E | R | T | Y | U | I | O | P | BACKSP | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | TAB | A | S | D | F | G | H | J | K | L | ; | ' | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * |SFT/CAPS| Z | X | C | V | B | N | M | , | . | / | ENTER | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | LCTRL | LGUI | ALT | ALT | LOWER | SHIFT | SPACE | RAISE | RALT | RGUI | DEL | CTRL | + * '-----------------------------------------------------------------------------------------------------------' + */ + +[_QW] = { /* QWERTY */ + {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {TD(TD_SFT_CAPS), + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_T(KC_ENT)}, + {KC_LCTL, KC_LGUI, KC_LALT, KC_LALT, MO(_LW), KC_LSFT, KC_SPC, MO(_RS), KC_LALT, KC_RGUI, KC_DEL, KC_RCTL} +}, + +[_LW] = { /* LOWER */ + {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______}, + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______}, + {_______, KC_F11, KC_F12, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, DF(_GK), _______, _______, _______, _______, _______, _______, _______, _______, _______} +}, + +[_RS] = { /* RAISE */ + {RESET, _______, KC_UP, _______, KC_INS, _______, _______, KC_PGUP, KC_HOME, KC_MINS, KC_EQL, KC_DEL }, + {_______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PSCR, _______, _______, KC_PGDN, KC_END, KC_LBRC, KC_RBRC, KC_BSLS}, +//no music line +// {_______, KC_PAUS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, +//enable music + {_______, KC_PAUS, _______, _______, _______, _______, _______, DF(7), _______, _______, _______, _______}, + {_______, _______, DF(_QW), _______, _______, _______, _______, _______, _______, _______, _______, _______} +}, + +[nada] = { /*nothing layer for use with music mode */ + {MU_OFF, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DF(_QW), MU_ON} +}, + + /* myGherkin + * .-----------------------------------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | Q//ESC | W | E | R | T | Y | U | I | O | P | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | A | S | D | F | G | H | J | K | L | ENTER | | + * | | | | | | | | | | |SFThold | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | Z | X | C | V/gNUM | B/gETC | N | M/gDIR | ,/GUI | ./ALT | BKSC | | + * | |SFThold | | | | | | | | |CTRLhold| | + * '-----------------------------------------------------------------------------------------------------------' + */ + + [_GK] = { /* myGherkin*/ + { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, + { XXXXXXX, TD(TD_Q_ESC), KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, XXXXXXX}, + { XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, SFT_T(KC_SPC), XXXXXXX}, + { XXXXXXX, SFT_T(KC_Z), KC_X, KC_C, LT(gNUM, KC_V), LT(gETC, KC_B), KC_N, LT(gDIR, KC_M), GUI_T(KC_COMM), ALT_T(KC_DOT), CTL_T(KC_BSPC), XXXXXXX} + }, + + +/* + * myGherkin Directional Modifiers + * .-----------------------------------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | TAB | up | | INS | CTRL | SHIFT | PgUp | HOME | - | = | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | left | down | right | PrScr | SHIFT | CTRL | PgDn | END | [ | ] | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | QWERTY | | | | | | | ALT | / | | + * '-----------------------------------------------------------------------------------------------------------' + */ + + [gDIR] = { /* myGherkin Directional Modifiers */ + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { _______, KC_TAB, KC_UP, KC_TRNS, KC_INS, KC_LCTL, KC_LSFT, KC_PGUP, KC_HOME, KC_MINS, KC_EQL , _______ }, + { _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PSCR, KC_LSFT, KC_LCTL, KC_PGDN, KC_END, KC_LBRC, KC_RBRC, _______ }, + { _______, _______, DF(_QW), _______, _______, _______, _______, _______, _______, KC_LALT, KC_SLSH, _______ } + }, + + /* + * myGherkin Numbers + * .-----------------------------------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | F11 | F12 | | | | ENTER | SHIFT | SUPER | ./ALT | BKSC | | + * | | | | | | | | | | |CTRLhold| | + * '-----------------------------------------------------------------------------------------------------------' + */ + + [gNUM] = { /* myGherkin Numbers */ + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______ }, + { _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______ }, + { _______, KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENT, KC_LSFT, KC_RGUI, ALT_T(KC_DOT), CTL_T(KC_BSPC), _______ } + }, + + + /* + * myGherkin ETC + * .-----------------------------------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | ` | | | | | RESET | | | | \ | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | CAPS | P-Brk | | | | | | | ; | ' | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | SHIFT | | | | | C-A-D | | SUPER | | DEL | | + * '-----------------------------------------------------------------------------------------------------------' + */ + + [gETC] = { /* myGherkin ETC */ + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { _______, KC_GRV, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS, _______ }, + { _______, KC_CAPS, KC_PAUS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_SCLN, KC_QUOT, _______ }, + { _______, KC_LSFT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LALT(LCTL(KC_DEL)), KC_TRNS, KC_LGUI, KC_TRNS, KC_DEL, _______ } + + }, + +}; diff --git a/keyboards/planck/keymaps/wanleg/rules.mk b/keyboards/planck/keymaps/wanleg/rules.mk new file mode 100644 index 0000000000..991e88d1b4 --- /dev/null +++ b/keyboards/planck/keymaps/wanleg/rules.mk @@ -0,0 +1,71 @@ +# MCU name +#MCU = at90usb1287 +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 to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = no # 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 = yes # 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. +API_SYSEX_ENABLE = no +TAP_DANCE_ENABLE = yes # Enable Tap Dance (comment if not being implemented) + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +LAYOUTS = ortho_4x12 \ No newline at end of file