Skip to content

Commit

Permalink
[Keyboard] Added little fixes and bootmagic for gBoard keebs (qmk#6477)
Browse files Browse the repository at this point in the history
* Added little fixes and bootmagic

* Update keyboards/gergo/keymaps/oled/rules.mk

Co-Authored-By: Drashna Jaelre <[email protected]>

* whacked out quantum_libs
  • Loading branch information
germ authored and drashna committed Aug 6, 2019
1 parent ae934c3 commit 07bdc8f
Show file tree
Hide file tree
Showing 10 changed files with 508 additions and 16 deletions.
15 changes: 7 additions & 8 deletions keyboards/butterstick/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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]);
61 changes: 56 additions & 5 deletions keyboards/butterstick/sten.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -70,19 +94,46 @@ 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
layer_on(1);
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;
Expand Down
12 changes: 10 additions & 2 deletions keyboards/butterstick/sten.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions keyboards/gergo/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "config_common.h"

#define BOOTMAGIC_LITE_ROW 13
#define BOOTMAGIC_LITE_COLUMN 2

/* Defaults */
#ifndef BALLSTEP
#define BALLSTEP 20
Expand Down
4 changes: 4 additions & 0 deletions keyboards/gergo/keymaps/oled/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#pragma once

#define IGNORE_MOD_TAP_INTERRUPT
#define OLED_FONT_H "keyboards/gergo/keymaps/oled/glcdfont.c"
Loading

0 comments on commit 07bdc8f

Please sign in to comment.