forked from mirrors/qmk_firmware
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b9667a4bf | ||
|
|
0cde880747 | ||
|
|
b09dc19d32 | ||
|
|
bb208f3e3b | ||
|
|
483ad4e3e0 | ||
|
|
4c2453aa1b | ||
|
|
c745d9b82e |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -54,6 +54,7 @@ util/Win_Check_Output.txt
|
||||
.vscode/tasks.json
|
||||
.vscode/last.sql
|
||||
.vscode/temp.sql
|
||||
.vscode/ipch/
|
||||
.stfolder
|
||||
.tags
|
||||
|
||||
|
||||
@@ -351,3 +351,9 @@ ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
||||
SRC += oled_driver.c
|
||||
endif
|
||||
|
||||
SPACE_CADET_ENABLE ?= yes
|
||||
ifeq ($(strip $(SPACE_CADET_ENABLE)), yes)
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_space_cadet.c
|
||||
OPT_DEFS += -DSPACE_CADET_ENABLE
|
||||
endif
|
||||
|
||||
@@ -68,8 +68,7 @@
|
||||
* [PS/2 Mouse](feature_ps2_mouse.md)
|
||||
* [RGB Lighting](feature_rgblight.md)
|
||||
* [RGB Matrix](feature_rgb_matrix.md)
|
||||
* [Space Cadet Shift](feature_space_cadet_shift.md)
|
||||
* [Space Cadet Shift Enter](feature_space_cadet_shift_enter.md)
|
||||
* [Space Cadet](feature_space_cadet.md)
|
||||
* [Stenography](feature_stenography.md)
|
||||
* [Swap Hands](feature_swap_hands.md)
|
||||
* [Tap Dance](feature_tap_dance.md)
|
||||
|
||||
59
docs/feature_space_cadet.md
Normal file
59
docs/feature_space_cadet.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# Space Cadet: The Future, Built In
|
||||
|
||||
Steve Losh described the [Space Cadet Shift](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) quite well. Essentially, when you tap Left Shift on its own, you get an opening parenthesis; tap Right Shift on its own and you get the closing one. When held, the Shift keys function as normal. Yes, it's as cool as it sounds, and now even cooler supporting Control and Alt as well!
|
||||
|
||||
## Usage
|
||||
|
||||
Firstly, in your keymap, do one of the following:
|
||||
- Replace the Left Shift key with `KC_LSPO` (Left Shift, Parenthesis Open), and Right Shift with `KC_RSPC` (Right Shift, Parenthesis Close).
|
||||
- Replace the Left Control key with `KC_LCPO` (Left Control, Parenthesis Open), and Right Control with `KC_RCPC` (Right Control, Parenthesis Close).
|
||||
- Replace the Left Alt key with `KC_LAPO` (Left Alt, Parenthesis Open), and Right Alt with `KC_RAPC` (Right Alt, Parenthesis Close).
|
||||
- Replace any Shift key in your keymap with `KC_SFTENT` (Right Shift, Enter).
|
||||
|
||||
## Keycodes
|
||||
|
||||
|Keycode |Description |
|
||||
|-----------|-------------------------------------------|
|
||||
|`KC_LSPO` |Left Shift when held, `(` when tapped |
|
||||
|`KC_RSPC` |Right Shift when held, `)` when tapped |
|
||||
|`KC_LCPO` |Left Control when held, `(` when tapped |
|
||||
|`KC_RCPC` |Right Control when held, `)` when tapped |
|
||||
|`KC_LAPO` |Left Alt when held, `(` when tapped |
|
||||
|`KC_RAPC` |Right Alt when held, `)` when tapped |
|
||||
|`KC_SFTENT`|Right Shift when held, `Enter` when tapped |
|
||||
|
||||
## Caveats
|
||||
|
||||
Space Cadet's functionality can conflict with the default Command functionality when both Shift keys are held at the same time. See the [Command feature](feature_command.md) for info on how to change it, or make sure that Command is disabled in your `rules.mk` with:
|
||||
|
||||
```make
|
||||
COMMAND_ENABLE = no
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
By default Space Cadet assumes a US ANSI layout, but if your layout uses different keys for parentheses, you can redefine them in your `config.h`. In addition, you can redefine the modifier to send on tap, or even send no modifier at all. The new configuration defines bundle all options up into a single define of 3 key codes in this order: the `Modifier` when held or when used with other keys, the `Tap Modifer` sent when tapped (no modifier if `KC_TRNS`), finally the `Keycode` sent when tapped. Now keep in mind, mods from other keys will still apply to the `Keycode` if say `KC_RSFT` is held while tapping `KC_LSPO` key with `KC_TRNS` as the `Tap Modifer`.
|
||||
|
||||
|Define |Default |Description |
|
||||
|----------------|-------------------------------|---------------------------------------------------------------------------------|
|
||||
|`LSPO_KEYS` |`KC_LSFT, LSPO_MOD, LSPO_KEY` |Send `KC_LSFT` when held, the mod and key defined by `LSPO_MOD` and `LSPO_KEY`. |
|
||||
|`RSPC_KEYS` |`KC_RSFT, RSPC_MOD, RSPC_KEY` |Send `KC_RSFT` when held, the mod and key defined by `RSPC_MOD` and `RSPC_KEY`. |
|
||||
|`LCPO_KEYS` |`KC_LCTL, KC_LCTL, KC_9` |Send `KC_LCTL` when held, the mod `KC_LCTL` with the key `KC_9` when tapped. |
|
||||
|`RCPO_KEYS` |`KC_RCTL, KC_RCTL, KC_0` |Send `KC_RCTL` when held, the mod `KC_RCTL` with the key `KC_0` when tapped. |
|
||||
|`LAPO_KEYS` |`KC_LALT, KC_LALT, KC_9` |Send `KC_LALT` when held, the mod `KC_LALT` with the key `KC_9` when tapped. |
|
||||
|`RAPO_KEYS` |`KC_RALT, KC_RALT, KC_0` |Send `KC_RALT` when held, the mod `KC_RALT` with the key `KC_0` when tapped. |
|
||||
|`SFTENT_KEYS` |`KC_RSFT, KC_TRNS, SFTENT_KEY` |Send `KC_RSFT` when held, no mod with the key `SFTENT_KEY` when tapped. |
|
||||
|
||||
|
||||
## Obsolete Configuration
|
||||
|
||||
These defines are used in the above defines internally to support backwards compatibility, so you may continue to use them, however the above defines open up a larger range of flexibility than before. As an example, say you want to not send any modifier when you tap just `KC_LSPO`, with the old defines you had an all or nothing choice of using the `DISABLE_SPACE_CADET_MODIFIER` define. Now you can define that key as: `#define KC_LSPO_KEYS KC_LSFT, KC_TRNS, KC_9`. This tells the system to set Left Shift if held or used with other keys, then on tap send no modifier (transparent) with the `KC_9`
|
||||
|
||||
|Define |Default |Description |
|
||||
|------------------------------|-------------|------------------------------------------------------------------|
|
||||
|`LSPO_KEY` |`KC_9` |The keycode to send when Left Shift is tapped |
|
||||
|`RSPC_KEY` |`KC_0` |The keycode to send when Right Shift is tapped |
|
||||
|`LSPO_MOD` |`KC_LSFT` |The modifier to apply to `LSPO_KEY` |
|
||||
|`RSPC_MOD` |`KC_RSFT` |The modifier to apply to `RSPC_KEY` |
|
||||
|`SFTENT_KEY` |`KC_ENT` |The keycode to send when the Shift key is tapped |
|
||||
|`DISABLE_SPACE_CADET_MODIFIER`|*Not defined*|If defined, prevent the Space Cadet from applying a modifier |
|
||||
@@ -1,37 +0,0 @@
|
||||
# Space Cadet Shift: The Future, Built In
|
||||
|
||||
Steve Losh described the [Space Cadet Shift](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) quite well. Essentially, when you tap Left Shift on its own, you get an opening parenthesis; tap Right Shift on its own and you get the closing one. When held, the Shift keys function as normal. Yes, it's as cool as it sounds.
|
||||
|
||||
## Usage
|
||||
|
||||
Replace the Left Shift key in your keymap with `KC_LSPO` (Left Shift, Parenthesis Open), and Right Shift with `KC_RSPC` (Right Shift, Parenthesis Close).
|
||||
|
||||
## Keycodes
|
||||
|
||||
|Keycode |Description |
|
||||
|---------|--------------------------------------|
|
||||
|`KC_LSPO`|Left Shift when held, `(` when tapped |
|
||||
|`KC_RSPC`|Right Shift when held, `)` when tapped|
|
||||
|
||||
## Caveats
|
||||
|
||||
Space Cadet's functionality can conflict with the default Command functionality when both Shift keys are held at the same time. Make sure that Command is disabled in your `rules.mk` with:
|
||||
|
||||
```make
|
||||
COMMAND_ENABLE = no
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
By default Space Cadet assumes a US ANSI layout, but if your layout uses different keys for parentheses, you can redefine them in your `config.h`.
|
||||
You can also disable the rollover, allowing you to use the opposite Shift key to cancel the Space Cadet state in the event of an erroneous press, instead of emitting a pair of parentheses when the keys are released.
|
||||
Also, by default, the Space Cadet applies modifiers LSPO_MOD and RSPC_MOD to keys defined by LSPO_KEY and RSPC_KEY. You can override this behavior by redefining those variables in your `config.h`. You can also prevent the Space Cadet to apply a modifier by defining DISABLE_SPACE_CADET_MODIFIER in your `config.h`.
|
||||
|
||||
|Define |Default |Description |
|
||||
|------------------------------|-------------|--------------------------------------------------------------------------------|
|
||||
|`LSPO_KEY` |`KC_9` |The keycode to send when Left Shift is tapped |
|
||||
|`RSPC_KEY` |`KC_0` |The keycode to send when Right Shift is tapped |
|
||||
|`LSPO_MOD` |`KC_LSFT` |The keycode to send when Left Shift is tapped |
|
||||
|`RSPC_MOD` |`KC_RSFT` |The keycode to send when Right Shift is tapped |
|
||||
|`DISABLE_SPACE_CADET_ROLLOVER`|*Not defined*|If defined, use the opposite Shift key to cancel Space Cadet |
|
||||
|`DISABLE_SPACE_CADET_MODIFIER`|*Not defined*|If defined, prevent the Space Cadet to apply a modifier to LSPO_KEY and RSPC_KEY|
|
||||
@@ -1,31 +0,0 @@
|
||||
# Space Cadet Shift Enter
|
||||
|
||||
Based on the [Space Cadet Shift](feature_space_cadet_shift.md) feature. Tap the Shift key on its own, and it behaves like Enter. When held, the Shift functions as normal.
|
||||
|
||||
## Usage
|
||||
|
||||
Replace any Shift key in your keymap with `KC_SFTENT` (Shift, Enter), and you're done.
|
||||
|
||||
## Keycodes
|
||||
|
||||
|Keycode |Description |
|
||||
|-----------|----------------------------------------|
|
||||
|`KC_SFTENT`|Right Shift when held, Enter when tapped|
|
||||
|
||||
## Caveats
|
||||
|
||||
As with Space Cadet Shift, this feature may conflict with Command, so it should be disabled in your `rules.mk` with:
|
||||
|
||||
```make
|
||||
COMMAND_ENABLE = no
|
||||
```
|
||||
|
||||
This feature also uses the same timers as Space Cadet Shift, so using them in tandem may produce strange results.
|
||||
|
||||
## Configuration
|
||||
|
||||
By default Space Cadet assumes a US ANSI layout, but if you'd like to use a different key for Enter, you can redefine it in your `config.h`:
|
||||
|
||||
|Define |Default |Description |
|
||||
|------------|--------|------------------------------------------------|
|
||||
|`SFTENT_KEY`|`KC_ENT`|The keycode to send when the Shift key is tapped|
|
||||
56
keyboards/butterstick/butterstick.c
Normal file
56
keyboards/butterstick/butterstick.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/* Copyright 2019 Jeremy Bernhardt
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "butterstick.h"
|
||||
|
||||
// Optional override functions below.
|
||||
// You can leave any or all of these undefined.
|
||||
// These are only required if you want to perform custom actions.
|
||||
|
||||
/*
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
// put your keyboard start-up code here
|
||||
// runs once when the firmware starts up
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
*/
|
||||
|
||||
void matrix_scan_kb(void) {
|
||||
#ifdef DEBUG_MATRIX
|
||||
for (uint8_t c = 0; c < MATRIX_COLS; c++)
|
||||
for (uint8_t r = 0; r < MATRIX_ROWS; r++)
|
||||
if (matrix_is_on(r, c)) xprintf("r:%d c:%d \n", r, c);
|
||||
#endif
|
||||
|
||||
matrix_scan_user();
|
||||
}
|
||||
|
||||
/*
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
// put your per-action keyboard code here
|
||||
// runs for every action, just before processing by the firmware
|
||||
|
||||
return process_record_user(keycode, record);
|
||||
}
|
||||
|
||||
void led_set_kb(uint8_t usb_led) {
|
||||
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
||||
|
||||
led_set_user(usb_led);
|
||||
}
|
||||
|
||||
*/
|
||||
11
keyboards/butterstick/butterstick.h
Normal file
11
keyboards/butterstick/butterstick.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#define LAYOUT_butter( \
|
||||
k09, k08, k07, k06, k05, k04, k03, k02, k01, k00, \
|
||||
k19, k18, k17, k16, k15, k14, k13, k12, k11, k10 \
|
||||
) { \
|
||||
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09}, \
|
||||
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19}, \
|
||||
}
|
||||
26
keyboards/butterstick/config.h
Normal file
26
keyboards/butterstick/config.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0x1337
|
||||
#define DEVICE_VER 0x0001
|
||||
#define MANUFACTURER g Heavy Industries
|
||||
#define PRODUCT Butter Stick
|
||||
#define DESCRIPTION Its a stick of butter
|
||||
#define VERSION "Paula Deen"
|
||||
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define FORCE_NKRO
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 2
|
||||
#define MATRIX_COLS 10
|
||||
#define MATRIX_ROW_PINS { F4, F5 }
|
||||
#define MATRIX_COL_PINS { B0, B1, B2, B3, B4, B5, B6, B7, C6, C7}
|
||||
#define UNUSED_PINS
|
||||
|
||||
/* COL2ROW, ROW2COL*/
|
||||
#define DIODE_DIRECTION ROW2COL
|
||||
|
||||
183
keyboards/butterstick/keymaps/default/keymap.c
Normal file
183
keyboards/butterstick/keymaps/default/keymap.c
Normal file
@@ -0,0 +1,183 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "sten.h"
|
||||
/*
|
||||
* Key names are inherited from steno machines
|
||||
* .-----------------------------------------------------.
|
||||
* | LSU | LFT | LP | LH | ST1 | RF | RP | RL | RT | RD |
|
||||
* |-----------------------------------------------------|
|
||||
* | LSD | LK | LW | LR | ST2 | RR | RB | RG | RS | RZ |
|
||||
* '-----------------------------------------------------'
|
||||
*/
|
||||
|
||||
// Function prefixes
|
||||
#define MEDIA (LSD | LK | LW | LR)
|
||||
#define FUNCT (LSD | LK | LP | LH)
|
||||
#define MOVE (LSU | LFT | LP | LH)
|
||||
#define SYMB (RD | RZ)
|
||||
#define NUMA (LW | LR)
|
||||
#define NUMB (RR | RB)
|
||||
|
||||
// QMK Layer Numbers
|
||||
#define BASE 0
|
||||
#define GAME 1
|
||||
|
||||
// Do not change QMK Layer 0! This is your main keyboard.
|
||||
// Make your QMK modifications to the later layers, to add
|
||||
// keys/customize on the first layer modify processQwerty():
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[BASE] = LAYOUT_butter(
|
||||
STN_S1, STN_TL, STN_PL, STN_HL, STN_ST1, STN_FR, STN_PR, STN_LR, STN_TR, STN_DR,
|
||||
STN_S2, STN_KL, STN_WL, STN_RL, STN_ST2, STN_RR, STN_BR, STN_GR, STN_SR, STN_ZR
|
||||
),
|
||||
// I don't game don't roast me thanks
|
||||
[GAME] = LAYOUT_butter(
|
||||
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_ENT,
|
||||
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, TO(BASE)
|
||||
)
|
||||
};
|
||||
|
||||
// Note: You can only use basic keycodes here!
|
||||
// P() is just a wrapper to make your life easier, any C code can be executed.
|
||||
// Only the longest matched chord is run!
|
||||
//
|
||||
// http://docs.gboards.ca
|
||||
uint32_t processQwerty(bool lookup) {
|
||||
// SECRET AGENT CHORDS
|
||||
P( LSU | LK | RS | RD, SEND_STRING(VERSION); SEND_STRING(__DATE__));
|
||||
P( LSD | RZ, SEND(KC_SPC));
|
||||
|
||||
// Dual chords
|
||||
P( LP | LH, CLICK_MOUSE(KC_MS_BTN2));
|
||||
P( ST1 | RF, CLICK_MOUSE(KC_MS_BTN1));
|
||||
P( LSU | LFT, SEND(KC_ESC));
|
||||
P( LSD | LK, SEND(KC_LSFT));
|
||||
P( RZ | RS, SEND(KC_LSFT));
|
||||
P( ST2 | RR, SEND(KC_SPC));
|
||||
P( RP | RL, SEND(KC_LGUI));
|
||||
P( RT | RD, SEND(KC_LCTL));
|
||||
P( RL | RT, SEND(KC_LALT));
|
||||
P( LSU | LSD | LFT | LK, SEND(KC_LCTL));
|
||||
P( RS | RT | RD | RZ, SEND(KC_ENT));
|
||||
|
||||
// Function Layer
|
||||
P( FUNCT | RF, SEND(KC_F1));
|
||||
P( FUNCT | RP, SEND(KC_F2));
|
||||
P( FUNCT | RL, SEND(KC_F3));
|
||||
P( FUNCT | RT, SEND(KC_F4));
|
||||
P( FUNCT | RF | RR, SEND(KC_F5));
|
||||
P( FUNCT | RP | RB, SEND(KC_F6));
|
||||
P( FUNCT | RL | RG, SEND(KC_F7));
|
||||
P( FUNCT | RT | RS, SEND(KC_F8));
|
||||
P( FUNCT | RR, SEND(KC_F9));
|
||||
P( FUNCT | RB, SEND(KC_F10));
|
||||
P( FUNCT | RG, SEND(KC_F11));
|
||||
P( FUNCT | RS, SEND(KC_F12));
|
||||
|
||||
// Movement Layer
|
||||
P( MOVE | RF, SEND(KC_LEFT));
|
||||
P( MOVE | RP, SEND(KC_DOWN));
|
||||
P( MOVE | RL, SEND(KC_UP));
|
||||
P( MOVE | RT, SEND(KC_RIGHT));
|
||||
P( MOVE | ST1, SEND(KC_PGUP));
|
||||
P( MOVE | ST2, SEND(KC_PGDN));
|
||||
|
||||
// Media Layer
|
||||
P( MEDIA | RF, SEND(KC_MPRV));
|
||||
P( MEDIA | RP, SEND(KC_MPLY));
|
||||
P( MEDIA | RL, SEND(KC_MPLY));
|
||||
P( MEDIA | RT, SEND(KC_MNXT));
|
||||
P( MEDIA | RG, SEND(KC_VOLU));
|
||||
P( MEDIA | RB, SEND(KC_VOLD));
|
||||
P( MEDIA | RS, SEND(KC_MUTE));
|
||||
|
||||
// Number Row, Right
|
||||
P( NUMB | LSU, SEND(KC_1));
|
||||
P( NUMB | LFT, SEND(KC_2));
|
||||
P( NUMB | LP, SEND(KC_3));
|
||||
P( NUMB | LH, SEND(KC_4));
|
||||
P( NUMB | ST1, SEND(KC_5));
|
||||
P( NUMB | RF, SEND(KC_6));
|
||||
P( NUMB | RP, SEND(KC_7));
|
||||
P( NUMB | RL, SEND(KC_8));
|
||||
P( NUMB | RT, SEND(KC_9));
|
||||
P( NUMB | RD, SEND(KC_0));
|
||||
|
||||
// Number Row, Left
|
||||
P( NUMA | LSU, SEND(KC_1));
|
||||
P( NUMA | LFT, SEND(KC_2));
|
||||
P( NUMA | LP, SEND(KC_3));
|
||||
P( NUMA | LH, SEND(KC_4));
|
||||
P( NUMA | ST1, SEND(KC_5));
|
||||
P( NUMA | RF, SEND(KC_6));
|
||||
P( NUMA | RP, SEND(KC_7));
|
||||
P( NUMA | RL, SEND(KC_8));
|
||||
P( NUMA | RT, SEND(KC_9));
|
||||
P( NUMA | RD, SEND(KC_0));
|
||||
|
||||
|
||||
// Symbols and Numbers
|
||||
P( SYMB | LP | LW, SEND(KC_LSFT); SEND(KC_9)); // (
|
||||
P( SYMB | LH | LR, SEND(KC_LSFT); SEND(KC_0)); // )
|
||||
P( SYMB | ST1 | ST2, SEND(KC_GRV)); // `
|
||||
P( SYMB | RR | RF, SEND(KC_LSFT); SEND(KC_3)); // #
|
||||
P( SYMB | LFT | LK, SEND(KC_LSFT); SEND(KC_4)); // $
|
||||
P( SYMB | LSU, SEND(KC_LSFT); SEND(KC_1)); // !
|
||||
P( SYMB | LSD, SEND(KC_LSFT); SEND(KC_5)); // %
|
||||
P( SYMB | LFT, SEND(KC_LSFT); SEND(KC_2)); // @
|
||||
P( SYMB | LK, SEND(KC_LSFT); SEND(KC_6)); // ^
|
||||
P( SYMB | LP, SEND(KC_LSFT); SEND(KC_LBRC)); // {
|
||||
P( SYMB | LW, SEND(KC_LBRC));
|
||||
P( SYMB | LH, SEND(KC_LSFT); SEND(KC_RBRC)); // }
|
||||
P( SYMB | LR, SEND(KC_RBRC));
|
||||
P( SYMB | ST1, SEND(KC_LSFT); SEND(KC_BSLS)); // |
|
||||
P( SYMB | ST2, SEND(KC_LSFT); SEND(KC_GRV)); // ~
|
||||
P( SYMB | RP | RB, SEND(KC_QUOT));
|
||||
P( SYMB | RP | RG, SEND(KC_LSFT); SEND(KC_QUOT)); // "
|
||||
P( SYMB | RF, SEND(KC_KP_PLUS));
|
||||
P( SYMB | RR, SEND(KC_LSFT); SEND(KC_7)); // &
|
||||
P( SYMB | RP, SEND(KC_MINS));
|
||||
P( SYMB | RB, SEND(KC_EQL));
|
||||
P( SYMB | RL, SEND(KC_SLSH));
|
||||
P( SYMB | RG, SEND(KC_COMM));
|
||||
P( SYMB | RT, SEND(KC_PAST));
|
||||
P( SYMB | RS, SEND(KC_DOT));
|
||||
|
||||
// Letters
|
||||
P( LSU | LSD, SEND(KC_A));
|
||||
P( LFT | LK, SEND(KC_S));
|
||||
P( LP | LW, SEND(KC_D));
|
||||
P( LH | LR, SEND(KC_F));
|
||||
P( ST1 | ST2, SEND(KC_G));
|
||||
P( RF | RR, SEND(KC_H));
|
||||
P( RT | RS, SEND(KC_L));
|
||||
P( RD | RZ, SEND(KC_SCLN));
|
||||
P( RG | RL, SEND(KC_K));
|
||||
P( RP | RB, SEND(KC_J));
|
||||
P( LSU, SEND(KC_Q));
|
||||
P( LSD, SEND(KC_Z));
|
||||
P( LFT, SEND(KC_W));
|
||||
P( LK, SEND(KC_X));
|
||||
P( LP, SEND(KC_E));
|
||||
P( LW, SEND(KC_C));
|
||||
P( LH, SEND(KC_R));
|
||||
P( LR, SEND(KC_V));
|
||||
P( ST1, SEND(KC_T));
|
||||
P( ST2, SEND(KC_B));
|
||||
P( RF, SEND(KC_Y));
|
||||
P( RR, SEND(KC_N));
|
||||
P( RP, SEND(KC_U));
|
||||
P( RB, SEND(KC_M));
|
||||
P( RL, SEND(KC_I));
|
||||
P( RG, SEND(KC_COMM));
|
||||
P( RT, SEND(KC_O));
|
||||
P( RS, SEND(KC_DOT));
|
||||
P( RD, SEND(KC_P));
|
||||
P( RZ, SEND(KC_SLSH));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Don't fuck with this, thanks.
|
||||
size_t keymapsCount = sizeof(keymaps)/sizeof(keymaps[0]);
|
||||
0
keyboards/butterstick/keymaps/default/rules.mk
Normal file
0
keyboards/butterstick/keymaps/default/rules.mk
Normal file
14
keyboards/butterstick/readme.md
Normal file
14
keyboards/butterstick/readme.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Butter Stick
|
||||
|
||||

|
||||
|
||||
A chorded 20% keyboard packing full sized useage into your pocket. More info on [gboards.ca](http://docs.gboards.ca/Meet-Butter-Stick)!
|
||||
|
||||
Keyboard Maintainer: [Germ](https://github.com/germ)
|
||||
Hardware Availability: [g Heavy Industries](https://www.gboards.ca/product/butter-stick-limited-edition)
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make butterstick:default
|
||||
|
||||
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
||||
19
keyboards/butterstick/rules.mk
Normal file
19
keyboards/butterstick/rules.mk
Normal file
@@ -0,0 +1,19 @@
|
||||
# MCU name
|
||||
MCU = atmega32u4
|
||||
F_CPU = 16000000
|
||||
ARCH = AVR8
|
||||
F_USB = $(F_CPU)
|
||||
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT -DONLYQWERTY -DDEBUG_MATRIX
|
||||
SRC += sten.c
|
||||
EXTRAFLAGS += -flto
|
||||
|
||||
|
||||
BOOTLOADER = atmel-dfu
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
STENO_ENABLE = yes # Needed for chording
|
||||
|
||||
367
keyboards/butterstick/sten.c
Normal file
367
keyboards/butterstick/sten.c
Normal file
@@ -0,0 +1,367 @@
|
||||
#include "sten.h"
|
||||
|
||||
// Chord state
|
||||
uint32_t cChord = 0; // Current Chord
|
||||
int chordIndex = 0; // Keys in previousachord
|
||||
int32_t chordState[32]; // Full Chord history
|
||||
#define QWERBUF 24 // Size of chords to buffer for output
|
||||
|
||||
bool repeatFlag = false; // Should we repeat?
|
||||
uint32_t pChord = 0; // Previous Chord
|
||||
int pChordIndex = 0; // Keys in previousachord
|
||||
uint32_t pChordState[32]; // Previous chord sate
|
||||
uint32_t stickyBits = 0; // Or'd with every incoming press
|
||||
|
||||
// Mode state
|
||||
enum MODE { STENO = 0, QWERTY, COMMAND };
|
||||
enum MODE pMode;
|
||||
bool QWERSTENO = false;
|
||||
#ifdef ONLYQWERTY
|
||||
enum MODE cMode = QWERTY;
|
||||
#else
|
||||
enum MODE cMode = STENO;
|
||||
#endif
|
||||
|
||||
// Command State
|
||||
#define MAX_CMD_BUF 20
|
||||
uint8_t CMDLEN = 0;
|
||||
uint8_t CMDBUF[MAX_CMD_BUF];
|
||||
|
||||
// Key Repeat state
|
||||
bool inChord = false;
|
||||
bool repEngaged = false;
|
||||
uint16_t repTimer = 0;
|
||||
#define REP_INIT_DELAY 750
|
||||
#define REP_DELAY 25
|
||||
|
||||
// Mousekeys state
|
||||
bool inMouse = false;
|
||||
int8_t mousePress;
|
||||
|
||||
// All processing done at chordUp goes through here
|
||||
// Note, this is a gutted version of the Georgi sten.h
|
||||
bool send_steno_chord_user(steno_mode_t mode, uint8_t chord[6]) {
|
||||
// Check for mousekeys, this is release
|
||||
#ifdef MOUSEKEY_ENABLE
|
||||
if (inMouse) {
|
||||
inMouse = false;
|
||||
mousekey_off(mousePress);
|
||||
mousekey_send();
|
||||
}
|
||||
#endif
|
||||
|
||||
// handle command mode
|
||||
if (cChord == (LSU | LSD | RD | RZ)) {
|
||||
if (cMode != COMMAND) { // Entering Command Mode
|
||||
CMDLEN = 0;
|
||||
pMode = cMode;
|
||||
cMode = COMMAND;
|
||||
} else { // Exiting Command Mode
|
||||
cMode = pMode;
|
||||
|
||||
// Press all and release all
|
||||
for (int i = 0; i < CMDLEN; i++) {
|
||||
register_code(CMDBUF[i]);
|
||||
}
|
||||
clear_keyboard();
|
||||
}
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
// Handle Gaming Toggle,
|
||||
if (cChord == (LSU | LSD | LFT | LK | RT | RS | RD | RZ) && keymapsCount > 1) {
|
||||
#ifndef NO_DEBUG
|
||||
uprintf("Switching to QMK\n");
|
||||
#endif
|
||||
layer_on(1);
|
||||
goto out;
|
||||
}
|
||||
|
||||
// Do QWERTY and Momentary QWERTY
|
||||
if (cMode == QWERTY || (cMode == COMMAND)) {
|
||||
processChord(false);
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
cChord = 0;
|
||||
inChord = false;
|
||||
chordIndex = 0;
|
||||
clear_keyboard();
|
||||
repEngaged = false;
|
||||
for (int i = 0; i < 32; i++)
|
||||
chordState[i] = 0xFFFF;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Update Chord State
|
||||
bool process_steno_user(uint16_t keycode, keyrecord_t *record) {
|
||||
// Everything happens in here when steno keys come in.
|
||||
// Bail on keyup
|
||||
if (!record->event.pressed) return true;
|
||||
|
||||
// Update key repeat timers
|
||||
repTimer = timer_read();
|
||||
inChord = true;
|
||||
|
||||
// Switch on the press adding to chord
|
||||
bool pr = record->event.pressed;
|
||||
switch (keycode) {
|
||||
// Mods and stuff
|
||||
case STN_ST1: pr ? (cChord |= (ST1)): (cChord &= ~(ST1)); break;
|
||||
case STN_ST2: pr ? (cChord |= (ST2)): (cChord &= ~(ST2)); break;
|
||||
case STN_ST3: pr ? (cChord |= (ST3)): (cChord &= ~(ST3)); break;
|
||||
case STN_ST4: pr ? (cChord |= (ST4)): (cChord &= ~(ST4)); break;
|
||||
case STN_FN: pr ? (cChord |= (FN)) : (cChord &= ~(FN)); break;
|
||||
case STN_PWR: pr ? (cChord |= (PWR)): (cChord &= ~(PWR)); break;
|
||||
case STN_N1...STN_N6: pr ? (cChord |= (LNO)): (cChord &= ~(LNO)); break;
|
||||
case STN_N7...STN_NC: pr ? (cChord |= (RNO)): (cChord &= ~(RNO)); break;
|
||||
|
||||
// All the letter keys
|
||||
case STN_S1: pr ? (cChord |= (LSU)) : (cChord &= ~(LSU)); break;
|
||||
case STN_S2: pr ? (cChord |= (LSD)) : (cChord &= ~(LSD)); break;
|
||||
case STN_TL: pr ? (cChord |= (LFT)) : (cChord &= ~(LFT)); break;
|
||||
case STN_KL: pr ? (cChord |= (LK)) : (cChord &= ~(LK)); break;
|
||||
case STN_PL: pr ? (cChord |= (LP)) : (cChord &= ~(LP)); break;
|
||||
case STN_WL: pr ? (cChord |= (LW)) : (cChord &= ~(LW)); break;
|
||||
case STN_HL: pr ? (cChord |= (LH)) : (cChord &= ~(LH)); break;
|
||||
case STN_RL: pr ? (cChord |= (LR)) : (cChord &= ~(LR)); break;
|
||||
case STN_A: pr ? (cChord |= (LA)) : (cChord &= ~(LA)); break;
|
||||
case STN_O: pr ? (cChord |= (LO)) : (cChord &= ~(LO)); break;
|
||||
case STN_E: pr ? (cChord |= (RE)) : (cChord &= ~(RE)); break;
|
||||
case STN_U: pr ? (cChord |= (RU)) : (cChord &= ~(RU)); break;
|
||||
case STN_FR: pr ? (cChord |= (RF)) : (cChord &= ~(RF)); break;
|
||||
case STN_RR: pr ? (cChord |= (RR)) : (cChord &= ~(RR)); break;
|
||||
case STN_PR: pr ? (cChord |= (RP)) : (cChord &= ~(RP)); break;
|
||||
case STN_BR: pr ? (cChord |= (RB)) : (cChord &= ~(RB)); break;
|
||||
case STN_LR: pr ? (cChord |= (RL)) : (cChord &= ~(RL)); break;
|
||||
case STN_GR: pr ? (cChord |= (RG)) : (cChord &= ~(RG)); break;
|
||||
case STN_TR: pr ? (cChord |= (RT)) : (cChord &= ~(RT)); break;
|
||||
case STN_SR: pr ? (cChord |= (RS)) : (cChord &= ~(RS)); break;
|
||||
case STN_DR: pr ? (cChord |= (RD)) : (cChord &= ~(RD)); break;
|
||||
case STN_ZR: pr ? (cChord |= (RZ)) : (cChord &= ~(RZ)); break;
|
||||
}
|
||||
|
||||
// Store previous state for fastQWER
|
||||
if (pr) {
|
||||
chordState[chordIndex] = cChord;
|
||||
chordIndex++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
void matrix_scan_user(void) {
|
||||
// We abuse this for early sending of key
|
||||
// Key repeat only on QWER/SYMB layers
|
||||
if (cMode != QWERTY || !inChord) return;
|
||||
|
||||
// Check timers
|
||||
#ifndef NO_REPEAT
|
||||
if (repEngaged && timer_elapsed(repTimer) > REP_DELAY) {
|
||||
// Process Key for report
|
||||
processChord(false);
|
||||
|
||||
// Send report to host
|
||||
send_keyboard_report();
|
||||
clear_keyboard();
|
||||
repTimer = timer_read();
|
||||
}
|
||||
|
||||
if (!repEngaged && timer_elapsed(repTimer) > REP_INIT_DELAY) {
|
||||
repEngaged = true;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
// For Plover NKRO
|
||||
uint32_t processFakeSteno(bool lookup) {
|
||||
P( LSU, SEND(KC_Q););
|
||||
P( LSD, SEND(KC_A););
|
||||
P( LFT, SEND(KC_W););
|
||||
P( LP, SEND(KC_E););
|
||||
P( LH, SEND(KC_R););
|
||||
P( LK, SEND(KC_S););
|
||||
P( LW, SEND(KC_D););
|
||||
P( LR, SEND(KC_F););
|
||||
P( ST1, SEND(KC_T););
|
||||
P( ST2, SEND(KC_G););
|
||||
P( LA, SEND(KC_C););
|
||||
P( LO, SEND(KC_V););
|
||||
P( RE, SEND(KC_N););
|
||||
P( RU, SEND(KC_M););
|
||||
P( ST3, SEND(KC_Y););
|
||||
P( ST4, SEND(KC_H););
|
||||
P( RF, SEND(KC_U););
|
||||
P( RP, SEND(KC_I););
|
||||
P( RL, SEND(KC_O););
|
||||
P( RT, SEND(KC_P););
|
||||
P( RD, SEND(KC_LBRC););
|
||||
P( RR, SEND(KC_J););
|
||||
P( RB, SEND(KC_K););
|
||||
P( RG, SEND(KC_L););
|
||||
P( RS, SEND(KC_SCLN););
|
||||
P( RZ, SEND(KC_COMM););
|
||||
P( LNO, SEND(KC_1););
|
||||
P( RNO, SEND(KC_1););
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Traverse the chord history to a given point
|
||||
// Returns the mask to use
|
||||
void processChord(bool useFakeSteno) {
|
||||
// Save the clean chord state
|
||||
uint32_t savedChord = cChord;
|
||||
|
||||
// Apply Stick Bits if needed
|
||||
if (stickyBits != 0) {
|
||||
cChord |= stickyBits;
|
||||
for (int i = 0; i <= chordIndex; i++)
|
||||
chordState[i] |= stickyBits;
|
||||
}
|
||||
|
||||
// Strip FN
|
||||
if (cChord & FN) cChord ^= FN;
|
||||
|
||||
// First we test if a whole chord was passsed
|
||||
// If so we just run it handling repeat logic
|
||||
if (useFakeSteno && processFakeSteno(true) == cChord) {
|
||||
processFakeSteno(false);
|
||||
return;
|
||||
} else if (processQwerty(true) == cChord) {
|
||||
processQwerty(false);
|
||||
// Repeat logic
|
||||
if (repeatFlag) {
|
||||
restoreState();
|
||||
repeatFlag = false;
|
||||
processChord(false);
|
||||
} else {
|
||||
saveState(cChord);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Iterate through chord picking out the individual
|
||||
// and longest chords
|
||||
uint32_t bufChords[QWERBUF];
|
||||
int bufLen = 0;
|
||||
uint32_t mask = 0;
|
||||
|
||||
// We iterate over it multiple times to catch the longest
|
||||
// chord. Then that gets addded to the mask and re run.
|
||||
while (savedChord != mask) {
|
||||
uint32_t test = 0;
|
||||
uint32_t longestChord = 0;
|
||||
|
||||
for (int i = 0; i <= chordIndex; i++) {
|
||||
cChord = chordState[i] & ~mask;
|
||||
if (cChord == 0)
|
||||
continue;
|
||||
|
||||
// Assume mid parse Sym is new chord
|
||||
if (i != 0 && test != 0 && (cChord ^ test) == PWR) {
|
||||
longestChord = test;
|
||||
break;
|
||||
}
|
||||
|
||||
// Lock SYM layer in once detected
|
||||
if (mask & PWR)
|
||||
cChord |= PWR;
|
||||
|
||||
|
||||
// Testing for keycodes
|
||||
if (useFakeSteno) {
|
||||
test = processFakeSteno(true);
|
||||
} else {
|
||||
test = processQwerty(true);
|
||||
}
|
||||
|
||||
if (test != 0) {
|
||||
longestChord = test;
|
||||
}
|
||||
}
|
||||
|
||||
mask |= longestChord;
|
||||
bufChords[bufLen] = longestChord;
|
||||
bufLen++;
|
||||
|
||||
// That's a loop of sorts, halt processing
|
||||
if (bufLen >= QWERBUF) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Now that the buffer is populated, we run it
|
||||
for (int i = 0; i < bufLen ; i++) {
|
||||
cChord = bufChords[i];
|
||||
if (useFakeSteno) {
|
||||
processFakeSteno(false);
|
||||
} else {
|
||||
processQwerty(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Save state in case of repeat
|
||||
if (!repeatFlag) {
|
||||
saveState(savedChord);
|
||||
}
|
||||
|
||||
// Restore cChord for held repeat
|
||||
cChord = savedChord;
|
||||
|
||||
return;
|
||||
}
|
||||
void saveState(uint32_t cleanChord) {
|
||||
pChord = cleanChord;
|
||||
pChordIndex = chordIndex;
|
||||
for (int i = 0; i < 32; i++)
|
||||
pChordState[i] = chordState[i];
|
||||
}
|
||||
void restoreState() {
|
||||
cChord = pChord;
|
||||
chordIndex = pChordIndex;
|
||||
for (int i = 0; i < 32; i++)
|
||||
chordState[i] = pChordState[i];
|
||||
}
|
||||
|
||||
// Macros for calling from keymap.c
|
||||
void SEND(uint8_t kc) {
|
||||
// Send Keycode, Does not work for Quantum Codes
|
||||
if (cMode == COMMAND && CMDLEN < MAX_CMD_BUF) {
|
||||
#ifndef NO_DEBUG
|
||||
uprintf("CMD LEN: %d BUF: %d\n", CMDLEN, MAX_CMD_BUF);
|
||||
#endif
|
||||
CMDBUF[CMDLEN] = kc;
|
||||
CMDLEN++;
|
||||
}
|
||||
|
||||
if (cMode != COMMAND) register_code(kc);
|
||||
return;
|
||||
}
|
||||
void REPEAT(void) {
|
||||
if (cMode != QWERTY)
|
||||
return;
|
||||
|
||||
repeatFlag = true;
|
||||
return;
|
||||
}
|
||||
void SET_STICKY(uint32_t stick) {
|
||||
stickyBits = stick;
|
||||
return;
|
||||
}
|
||||
void SWITCH_LAYER(int layer) {
|
||||
if (keymapsCount >= layer)
|
||||
layer_on(layer);
|
||||
}
|
||||
void CLICK_MOUSE(uint8_t kc) {
|
||||
#ifdef MOUSEKEY_ENABLE
|
||||
mousekey_on(kc);
|
||||
mousekey_send();
|
||||
|
||||
// Store state for later use
|
||||
inMouse = true;
|
||||
mousePress = kc;
|
||||
#endif
|
||||
}
|
||||
77
keyboards/butterstick/sten.h
Normal file
77
keyboards/butterstick/sten.h
Normal file
@@ -0,0 +1,77 @@
|
||||
// 2019, g Heavy Industries
|
||||
// Blessed mother of Christ, please keep this readable
|
||||
// and protect us from segfaults. For thine is the clock,
|
||||
// the slave and the master. Until we return from main.
|
||||
//
|
||||
// Amen.
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "mousekey.h"
|
||||
#include "keymap.h"
|
||||
#include "keymap_steno.h"
|
||||
#include "wait.h"
|
||||
|
||||
extern size_t keymapsCount; // Total keymaps
|
||||
extern uint32_t cChord; // Current Chord
|
||||
|
||||
// Function defs
|
||||
void processChord(bool useFakeSteno);
|
||||
uint32_t processQwerty(bool lookup);
|
||||
uint32_t processFakeSteno(bool lookup);
|
||||
void saveState(uint32_t cChord);
|
||||
void restoreState(void);
|
||||
|
||||
// Macros for use in keymap.c
|
||||
void SEND(uint8_t kc);
|
||||
void REPEAT(void);
|
||||
void SET_STICKY(uint32_t);
|
||||
void SWITCH_LAYER(int);
|
||||
void CLICK_MOUSE(uint8_t);
|
||||
|
||||
// Keymap helper
|
||||
#define P(chord, act) if (cChord == (chord)) { if (!lookup) {act;} return chord;}
|
||||
|
||||
// Shift to internal representation
|
||||
// i.e) S(teno)R(ight)F
|
||||
#define STN(n) (1L<<n)
|
||||
enum ORDER {
|
||||
SFN = 0, SPWR, SST1, SST2, SST3, SST4, SNUML, SNUMR,
|
||||
SLSU, SLSD, SLT, SLK, SLP, SLW, SLH, SLR, SLA, SLO,
|
||||
SRE, SRU, SRF, SRR, SRP, SRB, SRL, SRG, SRT, SRS, SRD, SRZ, SRES1, SRES2
|
||||
};
|
||||
|
||||
// Break it all out
|
||||
#define FN STN(SFN)
|
||||
#define PWR STN(SPWR)
|
||||
#define ST1 STN(SST1)
|
||||
#define ST2 STN(SST2)
|
||||
#define ST3 STN(SST3)
|
||||
#define ST4 STN(SST4)
|
||||
#define LNO STN(SNUML) // STN1-6
|
||||
#define RNO STN(SNUMR) // STN7-C
|
||||
#define RES1 STN(SRES1) // Use reserved for sticky state
|
||||
#define RES2 STN(SRES2)
|
||||
|
||||
#define LSU STN(SLSU)
|
||||
#define LSD STN(SLSD)
|
||||
#define LFT STN(SLT) // (L)e(F)t (T), preprocessor conflict
|
||||
#define LK STN(SLK)
|
||||
#define LP STN(SLP)
|
||||
#define LW STN(SLW)
|
||||
#define LH STN(SLH)
|
||||
#define LR STN(SLR)
|
||||
#define LA STN(SLA)
|
||||
#define LO STN(SLO)
|
||||
|
||||
#define RE STN(SRE)
|
||||
#define RU STN(SRU)
|
||||
#define RF STN(SRF)
|
||||
#define RR STN(SRR)
|
||||
#define RP STN(SRP)
|
||||
#define RB STN(SRB)
|
||||
#define RL STN(SRL)
|
||||
#define RG STN(SRG)
|
||||
#define RT STN(SRT)
|
||||
#define RS STN(SRS)
|
||||
#define RD STN(SRD)
|
||||
#define RZ STN(SRZ)
|
||||
39
keyboards/planck/keymaps/motform/config.h
Normal file
39
keyboards/planck/keymaps/motform/config.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
#define STARTUP_SONG SONG(PLANCK_SOUND)
|
||||
// #define STARTUP_SONG SONG(NO_SOUND)
|
||||
|
||||
#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
|
||||
SONG(COLEMAK_SOUND), \
|
||||
SONG(DVORAK_SOUND) \
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MIDI options
|
||||
*/
|
||||
|
||||
/* Prevent use of disabled MIDI features in the keymap */
|
||||
//#define MIDI_ENABLE_STRICT 1
|
||||
|
||||
/* enable basic MIDI features:
|
||||
- MIDI notes can be sent when in Music mode is on
|
||||
*/
|
||||
|
||||
#define MIDI_BASIC
|
||||
|
||||
/* enable advanced MIDI features:
|
||||
- MIDI notes can be added to the keymap
|
||||
- Octave shift and transpose
|
||||
- Virtual sustain, portamento, and modulation wheel
|
||||
- etc.
|
||||
*/
|
||||
//#define MIDI_ADVANCED
|
||||
|
||||
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
|
||||
//#define MIDI_TONE_KEYCODE_OCTAVES 2
|
||||
|
||||
// Most tactile encoders have detents every 4 stages
|
||||
#define ENCODER_RESOLUTION 4
|
||||
|
||||
211
keyboards/planck/keymaps/motform/keymap.c
Normal file
211
keyboards/planck/keymaps/motform/keymap.c
Normal file
@@ -0,0 +1,211 @@
|
||||
/* Copyright 2015-2017 Jack Humbert
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "muse.h"
|
||||
#include "keymap_swedish.h"
|
||||
|
||||
extern keymap_config_t keymap_config;
|
||||
|
||||
enum planck_layers {
|
||||
_COLEMAK,
|
||||
_LOWER,
|
||||
_RAISE,
|
||||
_ADJUST
|
||||
};
|
||||
|
||||
#define LOWER MO(_LOWER)
|
||||
#define RAISE MO(_RAISE)
|
||||
|
||||
/* These definitions can be removed once keymap_swe is properly vetted against MacOS */
|
||||
#define NO_DLR_MAC_V ALGR(LALT(KC_4))
|
||||
#define NO_AT_MAC_V ALGR(LALT(KC_2))
|
||||
|
||||
/* Esc when pressed, ctrl when used as a modifier */
|
||||
#define KC_ECTL MT(MOD_LCTL, KC_ESC)
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* Colemak_se
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | Q | W | F | P | G | J | L | U | Y | Ö | Å |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | ECTR | A | R | S | T | D | H | N | E | I | O | Ä |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | SCSHE| Z | X | C | V | B | K | M | , | . | - |SCSHE |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | esc | CTRL | Alt | CMD |Lower |Space |Bksp |Raise | CMD | RALT | HYPER| MEH |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_COLEMAK] = LAYOUT_planck_grid
|
||||
(
|
||||
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, NO_OSLH, NO_AA,
|
||||
KC_ECTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, NO_AE,
|
||||
KC_SFTENT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, NO_MINS, KC_SFTENT,
|
||||
KC_ESC, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_BSPC, RAISE, KC_RGUI, KC_RALT, KC_HYPR, KC_MEH
|
||||
),
|
||||
|
||||
/* Lower
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | | PIPE | ' | @ | & | | DOWN | | RIGHT| ` | ´ | ~ |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | | ! | " | # | ? | % | LEFT | / | \ | = | + | * |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | | | | [ | { | | UP | } | ] | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | DEL | | Next | Vol- | Vol+ | Play |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_LOWER] = LAYOUT_planck_grid
|
||||
(
|
||||
_______, NO_PIPE_MAC, NO_APOS, NO_AT_MAC_V, NO_AMPR, _______, KC_DOWN, KC_NO, KC_RGHT, NO_GRV, NO_GRV, NO_TILD,
|
||||
_______, KC_EXLM, NO_QUO2, KC_HASH, NO_QUES, KC_PERC, KC_LEFT, NO_SLSH, NO_BSLS_MAC, NO_EQL, KC_PPLS, KC_PAST,
|
||||
_______, KC_NO, KC_NO, NO_LBRC, NO_LCBR_MAC, KC_NO, KC_UP, NO_RCBR_MAC, NO_RBRC, KC_NO, KC_NO, _______,
|
||||
_______, _______, _______, _______, _______, _______, KC_DEL, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
|
||||
),
|
||||
|
||||
/* Raise
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | ^ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | $ |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | | | | < | ( | | | ) | > |Pg Up |Pg Dn | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | Next | Vol- | Vol+ | Play |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_RAISE] = LAYOUT_planck_grid
|
||||
(
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
|
||||
NO_CIRC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, NO_DLR_MAC_V,
|
||||
_______, KC_NO, KC_NO, NO_LESS_MAC, NO_LPRN, KC_NO, KC_NO, NO_RPRN, NO_GRTR_MAC, KC_PGUP, KC_PGDN, KC_NO,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
|
||||
),
|
||||
|
||||
/* Adjust (Lower + Raise)
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | | Reset| Debug| | | | | | | | | |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | | | |Aud on|Audoff|AGnorm|AGswap| | | | | |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof|TRMon |TRMoff| | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_ADJUST] = LAYOUT_planck_grid
|
||||
(
|
||||
_______, RESET, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
)
|
||||
|
||||
};
|
||||
|
||||
uint32_t layer_state_set_user(uint32_t state) {
|
||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
|
||||
bool muse_mode = false;
|
||||
uint8_t last_muse_note = 0;
|
||||
uint16_t muse_counter = 0;
|
||||
uint8_t muse_offset = 70;
|
||||
uint16_t muse_tempo = 50;
|
||||
|
||||
void encoder_update(bool clockwise) {
|
||||
if (muse_mode) {
|
||||
if (IS_LAYER_ON(_RAISE)) {
|
||||
if (clockwise) {
|
||||
muse_offset++;
|
||||
} else {
|
||||
muse_offset--;
|
||||
}
|
||||
} else {
|
||||
if (clockwise) {
|
||||
muse_tempo+=1;
|
||||
} else {
|
||||
muse_tempo-=1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (clockwise) {
|
||||
#ifdef MOUSEKEY_ENABLE
|
||||
register_code(KC_MS_WH_DOWN);
|
||||
unregister_code(KC_MS_WH_DOWN);
|
||||
#else
|
||||
register_code(KC_PGDN);
|
||||
unregister_code(KC_PGDN);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef MOUSEKEY_ENABLE
|
||||
register_code(KC_MS_WH_UP);
|
||||
unregister_code(KC_MS_WH_UP);
|
||||
#else
|
||||
register_code(KC_PGUP);
|
||||
unregister_code(KC_PGUP);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dip_update(uint8_t index, bool active) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
if (active) {
|
||||
layer_on(_ADJUST);
|
||||
} else {
|
||||
layer_off(_ADJUST);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (active) {
|
||||
muse_mode = true;
|
||||
} else {
|
||||
muse_mode = false;
|
||||
#ifdef AUDIO_ENABLE
|
||||
stop_all_notes();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
if (muse_mode) {
|
||||
if (muse_counter == 0) {
|
||||
uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()];
|
||||
if (muse_note != last_muse_note) {
|
||||
stop_note(compute_freq_for_midi_note(last_muse_note));
|
||||
play_note(compute_freq_for_midi_note(muse_note), 0xF);
|
||||
last_muse_note = muse_note;
|
||||
}
|
||||
}
|
||||
muse_counter = (muse_counter + 1) % muse_tempo;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool music_mask_user(uint16_t keycode) {
|
||||
switch (keycode) {
|
||||
case RAISE:
|
||||
case LOWER:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
11
keyboards/planck/keymaps/motform/readme.md
Normal file
11
keyboards/planck/keymaps/motform/readme.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Motform Planck Layout
|
||||
|
||||
This layout is based off the [colemak-se](github.com/motform/colemak-se)
|
||||
layout and features many tweaks to make working with Emacs and
|
||||
evil-mode more ergonomi. As with the colemak layout itself, the idea
|
||||
is to concentrate as much movement as possible to the home row.
|
||||
|
||||
To properly use the layout in Emacs, set Super to LGUI and Meta to RGUI.
|
||||
Unless you are running a permutation of the MacOS Swedish QWERTY-layout,
|
||||
modifiers will probably not work. For future develoment, I’m planning
|
||||
to add support for MS Windows SE-QWERTY in the form of a secondary layer.
|
||||
1
keyboards/planck/keymaps/motform/rules.mk
Normal file
1
keyboards/planck/keymaps/motform/rules.mk
Normal file
@@ -0,0 +1 @@
|
||||
SRC += muse.c
|
||||
@@ -2,74 +2,64 @@
|
||||
"keyboard_name": "Signum 3.0",
|
||||
"url": "http://troyfletcher.net/",
|
||||
"maintainer": "jceb",
|
||||
"width": 17,
|
||||
"height": 8,
|
||||
"width": 15,
|
||||
"height": 6,
|
||||
"layouts": {
|
||||
"LAYOUT_ortho_4x12": {
|
||||
"key_count": 48,
|
||||
"layout": [
|
||||
|
||||
{ "x": 1.25, "y": 0.75, "r": 15 },
|
||||
{ "x": 1.25, "y": 1.75, "r": 15 },
|
||||
{ "x": 1.25, "y": 2.75, "r": 15 },
|
||||
{ "x": 1.25, "y": 4.25, "r": 15 },
|
||||
{ "x": 0, "y": 0.5, "r": 15 },
|
||||
{ "x": 1, "y": 0.5, "r": 15 },
|
||||
{ "x": 2, "y": 0.25, "r": 15 },
|
||||
{ "x": 3, "y": 0, "r": 15 },
|
||||
{ "x": 4, "y": 0.25, "r": 15 },
|
||||
{ "x": 5, "y": 0.5, "r": 15 },
|
||||
{ "x": 9, "y": 0.5, "r": -15 },
|
||||
{ "x": 10, "y": 0.25, "r": -15 },
|
||||
{ "x": 11, "y": 0, "r": -15 },
|
||||
{ "x": 12, "y": 0.25, "r": -15 },
|
||||
{ "x": 13, "y": 0.5, "r": -15 },
|
||||
{ "x": 14, "y": 0.5, "r": -15 },
|
||||
|
||||
{ "x": 2.25, "y": 0.75, "r": 15 },
|
||||
{ "x": 2.25, "y": 1.75, "r": 15 },
|
||||
{ "x": 2.25, "y": 2.75, "r": 15 },
|
||||
{ "x": 2.25, "y": 3.75, "r": 15 },
|
||||
{ "x": 0, "y": 1.5, "r": 15 },
|
||||
{ "x": 1, "y": 1.5, "r": 15 },
|
||||
{ "x": 2, "y": 1.25, "r": 15 },
|
||||
{ "x": 3, "y": 1, "r": 15 },
|
||||
{ "x": 4, "y": 1.25, "r": 15 },
|
||||
{ "x": 5, "y": 1.5, "r": 15 },
|
||||
{ "x": 9, "y": 1.5, "r": -15 },
|
||||
{ "x": 10, "y": 1.25, "r": -15 },
|
||||
{ "x": 11, "y": 1, "r": -15 },
|
||||
{ "x": 12, "y": 1.25, "r": -15 },
|
||||
{ "x": 13, "y": 1.5, "r": -15 },
|
||||
{ "x": 14, "y": 1.5, "r": -15 },
|
||||
|
||||
{ "x": 3.25, "y": 0.5, "r": 15 },
|
||||
{ "x": 3.25, "y": 1.5, "r": 15 },
|
||||
{ "x": 3.25, "y": 2.5, "r": 15 },
|
||||
{ "x": 3.25, "y": 3.5, "r": 15 },
|
||||
{ "x": 0, "y": 2.5, "r": 15 },
|
||||
{ "x": 1, "y": 2.5, "r": 15 },
|
||||
{ "x": 2, "y": 2.25, "r": 15 },
|
||||
{ "x": 3, "y": 2, "r": 15 },
|
||||
{ "x": 4, "y": 2.25, "r": 15 },
|
||||
{ "x": 5, "y": 2.5, "r": 15 },
|
||||
{ "x": 9, "y": 2.5, "r": -15 },
|
||||
{ "x": 10, "y": 2.25, "r": -15 },
|
||||
{ "x": 11, "y": 2, "r": -15 },
|
||||
{ "x": 12, "y": 2.25, "r": -15 },
|
||||
{ "x": 13, "y": 2.5, "r": -15 },
|
||||
{ "x": 14, "y": 2.5, "r": -15 },
|
||||
|
||||
{ "x": 4.25, "y": 0.25, "r": 15 },
|
||||
{ "x": 4.25, "y": 1.25, "r": 15 },
|
||||
{ "x": 4.25, "y": 2.25, "r": 15 },
|
||||
|
||||
{ "x": 5.25, "y": 0.5, "r": 15 },
|
||||
{ "x": 5.25, "y": 1.5, "r": 15 },
|
||||
{ "x": 5.25, "y": 2.5, "r": 15 },
|
||||
{ "x": 5.25, "y": 4.5, "r": 15, "h": 1.5 },
|
||||
|
||||
{ "x": 6.25, "y": 0.75, "r": 15 },
|
||||
{ "x": 6.25, "y": 1.75, "r": 15 },
|
||||
{ "x": 6.25, "y": 2.75, "r": 15 },
|
||||
{ "x": 6.25, "y": 4.25, "r": 15, "h": 2 },
|
||||
|
||||
{ "x": 7.25, "y": 4.5, "r": 15, "h": 1.5 },
|
||||
|
||||
{ "x": 8.25, "y": 4.5, "r": -15, "h": 1.5 },
|
||||
|
||||
{ "x": 9.25, "y": 0.75, "r": -15 },
|
||||
{ "x": 9.25, "y": 1.75, "r": -15 },
|
||||
{ "x": 9.25, "y": 2.75, "r": -15 },
|
||||
{ "x": 9.25, "y": 4.25, "r": -15, "h": 2 },
|
||||
|
||||
{ "x": 10.25, "y": 0.5, "r": -15 },
|
||||
{ "x": 10.25, "y": 1.5, "r": -15 },
|
||||
{ "x": 10.25, "y": 2.5, "r": -15 },
|
||||
{ "x": 10.25, "y": 4.5, "r": -15, "h": 1.5 },
|
||||
|
||||
{ "x": 11.25, "y": 0.25, "r": -15 },
|
||||
{ "x": 11.25, "y": 1.25, "r": -15 },
|
||||
{ "x": 11.25, "y": 2.25, "r": -15 },
|
||||
|
||||
{ "x": 12.25, "y": 0.5, "r": -15 },
|
||||
{ "x": 12.25, "y": 1.5, "r": -15 },
|
||||
{ "x": 12.25, "y": 2.5, "r": -15 },
|
||||
{ "x": 12.25, "y": 3.5, "r": -15 },
|
||||
|
||||
{ "x": 13.25, "y": 0.75, "r": -15 },
|
||||
{ "x": 13.25, "y": 1.75, "r": -15 },
|
||||
{ "x": 13.25, "y": 2.75, "r": -15 },
|
||||
{ "x": 13.25, "y": 3.75, "r": -15 },
|
||||
|
||||
{ "x": 14.25, "y": 0.75, "r": -15 },
|
||||
{ "x": 14.25, "y": 1.75, "r": -15 },
|
||||
{ "x": 14.25, "y": 2.75, "r": -15 },
|
||||
{ "x": 14.25, "y": 4.25, "r": -15 }
|
||||
{ "x": 0, "y": 4, "r": 15 },
|
||||
{ "x": 1, "y": 3.5, "r": 15 },
|
||||
{ "x": 2, "y": 3.25, "r": 15 },
|
||||
{ "x": 4, "y": 4.25, "r": 15, "h": 1.5 },
|
||||
{ "x": 5, "y": 4, "r": 15, "h": 2 },
|
||||
{ "x": 6, "y": 4.25, "r": 15, "h": 1.5 },
|
||||
{ "x": 8, "y": 4.25, "r": -15, "h": 1.5 },
|
||||
{ "x": 9, "y": 4, "r": -15, "h": 2 },
|
||||
{ "x": 10, "y": 4.25, "r": -15, "h": 1.5 },
|
||||
{ "x": 12, "y": 3.25, "r": -15 },
|
||||
{ "x": 13, "y": 3.5, "r": -15 },
|
||||
{ "x": 14, "y": 4, "r": -15 }
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from sortedcontainers import SortedDict
|
||||
import layout
|
||||
import re
|
||||
|
||||
@@ -11,7 +10,7 @@ import re
|
||||
|
||||
def gen_uc_iter():
|
||||
length = len(layout.uc_dict)
|
||||
for key, value in layout.uc_dict.items():
|
||||
for key, value in sorted(layout.uc_dict.items()):
|
||||
length -= 1
|
||||
if length:
|
||||
yield (key, value, False)
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
from sortedcontainers import SortedDict
|
||||
|
||||
# Add all used Unicode symbols to this list.
|
||||
# The key (e.g. "SNEK") is used in keymap.c for "enum", "unicode_map" and "keymaps", so it needs to be a valid C variable name.
|
||||
# The key is also used in this file to define the layout, so use recognizeable names.
|
||||
# The value (e.g. "0x1f40d") is used in keymap.c for "unicode_map" and to automatically generate the "ASCII"-art comments.
|
||||
# When adding new Unicode names, use "0x1f40d" until you looked up the correct Unicode code point.
|
||||
uc_dict = SortedDict({
|
||||
uc_dict = {
|
||||
"SNEK": "0x1f40d", ## Error
|
||||
## qwertz
|
||||
"ACUTE": "0x00b4",
|
||||
@@ -329,7 +327,7 @@ uc_dict = SortedDict({
|
||||
"NOT_PARA": "0x2226",
|
||||
"TIMES_OP": "0x2297",
|
||||
"NOT_DIV": "0x2224"
|
||||
})
|
||||
}
|
||||
|
||||
# Add all used Keycodes to this list.
|
||||
# The key (e.g. "a") is used in keymap.c to automatically generate the comments. The first 7 chars will show as a keycap legend.
|
||||
|
||||
@@ -11,10 +11,6 @@ starting point to create your own layouts for the Signum 3.0 with
|
||||
|
||||
# Customization
|
||||
|
||||
- Install `python3` and [Sorted Containers
|
||||
Library](http://www.grantjenks.com/docs/sortedcontainers/), `pip
|
||||
install sortedcontainers`.
|
||||
|
||||
- Customize `layout.py` to your liking.
|
||||
- Attention 1: keycodes are either translated into symbols and
|
||||
function calls via the `translate()` function in `generate_km.py`
|
||||
|
||||
@@ -1 +1,20 @@
|
||||
#include "sol.h"
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE)
|
||||
uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) {
|
||||
if (row == 4 && column == 5) {
|
||||
led_i[0] = 33;
|
||||
return 1;
|
||||
} else if (row == 4 && column == 6) {
|
||||
led_i[0] = 34;
|
||||
return 1;
|
||||
} else if (row == 10 && column == 5) {
|
||||
led_i[0] = 68;
|
||||
return 1;
|
||||
} else if (row == 10 && column == 6) {
|
||||
led_i[0] = 69;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
146
quantum/process_keycode/process_space_cadet.c
Normal file
146
quantum/process_keycode/process_space_cadet.c
Normal file
@@ -0,0 +1,146 @@
|
||||
/* Copyright 2019 Jack Humbert
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "process_space_cadet.h"
|
||||
|
||||
#ifndef TAPPING_TERM
|
||||
#define TAPPING_TERM 200
|
||||
#endif
|
||||
|
||||
// ********** OBSOLETE DEFINES, STOP USING! (pls?) **********
|
||||
// Shift / paren setup
|
||||
#ifndef LSPO_KEY
|
||||
#define LSPO_KEY KC_9
|
||||
#endif
|
||||
#ifndef RSPC_KEY
|
||||
#define RSPC_KEY KC_0
|
||||
#endif
|
||||
|
||||
// Shift / Enter setup
|
||||
#ifndef SFTENT_KEY
|
||||
#define SFTENT_KEY KC_ENT
|
||||
#endif
|
||||
|
||||
#ifdef DISABLE_SPACE_CADET_MODIFIER
|
||||
#ifndef LSPO_MOD
|
||||
#define LSPO_MOD KC_TRNS
|
||||
#endif
|
||||
#ifndef RSPC_MOD
|
||||
#define RSPC_MOD KC_TRNS
|
||||
#endif
|
||||
#else
|
||||
#ifndef LSPO_MOD
|
||||
#define LSPO_MOD KC_LSFT
|
||||
#endif
|
||||
#ifndef RSPC_MOD
|
||||
#define RSPC_MOD KC_RSFT
|
||||
#endif
|
||||
#endif
|
||||
// **********************************************************
|
||||
|
||||
// Shift / paren setup
|
||||
#ifndef LSPO_KEYS
|
||||
#define LSPO_KEYS KC_LSFT, LSPO_MOD, LSPO_KEY
|
||||
#endif
|
||||
#ifndef RSPC_KEYS
|
||||
#define RSPC_KEYS KC_RSFT, RSPC_MOD, RSPC_KEY
|
||||
#endif
|
||||
|
||||
// Control / paren setup
|
||||
#ifndef LCPO_KEYS
|
||||
#define LCPO_KEYS KC_LCTL, KC_LCTL, KC_9
|
||||
#endif
|
||||
#ifndef RCPO_KEYS
|
||||
#define RCPO_KEYS KC_RCTL, KC_RCTL, KC_0
|
||||
#endif
|
||||
|
||||
// Alt / paren setup
|
||||
#ifndef LAPO_KEYS
|
||||
#define LAPO_KEYS KC_LALT, KC_LALT, KC_9
|
||||
#endif
|
||||
#ifndef RAPO_KEYS
|
||||
#define RAPO_KEYS KC_RALT, KC_RALT, KC_0
|
||||
#endif
|
||||
|
||||
// Shift / Enter setup
|
||||
#ifndef SFTENT_KEYS
|
||||
#define SFTENT_KEYS KC_RSFT, KC_TRNS, SFTENT_KEY
|
||||
#endif
|
||||
|
||||
static uint8_t sc_last = 0;
|
||||
static uint16_t sc_timer = 0;
|
||||
|
||||
void perform_space_cadet(keyrecord_t *record, uint8_t normalMod, uint8_t tapMod, uint8_t keycode) {
|
||||
if (record->event.pressed) {
|
||||
sc_last = normalMod;
|
||||
sc_timer = timer_read ();
|
||||
if (IS_MOD(normalMod)) {
|
||||
register_mods(MOD_BIT(normalMod));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (IS_MOD(normalMod)) {
|
||||
unregister_mods(MOD_BIT(normalMod));
|
||||
}
|
||||
|
||||
if (sc_last == normalMod && timer_elapsed(sc_timer) < TAPPING_TERM) {
|
||||
if (IS_MOD(tapMod)) {
|
||||
register_mods(MOD_BIT(tapMod));
|
||||
}
|
||||
tap_code(keycode);
|
||||
if (IS_MOD(tapMod)) {
|
||||
unregister_mods(MOD_BIT(tapMod));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool process_space_cadet(uint16_t keycode, keyrecord_t *record) {
|
||||
switch(keycode) {
|
||||
case KC_LSPO: {
|
||||
perform_space_cadet(record, LSPO_KEYS);
|
||||
return false;
|
||||
}
|
||||
case KC_RSPC: {
|
||||
perform_space_cadet(record, RSPC_KEYS);
|
||||
return false;
|
||||
}
|
||||
case KC_LCPO: {
|
||||
perform_space_cadet(record, LCPO_KEYS);
|
||||
return false;
|
||||
}
|
||||
case KC_RCPC: {
|
||||
perform_space_cadet(record, RCPO_KEYS);
|
||||
return false;
|
||||
}
|
||||
case KC_LAPO: {
|
||||
perform_space_cadet(record, LAPO_KEYS);
|
||||
return false;
|
||||
}
|
||||
case KC_RAPC: {
|
||||
perform_space_cadet(record, RAPO_KEYS);
|
||||
return false;
|
||||
}
|
||||
case KC_SFTENT: {
|
||||
perform_space_cadet(record, SFTENT_KEYS);
|
||||
return false;
|
||||
}
|
||||
default: {
|
||||
sc_last = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
21
quantum/process_keycode/process_space_cadet.h
Normal file
21
quantum/process_keycode/process_space_cadet.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* Copyright 2019 Jack Humbert
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
void perform_space_cadet(keyrecord_t *record, uint8_t normalMod, uint8_t tapMod, uint8_t keycode);
|
||||
bool process_space_cadet(uint16_t keycode, keyrecord_t *record);
|
||||
@@ -24,10 +24,6 @@
|
||||
#include "outputselect.h"
|
||||
#endif
|
||||
|
||||
#ifndef TAPPING_TERM
|
||||
#define TAPPING_TERM 200
|
||||
#endif
|
||||
|
||||
#ifndef BREATHING_PERIOD
|
||||
#define BREATHING_PERIOD 6
|
||||
#endif
|
||||
@@ -196,30 +192,6 @@ void reset_keyboard(void) {
|
||||
bootloader_jump();
|
||||
}
|
||||
|
||||
// Shift / paren setup
|
||||
|
||||
#ifndef LSPO_KEY
|
||||
#define LSPO_KEY KC_9
|
||||
#endif
|
||||
#ifndef RSPC_KEY
|
||||
#define RSPC_KEY KC_0
|
||||
#endif
|
||||
|
||||
#ifndef LSPO_MOD
|
||||
#define LSPO_MOD KC_LSFT
|
||||
#endif
|
||||
#ifndef RSPC_MOD
|
||||
#define RSPC_MOD KC_RSFT
|
||||
#endif
|
||||
|
||||
// Shift / Enter setup
|
||||
#ifndef SFTENT_KEY
|
||||
#define SFTENT_KEY KC_ENT
|
||||
#endif
|
||||
|
||||
static bool shift_interrupted[2] = {0, 0};
|
||||
static uint16_t scs_timer[2] = {0, 0};
|
||||
|
||||
/* true if the last press of GRAVE_ESC was shifted (i.e. GUI or SHIFT were pressed), false otherwise.
|
||||
* Used to ensure that the correct keycode is released if the key is released.
|
||||
*/
|
||||
@@ -328,6 +300,9 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
#endif
|
||||
#ifdef TERMINAL_ENABLE
|
||||
process_terminal(keycode, record) &&
|
||||
#endif
|
||||
#ifdef SPACE_CADET_ENABLE
|
||||
process_space_cadet(keycode, record) &&
|
||||
#endif
|
||||
true)) {
|
||||
return false;
|
||||
@@ -685,92 +660,6 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case KC_LSPO: {
|
||||
if (record->event.pressed) {
|
||||
shift_interrupted[0] = false;
|
||||
scs_timer[0] = timer_read ();
|
||||
register_mods(MOD_BIT(KC_LSFT));
|
||||
}
|
||||
else {
|
||||
#ifdef DISABLE_SPACE_CADET_ROLLOVER
|
||||
if (get_mods() & MOD_BIT(RSPC_MOD)) {
|
||||
shift_interrupted[0] = true;
|
||||
shift_interrupted[1] = true;
|
||||
}
|
||||
#endif
|
||||
if (!shift_interrupted[0] && timer_elapsed(scs_timer[0]) < TAPPING_TERM) {
|
||||
#ifdef DISABLE_SPACE_CADET_MODIFIER
|
||||
unregister_mods(MOD_BIT(KC_LSFT));
|
||||
#else
|
||||
if( LSPO_MOD != KC_LSFT ){
|
||||
unregister_mods(MOD_BIT(KC_LSFT));
|
||||
register_mods(MOD_BIT(LSPO_MOD));
|
||||
}
|
||||
#endif
|
||||
register_code(LSPO_KEY);
|
||||
unregister_code(LSPO_KEY);
|
||||
#ifndef DISABLE_SPACE_CADET_MODIFIER
|
||||
if( LSPO_MOD != KC_LSFT ){
|
||||
unregister_mods(MOD_BIT(LSPO_MOD));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
unregister_mods(MOD_BIT(KC_LSFT));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
case KC_RSPC: {
|
||||
if (record->event.pressed) {
|
||||
shift_interrupted[1] = false;
|
||||
scs_timer[1] = timer_read ();
|
||||
register_mods(MOD_BIT(KC_RSFT));
|
||||
}
|
||||
else {
|
||||
#ifdef DISABLE_SPACE_CADET_ROLLOVER
|
||||
if (get_mods() & MOD_BIT(LSPO_MOD)) {
|
||||
shift_interrupted[0] = true;
|
||||
shift_interrupted[1] = true;
|
||||
}
|
||||
#endif
|
||||
if (!shift_interrupted[1] && timer_elapsed(scs_timer[1]) < TAPPING_TERM) {
|
||||
#ifdef DISABLE_SPACE_CADET_MODIFIER
|
||||
unregister_mods(MOD_BIT(KC_RSFT));
|
||||
#else
|
||||
if( RSPC_MOD != KC_RSFT ){
|
||||
unregister_mods(MOD_BIT(KC_RSFT));
|
||||
register_mods(MOD_BIT(RSPC_MOD));
|
||||
}
|
||||
#endif
|
||||
register_code(RSPC_KEY);
|
||||
unregister_code(RSPC_KEY);
|
||||
#ifndef DISABLE_SPACE_CADET_MODIFIER
|
||||
if ( RSPC_MOD != KC_RSFT ){
|
||||
unregister_mods(MOD_BIT(RSPC_MOD));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
unregister_mods(MOD_BIT(KC_RSFT));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
case KC_SFTENT: {
|
||||
if (record->event.pressed) {
|
||||
shift_interrupted[1] = false;
|
||||
scs_timer[1] = timer_read ();
|
||||
register_mods(MOD_BIT(KC_RSFT));
|
||||
}
|
||||
else if (!shift_interrupted[1] && timer_elapsed(scs_timer[1]) < TAPPING_TERM) {
|
||||
unregister_mods(MOD_BIT(KC_RSFT));
|
||||
register_code(SFTENT_KEY);
|
||||
unregister_code(SFTENT_KEY);
|
||||
}
|
||||
else {
|
||||
unregister_mods(MOD_BIT(KC_RSFT));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
case GRAVE_ESC: {
|
||||
uint8_t shifted = get_mods() & ((MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)
|
||||
@@ -825,12 +714,6 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
default: {
|
||||
shift_interrupted[0] = true;
|
||||
shift_interrupted[1] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return process_action_kb(record);
|
||||
|
||||
@@ -131,6 +131,10 @@ extern uint32_t default_layer_state;
|
||||
#include "process_terminal_nop.h"
|
||||
#endif
|
||||
|
||||
#ifdef SPACE_CADET_ENABLE
|
||||
#include "process_space_cadet.h"
|
||||
#endif
|
||||
|
||||
#ifdef HD44780_ENABLE
|
||||
#include "hd44780.h"
|
||||
#endif
|
||||
|
||||
@@ -475,6 +475,18 @@ enum quantum_keycodes {
|
||||
HPT_DWLI,
|
||||
HPT_DWLD,
|
||||
|
||||
// Left control, open paren
|
||||
KC_LCPO,
|
||||
|
||||
// Right control, close paren
|
||||
KC_RCPC,
|
||||
|
||||
// Left control, open paren
|
||||
KC_LAPO,
|
||||
|
||||
// Right control, close paren
|
||||
KC_RAPC,
|
||||
|
||||
// always leave at the end
|
||||
SAFE_RANGE
|
||||
};
|
||||
|
||||
@@ -144,9 +144,14 @@ void eeconfig_debug_rgb_matrix(void) {
|
||||
dprintf("rgb_matrix_config.speed = %d\n", rgb_matrix_config.speed);
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i) {
|
||||
// TODO: This is kinda expensive, fix this soonish
|
||||
uint8_t led_count = 0;
|
||||
uint8_t led_count = rgb_matrix_map_row_column_to_led_kb(row, column, led_i);
|
||||
for (uint8_t i = 0; i < DRIVER_LED_TOTAL && led_count < LED_HITS_TO_REMEMBER; i++) {
|
||||
matrix_co_t matrix_co = g_rgb_leds[i].matrix_co;
|
||||
if (row == matrix_co.row && column == matrix_co.col) {
|
||||
|
||||
Reference in New Issue
Block a user