From 59bef40aab37f8dd4db61e601f2a0e9b5991e993 Mon Sep 17 00:00:00 2001 From: Zach Nielsen Date: Thu, 10 Nov 2016 12:14:54 -0800 Subject: [PATCH 01/12] Keep unicode's input_mode through a power cycle --- quantum/process_keycode/process_unicode.c | 6 ++++++ tmk_core/common/eeconfig.h | 1 + 2 files changed, 7 insertions(+) diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index cd3a610b4..f42f25538 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c @@ -1,6 +1,7 @@ #include "process_unicode.h" static uint8_t input_mode; +static uint8_t first_flag = 0; __attribute__((weak)) uint16_t hex_to_keycode(uint8_t hex) @@ -17,6 +18,7 @@ uint16_t hex_to_keycode(uint8_t hex) void set_unicode_input_mode(uint8_t os_target) { input_mode = os_target; + eeprom_update_byte(EECONFIG_UNICODEMODE, os_target); } uint8_t get_unicode_input_mode(void) { @@ -75,6 +77,10 @@ void register_hex(uint16_t hex) { bool process_unicode(uint16_t keycode, keyrecord_t *record) { if (keycode > QK_UNICODE && record->event.pressed) { + if (first_flag == 0) { + set_unicode_input_mode(eeprom_read_byte(EECONFIG_UNICODEMODE)); + first_flag = 1; + } uint16_t unicode = keycode & 0x7FFF; unicode_input_start(); register_hex(unicode); diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h index d8caa346f..280dc7ab6 100644 --- a/tmk_core/common/eeconfig.h +++ b/tmk_core/common/eeconfig.h @@ -33,6 +33,7 @@ along with this program. If not, see . #define EECONFIG_BACKLIGHT (uint8_t *)6 #define EECONFIG_AUDIO (uint8_t *)7 #define EECONFIG_RGBLIGHT (uint32_t *)8 +#define EECONFIG_UNICODEMODE (uint8_t *)12 /* debug bit */ From c07ef5c6abd7875c19c4bcbe3bcaecd123862fd3 Mon Sep 17 00:00:00 2001 From: Zach Nielsen Date: Thu, 10 Nov 2016 12:26:56 -0800 Subject: [PATCH 02/12] Adding my (zach) keymaps for planck and preonic --- keyboards/planck/keymaps/zach/Makefile | 29 + keyboards/planck/keymaps/zach/config.h | 91 +++ keyboards/planck/keymaps/zach/keymap.c | 48 ++ .../keymaps/zach/zach_common_functions.c | 538 ++++++++++++++++++ keyboards/preonic/keymaps/zach/Makefile | 29 + keyboards/preonic/keymaps/zach/config.h | 95 ++++ keyboards/preonic/keymaps/zach/keymap.c | 54 ++ .../keymaps/zach/zach_common_functions.c | 538 ++++++++++++++++++ 8 files changed, 1422 insertions(+) create mode 100644 keyboards/planck/keymaps/zach/Makefile create mode 100644 keyboards/planck/keymaps/zach/config.h create mode 100644 keyboards/planck/keymaps/zach/keymap.c create mode 100644 keyboards/planck/keymaps/zach/zach_common_functions.c create mode 100644 keyboards/preonic/keymaps/zach/Makefile create mode 100644 keyboards/preonic/keymaps/zach/config.h create mode 100644 keyboards/preonic/keymaps/zach/keymap.c create mode 100644 keyboards/preonic/keymaps/zach/zach_common_functions.c diff --git a/keyboards/planck/keymaps/zach/Makefile b/keyboards/planck/keymaps/zach/Makefile new file mode 100644 index 000000000..b0009147a --- /dev/null +++ b/keyboards/planck/keymaps/zach/Makefile @@ -0,0 +1,29 @@ +# Zach Planck Makefile +# Max .hex size is about 28636 bytes + +# 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 +# +TAP_DANCE_ENABLE = yes # Enable TapDance functionality +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = no # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +USB_6KRO_ENABLE = no # 6key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +VARIABLE_TRACE = no # Debug changes to variable values +UNICODE_ENABLE = yes # Unicode +UNICODEMAP_ENABLE = yes # Enable extended 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 + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/planck/keymaps/zach/config.h b/keyboards/planck/keymaps/zach/config.h new file mode 100644 index 000000000..1be800545 --- /dev/null +++ b/keyboards/planck/keymaps/zach/config.h @@ -0,0 +1,91 @@ +/* +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 Ortholinear Keyboards +#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 BACKLIGHT_PIN B7 + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +//#define BACKLIGHT_BREATHING // LED breathing +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 5 + +/* 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 +//#define DYNAMIC_MACRO_ENABLE // Enable if you need to use the macro functionality +//#define SPACE_CADET // Parenthesis on L/R shift + +#ifdef SUBPROJECT_rev3 + #include "rev3/config.h" +#endif +#ifdef SUBPROJECT_rev4 + #include "rev4/config.h" +#endif + +#endif diff --git a/keyboards/planck/keymaps/zach/keymap.c b/keyboards/planck/keymaps/zach/keymap.c new file mode 100644 index 000000000..d3cde5bb9 --- /dev/null +++ b/keyboards/planck/keymaps/zach/keymap.c @@ -0,0 +1,48 @@ +// Zach Nielsen Custom Planck Keyboard layout +#include "planck.h" +#define PLANCK_YES // This is the Planck +#include "zach_common_functions.c" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[_COLEMAK] = { /* Base Layer */ + {KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, KC_BSPC}, + {KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT}, + {SHFT_CAP,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT}, + {CTRLB, TD(SUP), KC_LALT, KC_LCTL, TD(LOW), KC_SPC, KC_SPC, TD(RAI), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +[_SWCOLE] = { /* Software Colemak */ + {_______, CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, KC_QUOT, _______}, + {_______, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, _______}, + {_______, CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, CM_COMM, CM_DOT, CM_SLSH, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +}, + +[_RAISE] = { /* RAISE - Numpad and Unicode symbols */ + {KC_GRV, SUPA2, FACE, DISFACE, SHRUG, PLUMIN, IBANG, KC_7, KC_8, KC_9, KC_COLN, _______}, + {KC_DEL, DEGREE, MICRO, WOMEGA, OMEGA, PENGY, KC_ENT, KC_4, KC_5, KC_6, KC_SLSH, KC_ASTR}, + {_______, KC_COLN, TFLIP, LAROW, RAROW, DUCK, KC_SPC, KC_1, KC_2, KC_3, KC_MINS, KC_PLUS}, + {_______, KC_PIPE, TPUT, _______, _______, KC_TAB, KC_TAB, _______, KC_0, KC_0, KC_DOT, KC_EQL} +}, + +[_LOWER] = { /* LOWER - Symbols, Paging, CtrAltDel */ + {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_QUES, KC_DQT, KC_DEL}, + {KC_DEL, KC_LBRC, KC_RBRC, KC_MINS, KC_UNDS, KC_HOME, KC_END, KC_LPRN, KC_RPRN, KC_SLSH, KC_SCLN, KC_PGUP}, + {CPYPST, XXXXXXX, C(KC_X), KC_LABK, KC_RABK, XXXXXXX, XXXXXXX, KC_LCBR, KC_RCBR, KC_BSLS, KC_COLN, KC_PGDN}, + {_______, _______, _______, _______, _______, KC_TAB, KC_TAB, _______, _______, _______, _______, _______} +}, + +[_ADJUST] = { /* ADJUST - Macros, Layer Switching, Function Keys */ + {UNIWIN, Sil_Usr, Sil_Pas, PENGY, DUCK, KC_INS, KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX}, + {UNILIN, UltiU, UltiP, RANDIG, RANDIG, SWCOLE, COLEMAK, KC_F5, KC_F6, KC_F7, KC_F8, XXXXXXX}, + {_______, CADKEY, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX}, + {_______, _______, _______, _______, _______, RESET, RESET, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX} +}, + +[_UNICODES] = { /* UNICODES - Extra layer for unicode stuff */ + {_______, TFLIP, XXXXXXX, FINGER, IBANG, roman7, XXXXXXX, XXXXXXX, ROMAN7, TappyL, TappyR, _______}, + {KC_DEL, TPUT, FACE, DISFACE, SHRUG, roman4, roman5, roman6, ROMAN4, ROMAN5, ROMAN6, _______}, + {XXXXXXX, PENIS, BOOBS, LAROW, RAROW, roman1, roman2, roman3, ROMAN1, ROMAN2, ROMAN3, XXXXXXX}, + {_______, _______, _______, _______, _______, KC_SPC, KC_SPC, _______, _______, _______, _______, _______} +} +}; diff --git a/keyboards/planck/keymaps/zach/zach_common_functions.c b/keyboards/planck/keymaps/zach/zach_common_functions.c new file mode 100644 index 000000000..f01929f5d --- /dev/null +++ b/keyboards/planck/keymaps/zach/zach_common_functions.c @@ -0,0 +1,538 @@ +#ifndef ZACH_COMMON_FUNCTIONS +#define ZACH_COMMON_FUNCTIONS +#include "eeconfig.h" +#include "action_layer.h" +#include "keymap_colemak.h" +#include "extra_functions.c" +extern keymap_config_t keymap_config; + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO +#define C(n) RCTL(n) +#define CADKEY RCTL(RALT(KC_DEL)) + +void tap(uint16_t keycode){ + register_code(keycode); + unregister_code(keycode); +}; + +void persistant_default_layer_set(uint16_t default_layer){ + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +}; + +// Automatic number generation of important keywords +enum my_keycodes{ + // Layer numbers + _COLEMAK = 0, + _SWCOLE, + _RAISE, + _LOWER, + _ADJUST, + _UNICODES, + // These use process_record_user() + COLEMAK = SAFE_RANGE, + SWCOLE, + LOWER, + RAISE, + SHFT_CAP, + CTRLB, + CPYPST, + FACE, + UNIWIN, + UNILIN, + DISFACE, + TFLIP, + TPUT, + SHRUG, + PENIS, + BOOBS, + Sil_Pas, + Sil_Usr, + UltiU, + UltiP, + TappyR, + TappyL, + RANDIG, + FINGER, + // Tap_Dance nums + RAI = 0, + LOW, + SUP +}; + +#ifdef AUDIO_ENABLE +#include "audio.h" +float tone_startup[][2] = SONG(STARTUP_SOUND); +float tone_goodbye[][2] = SONG(GOODBYE_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +float tone_swcole[][2] = SONG(QWERTY_SOUND); +float tone_capslock_on[][2] = SONG(CAPS_LOCK_ON_SOUND); +float tone_capslock_off[][2] = SONG(CAPS_LOCK_OFF_SOUND); +float tone_ctrl_mod[][2] = SONG(COIN_SOUND); +float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND); +float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND); +float uniwin[][2] = SONG(UNICODE_WINDOWS); +float unilin[][2] = SONG(UNICODE_LINUX); +#endif + +#ifdef TAP_DANCE_ENABLE +#define TAPPING_TERM 200 + +uint8_t Lstate = 0, Rstate = 0; +uint32_t Ltimer = 0, Rtimer = 0; +uint32_t Ltimes[3], Rtimes[4]; // Ratio of tap times should be about 1.335 (L/R) +void rhythm_parse(void){ + int L = Ltimes[0] + Ltimes[1] + Ltimes[2]; // Start to end time + int R = Rtimes[0] + Rtimes[1] + Rtimes[2] + Rtimes[3]; + if(abs(R-L) > 10){ + tap(KC_N); tap(KC_O); + return; + } else { + L = (L / 3)*100; // Average time per tap * 100 + R = (R / 4); + if(abs(abs(L/R)-133) > 1){ + tap(KC_N); tap(KC_O); + tap(KC_P); tap(KC_E); + return; + } else { + tap(KC_O); tap(KC_K); + return; + } + } +}; + +void dance_raise_press(qk_tap_dance_state_t *state, void *user_data){// Called on each tap + switch(state->count){ // Only turn the layer on once + case 1: + layer_off(_UNICODES); + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + break; + } +}; +void dance_raise_lift(qk_tap_dance_state_t *state, void *user_data){ // Called on release + switch(state->count){ + case 1: // Normal action. Turn off layers + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + layer_off(_UNICODES); + break; + } +}; +///////////////////////////////////////////////////////////////////// +void dance_lower_press(qk_tap_dance_state_t *state, void *user_data){// Called on tap + switch(state->count){ + case 1: // Turn on lower + layer_off(_UNICODES); + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + break; + } +}; +void dance_lower_lift(qk_tap_dance_state_t *state, void *user_data){ // Called on release + switch(state->count){ + case 1: // Normal action. Turn off layers + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + layer_off(_UNICODES); + break; + case 2: // Turn on _UNICODES layer + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + layer_on(_UNICODES); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_ctrl_mod, false, 0); + #endif + break; + } +}; +///////////////////////////////////////////////////////////////////// +void dance_super_press(qk_tap_dance_state_t *state, void *user_data){ // Called on down + if(state->count == 1){ + register_code(KC_LGUI); + } +} +void dance_super_done(qk_tap_dance_state_t *state, void *user_data){ // Called on timeout + switch(state->count){ + case 2: + register_code(KC_LGUI); + tap(KC_L); + unregister_code(KC_LGUI); + break; + } +} +void dance_super_lift(qk_tap_dance_state_t *state, void *user_data){ // Called on up + unregister_code(KC_LGUI); +} + +qk_tap_dance_action_t tap_dance_actions[] = { + [RAI] = ACTION_TAP_DANCE_FN_ADVANCED(dance_raise_press, NULL, dance_raise_lift), + [LOW] = ACTION_TAP_DANCE_FN_ADVANCED(dance_lower_press, NULL, dance_lower_lift), + [SUP] = ACTION_TAP_DANCE_FN_ADVANCED(dance_super_press, dance_super_done, dance_super_lift) +}; +#endif + +#ifdef UNICODE_ENABLE +// Unicode shortcuts +#define IBANG UC(0x203D) +#define RAROW UC(0x2192) +#define LAROW UC(0x2190) +#define DEGREE UC(0x00B0) +#define OMEGA UC(0x03A9) +#define WOMEGA UC(0x03C9) +#define MICRO UC(0x00B5) +#define PLUMIN UC(0x00B1) +#define SUPA2 UC(0x00B2) +#define ROMAN1 UC(0x2160) +#define ROMAN2 UC(0x2161) +#define ROMAN3 UC(0x2162) +#define ROMAN4 UC(0x2163) +#define ROMAN5 UC(0x2164) +#define ROMAN6 UC(0x2165) +#define ROMAN7 UC(0x2166) +#define roman1 UC(0x2170) +#define roman2 UC(0x2171) +#define roman3 UC(0x2172) +#define roman4 UC(0x2173) +#define roman5 UC(0x2174) +#define roman6 UC(0x2175) +#define roman7 UC(0x2176) + +#ifdef UNICODEMAP_ENABLE // For Unicode characters larger than 0x8000. Send with X() +enum Ext_Unicode{ + PENGUIN = 0, + BOAR, + MONKEY, + DRAGON, + CHICK, + TUMBLER +}; +const uint32_t PROGMEM unicode_map[] = { + [PENGUIN] = 0x1F427, + [BOAR] = 0x1F417, + [MONKEY] = 0x1F412, + [DRAGON] = 0x1F409, + [CHICK] = 0x1F425, + [TUMBLER] = 0x1F943 +}; +#define PENGY X(PENGUIN) +#define BOARY X(BOAR) +#define MNKY X(MONKEY) +#define DRGN X(DRAGON) +#define DUCK X(CHICK) +#define TMBL X(TUMBLER) +#endif + +#endif + +static uint16_t key_timer; +static uint8_t caps_status = 0; +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case COLEMAK: + if(record->event.pressed){ + persistant_default_layer_set(1UL<<_COLEMAK); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + } + return false; + break; + case SWCOLE: + if(record->event.pressed){ + persistant_default_layer_set(1UL<<_SWCOLE); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_swcole, false, 0); + #endif + } + return false; + break; + #ifndef TAP_DANCE_ENABLE + case RAISE: + if(record->event.pressed){ + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case LOWER: + if(record->event.pressed){ + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + #endif + case SHFT_CAP: + if(record->event.pressed){ + key_timer = timer_read(); // if the key is being pressed, we start the timer. + register_code(KC_LSHIFT); + } else { // this means the key was just released (tap or "held down") + if(timer_elapsed(key_timer) < 152){ // Time in ms, the threshold we pick for counting something as a tap. + tap(KC_CAPS); + if(caps_status == 0){ + caps_status = 1; + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_capslock_on, false, 0); + #endif + } else { + caps_status = 0; + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_capslock_off, false, 0); + #endif + } + } + unregister_code(KC_LSHIFT); + } + return false; + break; + case CTRLB: // Control-B on tap (bold) + if(record->event.pressed){ + key_timer = timer_read(); // if the key is being pressed, we start the timer. + register_code(KC_LCTL); + } else { // this means the key was just released (tap or "held down") + if (timer_elapsed(key_timer) < 152) { // Time in ms, the threshold we pick for counting something as a tap. + tap(KC_B); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_ctrl_mod, false, 0); + #endif + #ifdef BACKLIGHT_BREATHING + breathing_speed_set(2); + breathing_pulse(); + #endif + } + unregister_code(KC_LCTL); + } + return false; + break; + case CPYPST: // One key copy/paste + if(record->event.pressed){ + key_timer = timer_read(); + } else { + if (timer_elapsed(key_timer) > 152) { // Hold, copy + register_code(KC_LCTL); + tap(KC_C); + unregister_code(KC_LCTL); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_copy, false, 0); + #endif + } else { // Tap, paste + register_code(KC_LCTL); + tap(KC_V); + unregister_code(KC_LCTL); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_paste, false, 0); + #endif + } + } + return false; + break; + #ifdef UNICODE_ENABLE + case UNIWIN: + if(record->event.pressed){ + set_unicode_input_mode(UC_WIN); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(uniwin, false, 0); + #endif + } + return false; + break; + case UNILIN: + if(record->event.pressed){ + set_unicode_input_mode(UC_LNX); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(unilin, false, 0); + #endif + } + return false; + break; + case DISFACE: // ಠ_ಠ + if(record->event.pressed){ + process_unicode((0x0CA0|QK_UNICODE), record); // Eye + register_code(KC_RSFT); + tap(KC_MINS); + unregister_code(KC_RSFT); + process_unicode((0x0CA0|QK_UNICODE), record); // Eye + } + return false; + break; + case TFLIP: // (╯°□°)╯ ︵ ┻━┻ + if(record->event.pressed){ + register_code(KC_RSFT); + tap(KC_9); + unregister_code(KC_RSFT); + process_unicode((0x256F|QK_UNICODE), record); // Arm + process_unicode((0x00B0|QK_UNICODE), record); // Eye + process_unicode((0x25A1|QK_UNICODE), record); // Mouth + process_unicode((0x00B0|QK_UNICODE), record); // Eye + register_code(KC_RSFT); + tap(KC_0); + unregister_code(KC_RSFT); + process_unicode((0x256F|QK_UNICODE), record); // Arm + tap(KC_SPC); + process_unicode((0x0361|QK_UNICODE), record); // Flippy + tap(KC_SPC); + process_unicode((0x253B|QK_UNICODE), record); // Table + process_unicode((0x2501|QK_UNICODE), record); // Table + process_unicode((0x253B|QK_UNICODE), record); // Table + } + return false; + break; + case TPUT: // ┬──┬ ノ( ゜-゜ノ) + if(record->event.pressed){ + process_unicode((0x252C|QK_UNICODE), record); // Table + process_unicode((0x2500|QK_UNICODE), record); // Table + process_unicode((0x2500|QK_UNICODE), record); // Table + process_unicode((0x252C|QK_UNICODE), record); // Table + tap(KC_SPC); + process_unicode((0x30CE|QK_UNICODE), record); // Arm + register_code(KC_RSFT); + tap(KC_9); + unregister_code(KC_RSFT); + tap(KC_SPC); + process_unicode((0x309C|QK_UNICODE), record); // Eye + tap(KC_MINS); + process_unicode((0x309C|QK_UNICODE), record); // Eye + process_unicode((0x30CE|QK_UNICODE), record); // Arm + register_code(KC_RSFT); + tap(KC_0); + unregister_code(KC_RSFT); + } + return false; + break; + case SHRUG: // ¯\_(ツ)_/¯ + if(record->event.pressed){ + process_unicode((0x00AF|QK_UNICODE), record); // Hand + tap(KC_BSLS); // Arm + register_code(KC_RSFT); + tap(KC_UNDS); // Arm + tap(KC_LPRN); // Head + unregister_code(KC_RSFT); + process_unicode((0x30C4|QK_UNICODE), record); // Face + register_code(KC_RSFT); + tap(KC_RPRN); // Head + tap(KC_UNDS); // Arm + unregister_code(KC_RSFT); + tap(KC_SLSH); // Arm + process_unicode((0x00AF|QK_UNICODE), record); // Hand + } + return false; + break; + #endif + case FACE: // (o_O) + if(record->event.pressed){ + register_code(KC_RSFT); + tap(KC_LPRN); + unregister_code(KC_RSFT); + tap(KC_O); + register_code(KC_RSFT); + tap(KC_UNDS); + tap(KC_O); + tap(KC_RPRN); + unregister_code(KC_RSFT); + } + return false; + break; + #ifdef TAP_DANCE_ENABLE + case TappyR: + if(record->event.pressed){ + if(timer_elapsed32(Rtimer) > 1052){ + Rstate = 0; + } + switch(Rstate){ + case 0: + Rtimer = timer_read32(); + Rstate++; + break; + case 1: + Rtimes[0] = timer_elapsed32(Rtimer); + Rtimer = timer_read32(); + Rstate++; + break; + case 2: + Rtimes[1] = timer_elapsed32(Rtimer); + Rtimer = timer_read32(); + Rstate++; + break; + case 3: + Rtimes[2] = timer_elapsed32(Rtimer); + Rstate = 0; + break; + } + if(Rstate == 0 && Lstate == 0) rhythm_parse(); + } + return false; + break; + case TappyL: + if(record->event.pressed){ + if(timer_elapsed32(Ltimer) > 1052){ + Lstate = 0; + } + switch(Lstate){ + case 0: + Ltimer = timer_read32(); + Lstate++; + break; + case 1: + Ltimes[0] = timer_elapsed32(Ltimer); + Ltimer = timer_read32(); + Lstate++; + break; + case 2: + Ltimes[1] = timer_elapsed32(Ltimer); + Lstate = 0; + break; + } + if(Rstate == 0 && Lstate == 0) rhythm_parse(); + } + return false; + break; + #endif + #endif + case RANDIG: + if (record->event.pressed) { + tap_random_base64(); + } + return false; + break; + } + return true; +}; + +#ifdef AUDIO_ENABLE +void matrix_init_user(void){ // Run once at startup + #ifdef AUDIO_ENABLE + _delay_ms(50); // gets rid of tick + PLAY_NOTE_ARRAY(tone_startup, false, 0); + #endif +} + +void play_goodbye_tone(void){ + PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + _delay_ms(150); +} + +void shutdown_user(){ + PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + _delay_ms(150); + stop_all_notes(); +} + +void music_on_user(void){ // Run when the music layer is turned on + PLAY_NOTE_ARRAY(tone_startup, false, 0); +} + +void music_off_user(void){ // Run when music is turned off + PLAY_NOTE_ARRAY(tone_goodbye, false, 0); +} +#endif + +#endif diff --git a/keyboards/preonic/keymaps/zach/Makefile b/keyboards/preonic/keymaps/zach/Makefile new file mode 100644 index 000000000..bd49d142c --- /dev/null +++ b/keyboards/preonic/keymaps/zach/Makefile @@ -0,0 +1,29 @@ +# Zach Preonic Makefile +# Max .hex size is about 28636 bytes + +# 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 +# +TAP_DANCE_ENABLE = yes # Enable TapDance functionality +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = no # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +USB_6KRO_ENABLE = no # 6key Rollover +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = yes # Audio output on port C6 +VARIABLE_TRACE = no # Debug changes to variable values +UNICODE_ENABLE = yes # Unicode +UNICODEMAP_ENABLE = no # Enable extended 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 + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/preonic/keymaps/zach/config.h b/keyboards/preonic/keymaps/zach/config.h new file mode 100644 index 000000000..59959524f --- /dev/null +++ b/keyboards/preonic/keymaps/zach/config.h @@ -0,0 +1,95 @@ +/* +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 0x6061 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Ortholinear Keyboards +#define PRODUCT The Preonic Keyboard +#define DESCRIPTION A compact ortholinear keyboard + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 12 + +/* Planck PCB default pin-out */ +#define MATRIX_ROW_PINS { D2, D5, B5, B6, D3 } +#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } +#define UNUSED_PINS + +#define BACKLIGHT_PIN B7 + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + + +#define BACKLIGHT_BREATHING // LED breathing +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 5 + +/* 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)) \ +) + +/* ws2812 RGB LED */ +//#define RGB_DI_PIN D1 +//#define RGBLIGHT_TIMER +//#define RGBLED_NUM 28 // Number of LEDs +//#define RGBLIGHT_HUE_STEP 10 +//#define RGBLIGHT_SAT_STEP 17 +//#define RGBLIGHT_VAL_STEP 17 + +/* + * 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 +//#define DYNAMIC_MACRO_ENABLE // Enable if you need to use the macro functionality +//#define SPACE_CADET // Parenthesis on L/R shift + + +#endif diff --git a/keyboards/preonic/keymaps/zach/keymap.c b/keyboards/preonic/keymaps/zach/keymap.c new file mode 100644 index 000000000..423ca4b86 --- /dev/null +++ b/keyboards/preonic/keymaps/zach/keymap.c @@ -0,0 +1,54 @@ +// Zach Nielsen Custom Preonic Keyboard layout +#include "preonic.h" +#define PREONIC_YES // This is the Preonic +#include "zach_common_functions.c" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[_COLEMAK] = { /* Base Layer */ + {KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, KC_ENT}, + {KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT}, + {SHFT_CAP, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT}, + {CTRLB, TD(SUP), KC_LALT, KC_LCTL, TD(LOW), KC_SPC, KC_SPC, TD(RAI), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +[_SWCOLE] = { /* Software Colemak */ + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, KC_QUOT, _______}, + {_______, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, _______}, + {_______, CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, CM_COMM, CM_DOT, CM_SLSH, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +}, + +[_RAISE] = { /* RAISE - Numpad and Unicode symbols */ + {KC_TILD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {KC_GRV, SUPA2, FACE, DISFACE, SHRUG, PLUMIN, IBANG, KC_7, KC_8, KC_9, KC_COLN, _______}, + {KC_DEL, DEGREE, MICRO, WOMEGA, OMEGA, XXXXXXX, KC_ENT, KC_4, KC_5, KC_6, KC_SLSH, KC_ASTR}, + {_______, KC_COLN, TFLIP, LAROW, RAROW, XXXXXXX, KC_SPC, KC_1, KC_2, KC_3, KC_MINS, KC_PLUS}, + {_______, KC_PIPE, TPUT, _______, _______, KC_TAB, KC_TAB, _______, KC_0, KC_0, KC_DOT, KC_EQL} +}, + +[_LOWER] = { /* LOWER - Symbols, Paging, CtrAltDel */ + {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_QUES, KC_DQT, KC_DEL}, + {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_QUES, KC_DQT, KC_DEL}, + {KC_DEL, KC_LBRC, KC_RBRC, KC_MINS, KC_UNDS, KC_HOME, KC_END, KC_LPRN, KC_RPRN, KC_SLSH, KC_SCLN, KC_PGUP}, + {CPYPST, XXXXXXX, C(KC_X), KC_LABK, KC_RABK, XXXXXXX, XXXXXXX, KC_LCBR, KC_RCBR, KC_BSLS, KC_COLN, KC_PGDN}, + {_______, _______, _______, _______, _______, KC_TAB, KC_TAB, _______, _______, _______, _______, _______} +}, + +[_ADJUST] = { /* ADJUST - Macros, Layer Switching, Function Keys */ + {UNIWIN, XXXXXXX, XXXXXXX, RANDIG, RANDIG, KC_INS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, AU_TOG, MU_TOG}, + {UNILIN, SUPA2, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX}, + {XXXXXXX, DEGREE, IBANG, LAROW, RAROW, SWCOLE, COLEMAK, KC_F5, KC_F6, KC_F7, KC_F8, BL_INC}, + {_______, CADKEY, MICRO, WOMEGA, OMEGA, XXXXXXX, XXXXXXX, KC_F9, KC_F10, KC_F11, KC_F12, BL_DEC}, + {_______, _______, _______, _______, _______, RESET, RESET, _______, XXXXXXX, MUV_DE, MUV_IN, BL_TOGG} +}, + +[_UNICODES] = { /* UNICODES - Extra layer for unicode stuff */ + {_______, XXXXXXX, XXXXXXX, FINGER, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______}, + {_______, TFLIP, XXXXXXX, XXXXXXX, IBANG, roman7, XXXXXXX, XXXXXXX, ROMAN7, XXXXXXX, XXXXXXX, _______}, + {KC_DEL, TPUT, FACE, DISFACE, SHRUG, roman4, roman5, roman6, ROMAN4, ROMAN5, ROMAN6, _______}, + {XXXXXXX, PENIS, BOOBS, LAROW, RAROW, roman1, roman2, roman3, ROMAN1, ROMAN2, ROMAN3, XXXXXXX}, + {_______, _______, _______, _______, _______, KC_SPC, KC_SPC, _______, _______, _______, _______, _______} +} +}; diff --git a/keyboards/preonic/keymaps/zach/zach_common_functions.c b/keyboards/preonic/keymaps/zach/zach_common_functions.c new file mode 100644 index 000000000..f01929f5d --- /dev/null +++ b/keyboards/preonic/keymaps/zach/zach_common_functions.c @@ -0,0 +1,538 @@ +#ifndef ZACH_COMMON_FUNCTIONS +#define ZACH_COMMON_FUNCTIONS +#include "eeconfig.h" +#include "action_layer.h" +#include "keymap_colemak.h" +#include "extra_functions.c" +extern keymap_config_t keymap_config; + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO +#define C(n) RCTL(n) +#define CADKEY RCTL(RALT(KC_DEL)) + +void tap(uint16_t keycode){ + register_code(keycode); + unregister_code(keycode); +}; + +void persistant_default_layer_set(uint16_t default_layer){ + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +}; + +// Automatic number generation of important keywords +enum my_keycodes{ + // Layer numbers + _COLEMAK = 0, + _SWCOLE, + _RAISE, + _LOWER, + _ADJUST, + _UNICODES, + // These use process_record_user() + COLEMAK = SAFE_RANGE, + SWCOLE, + LOWER, + RAISE, + SHFT_CAP, + CTRLB, + CPYPST, + FACE, + UNIWIN, + UNILIN, + DISFACE, + TFLIP, + TPUT, + SHRUG, + PENIS, + BOOBS, + Sil_Pas, + Sil_Usr, + UltiU, + UltiP, + TappyR, + TappyL, + RANDIG, + FINGER, + // Tap_Dance nums + RAI = 0, + LOW, + SUP +}; + +#ifdef AUDIO_ENABLE +#include "audio.h" +float tone_startup[][2] = SONG(STARTUP_SOUND); +float tone_goodbye[][2] = SONG(GOODBYE_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +float tone_swcole[][2] = SONG(QWERTY_SOUND); +float tone_capslock_on[][2] = SONG(CAPS_LOCK_ON_SOUND); +float tone_capslock_off[][2] = SONG(CAPS_LOCK_OFF_SOUND); +float tone_ctrl_mod[][2] = SONG(COIN_SOUND); +float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND); +float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND); +float uniwin[][2] = SONG(UNICODE_WINDOWS); +float unilin[][2] = SONG(UNICODE_LINUX); +#endif + +#ifdef TAP_DANCE_ENABLE +#define TAPPING_TERM 200 + +uint8_t Lstate = 0, Rstate = 0; +uint32_t Ltimer = 0, Rtimer = 0; +uint32_t Ltimes[3], Rtimes[4]; // Ratio of tap times should be about 1.335 (L/R) +void rhythm_parse(void){ + int L = Ltimes[0] + Ltimes[1] + Ltimes[2]; // Start to end time + int R = Rtimes[0] + Rtimes[1] + Rtimes[2] + Rtimes[3]; + if(abs(R-L) > 10){ + tap(KC_N); tap(KC_O); + return; + } else { + L = (L / 3)*100; // Average time per tap * 100 + R = (R / 4); + if(abs(abs(L/R)-133) > 1){ + tap(KC_N); tap(KC_O); + tap(KC_P); tap(KC_E); + return; + } else { + tap(KC_O); tap(KC_K); + return; + } + } +}; + +void dance_raise_press(qk_tap_dance_state_t *state, void *user_data){// Called on each tap + switch(state->count){ // Only turn the layer on once + case 1: + layer_off(_UNICODES); + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + break; + } +}; +void dance_raise_lift(qk_tap_dance_state_t *state, void *user_data){ // Called on release + switch(state->count){ + case 1: // Normal action. Turn off layers + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + layer_off(_UNICODES); + break; + } +}; +///////////////////////////////////////////////////////////////////// +void dance_lower_press(qk_tap_dance_state_t *state, void *user_data){// Called on tap + switch(state->count){ + case 1: // Turn on lower + layer_off(_UNICODES); + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + break; + } +}; +void dance_lower_lift(qk_tap_dance_state_t *state, void *user_data){ // Called on release + switch(state->count){ + case 1: // Normal action. Turn off layers + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + layer_off(_UNICODES); + break; + case 2: // Turn on _UNICODES layer + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + layer_on(_UNICODES); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_ctrl_mod, false, 0); + #endif + break; + } +}; +///////////////////////////////////////////////////////////////////// +void dance_super_press(qk_tap_dance_state_t *state, void *user_data){ // Called on down + if(state->count == 1){ + register_code(KC_LGUI); + } +} +void dance_super_done(qk_tap_dance_state_t *state, void *user_data){ // Called on timeout + switch(state->count){ + case 2: + register_code(KC_LGUI); + tap(KC_L); + unregister_code(KC_LGUI); + break; + } +} +void dance_super_lift(qk_tap_dance_state_t *state, void *user_data){ // Called on up + unregister_code(KC_LGUI); +} + +qk_tap_dance_action_t tap_dance_actions[] = { + [RAI] = ACTION_TAP_DANCE_FN_ADVANCED(dance_raise_press, NULL, dance_raise_lift), + [LOW] = ACTION_TAP_DANCE_FN_ADVANCED(dance_lower_press, NULL, dance_lower_lift), + [SUP] = ACTION_TAP_DANCE_FN_ADVANCED(dance_super_press, dance_super_done, dance_super_lift) +}; +#endif + +#ifdef UNICODE_ENABLE +// Unicode shortcuts +#define IBANG UC(0x203D) +#define RAROW UC(0x2192) +#define LAROW UC(0x2190) +#define DEGREE UC(0x00B0) +#define OMEGA UC(0x03A9) +#define WOMEGA UC(0x03C9) +#define MICRO UC(0x00B5) +#define PLUMIN UC(0x00B1) +#define SUPA2 UC(0x00B2) +#define ROMAN1 UC(0x2160) +#define ROMAN2 UC(0x2161) +#define ROMAN3 UC(0x2162) +#define ROMAN4 UC(0x2163) +#define ROMAN5 UC(0x2164) +#define ROMAN6 UC(0x2165) +#define ROMAN7 UC(0x2166) +#define roman1 UC(0x2170) +#define roman2 UC(0x2171) +#define roman3 UC(0x2172) +#define roman4 UC(0x2173) +#define roman5 UC(0x2174) +#define roman6 UC(0x2175) +#define roman7 UC(0x2176) + +#ifdef UNICODEMAP_ENABLE // For Unicode characters larger than 0x8000. Send with X() +enum Ext_Unicode{ + PENGUIN = 0, + BOAR, + MONKEY, + DRAGON, + CHICK, + TUMBLER +}; +const uint32_t PROGMEM unicode_map[] = { + [PENGUIN] = 0x1F427, + [BOAR] = 0x1F417, + [MONKEY] = 0x1F412, + [DRAGON] = 0x1F409, + [CHICK] = 0x1F425, + [TUMBLER] = 0x1F943 +}; +#define PENGY X(PENGUIN) +#define BOARY X(BOAR) +#define MNKY X(MONKEY) +#define DRGN X(DRAGON) +#define DUCK X(CHICK) +#define TMBL X(TUMBLER) +#endif + +#endif + +static uint16_t key_timer; +static uint8_t caps_status = 0; +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case COLEMAK: + if(record->event.pressed){ + persistant_default_layer_set(1UL<<_COLEMAK); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + } + return false; + break; + case SWCOLE: + if(record->event.pressed){ + persistant_default_layer_set(1UL<<_SWCOLE); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_swcole, false, 0); + #endif + } + return false; + break; + #ifndef TAP_DANCE_ENABLE + case RAISE: + if(record->event.pressed){ + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case LOWER: + if(record->event.pressed){ + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + #endif + case SHFT_CAP: + if(record->event.pressed){ + key_timer = timer_read(); // if the key is being pressed, we start the timer. + register_code(KC_LSHIFT); + } else { // this means the key was just released (tap or "held down") + if(timer_elapsed(key_timer) < 152){ // Time in ms, the threshold we pick for counting something as a tap. + tap(KC_CAPS); + if(caps_status == 0){ + caps_status = 1; + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_capslock_on, false, 0); + #endif + } else { + caps_status = 0; + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_capslock_off, false, 0); + #endif + } + } + unregister_code(KC_LSHIFT); + } + return false; + break; + case CTRLB: // Control-B on tap (bold) + if(record->event.pressed){ + key_timer = timer_read(); // if the key is being pressed, we start the timer. + register_code(KC_LCTL); + } else { // this means the key was just released (tap or "held down") + if (timer_elapsed(key_timer) < 152) { // Time in ms, the threshold we pick for counting something as a tap. + tap(KC_B); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_ctrl_mod, false, 0); + #endif + #ifdef BACKLIGHT_BREATHING + breathing_speed_set(2); + breathing_pulse(); + #endif + } + unregister_code(KC_LCTL); + } + return false; + break; + case CPYPST: // One key copy/paste + if(record->event.pressed){ + key_timer = timer_read(); + } else { + if (timer_elapsed(key_timer) > 152) { // Hold, copy + register_code(KC_LCTL); + tap(KC_C); + unregister_code(KC_LCTL); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_copy, false, 0); + #endif + } else { // Tap, paste + register_code(KC_LCTL); + tap(KC_V); + unregister_code(KC_LCTL); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_paste, false, 0); + #endif + } + } + return false; + break; + #ifdef UNICODE_ENABLE + case UNIWIN: + if(record->event.pressed){ + set_unicode_input_mode(UC_WIN); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(uniwin, false, 0); + #endif + } + return false; + break; + case UNILIN: + if(record->event.pressed){ + set_unicode_input_mode(UC_LNX); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(unilin, false, 0); + #endif + } + return false; + break; + case DISFACE: // ಠ_ಠ + if(record->event.pressed){ + process_unicode((0x0CA0|QK_UNICODE), record); // Eye + register_code(KC_RSFT); + tap(KC_MINS); + unregister_code(KC_RSFT); + process_unicode((0x0CA0|QK_UNICODE), record); // Eye + } + return false; + break; + case TFLIP: // (╯°□°)╯ ︵ ┻━┻ + if(record->event.pressed){ + register_code(KC_RSFT); + tap(KC_9); + unregister_code(KC_RSFT); + process_unicode((0x256F|QK_UNICODE), record); // Arm + process_unicode((0x00B0|QK_UNICODE), record); // Eye + process_unicode((0x25A1|QK_UNICODE), record); // Mouth + process_unicode((0x00B0|QK_UNICODE), record); // Eye + register_code(KC_RSFT); + tap(KC_0); + unregister_code(KC_RSFT); + process_unicode((0x256F|QK_UNICODE), record); // Arm + tap(KC_SPC); + process_unicode((0x0361|QK_UNICODE), record); // Flippy + tap(KC_SPC); + process_unicode((0x253B|QK_UNICODE), record); // Table + process_unicode((0x2501|QK_UNICODE), record); // Table + process_unicode((0x253B|QK_UNICODE), record); // Table + } + return false; + break; + case TPUT: // ┬──┬ ノ( ゜-゜ノ) + if(record->event.pressed){ + process_unicode((0x252C|QK_UNICODE), record); // Table + process_unicode((0x2500|QK_UNICODE), record); // Table + process_unicode((0x2500|QK_UNICODE), record); // Table + process_unicode((0x252C|QK_UNICODE), record); // Table + tap(KC_SPC); + process_unicode((0x30CE|QK_UNICODE), record); // Arm + register_code(KC_RSFT); + tap(KC_9); + unregister_code(KC_RSFT); + tap(KC_SPC); + process_unicode((0x309C|QK_UNICODE), record); // Eye + tap(KC_MINS); + process_unicode((0x309C|QK_UNICODE), record); // Eye + process_unicode((0x30CE|QK_UNICODE), record); // Arm + register_code(KC_RSFT); + tap(KC_0); + unregister_code(KC_RSFT); + } + return false; + break; + case SHRUG: // ¯\_(ツ)_/¯ + if(record->event.pressed){ + process_unicode((0x00AF|QK_UNICODE), record); // Hand + tap(KC_BSLS); // Arm + register_code(KC_RSFT); + tap(KC_UNDS); // Arm + tap(KC_LPRN); // Head + unregister_code(KC_RSFT); + process_unicode((0x30C4|QK_UNICODE), record); // Face + register_code(KC_RSFT); + tap(KC_RPRN); // Head + tap(KC_UNDS); // Arm + unregister_code(KC_RSFT); + tap(KC_SLSH); // Arm + process_unicode((0x00AF|QK_UNICODE), record); // Hand + } + return false; + break; + #endif + case FACE: // (o_O) + if(record->event.pressed){ + register_code(KC_RSFT); + tap(KC_LPRN); + unregister_code(KC_RSFT); + tap(KC_O); + register_code(KC_RSFT); + tap(KC_UNDS); + tap(KC_O); + tap(KC_RPRN); + unregister_code(KC_RSFT); + } + return false; + break; + #ifdef TAP_DANCE_ENABLE + case TappyR: + if(record->event.pressed){ + if(timer_elapsed32(Rtimer) > 1052){ + Rstate = 0; + } + switch(Rstate){ + case 0: + Rtimer = timer_read32(); + Rstate++; + break; + case 1: + Rtimes[0] = timer_elapsed32(Rtimer); + Rtimer = timer_read32(); + Rstate++; + break; + case 2: + Rtimes[1] = timer_elapsed32(Rtimer); + Rtimer = timer_read32(); + Rstate++; + break; + case 3: + Rtimes[2] = timer_elapsed32(Rtimer); + Rstate = 0; + break; + } + if(Rstate == 0 && Lstate == 0) rhythm_parse(); + } + return false; + break; + case TappyL: + if(record->event.pressed){ + if(timer_elapsed32(Ltimer) > 1052){ + Lstate = 0; + } + switch(Lstate){ + case 0: + Ltimer = timer_read32(); + Lstate++; + break; + case 1: + Ltimes[0] = timer_elapsed32(Ltimer); + Ltimer = timer_read32(); + Lstate++; + break; + case 2: + Ltimes[1] = timer_elapsed32(Ltimer); + Lstate = 0; + break; + } + if(Rstate == 0 && Lstate == 0) rhythm_parse(); + } + return false; + break; + #endif + #endif + case RANDIG: + if (record->event.pressed) { + tap_random_base64(); + } + return false; + break; + } + return true; +}; + +#ifdef AUDIO_ENABLE +void matrix_init_user(void){ // Run once at startup + #ifdef AUDIO_ENABLE + _delay_ms(50); // gets rid of tick + PLAY_NOTE_ARRAY(tone_startup, false, 0); + #endif +} + +void play_goodbye_tone(void){ + PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + _delay_ms(150); +} + +void shutdown_user(){ + PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + _delay_ms(150); + stop_all_notes(); +} + +void music_on_user(void){ // Run when the music layer is turned on + PLAY_NOTE_ARRAY(tone_startup, false, 0); +} + +void music_off_user(void){ // Run when music is turned off + PLAY_NOTE_ARRAY(tone_goodbye, false, 0); +} +#endif + +#endif From 4c0aa02b2e476a8f939586a0da2f28f2a44c83c3 Mon Sep 17 00:00:00 2001 From: Zach Nielsen Date: Thu, 10 Nov 2016 12:59:55 -0800 Subject: [PATCH 03/12] Missed some stuff. Added a song (stole it from reddit). --- keyboards/planck/keymaps/zach/Makefile | 2 +- keyboards/planck/keymaps/zach/config.h | 3 + .../keymaps/zach/zach_common_functions.c | 61 +------------------ keyboards/preonic/keymaps/zach/Makefile | 2 +- .../keymaps/zach/zach_common_functions.c | 61 +------------------ quantum/audio/song_list.h | 12 ++++ 6 files changed, 19 insertions(+), 122 deletions(-) diff --git a/keyboards/planck/keymaps/zach/Makefile b/keyboards/planck/keymaps/zach/Makefile index b0009147a..977f1a901 100644 --- a/keyboards/planck/keymaps/zach/Makefile +++ b/keyboards/planck/keymaps/zach/Makefile @@ -16,7 +16,7 @@ USB_6KRO_ENABLE = no # 6key Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no # Audio output on port C6 -VARIABLE_TRACE = no # Debug changes to variable values +#VARIABLE_TRACE = no # Debug changes to variable values UNICODE_ENABLE = yes # Unicode UNICODEMAP_ENABLE = yes # Enable extended unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID diff --git a/keyboards/planck/keymaps/zach/config.h b/keyboards/planck/keymaps/zach/config.h index 1be800545..7deb9ebfe 100644 --- a/keyboards/planck/keymaps/zach/config.h +++ b/keyboards/planck/keymaps/zach/config.h @@ -53,8 +53,10 @@ along with this program. If not, see . /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ //#define LOCKING_SUPPORT_ENABLE +#undef LOCKING_SUPPORT_ENABLE /* Locking resynchronize hack */ //#define LOCKING_RESYNC_ENABLE +#undef LOCKING_RESYNC_ENABLE /* key combination for command */ #define IS_COMMAND() ( \ @@ -70,6 +72,7 @@ along with this program. If not, see . //#define NO_DEBUG /* disable print */ //#define NO_PRINT +#undef NO_PRINT /* disable action features */ //#define NO_ACTION_LAYER diff --git a/keyboards/planck/keymaps/zach/zach_common_functions.c b/keyboards/planck/keymaps/zach/zach_common_functions.c index f01929f5d..7d14dcf3f 100644 --- a/keyboards/planck/keymaps/zach/zach_common_functions.c +++ b/keyboards/planck/keymaps/zach/zach_common_functions.c @@ -3,7 +3,6 @@ #include "eeconfig.h" #include "action_layer.h" #include "keymap_colemak.h" -#include "extra_functions.c" extern keymap_config_t keymap_config; // Fillers to make layering more clear @@ -249,7 +248,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; - #ifndef TAP_DANCE_ENABLE case RAISE: if(record->event.pressed){ layer_on(_RAISE); @@ -270,7 +268,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; - #endif case SHFT_CAP: if(record->event.pressed){ key_timer = timer_read(); // if the key is being pressed, we start the timer. @@ -441,62 +438,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; - #ifdef TAP_DANCE_ENABLE - case TappyR: - if(record->event.pressed){ - if(timer_elapsed32(Rtimer) > 1052){ - Rstate = 0; - } - switch(Rstate){ - case 0: - Rtimer = timer_read32(); - Rstate++; - break; - case 1: - Rtimes[0] = timer_elapsed32(Rtimer); - Rtimer = timer_read32(); - Rstate++; - break; - case 2: - Rtimes[1] = timer_elapsed32(Rtimer); - Rtimer = timer_read32(); - Rstate++; - break; - case 3: - Rtimes[2] = timer_elapsed32(Rtimer); - Rstate = 0; - break; - } - if(Rstate == 0 && Lstate == 0) rhythm_parse(); - } - return false; - break; - case TappyL: - if(record->event.pressed){ - if(timer_elapsed32(Ltimer) > 1052){ - Lstate = 0; - } - switch(Lstate){ - case 0: - Ltimer = timer_read32(); - Lstate++; - break; - case 1: - Ltimes[0] = timer_elapsed32(Ltimer); - Ltimer = timer_read32(); - Lstate++; - break; - case 2: - Ltimes[1] = timer_elapsed32(Ltimer); - Lstate = 0; - break; - } - if(Rstate == 0 && Lstate == 0) rhythm_parse(); - } - return false; - break; - #endif - #endif case RANDIG: if (record->event.pressed) { tap_random_base64(); @@ -507,7 +448,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; }; -#ifdef AUDIO_ENABLE void matrix_init_user(void){ // Run once at startup #ifdef AUDIO_ENABLE _delay_ms(50); // gets rid of tick @@ -515,6 +455,7 @@ void matrix_init_user(void){ // Run once at startup #endif } +#ifdef AUDIO_ENABLE void play_goodbye_tone(void){ PLAY_NOTE_ARRAY(tone_goodbye, false, 0); _delay_ms(150); diff --git a/keyboards/preonic/keymaps/zach/Makefile b/keyboards/preonic/keymaps/zach/Makefile index bd49d142c..f0a84abac 100644 --- a/keyboards/preonic/keymaps/zach/Makefile +++ b/keyboards/preonic/keymaps/zach/Makefile @@ -16,7 +16,7 @@ USB_6KRO_ENABLE = no # 6key Rollover BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = yes # Audio output on port C6 -VARIABLE_TRACE = no # Debug changes to variable values +#VARIABLE_TRACE = no # Debug changes to variable values UNICODE_ENABLE = yes # Unicode UNICODEMAP_ENABLE = no # Enable extended unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID diff --git a/keyboards/preonic/keymaps/zach/zach_common_functions.c b/keyboards/preonic/keymaps/zach/zach_common_functions.c index f01929f5d..7d14dcf3f 100644 --- a/keyboards/preonic/keymaps/zach/zach_common_functions.c +++ b/keyboards/preonic/keymaps/zach/zach_common_functions.c @@ -3,7 +3,6 @@ #include "eeconfig.h" #include "action_layer.h" #include "keymap_colemak.h" -#include "extra_functions.c" extern keymap_config_t keymap_config; // Fillers to make layering more clear @@ -249,7 +248,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; - #ifndef TAP_DANCE_ENABLE case RAISE: if(record->event.pressed){ layer_on(_RAISE); @@ -270,7 +268,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; - #endif case SHFT_CAP: if(record->event.pressed){ key_timer = timer_read(); // if the key is being pressed, we start the timer. @@ -441,62 +438,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; - #ifdef TAP_DANCE_ENABLE - case TappyR: - if(record->event.pressed){ - if(timer_elapsed32(Rtimer) > 1052){ - Rstate = 0; - } - switch(Rstate){ - case 0: - Rtimer = timer_read32(); - Rstate++; - break; - case 1: - Rtimes[0] = timer_elapsed32(Rtimer); - Rtimer = timer_read32(); - Rstate++; - break; - case 2: - Rtimes[1] = timer_elapsed32(Rtimer); - Rtimer = timer_read32(); - Rstate++; - break; - case 3: - Rtimes[2] = timer_elapsed32(Rtimer); - Rstate = 0; - break; - } - if(Rstate == 0 && Lstate == 0) rhythm_parse(); - } - return false; - break; - case TappyL: - if(record->event.pressed){ - if(timer_elapsed32(Ltimer) > 1052){ - Lstate = 0; - } - switch(Lstate){ - case 0: - Ltimer = timer_read32(); - Lstate++; - break; - case 1: - Ltimes[0] = timer_elapsed32(Ltimer); - Ltimer = timer_read32(); - Lstate++; - break; - case 2: - Ltimes[1] = timer_elapsed32(Ltimer); - Lstate = 0; - break; - } - if(Rstate == 0 && Lstate == 0) rhythm_parse(); - } - return false; - break; - #endif - #endif case RANDIG: if (record->event.pressed) { tap_random_base64(); @@ -507,7 +448,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; }; -#ifdef AUDIO_ENABLE void matrix_init_user(void){ // Run once at startup #ifdef AUDIO_ENABLE _delay_ms(50); // gets rid of tick @@ -515,6 +455,7 @@ void matrix_init_user(void){ // Run once at startup #endif } +#ifdef AUDIO_ENABLE void play_goodbye_tone(void){ PLAY_NOTE_ARRAY(tone_goodbye, false, 0); _delay_ms(150); diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h index 8022ca672..623f24f32 100644 --- a/quantum/audio/song_list.h +++ b/quantum/audio/song_list.h @@ -3,6 +3,10 @@ #ifndef SONG_LIST_H #define SONG_LIST_H +#define COIN_SOUND \ + E__NOTE(_A5 ),\ + HD_NOTE(_E6 ), + #define ODE_TO_JOY \ Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \ Q__NOTE(_G4), Q__NOTE(_F4), Q__NOTE(_E4), Q__NOTE(_D4), \ @@ -122,4 +126,12 @@ E__NOTE(_E5), \ E__NOTE(_D5), +#define UNICODE_WINDOWS \ + E__NOTE(_B5), \ + S__NOTE(_E6), + +#define UNICODE_LINUX \ + E__NOTE(_E6), \ + S__NOTE(_B5), + #endif From f388bb5bdacb39a5309ca7594940184bbf35e84b Mon Sep 17 00:00:00 2001 From: nielsenz Date: Thu, 10 Nov 2016 13:39:46 -0800 Subject: [PATCH 04/12] Removed some common functions from my keymap --- keyboards/planck/keymaps/zach/keymap.c | 8 ++++---- keyboards/planck/keymaps/zach/zach_common_functions.c | 9 --------- keyboards/preonic/keymaps/zach/keymap.c | 4 ++-- keyboards/preonic/keymaps/zach/zach_common_functions.c | 9 --------- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/keyboards/planck/keymaps/zach/keymap.c b/keyboards/planck/keymaps/zach/keymap.c index d3cde5bb9..710477df5 100644 --- a/keyboards/planck/keymaps/zach/keymap.c +++ b/keyboards/planck/keymaps/zach/keymap.c @@ -33,16 +33,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }, [_ADJUST] = { /* ADJUST - Macros, Layer Switching, Function Keys */ - {UNIWIN, Sil_Usr, Sil_Pas, PENGY, DUCK, KC_INS, KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX}, - {UNILIN, UltiU, UltiP, RANDIG, RANDIG, SWCOLE, COLEMAK, KC_F5, KC_F6, KC_F7, KC_F8, XXXXXXX}, + {UNIWIN, XXXXXXX, XXXXXXX, PENGY, DUCK, KC_INS, KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX}, + {UNILIN, XXXXXXX, XXXXXXX, RANDIG, RANDIG, SWCOLE, COLEMAK, KC_F5, KC_F6, KC_F7, KC_F8, XXXXXXX}, {_______, CADKEY, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX}, {_______, _______, _______, _______, _______, RESET, RESET, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX} }, [_UNICODES] = { /* UNICODES - Extra layer for unicode stuff */ - {_______, TFLIP, XXXXXXX, FINGER, IBANG, roman7, XXXXXXX, XXXXXXX, ROMAN7, TappyL, TappyR, _______}, + {_______, TFLIP, XXXXXXX, XXXXXXX, IBANG, roman7, XXXXXXX, XXXXXXX, ROMAN7, XXXXXXX, XXXXXXX, _______}, {KC_DEL, TPUT, FACE, DISFACE, SHRUG, roman4, roman5, roman6, ROMAN4, ROMAN5, ROMAN6, _______}, - {XXXXXXX, PENIS, BOOBS, LAROW, RAROW, roman1, roman2, roman3, ROMAN1, ROMAN2, ROMAN3, XXXXXXX}, + {XXXXXXX, XXXXXXX, XXXXXXX, LAROW, RAROW, roman1, roman2, roman3, ROMAN1, ROMAN2, ROMAN3, XXXXXXX}, {_______, _______, _______, _______, _______, KC_SPC, KC_SPC, _______, _______, _______, _______, _______} } }; diff --git a/keyboards/planck/keymaps/zach/zach_common_functions.c b/keyboards/planck/keymaps/zach/zach_common_functions.c index 7d14dcf3f..1f907e6cb 100644 --- a/keyboards/planck/keymaps/zach/zach_common_functions.c +++ b/keyboards/planck/keymaps/zach/zach_common_functions.c @@ -45,16 +45,7 @@ enum my_keycodes{ TFLIP, TPUT, SHRUG, - PENIS, - BOOBS, - Sil_Pas, - Sil_Usr, - UltiU, - UltiP, - TappyR, - TappyL, RANDIG, - FINGER, // Tap_Dance nums RAI = 0, LOW, diff --git a/keyboards/preonic/keymaps/zach/keymap.c b/keyboards/preonic/keymaps/zach/keymap.c index 423ca4b86..6ce37840b 100644 --- a/keyboards/preonic/keymaps/zach/keymap.c +++ b/keyboards/preonic/keymaps/zach/keymap.c @@ -45,10 +45,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }, [_UNICODES] = { /* UNICODES - Extra layer for unicode stuff */ - {_______, XXXXXXX, XXXXXXX, FINGER, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______}, + {_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______}, {_______, TFLIP, XXXXXXX, XXXXXXX, IBANG, roman7, XXXXXXX, XXXXXXX, ROMAN7, XXXXXXX, XXXXXXX, _______}, {KC_DEL, TPUT, FACE, DISFACE, SHRUG, roman4, roman5, roman6, ROMAN4, ROMAN5, ROMAN6, _______}, - {XXXXXXX, PENIS, BOOBS, LAROW, RAROW, roman1, roman2, roman3, ROMAN1, ROMAN2, ROMAN3, XXXXXXX}, + {XXXXXXX, XXXXXXX, XXXXXXX, LAROW, RAROW, roman1, roman2, roman3, ROMAN1, ROMAN2, ROMAN3, XXXXXXX}, {_______, _______, _______, _______, _______, KC_SPC, KC_SPC, _______, _______, _______, _______, _______} } }; diff --git a/keyboards/preonic/keymaps/zach/zach_common_functions.c b/keyboards/preonic/keymaps/zach/zach_common_functions.c index 7d14dcf3f..1f907e6cb 100644 --- a/keyboards/preonic/keymaps/zach/zach_common_functions.c +++ b/keyboards/preonic/keymaps/zach/zach_common_functions.c @@ -45,16 +45,7 @@ enum my_keycodes{ TFLIP, TPUT, SHRUG, - PENIS, - BOOBS, - Sil_Pas, - Sil_Usr, - UltiU, - UltiP, - TappyR, - TappyL, RANDIG, - FINGER, // Tap_Dance nums RAI = 0, LOW, From 80c5ada3394c5ad8087df00ef878eb2cbcd87d70 Mon Sep 17 00:00:00 2001 From: Zach Nielsen Date: Thu, 10 Nov 2016 13:47:07 -0800 Subject: [PATCH 05/12] Missed removing a function --- .../keymaps/zach/zach_common_functions.c | 23 ------------------- .../keymaps/zach/zach_common_functions.c | 23 ------------------- 2 files changed, 46 deletions(-) diff --git a/keyboards/planck/keymaps/zach/zach_common_functions.c b/keyboards/planck/keymaps/zach/zach_common_functions.c index 1f907e6cb..b77f2b241 100644 --- a/keyboards/planck/keymaps/zach/zach_common_functions.c +++ b/keyboards/planck/keymaps/zach/zach_common_functions.c @@ -70,29 +70,6 @@ float unilin[][2] = SONG(UNICODE_LINUX); #ifdef TAP_DANCE_ENABLE #define TAPPING_TERM 200 -uint8_t Lstate = 0, Rstate = 0; -uint32_t Ltimer = 0, Rtimer = 0; -uint32_t Ltimes[3], Rtimes[4]; // Ratio of tap times should be about 1.335 (L/R) -void rhythm_parse(void){ - int L = Ltimes[0] + Ltimes[1] + Ltimes[2]; // Start to end time - int R = Rtimes[0] + Rtimes[1] + Rtimes[2] + Rtimes[3]; - if(abs(R-L) > 10){ - tap(KC_N); tap(KC_O); - return; - } else { - L = (L / 3)*100; // Average time per tap * 100 - R = (R / 4); - if(abs(abs(L/R)-133) > 1){ - tap(KC_N); tap(KC_O); - tap(KC_P); tap(KC_E); - return; - } else { - tap(KC_O); tap(KC_K); - return; - } - } -}; - void dance_raise_press(qk_tap_dance_state_t *state, void *user_data){// Called on each tap switch(state->count){ // Only turn the layer on once case 1: diff --git a/keyboards/preonic/keymaps/zach/zach_common_functions.c b/keyboards/preonic/keymaps/zach/zach_common_functions.c index 1f907e6cb..b77f2b241 100644 --- a/keyboards/preonic/keymaps/zach/zach_common_functions.c +++ b/keyboards/preonic/keymaps/zach/zach_common_functions.c @@ -70,29 +70,6 @@ float unilin[][2] = SONG(UNICODE_LINUX); #ifdef TAP_DANCE_ENABLE #define TAPPING_TERM 200 -uint8_t Lstate = 0, Rstate = 0; -uint32_t Ltimer = 0, Rtimer = 0; -uint32_t Ltimes[3], Rtimes[4]; // Ratio of tap times should be about 1.335 (L/R) -void rhythm_parse(void){ - int L = Ltimes[0] + Ltimes[1] + Ltimes[2]; // Start to end time - int R = Rtimes[0] + Rtimes[1] + Rtimes[2] + Rtimes[3]; - if(abs(R-L) > 10){ - tap(KC_N); tap(KC_O); - return; - } else { - L = (L / 3)*100; // Average time per tap * 100 - R = (R / 4); - if(abs(abs(L/R)-133) > 1){ - tap(KC_N); tap(KC_O); - tap(KC_P); tap(KC_E); - return; - } else { - tap(KC_O); tap(KC_K); - return; - } - } -}; - void dance_raise_press(qk_tap_dance_state_t *state, void *user_data){// Called on each tap switch(state->count){ // Only turn the layer on once case 1: From 3a1ee48cda5f185ebb3a4f989b389edf029992bb Mon Sep 17 00:00:00 2001 From: Osamu Aoki Date: Mon, 13 Mar 2017 17:11:05 +0000 Subject: [PATCH 06/12] Typo fix --- quantum/template/template.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantum/template/template.h b/quantum/template/template.h index e912188ba..7e2b14f3c 100644 --- a/quantum/template/template.h +++ b/quantum/template/template.h @@ -20,7 +20,7 @@ // This a shortcut to help you visually see your layout. // The following is an example using the Planck MIT layout -// The first section contains all of the arguements +// The first section contains all of the arguments // The second converts the arguments into a two-dimensional array #define KEYMAP( \ k00, k01, k02, \ From ccbdf90f02067bc37975130ca8c4b26d2497dcf7 Mon Sep 17 00:00:00 2001 From: Osamu Aoki Date: Sun, 12 Mar 2017 02:41:47 +0900 Subject: [PATCH 07/12] Update to match QMK keymap --- doc/keymap.md | 232 +++++++++++++++++++++++++++++++------------------- 1 file changed, 143 insertions(+), 89 deletions(-) diff --git a/doc/keymap.md b/doc/keymap.md index 2b0d2cd95..bc7809905 100644 --- a/doc/keymap.md +++ b/doc/keymap.md @@ -1,15 +1,30 @@ Keymap framework - how to define your keymap ============================================ -***NOTE: This is not final version, may be inconsistent with source code and changed occasionally for a while.*** +***NOTE: This is updated for QMK but this is still work in progress. This may still be inconsistent with the source code.*** + +QMK is based on TMK. Understanding the essential changes made should help you understand variable names etc. + +## TMK vs. QMK + +| Firmware |TMK |QMK | +|-------------------------------------------------|-----------------------|-------------------------| +| Maintainer |hasu |Jack Humbert et al. | +| Build path customization | `TMK_DIR = ...` | `include .../Makefile` | +| `keymaps` data | 3D array of `uint8_t` holding **keycode** | 3D array of `uint16_t` holding **action code** | +| `fn_actions` data | 1D array of `uint16_t` holding **action code** | 3D array of `uint16_t` holding **action code** | + +Since QMK is based on TMK and uses major portion of TMK code as is, understanding the essential changes made should help you understand the code. ## 0. Keymap and layers -**Keymap** is comprised of multiple layers of key layout, you can define **32 layers** at most. -**Layer** is an array of **keycodes** to define **actions** for each physical keys. -respective layers can be validated simultaneously. Layers are indexed with 0 to 31 and higher layer has precedence. +In QMK, **`const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS]`** holds multiple **layers** of keymap information in **16 bit** data holding the **action code**. You can define **32 layers** at most. - Keymap: 32 Layers Layer: Keycode matrix +For trivial key definitions, the higher 8 bits of the **action code** are all 0 and the lower 8 bits holds the USB HID usage code generated by the key as **keycode**. + +Respective layers can be validated simultaneously. Layers are indexed with 0 to 31 and higher layer has precedence. + + Keymap: 32 Layers Layer: action code matrix ----------------- --------------------- - stack of layers array_of_keycode[row][column] + stack of layers array_of_action_code[row][column] ____________ precedence _______________________ / / | high / ESC / F1 / F2 / F3 .... 31 /___________// | /-----/-----/-----/----- @@ -22,11 +37,15 @@ respective layers can be validated simultaneously. Layers are indexed with 0 to 0 /___________/ V low 0 `-------------------------- +Sometimes, the action code stored in keymap may be referred as keycode in some documents due to the TMK history. -### 0.1 Keymap status -Keymap has its state in two parameters: -**`default_layer`** indicates a base keymap layer(0-31) which is always valid and to be referred, **`keymap_stat`** is 16bit variable which has current on/off status of layers on its each bit. +### 0.1 Keymap layer status +Keymap layer has its state in two 32 bit parameters: +* **`default_layer_state`** indicates a base keymap layer(0-31) which is always valid and to be referred. +* **`layer_state`** () has current on/off status of the layer on its each bit. + +Keymap has its state in two parameter**`default_layer`** indicates a base keymap layer(0-31) which is always valid and to be referred, **`keymap_stat`** is 16bit variable which has current on/off status of layers on its each bit. Keymap layer '0' is usually `default_layer` and which is the only valid layer and other layers is initially off after boot up firmware, though, you can configured them in `config.h`. To change `default_layer` will be useful when you switch key layout completely, say you want Colmak instead of Qwerty. @@ -67,97 +86,132 @@ On the other hand, you shall change `layer_state` to overlay base layer with som ### 0.2 Layer Precedence and Transparency Note that ***higher layer has higher priority on stack of layers***, namely firmware falls down from top layer to bottom to look up keycode. Once it spots keycode other than **`KC_TRNS`**(transparent) on a layer it stops searching and lower layers aren't referred. -You can place `KC_TRNS` on overlay layer changes just part of layout to fall back on lower or base layer. -Key with `KC_TRANS` doesn't has its own keycode and refers to lower valid layers for keycode, instead. +You can place `KC_TRANS` on overlay layer changes just part of layout to fall back on lower or base layer. +Key with `KC_TRANS` (`KC_TRNS` and `_______` are the alias) doesn't has its own keycode and refers to lower valid layers for keycode, instead. See example below. ### 0.3 Keymap Example -Keymap is **`keymaps[]`** C array in fact and you can define layers in it with **`KEYMAP()`** C macro and keycodes. To use complex actions you need to define `Fn` keycode in **`fn_actions[]`** array. +Keymap in this QMK is **`static const uint16_t PROGMEM keymaps[]`** C array in fact and you can define layers in it with **`KEYMAP()`** C macro and keycodes. To use complex actions you need to define `Fn` keycode in **`fn_actions[]`** array. It holds the 16 bit quantum keycode (action code). + +> Please note that keymap in the TMK, which QMK was forked from, is **`static const uint8_t PROGMEM keymaps[]`** C array which holds the 8 bit keycode (~USB HID usage code). This is a keymap example for [HHKB](http://en.wikipedia.org/wiki/Happy_Hacking_Keyboard) keyboard. -This example has three layers, 'Qwerty' as base layer, 'Cursor' and 'Mousekey'. +This example has three layers, 'QWERTY' as base layer, 'FN' and 'MOUSE'. + In this example, - `Fn0` is a **momentary layer switching** key, you can use keys on Cursor layer while holding the key. - - `Fn1` is a momentary layer switching key with tapping feature, you can get semicolon **';'** with taping the key and switch layers while holding the key. The word **'tap'** or **'tapping'** mean to press and release a key quickly. - - `Fn2` is a **toggle layer switch** key, you can stay switched layer after releasing the key unlike momentary switching. + `MO(layer)` is a **momentary layer switching** key. You can find other keymap definitions in file `keymap.c` located on project directories. +``` +/* + * dbroqua HHKB Layout + */ +#include "hhkb.h" - static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* 0: Qwerty - * ,-----------------------------------------------------------. - * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `| - * |-----------------------------------------------------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Backs| - * |-----------------------------------------------------------| - * |Contro| A| S| D| F| G| H| J| K| L|Fn1| '|Enter | - * |-----------------------------------------------------------| - * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0| - * `-----------------------------------------------------------' - * |Gui|Alt |Space |Alt |Fn2| - * `-------------------------------------------' - */ - KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \ - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \ - LCTL,A, S, D, F, G, H, J, K, L, FN1, QUOT,ENT, \ - LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \ - LGUI,LALT, SPC, RALT,FN2), - /* 1: Cursor(HHKB mode) - * ,-----------------------------------------------------------. - * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| - * |-----------------------------------------------------------| - * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs| - * |-----------------------------------------------------------| - * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter | - * |-----------------------------------------------------------| - * |Shift | | | | | | +| -|End|PgD|Dow|Shift | | - * `-----------------------------------------------------------' - * |Gui |Alt |Space |Alt |Gui| - * `--------------------------------------------' - */ - KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ - CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS,BSPC, \ - LCTL,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, \ - LSFT,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,RSFT,TRNS, \ - LGUI,LALT, SPC, RALT,RGUI), - /* 2: Mousekey - * ,-----------------------------------------------------------. - * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| - * |-----------------------------------------------------------| - * |Tab | | | | | |MwL|MwD|MwU|MwR| | | |Backs| - * |-----------------------------------------------------------| - * |Contro| | | | | |McL|McD|McU|McR| | |Return | - * |-----------------------------------------------------------| - * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | | - * `-----------------------------------------------------------' - * |Gui |Alt |Mb1 |Alt | | - * `--------------------------------------------' - * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel - */ - KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ - TAB, TRNS,TRNS,TRNS,TRNS,TRNS,WH_L,WH_D,WH_U,WH_R,TRNS,TRNS,TRNS,BSPC, \ - LCTL,TRNS,ACL0,ACL1,ACL2,TRNS,MS_L,MS_D,MS_U,MS_R,TRNS,QUOT,ENT, \ - LSFT,TRNS,TRNS,TRNS,TRNS,BTN3,BTN2,BTN1,BTN4,BTN5,SLSH,RSFT,TRNS, \ - LGUI,LALT, BTN1, RALT,TRNS), - }; +#define BASE 0 +#define FN 1 +#define MOUSE 2 - static const uint16_t PROGMEM fn_actions[] = { - ACTION_LAYER_MOMENTARY(1), // FN0 - ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN1 - ACTION_LAYER_TOGGLE(2), // FN2 - }; +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* BASE Level: Default Layer + * ,-----------------------------------------------------------------------------------------. + * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` | + * |-----------------------------------------------------------------------------------------+ + * | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | Bksp | + * |-----------------------------------------------------------------------------------------+ + * | Ctrl | A | S | D | F | G | H | J | K | L | ; | ' | Enter | + * |-----------------------------------------------------------------------------------------+ + * | Shift | Z | X | C | V | B | N | M | , | . | / | Shift | fn | + * +-----------------------------------------------------------------------------------------+ + * | Gui | Alt | Space | AltGr |Mouse| + * `----------------------------------------------------------------´ + */ + [BASE] = KEYMAP( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, \ + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(FN), \ + KC_LGUI, KC_LALT, /* */ KC_SPC, KC_RALT, MO(MOUSE) + ), + /* FN Layer + * ,-----------------------------------------------------------------------------------------. + * | Pwr | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F0 | F11 | F12 | Ins | Del| + * |-----------------------------------------------------------------------------------------+ + * | Caps | | | | | | | |PrtSc| Slck| Paus| Up | | | + * |-----------------------------------------------------------------------------------------+ + * | | Vol-| Vol+| Mute| | | * | / | Home| PgUp| Left |Right| | + * |-----------------------------------------------------------------------------------------+ + * | | Prev| Play| Next| | | + | - | End |PgDwn| Down| | | + * +-----------------------------------------------------------------------------------------+ + * | | | | Stop | | + * `----------------------------------------------------------------´ + */ + [FN] = KEYMAP( + KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, \ + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, \ + KC_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_MSTP, KC_TRNS + ), + /* MOUSE Layer + * ,-----------------------------------------------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------------------------------------+ + * | | | WUp | | | | | | | | Btn1| Up | Btn2| | + * |-----------------------------------------------------------------------------------------+ + * | | WLt | WDn | WRt | | | | | | | Left |Right| | + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | | | | Btn3| Down| | | + * +-----------------------------------------------------------------------------------------+ + * | | | | | | + * `----------------------------------------------------------------´ + */ + [MOUSE] = KEYMAP( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_WH_U, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_MS_U, KC_BTN2, KC_TRNS, \ + KC_TRNS, KC_WH_L, KC_WH_D, KC_WH_R, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_R, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN3, KC_MS_D, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ) +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; +``` ## 1. Keycode -See [`common/keycode.h`](../common/keycode.h) or keycode table below for the detail. Keycode is internal **8bit code** to indicate action performed on key in keymap. Keycode has `KC_` prefixed symbol respectively. Most of keycodes like `KC_A` have simple action registers key to host on press and unregister on release, while some of other keycodes has some special actions like `Fn` keys, Media control keys, System control keys and Mousekeys. +See [`tmk_core/common/keycode.h`](../tmk_core/common/keycode.h) or keycode table below for the detail. Keycode is internal **8bit code** to indicate action performed on key in keymap. Keycodes are based on [HID Usage Keyboard/Keypad Page(0x07)](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) plus special codes in the `0xA5-DF` range. - ***In `KEYMAP()` macro you should omit prefix part `KC_` of keycode to keep keymap compact.*** For example, just use `A` instead you place `KC_A` in `KEYMAP()`. Some keycodes has 4-letter **short name** in addition to descriptive name, you'll prefer short one in `KEYMAP()`. +Keycode has `KC_` prefixed symbol respectively. Most of keycodes like `KC_A` have simple action registers key to host on press and unregister on release, while some of other keycodes has some special actions like `Fn` keys, Media control keys, System control keys and Mousekeys. + +keymaps[] + +In `KEYMAP()` macro, TMK recommends you to keep prefix part `KC_` of keycode to keep keymap compact. For example, just use `A` instead you place `KC_A` in `KEYMAP()`. But this doesn't apply for QMK. + +The `KEYMAP()` macro defines correspondence between the physical key location to the electrical key connection. + +Some keycodes has 7-letter **short name** such as `KC_COMM` in addition to descriptive name `KC_COMMA`, you'll prefer short one in `KEYMAP()`. ### 1.0 Other key - `KC_NO` for no action @@ -192,7 +246,10 @@ There are 8 modifiers which has discrimination between left and right. - `KC_WSCH`, `KC_WHOM`, `KC_WBAK`, `KC_WFWD`, `KC_WSTP`, `KC_WREF`, `KC_WFAV` for web browser operation ### 1.5 Fn key -`KC_FNnn` are keycodes for `Fn` key which not given any actions at the beginning unlike most of keycodes has its own inborn action. To use these keycodes in `KEYMAP()` you need to assign action you want at first. Action of `Fn` key is defined in `fn_actions[]` and its index of the array is identical with number part of `KC_FNnn`. Thus `KC_FN0` keycode indicates the action defined in first element of the array. ***32 `Fn` keys can be defined at most.*** +You don't need to use this functionality under QMK since this is a backward compatibility functionality. Unlike TMK, you can write action code itself directly in **`static const uint16_t PROGMEM keymaps[]`** C array using `MO(layer)`, etc. + +`KC_FNnn` are keycodes for `Fn` key which not given any actions at the beginning unlike most of keycodes has its own inborn action. To use these keycodes in `KEYMAP()` you need to assign action you want at first. Action of `Fn` key is defined in `fn_actions[]` and its index of the array is identical with number part of `KC_FNnn`. Thus `KC_FN0` keycode indicates the action defined in first element of the array. ***Only 32 `Fn` keys can be defined at most.*** + ### 1.6 Keycode Table See keycode table in [`doc/keycode.txt`](./keycode.txt) for description of keycodes. @@ -584,15 +641,11 @@ Similar to layer tap toggle, this works as a momentary modifier when holding, bu ## 5. Legacy Keymap -This was used in prior version and still works due to legacy support code in `common/keymap.c`. Legacy keymap doesn't support many of features that new keymap offers. ***It is not recommended to use Legacy Keymap for new project.*** - -To enable Legacy Keymap support define this macro in `config.h`. - - #define USE_LEGACY_KEYMAP +In QMK, `tmk_core/common/keymap.c` is missing and its replacement `quantum/keymap_common.c` lacks Legacy Keymap support. Legacy Keymap uses two arrays `fn_layer[]` and `fn_keycode[]` to define Fn key. The index of arrays corresponds with postfix number of `Fn` key. Array `fn_layer[]` indicates destination layer to switch and `fn_keycode[]` has keycodes to send when tapping `Fn` key. -In following setting example, `Fn0`, `Fn1` and `Fn2` switch layer to 1, 2 and 2 respectively. `Fn2` registers `Space` key when tapping while `Fn0` and `Fn1` doesn't send any key. +In the following legacy keymap setting example, `Fn0`, `Fn1` and `Fn2` switch layer to 1, 2 and 2 respectively. `Fn2` registers `Space` key when tapping while `Fn0` and `Fn1` doesn't send any key. static const uint8_t PROGMEM fn_layer[] = { 1, // Fn0 @@ -606,6 +659,7 @@ In following setting example, `Fn0`, `Fn1` and `Fn2` switch layer to 1, 2 and 2 KC_SPC, // Fn2 }; +Under QMK, these can be realized using action code ACTION_LAYER_TAP_KEY(1, KC_NO), ACTION_LAYER_TAP_KEY(2, KC_NO), and ACTION_LAYER_TAP_KEY(2, KC_SPC) in the `keymaps` directly. ## 6. Terminology ***TBD*** From eedb767279df6c43763cbf37b8fe75cfc224c80c Mon Sep 17 00:00:00 2001 From: Travis La Marr Date: Wed, 29 Mar 2017 23:03:04 -0400 Subject: [PATCH 08/12] Add RN42 Bluetooth module support Added support for sending HID keycodes over the RN42/reflashed HC05 module. Tested on OS X and iOS. --- tmk_core/common.mk | 5 +++++ tmk_core/protocol/lufa.mk | 5 +++++ tmk_core/protocol/lufa/bluetooth.h | 16 +++++++++++++++- tmk_core/protocol/lufa/lufa.c | 19 ++++++++++++++++++- 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 47f6fc571..3e0bd7dbc 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -107,6 +107,11 @@ ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey) TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_EZKEY endif +ifeq ($(strip $(BLUETOOTH)), RN42) + TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE + TMK_COMMON_DEFS += -DMODULE_RN42 +endif + ifeq ($(strip $(ONEHAND_ENABLE)), yes) TMK_COMMON_DEFS += -DONEHAND_ENABLE endif diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk index 5b1577972..7ce727dab 100644 --- a/tmk_core/protocol/lufa.mk +++ b/tmk_core/protocol/lufa.mk @@ -36,6 +36,11 @@ ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey) $(TMK_DIR)/protocol/serial_uart.c endif +ifeq ($(strip $(BLUETOOTH)), RN42) + LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ + $(TMK_DIR)/protocol/serial_uart.c +endif + ifeq ($(strip $(VIRTSER_ENABLE)), yes) LUFA_SRC += $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/CDCClassDevice.c endif diff --git a/tmk_core/protocol/lufa/bluetooth.h b/tmk_core/protocol/lufa/bluetooth.h index 78ece1cd0..f4b2f6f8b 100644 --- a/tmk_core/protocol/lufa/bluetooth.h +++ b/tmk_core/protocol/lufa/bluetooth.h @@ -62,4 +62,18 @@ void bluefruit_serial_send(uint8_t data); (usage == AC_REFRESH ? 0x0000 : \ (usage == AC_BOOKMARKS ? 0x0000 : 0))))))))))))))))))) -#endif \ No newline at end of file +#define CONSUMER2RN42(usage) \ + (usage == AUDIO_MUTE ? 0x0040 : \ + (usage == AUDIO_VOL_UP ? 0x0010 : \ + (usage == AUDIO_VOL_DOWN ? 0x0020 : \ + (usage == TRANSPORT_NEXT_TRACK ? 0x0100 : \ + (usage == TRANSPORT_PREV_TRACK ? 0x0200 : \ + (usage == TRANSPORT_STOP ? 0x0400 : \ + (usage == TRANSPORT_STOP_EJECT ? 0x0800 : \ + (usage == TRANSPORT_PLAY_PAUSE ? 0x0080 : \ + (usage == AL_EMAIL ? 0x0200 : \ + (usage == AL_LOCAL_BROWSER ? 0x8000 : \ + (usage == AC_SEARCH ? 0x0400 : \ + (usage == AC_HOME ? 0x0100 : 0)))))))))))) + + #endif diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 60cba8d2a..ae6129d1a 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -606,6 +606,13 @@ static void send_keyboard(report_keyboard_t *report) if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { #ifdef MODULE_ADAFRUIT_BLE adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys)); + #elif MODULE_RN42 + bluefruit_serial_send(0xFD); + bluefruit_serial_send(0x09); + bluefruit_serial_send(0x01); + for (uint8_t i = 0; i < KEYBOARD_EPSIZE; i++) { + bluefruit_serial_send(report->raw[i]); + } #else bluefruit_serial_send(0xFD); for (uint8_t i = 0; i < KEYBOARD_EPSIZE; i++) { @@ -726,6 +733,16 @@ static void send_consumer(uint16_t data) if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { #ifdef MODULE_ADAFRUIT_BLE adafruit_ble_send_consumer_key(data, 0); + #elif MODULE_RN42 + static uint16_t last_data = 0; + if (data == last_data) return; + last_data = data; + uint16_t bitmap = CONSUMER2RN42(data); + bluefruit_serial_send(0xFD); + bluefruit_serial_send(0x03); + bluefruit_serial_send(0x03); + bluefruit_serial_send(bitmap&0xFF); + bluefruit_serial_send((bitmap>>8)&0xFF); #else static uint16_t last_data = 0; if (data == last_data) return; @@ -1132,7 +1149,7 @@ int main(void) // midi_send_noteoff(&midi_device, 0, 64, 127); #endif -#ifdef MODULE_ADAFRUIT_EZKEY +#if defined(MODULE_ADAFRUIT_EZKEY) || defined(MODULE_RN42) serial_init(); #endif From 200ae0c519c0bba927e417ec154783ce4fd306fe Mon Sep 17 00:00:00 2001 From: Callum Oakley Date: Thu, 30 Mar 2017 13:22:16 +0100 Subject: [PATCH 09/12] changed hotkey cluster to accomodate awkward software --- keyboards/planck/keymaps/callum/keymap.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/keyboards/planck/keymaps/callum/keymap.c b/keyboards/planck/keymaps/callum/keymap.c index aede27df7..d50b04319 100644 --- a/keyboards/planck/keymaps/callum/keymap.c +++ b/keyboards/planck/keymaps/callum/keymap.c @@ -14,7 +14,7 @@ extern keymap_config_t keymap_config; #define _FUNC 4 #define ENDASH LALT(KC_MINS) #define POUND LALT(KC_3) -#define H(X) LALT(LCTL(X)) +#define H(X) RALT(X) enum planck_keycodes { MOVE = SAFE_RANGE, @@ -48,19 +48,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* MOVE * ,-----------------------------------------------------------------------------------. - * | H(3) | H(F1)| H(F2)| H(F3)| H(F4)| H(F5)| H(8) | Home | Up | End | H(7) | Esc | + * | H(F7)| H(F8)| H(6) | H(5) | H(4) | H(F9)|H(F10)| Home | Up | End | H(A) | Esc | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | H(4) | H(F6)| H(F7)| H(F8)| H(F9)|H(F10)| H(9) | Left | Down | Right| Caps | Del | + * | H(F3)| H(F4)| H(3) | H(2) | H(1) | H(F5)| H(F6)| Left | Down | Right| Caps | Del | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | |H(F11)|H(F12)| H(0) | H(1) | H(2) | H(A) | Pg Dn| Pg Up| H(5) | H(6) | | + * | | H(0) | H(9) | H(8) | H(7) | H(F1)| H(F2)| Pg Dn| Pg Up|H(F11)|H(F12)| | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | | | | | | * `-----------------------------------------------------------------------------------' */ [_MOVE] = { - {H(KC_3), H(KC_F1),H(KC_F2),H(KC_F3),H(KC_F4),H(KC_F5),H(KC_8), KC_HOME, KC_UP, KC_END, H(KC_7), KC_ESC }, - {H(KC_4), H(KC_F6),H(KC_F7),H(KC_F8),H(KC_F9),H(KC_F10),H(KC_9),KC_LEFT, KC_DOWN, KC_RGHT, KC_CAPS, KC_DEL }, - {_______, H(KC_F11),H(KC_F12),H(KC_0),H(KC_1),H(KC_2), H(KC_A), KC_PGDN, KC_PGUP, H(KC_5), H(KC_6), _______}, + {H(KC_F7),H(KC_F8),H(KC_6), H(KC_5), H(KC_4), H(KC_F9),H(KC_F10),KC_HOME,KC_UP, KC_END, H(KC_A), KC_ESC }, + {H(KC_F3),H(KC_F4),H(KC_3), H(KC_2), H(KC_1), H(KC_F5),H(KC_F6),KC_LEFT, KC_DOWN, KC_RGHT, KC_CAPS, KC_DEL }, + {_______, H(KC_0), H(KC_9), H(KC_8), H(KC_7), H(KC_F1),H(KC_F2),KC_PGDN,KC_PGUP,H(KC_F11),H(KC_F12),_______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} }, From b9225a28f253e1ec33b8c96798bfef4b8cc0918d Mon Sep 17 00:00:00 2001 From: Callum Oakley Date: Thu, 30 Mar 2017 14:20:18 +0100 Subject: [PATCH 10/12] changed hotkey cluster to accomodate awkward software... again --- keyboards/planck/keymaps/callum/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/planck/keymaps/callum/keymap.c b/keyboards/planck/keymaps/callum/keymap.c index d50b04319..09063cb97 100644 --- a/keyboards/planck/keymaps/callum/keymap.c +++ b/keyboards/planck/keymaps/callum/keymap.c @@ -14,7 +14,7 @@ extern keymap_config_t keymap_config; #define _FUNC 4 #define ENDASH LALT(KC_MINS) #define POUND LALT(KC_3) -#define H(X) RALT(X) +#define H(X) LALT(LCTL(X)) enum planck_keycodes { MOVE = SAFE_RANGE, From 7e54332890f4c376314f942574c6183c87a6e9c8 Mon Sep 17 00:00:00 2001 From: nielsenz Date: Thu, 30 Mar 2017 19:15:43 -0700 Subject: [PATCH 11/12] Pulling and pushing troubles --- quantum/process_keycode/process_unicode.c | 75 ------------------- .../process_keycode/process_unicode_common.c | 15 ++++ 2 files changed, 15 insertions(+), 75 deletions(-) diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index cecfaeee9..1f16b9bdb 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c @@ -16,81 +16,6 @@ #include "process_unicode.h" #include "action_util.h" -static uint8_t input_mode; -static uint8_t first_flag = 0; - -__attribute__((weak)) -uint16_t hex_to_keycode(uint8_t hex) -{ - if (hex == 0x0) { - return KC_0; - } else if (hex < 0xA) { - return KC_1 + (hex - 0x1); - } else { - return KC_A + (hex - 0xA); - } -} - -void set_unicode_input_mode(uint8_t os_target) -{ - input_mode = os_target; - eeprom_update_byte(EECONFIG_UNICODEMODE, os_target); -} - -uint8_t get_unicode_input_mode(void) { - return input_mode; -} - -__attribute__((weak)) -void unicode_input_start (void) { - switch(input_mode) { - case UC_OSX: - register_code(KC_LALT); - break; - case UC_LNX: - register_code(KC_LCTL); - register_code(KC_LSFT); - register_code(KC_U); - unregister_code(KC_U); - unregister_code(KC_LSFT); - unregister_code(KC_LCTL); - break; - case UC_WIN: - register_code(KC_LALT); - register_code(KC_PPLS); - unregister_code(KC_PPLS); - break; - case UC_WINC: - register_code(KC_RALT); - unregister_code(KC_RALT); - register_code(KC_U); - unregister_code(KC_U); - } - wait_ms(UNICODE_TYPE_DELAY); -} - -__attribute__((weak)) -void unicode_input_finish (void) { - switch(input_mode) { - case UC_OSX: - case UC_WIN: - unregister_code(KC_LALT); - break; - case UC_LNX: - register_code(KC_SPC); - unregister_code(KC_SPC); - break; - } -} - -void register_hex(uint16_t hex) { - for(int i = 3; i >= 0; i--) { - uint8_t digit = ((hex >> (i*4)) & 0xF); - register_code(hex_to_keycode(digit)); - unregister_code(hex_to_keycode(digit)); - } -} - bool process_unicode(uint16_t keycode, keyrecord_t *record) { if (keycode > QK_UNICODE && record->event.pressed) { diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index 6012b4f07..b4d4231db 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c @@ -16,11 +16,14 @@ #include "process_unicode_common.h" +static uint8_t input_mode; +static uint8_t first_flag = 0; uint8_t mods; void set_unicode_input_mode(uint8_t os_target) { input_mode = os_target; + eeprom_update_byte(EECONFIG_UNICODEMODE, os_target); } uint8_t get_unicode_input_mode(void) { @@ -92,6 +95,18 @@ void unicode_input_finish (void) { if (mods & MOD_BIT(KC_RGUI)) register_code(KC_RGUI); } +__attribute__((weak)) +uint16_t hex_to_keycode(uint8_t hex) +{ + if (hex == 0x0) { + return KC_0; + } else if (hex < 0xA) { + return KC_1 + (hex - 0x1); + } else { + return KC_A + (hex - 0xA); + } +} + void register_hex(uint16_t hex) { for(int i = 3; i >= 0; i--) { uint8_t digit = ((hex >> (i*4)) & 0xF); From d1e66e2e0715c680a8da3216525b54fd8f2b671f Mon Sep 17 00:00:00 2001 From: nielsenz Date: Thu, 30 Mar 2017 20:10:34 -0700 Subject: [PATCH 12/12] Worked around some new Makefile issues. --- keyboards/planck/keymaps/zach/Makefile | 2 +- keyboards/planck/keymaps/zach/config.h | 2 +- .../keymaps/zach/zach_common_functions.c | 50 +++++++++---------- keyboards/preonic/keymaps/zach/Makefile | 4 +- keyboards/preonic/keymaps/zach/config.h | 2 +- .../keymaps/zach/zach_common_functions.c | 50 +++++++++---------- quantum/process_keycode/process_tap_dance.c | 2 + quantum/process_keycode/process_unicode.c | 1 + .../process_keycode/process_unicode_common.c | 1 - 9 files changed, 58 insertions(+), 56 deletions(-) diff --git a/keyboards/planck/keymaps/zach/Makefile b/keyboards/planck/keymaps/zach/Makefile index 977f1a901..9d86fc81f 100644 --- a/keyboards/planck/keymaps/zach/Makefile +++ b/keyboards/planck/keymaps/zach/Makefile @@ -17,7 +17,7 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no # Audio output on port C6 #VARIABLE_TRACE = no # Debug changes to variable values -UNICODE_ENABLE = yes # Unicode +UNICODE_ENABLE = no # Unicode (can't be used with unicodemap) UNICODEMAP_ENABLE = yes # Enable extended 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. diff --git a/keyboards/planck/keymaps/zach/config.h b/keyboards/planck/keymaps/zach/config.h index 7deb9ebfe..d309c9493 100644 --- a/keyboards/planck/keymaps/zach/config.h +++ b/keyboards/planck/keymaps/zach/config.h @@ -77,7 +77,7 @@ along with this program. If not, see . /* disable action features */ //#define NO_ACTION_LAYER #define NO_ACTION_TAPPING -#define NO_ACTION_ONESHOT +//#define NO_ACTION_ONESHOT #define NO_ACTION_MACRO #define NO_ACTION_FUNCTION #define PREVENT_STUCK_MODIFIERS diff --git a/keyboards/planck/keymaps/zach/zach_common_functions.c b/keyboards/planck/keymaps/zach/zach_common_functions.c index b77f2b241..2c47b2289 100644 --- a/keyboards/planck/keymaps/zach/zach_common_functions.c +++ b/keyboards/planck/keymaps/zach/zach_common_functions.c @@ -141,31 +141,31 @@ qk_tap_dance_action_t tap_dance_actions[] = { }; #endif -#ifdef UNICODE_ENABLE +//#ifdef UNICODE_ENABLE // Unicode shortcuts -#define IBANG UC(0x203D) -#define RAROW UC(0x2192) -#define LAROW UC(0x2190) -#define DEGREE UC(0x00B0) -#define OMEGA UC(0x03A9) -#define WOMEGA UC(0x03C9) -#define MICRO UC(0x00B5) -#define PLUMIN UC(0x00B1) -#define SUPA2 UC(0x00B2) -#define ROMAN1 UC(0x2160) -#define ROMAN2 UC(0x2161) -#define ROMAN3 UC(0x2162) -#define ROMAN4 UC(0x2163) -#define ROMAN5 UC(0x2164) -#define ROMAN6 UC(0x2165) -#define ROMAN7 UC(0x2166) -#define roman1 UC(0x2170) -#define roman2 UC(0x2171) -#define roman3 UC(0x2172) -#define roman4 UC(0x2173) -#define roman5 UC(0x2174) -#define roman6 UC(0x2175) -#define roman7 UC(0x2176) +#define IBANG X(0x203D) +#define RAROW X(0x2192) +#define LAROW X(0x2190) +#define DEGREE X(0x00B0) +#define OMEGA X(0x03A9) +#define WOMEGA X(0x03C9) +#define MICRO X(0x00B5) +#define PLUMIN X(0x00B1) +#define SUPA2 X(0x00B2) +#define ROMAN1 X(0x2160) +#define ROMAN2 X(0x2161) +#define ROMAN3 X(0x2162) +#define ROMAN4 X(0x2163) +#define ROMAN5 X(0x2164) +#define ROMAN6 X(0x2165) +#define ROMAN7 X(0x2166) +#define roman1 X(0x2170) +#define roman2 X(0x2171) +#define roman3 X(0x2172) +#define roman4 X(0x2173) +#define roman5 X(0x2174) +#define roman6 X(0x2175) +#define roman7 X(0x2176) #ifdef UNICODEMAP_ENABLE // For Unicode characters larger than 0x8000. Send with X() enum Ext_Unicode{ @@ -192,7 +192,7 @@ const uint32_t PROGMEM unicode_map[] = { #define TMBL X(TUMBLER) #endif -#endif +//#endif static uint16_t key_timer; static uint8_t caps_status = 0; diff --git a/keyboards/preonic/keymaps/zach/Makefile b/keyboards/preonic/keymaps/zach/Makefile index f0a84abac..eebf41349 100644 --- a/keyboards/preonic/keymaps/zach/Makefile +++ b/keyboards/preonic/keymaps/zach/Makefile @@ -17,8 +17,8 @@ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = yes # Audio output on port C6 #VARIABLE_TRACE = no # Debug changes to variable values -UNICODE_ENABLE = yes # Unicode -UNICODEMAP_ENABLE = no # Enable extended unicode +UNICODE_ENABLE = no # Unicode +UNICODEMAP_ENABLE = yes # Enable extended 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 diff --git a/keyboards/preonic/keymaps/zach/config.h b/keyboards/preonic/keymaps/zach/config.h index 59959524f..bb8913c7a 100644 --- a/keyboards/preonic/keymaps/zach/config.h +++ b/keyboards/preonic/keymaps/zach/config.h @@ -84,7 +84,7 @@ along with this program. If not, see . /* disable action features */ //#define NO_ACTION_LAYER #define NO_ACTION_TAPPING -#define NO_ACTION_ONESHOT +//#define NO_ACTION_ONESHOT #define NO_ACTION_MACRO #define NO_ACTION_FUNCTION #define PREVENT_STUCK_MODIFIERS diff --git a/keyboards/preonic/keymaps/zach/zach_common_functions.c b/keyboards/preonic/keymaps/zach/zach_common_functions.c index b77f2b241..2c47b2289 100644 --- a/keyboards/preonic/keymaps/zach/zach_common_functions.c +++ b/keyboards/preonic/keymaps/zach/zach_common_functions.c @@ -141,31 +141,31 @@ qk_tap_dance_action_t tap_dance_actions[] = { }; #endif -#ifdef UNICODE_ENABLE +//#ifdef UNICODE_ENABLE // Unicode shortcuts -#define IBANG UC(0x203D) -#define RAROW UC(0x2192) -#define LAROW UC(0x2190) -#define DEGREE UC(0x00B0) -#define OMEGA UC(0x03A9) -#define WOMEGA UC(0x03C9) -#define MICRO UC(0x00B5) -#define PLUMIN UC(0x00B1) -#define SUPA2 UC(0x00B2) -#define ROMAN1 UC(0x2160) -#define ROMAN2 UC(0x2161) -#define ROMAN3 UC(0x2162) -#define ROMAN4 UC(0x2163) -#define ROMAN5 UC(0x2164) -#define ROMAN6 UC(0x2165) -#define ROMAN7 UC(0x2166) -#define roman1 UC(0x2170) -#define roman2 UC(0x2171) -#define roman3 UC(0x2172) -#define roman4 UC(0x2173) -#define roman5 UC(0x2174) -#define roman6 UC(0x2175) -#define roman7 UC(0x2176) +#define IBANG X(0x203D) +#define RAROW X(0x2192) +#define LAROW X(0x2190) +#define DEGREE X(0x00B0) +#define OMEGA X(0x03A9) +#define WOMEGA X(0x03C9) +#define MICRO X(0x00B5) +#define PLUMIN X(0x00B1) +#define SUPA2 X(0x00B2) +#define ROMAN1 X(0x2160) +#define ROMAN2 X(0x2161) +#define ROMAN3 X(0x2162) +#define ROMAN4 X(0x2163) +#define ROMAN5 X(0x2164) +#define ROMAN6 X(0x2165) +#define ROMAN7 X(0x2166) +#define roman1 X(0x2170) +#define roman2 X(0x2171) +#define roman3 X(0x2172) +#define roman4 X(0x2173) +#define roman5 X(0x2174) +#define roman6 X(0x2175) +#define roman7 X(0x2176) #ifdef UNICODEMAP_ENABLE // For Unicode characters larger than 0x8000. Send with X() enum Ext_Unicode{ @@ -192,7 +192,7 @@ const uint32_t PROGMEM unicode_map[] = { #define TMBL X(TUMBLER) #endif -#endif +//#endif static uint16_t key_timer; static uint8_t caps_status = 0; diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index 68c8425bb..b807ec3c3 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c @@ -16,6 +16,8 @@ #include "quantum.h" #include "action_tapping.h" +uint8_t get_oneshot_mods(void); + static uint16_t last_td; static int8_t highest_td = -1; diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index 1f16b9bdb..678a15234 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c @@ -16,6 +16,7 @@ #include "process_unicode.h" #include "action_util.h" +static uint8_t first_flag = 0; bool process_unicode(uint16_t keycode, keyrecord_t *record) { if (keycode > QK_UNICODE && record->event.pressed) { diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index b4d4231db..1dbdec3e7 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c @@ -17,7 +17,6 @@ #include "process_unicode_common.h" static uint8_t input_mode; -static uint8_t first_flag = 0; uint8_t mods; void set_unicode_input_mode(uint8_t os_target)