summaryrefslogtreecommitdiff
path: root/keyboards/butterstick
diff options
context:
space:
mode:
authorJeremy Bernhardt <bernhardtjeremy@gmail.com>2019-08-06 11:20:48 -0600
committerDrashna Jaelre <drashna@live.com>2019-08-06 10:20:48 -0700
commit07bdc8f4b7268f69a789bfe7656e8384bfcfed57 (patch)
tree50110933438d9fc4b928f9d6e225f8a8e397af8f /keyboards/butterstick
parentae934c389e755ae780eb6e385f55b687581c5db4 (diff)
[Keyboard] Added little fixes and bootmagic for gBoard keebs (#6477)
* Added little fixes and bootmagic * Update keyboards/gergo/keymaps/oled/rules.mk Co-Authored-By: Drashna Jaelre <drashna@live.com> * whacked out quantum_libs
Diffstat (limited to 'keyboards/butterstick')
-rw-r--r--keyboards/butterstick/keymaps/default/keymap.c15
-rw-r--r--keyboards/butterstick/sten.c61
-rw-r--r--keyboards/butterstick/sten.h12
3 files changed, 73 insertions, 15 deletions
diff --git a/keyboards/butterstick/keymaps/default/keymap.c b/keyboards/butterstick/keymaps/default/keymap.c
index e4d1ea91f3..749e9ba071 100644
--- a/keyboards/butterstick/keymaps/default/keymap.c
+++ b/keyboards/butterstick/keymaps/default/keymap.c
@@ -45,21 +45,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
uint32_t processQwerty(bool lookup) {
// SECRET AGENT CHORDS
P( LSU | LK | RS | RD, SEND_STRING(VERSION); SEND_STRING(__DATE__));
- P( LR | ST2| RR | RB, SEND(KC_BSPC));
+ P( LR | ST2| RR | RB, SEND(KC_BSPC));
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( 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));
+ P( LSU | LSD | LFT | LK, SEND(KC_LCTL));
+ P( RS | RT | RD | RZ, SEND(KC_ENT));
// Function Layer
P( FUNCT | RF, SEND(KC_F1));
@@ -179,6 +179,5 @@ uint32_t processQwerty(bool lookup) {
return 0;
}
-
// Don't fuck with this, thanks.
size_t keymapsCount = sizeof(keymaps)/sizeof(keymaps[0]);
diff --git a/keyboards/butterstick/sten.c b/keyboards/butterstick/sten.c
index a239e38842..197abaf92f 100644
--- a/keyboards/butterstick/sten.c
+++ b/keyboards/butterstick/sten.c
@@ -11,6 +11,18 @@ 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
+#ifndef NO_DEBUG
+char debugMsg[32];
+#endif
+
+// StenoLayer
+uint32_t releasedChord = 0; // Keys released from current chord
+uint32_t tChord = 0; // Protects state of cChord
+
+#ifndef STENOLAYERS
+uint32_t stenoLayers[] = { PWR };
+size_t stenoLayerCount = sizeof(stenoLayers)/sizeof(stenoLayers[0]);
+#endif
// Mode state
enum MODE { STENO = 0, QWERTY, COMMAND };
@@ -39,7 +51,6 @@ 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
@@ -50,8 +61,21 @@ bool send_steno_chord_user(steno_mode_t mode, uint8_t chord[6]) {
}
#endif
+ // Toggle Serial/QWERTY steno
+ if (cChord == (PWR | FN | ST1 | ST2)) {
+#ifndef NO_DEBUG
+ uprintf("Fallback Toggle\n");
+#endif
+ QWERSTENO = !QWERSTENO;
+
+ goto out;
+ }
+
// handle command mode
- if (cChord == (LSU | LSD | RD | RZ)) {
+ if (cChord == (PWR | FN | RD | RZ)) {
+#ifndef NO_DEBUG
+ uprintf("COMMAND Toggle\n");
+#endif
if (cMode != COMMAND) { // Entering Command Mode
CMDLEN = 0;
pMode = cMode;
@@ -70,7 +94,7 @@ bool send_steno_chord_user(steno_mode_t mode, uint8_t chord[6]) {
}
// Handle Gaming Toggle,
- if (cChord == (LSU | LSD | LFT | LK | RT | RS | RD | RZ) && keymapsCount > 1) {
+ if (cChord == (PWR | FN | ST4 | ST3) && keymapsCount > 1) {
#ifndef NO_DEBUG
uprintf("Switching to QMK\n");
#endif
@@ -78,11 +102,38 @@ bool send_steno_chord_user(steno_mode_t mode, uint8_t chord[6]) {
goto out;
}
+ // Lone FN press, toggle QWERTY
+#ifndef ONLYQWERTY
+ if (cChord == FN) {
+ (cMode == STENO) ? (cMode = QWERTY) : (cMode = STENO);
+ goto out;
+ }
+#endif
+
+ // Check for Plover momentary
+ if (cMode == QWERTY && (cChord & FN)) {
+ cChord ^= FN;
+ goto steno;
+ }
+
// Do QWERTY and Momentary QWERTY
- if (cMode == QWERTY || (cMode == COMMAND)) {
+ if (cMode == QWERTY || (cMode == COMMAND) || (cChord & (FN | PWR))) {
processChord(false);
goto out;
- }
+ }
+
+ // Fallback NKRO Steno
+ if (cMode == STENO && QWERSTENO) {
+ processChord(true);
+ goto out;
+ }
+
+steno:
+ // Hey that's a steno chord!
+ inChord = false;
+ chordIndex = 0;
+ cChord = 0;
+ return true;
out:
cChord = 0;
diff --git a/keyboards/butterstick/sten.h b/keyboards/butterstick/sten.h
index 5a9771d9a0..84635a554c 100644
--- a/keyboards/butterstick/sten.h
+++ b/keyboards/butterstick/sten.h
@@ -13,11 +13,14 @@
extern size_t keymapsCount; // Total keymaps
extern uint32_t cChord; // Current Chord
+extern uint32_t stenoLayers[]; // Chords that simulate QMK layers
+extern size_t stenoLayerCount; // Number of simulated layers
+uint32_t refChord; // Reference chord for PC macro
// Function defs
void processChord(bool useFakeSteno);
-uint32_t processQwerty(bool lookup);
-uint32_t processFakeSteno(bool lookup);
+uint32_t processQwerty(bool lookup);
+uint32_t processFakeSteno(bool lookup);
void saveState(uint32_t cChord);
void restoreState(void);
@@ -30,6 +33,11 @@ void CLICK_MOUSE(uint8_t);
// Keymap helper
#define P(chord, act) if (cChord == (chord)) { if (!lookup) {act;} return chord;}
+#define PC(chord, act) if (cChord == (chord)) { if (!lookup) {act;} return chord;} \
+ for(int i = 0; i < stenoLayerCount; i++) { \
+ refChord = stenoLayers[i] | chord; \
+ if (cChord == (refChord)) { if (!lookup) {act;} return refChord;}; \
+}
// Shift to internal representation
// i.e) S(teno)R(ight)F