diff options
| -rw-r--r-- | doc/keymap.md | 29 | ||||
| -rw-r--r-- | keyboards/ergodox/infinity/infinity.c | 24 | ||||
| -rw-r--r-- | keyboards/kitten_paw/Makefile | 77 | ||||
| -rw-r--r-- | keyboards/kitten_paw/config.h | 162 | ||||
| -rw-r--r-- | keyboards/kitten_paw/keymaps/default/keymap.c | 51 | ||||
| -rw-r--r-- | keyboards/kitten_paw/kitten_paw.c | 30 | ||||
| -rw-r--r-- | keyboards/kitten_paw/kitten_paw.h | 47 | ||||
| -rw-r--r-- | keyboards/kitten_paw/led.c | 47 | ||||
| -rw-r--r-- | keyboards/kitten_paw/matrix.c | 164 | ||||
| -rw-r--r-- | keyboards/kitten_paw/readme.md | 32 | ||||
| -rw-r--r-- | keyboards/planck/keymaps/experimental/Makefile | 1 | ||||
| -rw-r--r-- | keyboards/planck/keymaps/experimental/keymap.c | 8 | ||||
| -rw-r--r-- | keyboards/planck/planck.c | 10 | ||||
| -rw-r--r-- | keyboards/preonic/preonic.c | 11 | ||||
| -rw-r--r-- | keyboards/readme.md | 1 | ||||
| -rw-r--r-- | keyboards/tv44/tv44.h | 2 | ||||
| -rw-r--r-- | quantum/process_keycode/process_unicode.c | 2 | ||||
| -rw-r--r-- | tmk_core/common.mk | 4 | ||||
| -rw-r--r-- | tmk_core/common/action.c | 82 | ||||
| -rw-r--r-- | tmk_core/common/action.h | 18 | ||||
| -rw-r--r-- | tmk_core/common/action_code.h | 28 |
21 files changed, 824 insertions, 6 deletions
diff --git a/doc/keymap.md b/doc/keymap.md index d1985e567..6f2a663fc 100644 --- a/doc/keymap.md +++ b/doc/keymap.md | |||
| @@ -455,6 +455,35 @@ Turn the backlight on and off without changing level. | |||
| 455 | 455 | ||
| 456 | 456 | ||
| 457 | 457 | ||
| 458 | ### 2.6 Swap-Hands Action | ||
| 459 | The swap-hands action allows support for one-handed keyboards without requiring a separate layer. Set `ONEHAND_ENABLE` in the Makefile and define a `hand_swap_config` entry in your keymap. Now whenever the `ACTION_SWAP_HANDS` command key is pressed the keyboard is mirrored. For instance, to type "Hello, World" on QWERTY you would type `^Ge^s^s^w^c W^wr^sd` | ||
| 460 | |||
| 461 | ### 2.6.1 Configuration | ||
| 462 | The configuration table is a simple 2-dimensional array to map from column/row to new column/row. Example `hand_swap_config` for Planck: | ||
| 463 | |||
| 464 | ``` | ||
| 465 | const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { | ||
| 466 | {{11, 0}, {10, 0}, {9, 0}, {8, 0}, {7, 0}, {6, 0}, {5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}}, | ||
| 467 | {{11, 1}, {10, 1}, {9, 1}, {8, 1}, {7, 1}, {6, 1}, {5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}}, | ||
| 468 | {{11, 2}, {10, 2}, {9, 2}, {8, 2}, {7, 2}, {6, 2}, {5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}}, | ||
| 469 | {{11, 3}, {10, 3}, {9, 3}, {8, 3}, {7, 3}, {6, 3}, {5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}}, | ||
| 470 | }; | ||
| 471 | ``` | ||
| 472 | |||
| 473 | Note that the array indices are reversed same as the matrix and the values are of type `keypos_t` which is `{col, row}` and all values are zero-based. In the example above, `hand_swap_config[2][4]` (third row, fifth column) would return {7, 2} (third row, eighth column). | ||
| 474 | |||
| 475 | ### 2.6.2 Advanced Swap Commands | ||
| 476 | - **`ACTION_SWAP_HANDS()`** Swaps hands when pressed, returns to normal when released (momentary). | ||
| 477 | - **`ACTION_SWAP_HANDS_TOGGLE()`** Toggles swap on and off with every keypress. | ||
| 478 | - **`ACTION_SWAP_HANDS_TAP_TOGGLE()`** Toggles with a tap; momentary when held. | ||
| 479 | - **`ACTION_SWAP_HANDS_TAP_KEY(key)`** Sends `key` with a tap; momentary swap when held. | ||
| 480 | - **`ACTION_SWAP_HANDS_ON_OFF()`** Alias for `ACTION_SWAP_HANDS()` | ||
| 481 | - **`ACTION_SWAP_HANDS_OFF_ON()`** Momentarily turns off swap. | ||
| 482 | - **`ACTION_SWAP_HANDS_ON()`** Turns on swapping and leaves it on. | ||
| 483 | - **`ACTION_SWAP_HANDS_OFF()`** Turn off swapping and leaves it off. Good for returning to a known state. | ||
| 484 | |||
| 485 | |||
| 486 | |||
| 458 | ## 3. Layer switching Example | 487 | ## 3. Layer switching Example |
| 459 | There are some ways to switch layer with 'Layer' actions. | 488 | There are some ways to switch layer with 'Layer' actions. |
| 460 | 489 | ||
diff --git a/keyboards/ergodox/infinity/infinity.c b/keyboards/ergodox/infinity/infinity.c index f89e046d0..c5793385f 100644 --- a/keyboards/ergodox/infinity/infinity.c +++ b/keyboards/ergodox/infinity/infinity.c | |||
| @@ -130,3 +130,27 @@ void ergodox_right_led_3_off(void){ | |||
| 130 | 130 | ||
| 131 | void ergodox_right_led_off(uint8_t led){ | 131 | void ergodox_right_led_off(uint8_t led){ |
| 132 | } | 132 | } |
| 133 | |||
| 134 | #ifdef ONEHAND_ENABLE | ||
| 135 | __attribute__ ((weak)) | ||
| 136 | const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { | ||
| 137 | {{0, 9}, {1, 9}, {2, 9}, {3, 9}, {4, 9}}, | ||
| 138 | {{0, 10}, {1, 10}, {2, 10}, {3, 10}, {4, 10}}, | ||
| 139 | {{0, 11}, {1, 11}, {2, 11}, {3, 11}, {4, 11}}, | ||
| 140 | {{0, 12}, {1, 12}, {2, 12}, {3, 12}, {4, 12}}, | ||
| 141 | {{0, 13}, {1, 13}, {2, 13}, {3, 13}, {4, 13}}, | ||
| 142 | {{0, 14}, {1, 14}, {2, 14}, {3, 14}, {4, 14}}, | ||
| 143 | {{0, 15}, {1, 15}, {2, 15}, {3, 15}, {4, 15}}, | ||
| 144 | {{0, 16}, {1, 16}, {2, 16}, {3, 16}, {4, 16}}, | ||
| 145 | {{0, 17}, {1, 17}, {2, 17}, {3, 17}, {4, 17}}, | ||
| 146 | {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}}, | ||
| 147 | {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}}, | ||
| 148 | {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}}, | ||
| 149 | {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}}, | ||
| 150 | {{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}}, | ||
| 151 | {{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}}, | ||
| 152 | {{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}}, | ||
| 153 | {{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}}, | ||
| 154 | {{0, 8}, {1, 8}, {2, 8}, {3, 8}, {4, 8}}, | ||
| 155 | }; | ||
| 156 | #endif | ||
diff --git a/keyboards/kitten_paw/Makefile b/keyboards/kitten_paw/Makefile new file mode 100644 index 000000000..912292173 --- /dev/null +++ b/keyboards/kitten_paw/Makefile | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | |||
| 2 | |||
| 3 | # MCU name | ||
| 4 | #MCU = at90usb1287 | ||
| 5 | MCU = atmega32u2 | ||
| 6 | |||
| 7 | # Processor frequency. | ||
| 8 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
| 9 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
| 10 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
| 11 | # automatically to create a 32-bit value in your source code. | ||
| 12 | # | ||
| 13 | # This will be an integer division of F_USB below, as it is sourced by | ||
| 14 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
| 15 | # does not *change* the processor frequency - it should merely be updated to | ||
| 16 | # reflect the processor speed set externally so that the code can use accurate | ||
| 17 | # software delays. | ||
| 18 | F_CPU = 16000000 | ||
| 19 | |||
| 20 | |||
| 21 | # | ||
| 22 | # LUFA specific | ||
| 23 | # | ||
| 24 | # Target architecture (see library "Board Types" documentation). | ||
| 25 | ARCH = AVR8 | ||
| 26 | |||
| 27 | # Input clock frequency. | ||
| 28 | # This will define a symbol, F_USB, in all source code files equal to the | ||
| 29 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
| 30 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
| 31 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
| 32 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
| 33 | # at the end, this will be done automatically to create a 32-bit value in your | ||
| 34 | # source code. | ||
| 35 | # | ||
| 36 | # If no clock division is performed on the input clock inside the AVR (via the | ||
| 37 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
| 38 | F_USB = $(F_CPU) | ||
| 39 | |||
| 40 | # Interrupt driven control endpoint task(+60) | ||
| 41 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
| 42 | |||
| 43 | |||
| 44 | # Boot Section Size in *bytes* | ||
| 45 | # Teensy halfKay 512 | ||
| 46 | # Teensy++ halfKay 1024 | ||
| 47 | # Atmel DFU loader 4096 | ||
| 48 | # LUFA bootloader 4096 | ||
| 49 | # USBaspLoader 2048 | ||
| 50 | OPT_DEFS += -DBOOTLOADER_SIZE=4096 | ||
| 51 | |||
| 52 | |||
| 53 | # Build Options | ||
| 54 | # change yes to no to disable | ||
| 55 | # | ||
| 56 | BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) | ||
| 57 | MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) | ||
| 58 | EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) | ||
| 59 | CONSOLE_ENABLE ?= yes # Console for debug(+400) | ||
| 60 | COMMAND_ENABLE ?= yes # Commands for debug and configuration | ||
| 61 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 62 | SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend | ||
| 63 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 64 | NKRO_ENABLE ?= no # USB Nkey Rollover | ||
| 65 | BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default | ||
| 66 | MIDI_ENABLE ?= no # MIDI controls | ||
| 67 | UNICODE_ENABLE ?= no # Unicode | ||
| 68 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 69 | AUDIO_ENABLE ?= no # Audio output on port C6 | ||
| 70 | |||
| 71 | CUSTOM_MATRIX = yes | ||
| 72 | SRC += matrix.c led.c | ||
| 73 | |||
| 74 | ifndef QUANTUM_DIR | ||
| 75 | include ../../Makefile | ||
| 76 | endif | ||
| 77 | |||
diff --git a/keyboards/kitten_paw/config.h b/keyboards/kitten_paw/config.h new file mode 100644 index 000000000..d7089734a --- /dev/null +++ b/keyboards/kitten_paw/config.h | |||
| @@ -0,0 +1,162 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef CONFIG_H | ||
| 19 | #define CONFIG_H | ||
| 20 | |||
| 21 | #include "config_common.h" | ||
| 22 | |||
| 23 | |||
| 24 | /* USB Device descriptor parameter */ | ||
| 25 | #define VENDOR_ID 0xFEED | ||
| 26 | #define PRODUCT_ID 0x6050 | ||
| 27 | #define DEVICE_VER 0x0104 | ||
| 28 | #define MANUFACTURER Costar | ||
| 29 | #define PRODUCT Majestouch | ||
| 30 | |||
| 31 | /* key matrix size */ | ||
| 32 | #define MATRIX_ROWS 8 | ||
| 33 | #define MATRIX_COLS 18 | ||
| 34 | |||
| 35 | /* | ||
| 36 | * Keyboard Matrix Assignments | ||
| 37 | * | ||
| 38 | * Change this to how you wired your keyboard | ||
| 39 | * COLS: AVR pins used for columns, left to right | ||
| 40 | * ROWS: AVR pins used for rows, top to bottom | ||
| 41 | * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) | ||
| 42 | * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) | ||
| 43 | * | ||
| 44 | */ | ||
| 45 | //#define MATRIX_ROW_PINS { D0, D5 } | ||
| 46 | //#define MATRIX_COL_PINS { F1, F0, B0 } | ||
| 47 | //#define UNUSED_PINS | ||
| 48 | |||
| 49 | /* COL2ROW or ROW2COL */ | ||
| 50 | #define DIODE_DIRECTION COL2ROW | ||
| 51 | |||
| 52 | // #define BACKLIGHT_PIN B7 | ||
| 53 | // #define BACKLIGHT_BREATHING | ||
| 54 | // #define BACKLIGHT_LEVELS 3 | ||
| 55 | |||
| 56 | |||
| 57 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
| 58 | #define DEBOUNCING_DELAY 5 | ||
| 59 | |||
| 60 | /* define if matrix has ghost (lacks anti-ghosting diodes) */ | ||
| 61 | //#define MATRIX_HAS_GHOST | ||
| 62 | |||
| 63 | /* number of backlight levels */ | ||
| 64 | |||
| 65 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
| 66 | #define LOCKING_SUPPORT_ENABLE | ||
| 67 | /* Locking resynchronize hack */ | ||
| 68 | #define LOCKING_RESYNC_ENABLE | ||
| 69 | |||
| 70 | /* | ||
| 71 | * Force NKRO | ||
| 72 | * | ||
| 73 | * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved | ||
| 74 | * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the | ||
| 75 | * makefile for this to work.) | ||
| 76 | * | ||
| 77 | * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) | ||
| 78 | * until the next keyboard reset. | ||
| 79 | * | ||
| 80 | * NKRO may prevent your keystrokes from being detected in the BIOS, but it is | ||
| 81 | * fully operational during normal computer usage. | ||
| 82 | * | ||
| 83 | * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) | ||
| 84 | * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by | ||
| 85 | * bootmagic, NKRO mode will always be enabled until it is toggled again during a | ||
| 86 | * power-up. | ||
| 87 | * | ||
| 88 | */ | ||
| 89 | //#define FORCE_NKRO | ||
| 90 | |||
| 91 | /* | ||
| 92 | * Magic Key Options | ||
| 93 | * | ||
| 94 | * Magic keys are hotkey commands that allow control over firmware functions of | ||
| 95 | * the keyboard. They are best used in combination with the HID Listen program, | ||
| 96 | * found here: https://www.pjrc.com/teensy/hid_listen.html | ||
| 97 | * | ||
| 98 | * The options below allow the magic key functionality to be changed. This is | ||
| 99 | * useful if your keyboard/keypad is missing keys and you want magic key support. | ||
| 100 | * | ||
| 101 | */ | ||
| 102 | |||
| 103 | /* key combination for magic key command */ | ||
| 104 | #define IS_COMMAND() ( \ | ||
| 105 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
| 106 | ) | ||
| 107 | |||
| 108 | /* control how magic key switches layers */ | ||
| 109 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true | ||
| 110 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true | ||
| 111 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false | ||
| 112 | |||
| 113 | /* override magic key keymap */ | ||
| 114 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS | ||
| 115 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS | ||
| 116 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM | ||
| 117 | //#define MAGIC_KEY_HELP1 H | ||
| 118 | //#define MAGIC_KEY_HELP2 SLASH | ||
| 119 | //#define MAGIC_KEY_DEBUG D | ||
| 120 | //#define MAGIC_KEY_DEBUG_MATRIX X | ||
| 121 | //#define MAGIC_KEY_DEBUG_KBD K | ||
| 122 | //#define MAGIC_KEY_DEBUG_MOUSE M | ||
| 123 | //#define MAGIC_KEY_VERSION V | ||
| 124 | //#define MAGIC_KEY_STATUS S | ||
| 125 | //#define MAGIC_KEY_CONSOLE C | ||
| 126 | //#define MAGIC_KEY_LAYER0_ALT1 ESC | ||
| 127 | //#define MAGIC_KEY_LAYER0_ALT2 GRAVE | ||
| 128 | //#define MAGIC_KEY_LAYER0 0 | ||
| 129 | //#define MAGIC_KEY_LAYER1 1 | ||
| 130 | //#define MAGIC_KEY_LAYER2 2 | ||
| 131 | //#define MAGIC_KEY_LAYER3 3 | ||
| 132 | //#define MAGIC_KEY_LAYER4 4 | ||
| 133 | //#define MAGIC_KEY_LAYER5 5 | ||
| 134 | //#define MAGIC_KEY_LAYER6 6 | ||
| 135 | //#define MAGIC_KEY_LAYER7 7 | ||
| 136 | //#define MAGIC_KEY_LAYER8 8 | ||
| 137 | //#define MAGIC_KEY_LAYER9 9 | ||
| 138 | //#define MAGIC_KEY_BOOTLOADER PAUSE | ||
| 139 | //#define MAGIC_KEY_LOCK CAPS | ||
| 140 | //#define MAGIC_KEY_EEPROM E | ||
| 141 | //#define MAGIC_KEY_NKRO N | ||
| 142 | //#define MAGIC_KEY_SLEEP_LED Z | ||
| 143 | |||
| 144 | /* | ||
| 145 | * Feature disable options | ||
| 146 | * These options are also useful to firmware size reduction. | ||
| 147 | */ | ||
| 148 | |||
| 149 | /* disable debug print */ | ||
| 150 | //#define NO_DEBUG | ||
| 151 | |||
| 152 | /* disable print */ | ||
| 153 | //#define NO_PRINT | ||
| 154 | |||
| 155 | /* disable action features */ | ||
| 156 | //#define NO_ACTION_LAYER | ||
| 157 | //#define NO_ACTION_TAPPING | ||
| 158 | //#define NO_ACTION_ONESHOT | ||
| 159 | //#define NO_ACTION_MACRO | ||
| 160 | //#define NO_ACTION_FUNCTION | ||
| 161 | |||
| 162 | #endif | ||
diff --git a/keyboards/kitten_paw/keymaps/default/keymap.c b/keyboards/kitten_paw/keymaps/default/keymap.c new file mode 100644 index 000000000..f67235745 --- /dev/null +++ b/keyboards/kitten_paw/keymaps/default/keymap.c | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | #include "kitten_paw.h" | ||
| 2 | |||
| 3 | enum layers { | ||
| 4 | DEFAULT, | ||
| 5 | }; | ||
| 6 | |||
| 7 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 8 | [DEFAULT] = KEYMAP(\ | ||
| 9 | KC_ESC, 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_PSCR,KC_SLCK,KC_PAUS, \ | ||
| 10 | KC_GRV, 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_BSPC, KC_INS,KC_HOME,KC_PGUP, KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS, \ | ||
| 11 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,KC_LBRC,KC_RBRC,KC_BSLS, KC_DEL, KC_END,KC_PGDN, KC_P7, KC_P8, KC_P9,KC_PPLS, \ | ||
| 12 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_SCLN,KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, \ | ||
| 13 | KC_LSFT,KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3,KC_PENT, \ | ||
| 14 | KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT, KC_P0,KC_PDOT) | ||
| 15 | }; | ||
| 16 | |||
| 17 | const uint16_t PROGMEM fn_actions[] = { | ||
| 18 | |||
| 19 | }; | ||
| 20 | |||
| 21 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
| 22 | { | ||
| 23 | // MACRODOWN only works in this function | ||
| 24 | switch(id) { | ||
| 25 | case 0: | ||
| 26 | if (record->event.pressed) { | ||
| 27 | register_code(KC_RSFT); | ||
| 28 | } else { | ||
| 29 | unregister_code(KC_RSFT); | ||
| 30 | } | ||
| 31 | break; | ||
| 32 | } | ||
| 33 | return MACRO_NONE; | ||
| 34 | }; | ||
| 35 | |||
| 36 | |||
| 37 | void matrix_init_user(void) { | ||
| 38 | |||
| 39 | } | ||
| 40 | |||
| 41 | void matrix_scan_user(void) { | ||
| 42 | |||
| 43 | } | ||
| 44 | |||
| 45 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 46 | return true; | ||
| 47 | } | ||
| 48 | |||
| 49 | void led_set_user(uint8_t usb_led) { | ||
| 50 | |||
| 51 | } \ No newline at end of file | ||
diff --git a/keyboards/kitten_paw/kitten_paw.c b/keyboards/kitten_paw/kitten_paw.c new file mode 100644 index 000000000..8713baf43 --- /dev/null +++ b/keyboards/kitten_paw/kitten_paw.c | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | #include "kitten_paw.h" | ||
| 2 | |||
| 3 | void matrix_init_kb(void) { | ||
| 4 | // put your keyboard start-up code here | ||
| 5 | // runs once when the firmware starts up | ||
| 6 | |||
| 7 | matrix_init_quantum(); | ||
| 8 | matrix_init_user(); | ||
| 9 | } | ||
| 10 | |||
| 11 | void matrix_scan_kb(void) { | ||
| 12 | // put your looping keyboard code here | ||
| 13 | // runs every cycle (a lot) | ||
| 14 | |||
| 15 | matrix_scan_quantum(); | ||
| 16 | matrix_scan_user(); | ||
| 17 | } | ||
| 18 | |||
| 19 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 20 | // put your per-action keyboard code here | ||
| 21 | // runs for every action, just before processing by the firmware | ||
| 22 | |||
| 23 | return process_record_user(keycode, record); | ||
| 24 | } | ||
| 25 | |||
| 26 | void led_set_kb(uint8_t usb_led) { | ||
| 27 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 28 | |||
| 29 | led_set_user(usb_led); | ||
| 30 | } | ||
diff --git a/keyboards/kitten_paw/kitten_paw.h b/keyboards/kitten_paw/kitten_paw.h new file mode 100644 index 000000000..a6c1d27de --- /dev/null +++ b/keyboards/kitten_paw/kitten_paw.h | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | #ifndef KITTEN_PAW_H | ||
| 2 | #define KITTEN_PAW_H | ||
| 3 | |||
| 4 | #include "quantum.h" | ||
| 5 | |||
| 6 | // This a shortcut to help you visually see your layout. | ||
| 7 | // The first section contains all of the arguements | ||
| 8 | // The second converts the arguments into a two-dimensional array | ||
| 9 | /* | ||
| 10 | Matrix col/row mapping | ||
| 11 | |||
| 12 | ,----. ,-------------------. ,-------------------. ,-------------------. ,--------------. | ||
| 13 | | J6 | | I4 | H4 | H2 | H6 | | A7 | E6 | D2 | D4 | | B4 | B7 | B6 | B0 | | C7 | C5 | A5 | | ||
| 14 | `----' `-------------------' `-------------------' `-------------------' `--------------' | ||
| 15 | ,-------------------------------------------------------------------------. ,--------------. ,-------------------. | ||
| 16 | | J4 | J7 | I7 | H7 | G7 | G4 | F4 | F7 | E7 | D7 | R7 | R4 | E4 | B2 | | L4 | O4 | Q4 | | K1 | L1 | Q1 | Q0 | | ||
| 17 | |-------------------------------------------------------------------------| |--------------| |-------------------| | ||
| 18 | | J2 | J5 | I5 | H5 | G5 | G2 | F2 | F5 | E5 | D5 | R5 | R2 | E2 | B3 | | K4 | O7 | Q7 | | K5 | L5 | Q5 | O5 | | ||
| 19 | |-------------------------------------------------------------------------| '--------------' |-------------- | | ||
| 20 | | O5 | J3 | I3 | H3 | G3 | G6 | F6 | F3 | E3 | D3 | R3 | R6 | B1 | | K2 | L2 | Q2 | | | ||
| 21 | |-------------------------------------------------------------------------| ,----. |-------------------| | ||
| 22 | | N2 | J1 | I1 | H1 | G1 | G0 | F0 | F1 | E1 | D1 | R0 | N3 | | O6 | | K3 | L3 | Q3 | O3 | | ||
| 23 | |-------------------------------------------------------------------------| ,--------------. |-------------- | | ||
| 24 | | A4 | P2 | C6 | K6 | C0 | M3 | D0 | A1 | | O0 | K0 | L0 | | L6 | Q6 | | | ||
| 25 | `-------------------------------------------------------------------------' `--------------' `-------------------' | ||
| 26 | */ | ||
| 27 | |||
| 28 | #define KEYMAP( \ | ||
| 29 | KJ6, KI4, KH4, KH2, KH6, KA7, KE6, KD2, KD4, KB4, KB7, KB6, KB0, KC7, KC5, KA5, \ | ||
| 30 | KJ4, KJ7, KI7, KH7, KG7, KG4, KF4, KF7, KE7, KD7, KR7, KR4, KE4, KB2, KL4, KO4, KQ4, KK1, KL1, KQ1, KQ0, \ | ||
| 31 | KJ2, KJ5, KI5, KH5, KG5, KG2, KF2, KF5, KE5, KD5, KR5, KR2, KE2, KB3, KK4, KO7, KQ7, KK5, KL5, KQ5, KO5, \ | ||
| 32 | KI2, KJ3, KI3, KH3, KG3, KG6, KF6, KF3, KE3, KD3, KR3, KR6, KB1, KK2, KL2, KQ2, \ | ||
| 33 | KN2, KI6, KJ1, KI1, KH1, KG1, KG0, KF0, KF1, KE1, KD1, KR0, KN3, KO6, KK3, KL3, KQ3, KO3, \ | ||
| 34 | KA4, KP2, KC6, KK6, KC0, KM3, KD0, KA1, KO0, KK0, KL0, KL6, KQ6 \ | ||
| 35 | ) \ | ||
| 36 | { \ | ||
| 37 | {KC_NO, KB0, KC0, KD0,KC_NO, KF0, KG0,KC_NO,KC_NO,KC_NO, KK0, KL0,KC_NO,KC_NO, KO0,KC_NO, KQ0, KR0}, \ | ||
| 38 | { KA1, KB1,KC_NO, KD1, KE1, KF1, KG1, KH1, KI1, KJ1, KK1, KL1,KC_NO,KC_NO,KC_NO,KC_NO, KQ1,KC_NO}, \ | ||
| 39 | {KC_NO, KB2,KC_NO, KD2, KE2, KF2, KG2, KH2, KI2, KJ2, KK2, KL2,KC_NO, KN2,KC_NO, KP2, KQ2, KR2}, \ | ||
| 40 | {KC_NO, KB3,KC_NO, KD3, KE3, KF3, KG3, KH3, KI3, KJ3, KK3, KL3, KM3, KN3, KO3,KC_NO, KQ3, KR3}, \ | ||
| 41 | { KA4, KB4,KC_NO, KD4, KE4, KF4, KG4, KH4, KI4, KJ4, KK4, KL4,KC_NO,KC_NO, KO4,KC_NO, KQ4, KR4}, \ | ||
| 42 | { KA5,KC_NO, KC5, KD5, KE5, KF5, KG5, KH5, KI5, KJ5, KK5, KL5,KC_NO,KC_NO, KO5,KC_NO, KQ5, KR5}, \ | ||
| 43 | {KC_NO, KB6, KC6,KC_NO, KE6, KF6, KG6, KH6, KI6, KJ6, KK6, KL6,KC_NO,KC_NO, KO6,KC_NO, KQ6, KR6}, \ | ||
| 44 | { KA7, KB7, KC7, KD7, KE7, KF7, KG7, KH7, KI7, KJ7,KC_NO,KC_NO,KC_NO,KC_NO, KO7,KC_NO, KQ7, KR7} \ | ||
| 45 | } | ||
| 46 | |||
| 47 | #endif | ||
diff --git a/keyboards/kitten_paw/led.c b/keyboards/kitten_paw/led.c new file mode 100644 index 000000000..a1bf057c4 --- /dev/null +++ b/keyboards/kitten_paw/led.c | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2014 Ralf Schmitt <ralf@bunkertor.net> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <avr/io.h> | ||
| 19 | #include "stdint.h" | ||
| 20 | #include "led.h" | ||
| 21 | |||
| 22 | /* LED pin configuration | ||
| 23 | * | ||
| 24 | * Scroll Lock PC5 | ||
| 25 | * Caps Lock PC6 | ||
| 26 | * Num Lock PB7 | ||
| 27 | * | ||
| 28 | */ | ||
| 29 | void led_set(uint8_t usb_led) { | ||
| 30 | DDRB |= (1<<7); | ||
| 31 | DDRC |= (1<<5) | (1<<6); | ||
| 32 | |||
| 33 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) | ||
| 34 | PORTC &= ~(1<<6); | ||
| 35 | else | ||
| 36 | PORTC |= (1<<6); | ||
| 37 | |||
| 38 | if (usb_led & (1<<USB_LED_NUM_LOCK)) | ||
| 39 | PORTB &= ~(1<<7); | ||
| 40 | else | ||
| 41 | PORTB |= (1<<7); | ||
| 42 | |||
| 43 | if (usb_led & (1<<USB_LED_SCROLL_LOCK)) | ||
| 44 | PORTC &= ~(1<<5); | ||
| 45 | else | ||
| 46 | PORTC |= (1<<5); | ||
| 47 | } | ||
diff --git a/keyboards/kitten_paw/matrix.c b/keyboards/kitten_paw/matrix.c new file mode 100644 index 000000000..46875293f --- /dev/null +++ b/keyboards/kitten_paw/matrix.c | |||
| @@ -0,0 +1,164 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2014 Ralf Schmitt <ralf@bunkertor.net> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <stdint.h> | ||
| 19 | #include <stdbool.h> | ||
| 20 | #include <avr/io.h> | ||
| 21 | #include <util/delay.h> | ||
| 22 | #include "print.h" | ||
| 23 | #include "debug.h" | ||
| 24 | #include "util.h" | ||
| 25 | #include "matrix.h" | ||
| 26 | |||
| 27 | #ifndef DEBOUNCING_DELAY | ||
| 28 | # define DEBOUNCING_DELAY 5 | ||
| 29 | #endif | ||
| 30 | static uint8_t debouncing = DEBOUNCING_DELAY; | ||
| 31 | |||
| 32 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
| 33 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
| 34 | |||
| 35 | static uint8_t read_rows(void); | ||
| 36 | static void select_col(uint8_t col); | ||
| 37 | |||
| 38 | inline uint8_t matrix_rows(void) { | ||
| 39 | return MATRIX_ROWS; | ||
| 40 | } | ||
| 41 | |||
| 42 | inline uint8_t matrix_cols(void) { | ||
| 43 | return MATRIX_COLS; | ||
| 44 | } | ||
| 45 | |||
| 46 | /* Column pin configuration | ||
| 47 | * | ||
| 48 | * col: 0 1 2 3 4 5 6 7 | ||
| 49 | * pin: PC7 PD5 PD3 PD1 PC2 PD6 PD4 PD2 | ||
| 50 | * | ||
| 51 | * Rrr pin configuration | ||
| 52 | * | ||
| 53 | * These rrrs uses one 74HC154 4 to 16 bit demultiplexer (low | ||
| 54 | * active), together with 2 rrrs driven directly from the micro | ||
| 55 | * controller, to control the 18 rrrs. The rrrs are driven from | ||
| 56 | * pins B6,5,4,3,2,1,0. | ||
| 57 | */ | ||
| 58 | void matrix_init(void) { | ||
| 59 | DDRC &= ~0b10000100; // Row input pins | ||
| 60 | DDRD &= ~0b01111110; | ||
| 61 | PORTC |= 0b10000100; | ||
| 62 | PORTD |= 0b01111110; | ||
| 63 | |||
| 64 | DDRB |= 0b01111111; // Column output pins | ||
| 65 | |||
| 66 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
| 67 | matrix[i] = 0; | ||
| 68 | matrix_debouncing[i] = 0; | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 72 | uint8_t matrix_scan(void) { | ||
| 73 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | ||
| 74 | select_col(col); | ||
| 75 | _delay_us(3); | ||
| 76 | uint8_t rows = read_rows(); | ||
| 77 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 78 | bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); | ||
| 79 | bool curr_bit = rows & (1<<row); | ||
| 80 | if (prev_bit != curr_bit) { | ||
| 81 | matrix_debouncing[row] ^= ((matrix_row_t)1<<col); | ||
| 82 | debouncing = DEBOUNCING_DELAY; | ||
| 83 | } | ||
| 84 | } | ||
| 85 | } | ||
| 86 | |||
| 87 | if (debouncing) { | ||
| 88 | if (--debouncing) { | ||
| 89 | _delay_ms(1); | ||
| 90 | } | ||
| 91 | else { | ||
| 92 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 93 | matrix[i] = matrix_debouncing[i]; | ||
| 94 | } | ||
| 95 | } | ||
| 96 | } | ||
| 97 | |||
| 98 | return 1; | ||
| 99 | } | ||
| 100 | |||
| 101 | bool matrix_is_modified(void) { | ||
| 102 | if (debouncing) | ||
| 103 | return false; | ||
| 104 | else | ||
| 105 | return true; | ||
| 106 | } | ||
| 107 | |||
| 108 | inline bool matrix_is_on(uint8_t row, uint8_t col) { | ||
| 109 | return (matrix[row] & ((matrix_row_t)1<<col)); | ||
| 110 | } | ||
| 111 | |||
| 112 | inline matrix_row_t matrix_get_row(uint8_t row) { | ||
| 113 | return matrix[row]; | ||
| 114 | } | ||
| 115 | |||
| 116 | void matrix_print(void) { | ||
| 117 | print("\nr/c 0123456789ABCDEF\n"); | ||
| 118 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 119 | xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row))); | ||
| 120 | } | ||
| 121 | } | ||
| 122 | |||
| 123 | uint8_t matrix_key_count(void) { | ||
| 124 | uint8_t count = 0; | ||
| 125 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 126 | count += bitpop32(matrix[i]); | ||
| 127 | } | ||
| 128 | return count; | ||
| 129 | } | ||
| 130 | |||
| 131 | static uint8_t read_rows(void) { | ||
| 132 | return | ||
| 133 | (PINC&(1<<7) ? 0 : (1<<0)) | | ||
| 134 | (PIND&(1<<5) ? 0 : (1<<1)) | | ||
| 135 | (PIND&(1<<3) ? 0 : (1<<2)) | | ||
| 136 | (PIND&(1<<1) ? 0 : (1<<3)) | | ||
| 137 | (PINC&(1<<2) ? 0 : (1<<4)) | | ||
| 138 | (PIND&(1<<2) ? 0 : (1<<5)) | | ||
| 139 | (PIND&(1<<4) ? 0 : (1<<6)) | | ||
| 140 | (PIND&(1<<6) ? 0 : (1<<7)); | ||
| 141 | } | ||
| 142 | |||
| 143 | static void select_col(uint8_t col) { | ||
| 144 | switch (col) { | ||
| 145 | case 0: PORTB = (PORTB & ~0b01111111) | 0b01100100; break; | ||
| 146 | case 1: PORTB = (PORTB & ~0b01111111) | 0b01101100; break; | ||
| 147 | case 2: PORTB = (PORTB & ~0b01111111) | 0b01100010; break; | ||
| 148 | case 3: PORTB = (PORTB & ~0b01111111) | 0b01111010; break; | ||
| 149 | case 4: PORTB = (PORTB & ~0b01111111) | 0b01100110; break; | ||
| 150 | case 5: PORTB = (PORTB & ~0b01111111) | 0b01110110; break; | ||
| 151 | case 6: PORTB = (PORTB & ~0b01111111) | 0b01101110; break; | ||
| 152 | case 7: PORTB = (PORTB & ~0b01111111) | 0b01111110; break; | ||
| 153 | case 8: PORTB = (PORTB & ~0b01111111) | 0b01000001; break; | ||
| 154 | case 9: PORTB = (PORTB & ~0b01111111) | 0b00100001; break; | ||
| 155 | case 10: PORTB = (PORTB & ~0b01111111) | 0b01101010; break; | ||
| 156 | case 11: PORTB = (PORTB & ~0b01111111) | 0b01110010; break; | ||
| 157 | case 12: PORTB = (PORTB & ~0b01111111) | 0b01111100; break; | ||
| 158 | case 13: PORTB = (PORTB & ~0b01111111) | 0b01110100; break; | ||
| 159 | case 14: PORTB = (PORTB & ~0b01111111) | 0b01111000; break; | ||
| 160 | case 15: PORTB = (PORTB & ~0b01111111) | 0b01110000; break; | ||
| 161 | case 16: PORTB = (PORTB & ~0b01111111) | 0b01100000; break; | ||
| 162 | case 17: PORTB = (PORTB & ~0b01111111) | 0b01101000; break; | ||
| 163 | } | ||
| 164 | } | ||
diff --git a/keyboards/kitten_paw/readme.md b/keyboards/kitten_paw/readme.md new file mode 100644 index 000000000..a6ef2a067 --- /dev/null +++ b/keyboards/kitten_paw/readme.md | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | kitten_paw keyboard firmware | ||
| 2 | ====================== | ||
| 3 | This is the firmware for the 2016 revision of the Kitten Paw controller by Bathroom Epiphanies. | ||
| 4 | Most of the boilerplate code is the work of [BathroomEpiphanies](https://github.com/BathroomEpiphanies). | ||
| 5 | |||
| 6 | NKRO doesn't work at the moment, I don't know if I will take the time to find out how to fix this, so far 6KRO is enough for me. | ||
| 7 | |||
| 8 | ## Quantum MK Firmware | ||
| 9 | |||
| 10 | For the full Quantum feature list, see [the parent readme.md](/doc/readme.md). | ||
| 11 | |||
| 12 | ## Building | ||
| 13 | |||
| 14 | Download or clone the whole firmware and navigate to the keyboards/kitten_paw folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file. | ||
| 15 | |||
| 16 | Depending on which keymap you would like to use, you will have to compile slightly differently. | ||
| 17 | |||
| 18 | ### Default | ||
| 19 | |||
| 20 | To build with the default keymap, simply run `make`. | ||
| 21 | |||
| 22 | ### Other Keymaps | ||
| 23 | |||
| 24 | Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a folder with the name of your keymap in the keymaps folder, and see keymap documentation (you can find in top readme.md) and existant keymap files. | ||
| 25 | |||
| 26 | To build the firmware binary hex file with a keymap just do `make` with `keymap` option like: | ||
| 27 | |||
| 28 | ``` | ||
| 29 | $ make keymap=[default|jack|<name>] | ||
| 30 | ``` | ||
| 31 | |||
| 32 | Keymaps follow the format **__keymap.c__** and are stored in folders in the `keymaps` folder, eg `keymaps/my_keymap/` | ||
diff --git a/keyboards/planck/keymaps/experimental/Makefile b/keyboards/planck/keymaps/experimental/Makefile index 877c4aed0..3a8250a9b 100644 --- a/keyboards/planck/keymaps/experimental/Makefile +++ b/keyboards/planck/keymaps/experimental/Makefile | |||
| @@ -16,6 +16,7 @@ AUDIO_ENABLE = no # Audio output on port C6 | |||
| 16 | UNICODE_ENABLE = no # Unicode | 16 | UNICODE_ENABLE = no # Unicode |
| 17 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | 17 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID |
| 18 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | 18 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. |
| 19 | ONEHAND_ENABLE = yes # Enable one-hand typing | ||
| 19 | 20 | ||
| 20 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | 21 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE |
| 21 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | 22 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
diff --git a/keyboards/planck/keymaps/experimental/keymap.c b/keyboards/planck/keymaps/experimental/keymap.c index 2c1270094..569dbcc8a 100644 --- a/keyboards/planck/keymaps/experimental/keymap.c +++ b/keyboards/planck/keymaps/experimental/keymap.c | |||
| @@ -70,7 +70,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 70 | {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, | 70 | {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, |
| 71 | {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, | 71 | {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, |
| 72 | {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, | 72 | {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, |
| 73 | {KC_LEAD, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} | 73 | {KC_LEAD, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_FN0, KC_FN0, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} |
| 74 | }, | 74 | }, |
| 75 | 75 | ||
| 76 | /* Colemak | 76 | /* Colemak |
| @@ -88,7 +88,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 88 | {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, | 88 | {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, |
| 89 | {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, | 89 | {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, |
| 90 | {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, | 90 | {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, |
| 91 | {KC_LEAD, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} | 91 | {KC_LEAD, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_FN0, KC_FN0, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} |
| 92 | }, | 92 | }, |
| 93 | 93 | ||
| 94 | /* Dvorak | 94 | /* Dvorak |
| @@ -106,7 +106,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 106 | {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, | 106 | {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, |
| 107 | {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, | 107 | {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, |
| 108 | {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, | 108 | {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, |
| 109 | {KC_LEAD, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} | 109 | {KC_LEAD, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_FN0, KC_FN0, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} |
| 110 | }, | 110 | }, |
| 111 | 111 | ||
| 112 | /* Lower | 112 | /* Lower |
| @@ -186,7 +186,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 186 | }; | 186 | }; |
| 187 | 187 | ||
| 188 | const uint16_t PROGMEM fn_actions[] = { | 188 | const uint16_t PROGMEM fn_actions[] = { |
| 189 | 189 | ACTION_SWAP_HANDS_TAP_KEY(KC_SPC), | |
| 190 | }; | 190 | }; |
| 191 | 191 | ||
| 192 | #ifdef AUDIO_ENABLE | 192 | #ifdef AUDIO_ENABLE |
diff --git a/keyboards/planck/planck.c b/keyboards/planck/planck.c index 8d70bb4e5..645b450d1 100644 --- a/keyboards/planck/planck.c +++ b/keyboards/planck/planck.c | |||
| @@ -1,5 +1,15 @@ | |||
| 1 | #include "planck.h" | 1 | #include "planck.h" |
| 2 | 2 | ||
| 3 | #ifdef ONEHAND_ENABLE | ||
| 4 | __attribute__ ((weak)) | ||
| 5 | const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { | ||
| 6 | {{11, 0}, {10, 0}, {9, 0}, {8, 0}, {7, 0}, {6, 0}, {5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}}, | ||
| 7 | {{11, 1}, {10, 1}, {9, 1}, {8, 1}, {7, 1}, {6, 1}, {5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}}, | ||
| 8 | {{11, 2}, {10, 2}, {9, 2}, {8, 2}, {7, 2}, {6, 2}, {5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}}, | ||
| 9 | {{11, 3}, {10, 3}, {9, 3}, {8, 3}, {7, 3}, {6, 3}, {5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}}, | ||
| 10 | }; | ||
| 11 | #endif | ||
| 12 | |||
| 3 | void matrix_init_kb(void) { | 13 | void matrix_init_kb(void) { |
| 4 | // Turn status LED on | 14 | // Turn status LED on |
| 5 | DDRE |= (1<<6); | 15 | DDRE |= (1<<6); |
diff --git a/keyboards/preonic/preonic.c b/keyboards/preonic/preonic.c index 889c3fc8f..d9c119b8d 100644 --- a/keyboards/preonic/preonic.c +++ b/keyboards/preonic/preonic.c | |||
| @@ -1,5 +1,16 @@ | |||
| 1 | #include "preonic.h" | 1 | #include "preonic.h" |
| 2 | 2 | ||
| 3 | #ifdef ONEHAND_ENABLE | ||
| 4 | __attribute__ ((weak)) | ||
| 5 | const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { | ||
| 6 | {{11, 0}, {10, 0}, {9, 0}, {8, 0}, {7, 0}, {6, 0}, {5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}}, | ||
| 7 | {{11, 1}, {10, 1}, {9, 1}, {8, 1}, {7, 1}, {6, 1}, {5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}}, | ||
| 8 | {{11, 2}, {10, 2}, {9, 2}, {8, 2}, {7, 2}, {6, 2}, {5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}}, | ||
| 9 | {{11, 3}, {10, 3}, {9, 3}, {8, 3}, {7, 3}, {6, 3}, {5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}}, | ||
| 10 | {{11, 4}, {10, 4}, {9, 4}, {8, 4}, {7, 4}, {6, 4}, {5, 4}, {4, 4}, {3, 4}, {2, 4}, {1, 4}, {0, 4}}, | ||
| 11 | }; | ||
| 12 | #endif | ||
| 13 | |||
| 3 | void matrix_init_kb(void) { | 14 | void matrix_init_kb(void) { |
| 4 | 15 | ||
| 5 | // Turn status LED on | 16 | // Turn status LED on |
diff --git a/keyboards/readme.md b/keyboards/readme.md index f6c90b1f6..4f1796219 100644 --- a/keyboards/readme.md +++ b/keyboards/readme.md | |||
| @@ -39,6 +39,7 @@ These keyboards are part of the QMK repository, but their manufacturers are not | |||
| 39 | * [hhkb](/keyboards/hhkb) — The Happy Hacking keyboard can be hacked with a custom controller to run QMK. | 39 | * [hhkb](/keyboards/hhkb) — The Happy Hacking keyboard can be hacked with a custom controller to run QMK. |
| 40 | * [jd45](/keyboards/jd45) — Another Geekhack community project, designed by jdcarpe. | 40 | * [jd45](/keyboards/jd45) — Another Geekhack community project, designed by jdcarpe. |
| 41 | * [kc60](/keyboards/kc60) — A programmable Chinese-made keyboard, lost in the mists of time. | 41 | * [kc60](/keyboards/kc60) — A programmable Chinese-made keyboard, lost in the mists of time. |
| 42 | * [kitten_paw](/keyboards/kitten_paw) — A replacement controller (2016 revision) for the Filco Majestouch by [Bathroom Epiphanies](https://github.com/BathroomEpiphanies) | ||
| 42 | * [phantom](/keyboards/phantom) — A tenkeyless kit by Teel, also from Geekhack. | 43 | * [phantom](/keyboards/phantom) — A tenkeyless kit by Teel, also from Geekhack. |
| 43 | * [retro_refit](/keyboards/retro_refit) — Another creation by IBNobody. | 44 | * [retro_refit](/keyboards/retro_refit) — Another creation by IBNobody. |
| 44 | * [satan](/keyboards/satan) — A GH60 variant. | 45 | * [satan](/keyboards/satan) — A GH60 variant. |
diff --git a/keyboards/tv44/tv44.h b/keyboards/tv44/tv44.h index 4c30174ac..65c0b4593 100644 --- a/keyboards/tv44/tv44.h +++ b/keyboards/tv44/tv44.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ | 11 | K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ |
| 12 | K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ | 12 | K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ |
| 13 | K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ | 13 | K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ |
| 14 | K30, K31, K32, K33, K37, K38, K39, K3B \ | 14 | K30, K31, K32, K33, K37, K38, K39, K3A, K3B \ |
| 15 | ) \ | 15 | ) \ |
| 16 | { \ | 16 | { \ |
| 17 | { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B }, \ | 17 | { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B }, \ |
diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index 72c809c30..a1be8d2fc 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c | |||
| @@ -18,6 +18,7 @@ void set_unicode_input_mode(uint8_t os_target) | |||
| 18 | input_mode = os_target; | 18 | input_mode = os_target; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | __attribute__((weak)) | ||
| 21 | void unicode_input_start (void) { | 22 | void unicode_input_start (void) { |
| 22 | switch(input_mode) { | 23 | switch(input_mode) { |
| 23 | case UC_OSX: | 24 | case UC_OSX: |
| @@ -40,6 +41,7 @@ void unicode_input_start (void) { | |||
| 40 | wait_ms(UNICODE_TYPE_DELAY); | 41 | wait_ms(UNICODE_TYPE_DELAY); |
| 41 | } | 42 | } |
| 42 | 43 | ||
| 44 | __attribute__((weak)) | ||
| 43 | void unicode_input_finish (void) { | 45 | void unicode_input_finish (void) { |
| 44 | switch(input_mode) { | 46 | switch(input_mode) { |
| 45 | case UC_OSX: | 47 | case UC_OSX: |
diff --git a/tmk_core/common.mk b/tmk_core/common.mk index aa05b9491..429c57143 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk | |||
| @@ -85,6 +85,10 @@ ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) | |||
| 85 | OPT_DEFS += -DBLUETOOTH_ENABLE | 85 | OPT_DEFS += -DBLUETOOTH_ENABLE |
| 86 | endif | 86 | endif |
| 87 | 87 | ||
| 88 | ifeq ($(strip $(ONEHAND_ENABLE)), yes) | ||
| 89 | OPT_DEFS += -DONEHAND_ENABLE | ||
| 90 | endif | ||
| 91 | |||
| 88 | ifeq ($(strip $(KEYMAP_SECTION_ENABLE)), yes) | 92 | ifeq ($(strip $(KEYMAP_SECTION_ENABLE)), yes) |
| 89 | OPT_DEFS += -DKEYMAP_SECTION_ENABLE | 93 | OPT_DEFS += -DKEYMAP_SECTION_ENABLE |
| 90 | 94 | ||
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index be6dea2b7..08ef22eb9 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c | |||
| @@ -41,6 +41,12 @@ void action_exec(keyevent_t event) | |||
| 41 | dprint("EVENT: "); debug_event(event); dprintln(); | 41 | dprint("EVENT: "); debug_event(event); dprintln(); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | #ifdef ONEHAND_ENABLE | ||
| 45 | if (!IS_NOEVENT(event)) { | ||
| 46 | process_hand_swap(&event); | ||
| 47 | } | ||
| 48 | #endif | ||
| 49 | |||
| 44 | keyrecord_t record = { .event = event }; | 50 | keyrecord_t record = { .event = event }; |
| 45 | 51 | ||
| 46 | #ifndef NO_ACTION_TAPPING | 52 | #ifndef NO_ACTION_TAPPING |
| @@ -53,6 +59,26 @@ void action_exec(keyevent_t event) | |||
| 53 | #endif | 59 | #endif |
| 54 | } | 60 | } |
| 55 | 61 | ||
| 62 | #ifdef ONEHAND_ENABLE | ||
| 63 | bool swap_hands = false; | ||
| 64 | |||
| 65 | void process_hand_swap(keyevent_t *event) { | ||
| 66 | static swap_state_row_t swap_state[MATRIX_ROWS]; | ||
| 67 | |||
| 68 | keypos_t pos = event->key; | ||
| 69 | swap_state_row_t col_bit = (swap_state_row_t)1<<pos.col; | ||
| 70 | bool do_swap = event->pressed ? swap_hands : | ||
| 71 | swap_state[pos.row] & (col_bit); | ||
| 72 | |||
| 73 | if (do_swap) { | ||
| 74 | event->key = hand_swap_config[pos.row][pos.col]; | ||
| 75 | swap_state[pos.row] |= col_bit; | ||
| 76 | } else { | ||
| 77 | swap_state[pos.row] &= ~(col_bit); | ||
| 78 | } | ||
| 79 | } | ||
| 80 | #endif | ||
| 81 | |||
| 56 | #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS) | 82 | #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS) |
| 57 | bool disable_action_cache = false; | 83 | bool disable_action_cache = false; |
| 58 | 84 | ||
| @@ -440,6 +466,54 @@ void process_action(keyrecord_t *record, action_t action) | |||
| 440 | #endif | 466 | #endif |
| 441 | case ACT_COMMAND: | 467 | case ACT_COMMAND: |
| 442 | break; | 468 | break; |
| 469 | #ifdef ONEHAND_ENABLE | ||
| 470 | case ACT_SWAP_HANDS: | ||
| 471 | switch (action.swap.code) { | ||
| 472 | case OP_SH_TOGGLE: | ||
| 473 | if (event.pressed) { | ||
| 474 | swap_hands = !swap_hands; | ||
| 475 | } | ||
| 476 | break; | ||
| 477 | case OP_SH_ON_OFF: | ||
| 478 | swap_hands = event.pressed; | ||
| 479 | break; | ||
| 480 | case OP_SH_OFF_ON: | ||
| 481 | swap_hands = !event.pressed; | ||
| 482 | break; | ||
| 483 | case OP_SH_ON: | ||
| 484 | if (!event.pressed) { | ||
| 485 | swap_hands = true; | ||
| 486 | } | ||
| 487 | break; | ||
| 488 | case OP_SH_OFF: | ||
| 489 | if (!event.pressed) { | ||
| 490 | swap_hands = false; | ||
| 491 | } | ||
| 492 | break; | ||
| 493 | #ifndef NO_ACTION_TAPPING | ||
| 494 | case OP_SH_TAP_TOGGLE: | ||
| 495 | /* tap toggle */ | ||
| 496 | if (tap_count > 0) { | ||
| 497 | if (!event.pressed) { | ||
| 498 | swap_hands = !swap_hands; | ||
| 499 | } | ||
| 500 | } else { | ||
| 501 | swap_hands = event.pressed; | ||
| 502 | } | ||
| 503 | break; | ||
| 504 | default: | ||
| 505 | if (tap_count > 0) { | ||
| 506 | if (event.pressed) { | ||
| 507 | register_code(action.swap.code); | ||
| 508 | } else { | ||
| 509 | unregister_code(action.swap.code); | ||
| 510 | } | ||
| 511 | } else { | ||
| 512 | swap_hands = event.pressed; | ||
| 513 | } | ||
| 514 | #endif | ||
| 515 | } | ||
| 516 | #endif | ||
| 443 | #ifndef NO_ACTION_FUNCTION | 517 | #ifndef NO_ACTION_FUNCTION |
| 444 | case ACT_FUNCTION: | 518 | case ACT_FUNCTION: |
| 445 | action_function(record, action.func.id, action.func.opt); | 519 | action_function(record, action.func.id, action.func.opt); |
| @@ -652,6 +726,13 @@ bool is_tap_key(keypos_t key) | |||
| 652 | return true; | 726 | return true; |
| 653 | } | 727 | } |
| 654 | return false; | 728 | return false; |
| 729 | case ACT_SWAP_HANDS: | ||
| 730 | switch (action.swap.code) { | ||
| 731 | case 0x00 ... 0xdf: | ||
| 732 | case OP_SH_TAP_TOGGLE: | ||
| 733 | return true; | ||
| 734 | } | ||
| 735 | return false; | ||
| 655 | case ACT_MACRO: | 736 | case ACT_MACRO: |
| 656 | case ACT_FUNCTION: | 737 | case ACT_FUNCTION: |
| 657 | if (action.func.opt & FUNC_TAP) { return true; } | 738 | if (action.func.opt & FUNC_TAP) { return true; } |
| @@ -692,6 +773,7 @@ void debug_action(action_t action) | |||
| 692 | case ACT_MACRO: dprint("ACT_MACRO"); break; | 773 | case ACT_MACRO: dprint("ACT_MACRO"); break; |
| 693 | case ACT_COMMAND: dprint("ACT_COMMAND"); break; | 774 | case ACT_COMMAND: dprint("ACT_COMMAND"); break; |
| 694 | case ACT_FUNCTION: dprint("ACT_FUNCTION"); break; | 775 | case ACT_FUNCTION: dprint("ACT_FUNCTION"); break; |
| 776 | case ACT_SWAP_HANDS: dprint("ACT_SWAP_HANDS"); break; | ||
| 695 | default: dprint("UNKNOWN"); break; | 777 | default: dprint("UNKNOWN"); break; |
| 696 | } | 778 | } |
| 697 | dprintf("[%X:%02X]", action.kind.param>>8, action.kind.param&0xff); | 779 | dprintf("[%X:%02X]", action.kind.param>>8, action.kind.param&0xff); |
diff --git a/tmk_core/common/action.h b/tmk_core/common/action.h index e8aa12a7c..b9bdfe642 100644 --- a/tmk_core/common/action.h +++ b/tmk_core/common/action.h | |||
| @@ -65,6 +65,24 @@ bool process_record_quantum(keyrecord_t *record); | |||
| 65 | #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS) | 65 | #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS) |
| 66 | extern bool disable_action_cache; | 66 | extern bool disable_action_cache; |
| 67 | #endif | 67 | #endif |
| 68 | |||
| 69 | /* Code for handling one-handed key modifiers. */ | ||
| 70 | #ifdef ONEHAND_ENABLE | ||
| 71 | extern bool swap_hands; | ||
| 72 | extern const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS]; | ||
| 73 | #if (MATRIX_COLS <= 8) | ||
| 74 | typedef uint8_t swap_state_row_t; | ||
| 75 | #elif (MATRIX_COLS <= 16) | ||
| 76 | typedef uint16_t swap_state_row_t; | ||
| 77 | #elif (MATRIX_COLS <= 32) | ||
| 78 | typedef uint32_t swap_state_row_t; | ||
| 79 | #else | ||
| 80 | #error "MATRIX_COLS: invalid value" | ||
| 81 | #endif | ||
| 82 | |||
| 83 | void process_hand_swap(keyevent_t *record); | ||
| 84 | #endif | ||
| 85 | |||
| 68 | void process_record_nocache(keyrecord_t *record); | 86 | void process_record_nocache(keyrecord_t *record); |
| 69 | void process_record(keyrecord_t *record); | 87 | void process_record(keyrecord_t *record); |
| 70 | void process_action(keyrecord_t *record, action_t action); | 88 | void process_action(keyrecord_t *record, action_t action); |
diff --git a/tmk_core/common/action_code.h b/tmk_core/common/action_code.h index ca729aaec..33da35f35 100644 --- a/tmk_core/common/action_code.h +++ b/tmk_core/common/action_code.h | |||
| @@ -108,6 +108,8 @@ enum action_kind_id { | |||
| 108 | /* Other Keys */ | 108 | /* Other Keys */ |
| 109 | ACT_USAGE = 0b0100, | 109 | ACT_USAGE = 0b0100, |
| 110 | ACT_MOUSEKEY = 0b0101, | 110 | ACT_MOUSEKEY = 0b0101, |
| 111 | /* One-hand Support */ | ||
| 112 | ACT_SWAP_HANDS = 0b0110, | ||
| 111 | /* Layer Actions */ | 113 | /* Layer Actions */ |
| 112 | ACT_LAYER = 0b1000, | 114 | ACT_LAYER = 0b1000, |
| 113 | ACT_LAYER_TAP = 0b1010, /* Layer 0-15 */ | 115 | ACT_LAYER_TAP = 0b1010, /* Layer 0-15 */ |
| @@ -178,6 +180,11 @@ typedef union { | |||
| 178 | uint8_t opt :4; | 180 | uint8_t opt :4; |
| 179 | uint8_t kind :4; | 181 | uint8_t kind :4; |
| 180 | } func; | 182 | } func; |
| 183 | struct action_swap { | ||
| 184 | uint8_t code :8; | ||
| 185 | uint8_t opt :4; | ||
| 186 | uint8_t kind :4; | ||
| 187 | } swap; | ||
| 181 | } action_t; | 188 | } action_t; |
| 182 | 189 | ||
| 183 | 190 | ||
| @@ -295,6 +302,7 @@ enum backlight_opt { | |||
| 295 | BACKLIGHT_STEP = 3, | 302 | BACKLIGHT_STEP = 3, |
| 296 | BACKLIGHT_LEVEL = 4, | 303 | BACKLIGHT_LEVEL = 4, |
| 297 | }; | 304 | }; |
| 305 | |||
| 298 | /* Macro */ | 306 | /* Macro */ |
| 299 | #define ACTION_MACRO(id) ACTION(ACT_MACRO, (id)) | 307 | #define ACTION_MACRO(id) ACTION(ACT_MACRO, (id)) |
| 300 | #define ACTION_MACRO_TAP(id) ACTION(ACT_MACRO, FUNC_TAP<<8 | (id)) | 308 | #define ACTION_MACRO_TAP(id) ACTION(ACT_MACRO, FUNC_TAP<<8 | (id)) |
| @@ -306,7 +314,7 @@ enum backlight_opt { | |||
| 306 | #define ACTION_BACKLIGHT_STEP() ACTION(ACT_BACKLIGHT, BACKLIGHT_STEP << 8) | 314 | #define ACTION_BACKLIGHT_STEP() ACTION(ACT_BACKLIGHT, BACKLIGHT_STEP << 8) |
| 307 | #define ACTION_BACKLIGHT_LEVEL(level) ACTION(ACT_BACKLIGHT, BACKLIGHT_LEVEL << 8 | (level)) | 315 | #define ACTION_BACKLIGHT_LEVEL(level) ACTION(ACT_BACKLIGHT, BACKLIGHT_LEVEL << 8 | (level)) |
| 308 | /* Command */ | 316 | /* Command */ |
| 309 | #define ACTION_COMMAND(id, opt) ACTION(ACT_COMMAND, (opt)<<8 | (addr)) | 317 | #define ACTION_COMMAND(id, opt) ACTION(ACT_COMMAND, (opt)<<8 | (id)) |
| 310 | /* Function */ | 318 | /* Function */ |
| 311 | enum function_opts { | 319 | enum function_opts { |
| 312 | FUNC_TAP = 0x8, /* indciates function is tappable */ | 320 | FUNC_TAP = 0x8, /* indciates function is tappable */ |
| @@ -314,5 +322,23 @@ enum function_opts { | |||
| 314 | #define ACTION_FUNCTION(id) ACTION(ACT_FUNCTION, (id)) | 322 | #define ACTION_FUNCTION(id) ACTION(ACT_FUNCTION, (id)) |
| 315 | #define ACTION_FUNCTION_TAP(id) ACTION(ACT_FUNCTION, FUNC_TAP<<8 | (id)) | 323 | #define ACTION_FUNCTION_TAP(id) ACTION(ACT_FUNCTION, FUNC_TAP<<8 | (id)) |
| 316 | #define ACTION_FUNCTION_OPT(id, opt) ACTION(ACT_FUNCTION, (opt)<<8 | (id)) | 324 | #define ACTION_FUNCTION_OPT(id, opt) ACTION(ACT_FUNCTION, (opt)<<8 | (id)) |
| 325 | /* OneHand Support */ | ||
| 326 | enum swap_hands_pram_tap_op { | ||
| 327 | OP_SH_TOGGLE = 0xF0, | ||
| 328 | OP_SH_TAP_TOGGLE, | ||
| 329 | OP_SH_ON_OFF, | ||
| 330 | OP_SH_OFF_ON, | ||
| 331 | OP_SH_OFF, | ||
| 332 | OP_SH_ON, | ||
| 333 | }; | ||
| 334 | |||
| 335 | #define ACTION_SWAP_HANDS() ACTION_SWAP_HANDS_ON_OFF() | ||
| 336 | #define ACTION_SWAP_HANDS_TOGGLE() ACTION(ACT_SWAP_HANDS, OP_SH_TOGGLE) | ||
| 337 | #define ACTION_SWAP_HANDS_TAP_TOGGLE() ACTION(ACT_SWAP_HANDS, OP_SH_TAP_TOGGLE) | ||
| 338 | #define ACTION_SWAP_HANDS_TAP_KEY(key) ACTION(ACT_SWAP_HANDS, key) | ||
| 339 | #define ACTION_SWAP_HANDS_ON_OFF() ACTION(ACT_SWAP_HANDS, OP_SH_ON_OFF) | ||
| 340 | #define ACTION_SWAP_HANDS_OFF_ON() ACTION(ACT_SWAP_HANDS, OP_SH_OFF_ON) | ||
| 341 | #define ACTION_SWAP_HANDS_ON() ACTION(ACT_SWAP_HANDS, OP_SH_ON) | ||
| 342 | #define ACTION_SWAP_HANDS_OFF() ACTION(ACT_SWAP_HANDS, OP_SH_OFF) | ||
| 317 | 343 | ||
| 318 | #endif /* ACTION_CODE_H */ | 344 | #endif /* ACTION_CODE_H */ |
