Skip to content

Commit

Permalink
Klackygears add user and handwired brain (qmk#9154)
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Erovia <Erovia@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 28, 2020
1 parent 5c9a34b commit 9413245
Show file tree
Hide file tree
Showing 7 changed files with 609 additions and 0 deletions.
75 changes: 75 additions & 0 deletions users/klackygears/klackygears.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#include "klackygears.h"

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
/*
if (!process_record_dynamic_macro(keycode, record)) {
return false;
}
*/
switch (keycode) {
case KC_MACBASE:
if (record->event.pressed) {
set_single_persistent_default_layer(_MACBASE);
}
break;

case KC_QWERTY:
if (record->event.pressed) {
set_single_persistent_default_layer(_QWERTY);
}
break;

case KC_WINBASE:
if (record->event.pressed) {
set_single_persistent_default_layer(_WINBASE);
}
break;

case KC_GAMER:
if (record->event.pressed) {
set_single_persistent_default_layer(_GAMER);
}
break;

case KC_GAMR1:
if (record->event.pressed) {
set_single_persistent_default_layer(_GAMR1);
}
break;

case KC_GAMR2:
if (record->event.pressed) {
set_single_persistent_default_layer(_GAMR2);
}
break;
case RGBRST:
#ifdef RGBLIGHT_ENABLE
if (record->event.pressed) {
eeconfig_update_rgblight_default();
rgblight_enable();
}
#endif
break;

case MAKEK:
if (record->event.pressed) {
SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP);
}
break;

case MAKEKF:
if (!record->event.pressed) {
SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP ":flash");
}

break;

case SHRUG:
if (record->event.pressed) {
SEND_STRING(":Shrug:");
}
break;
}

return true;
}
72 changes: 72 additions & 0 deletions users/klackygears/klackygears.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#pragma once

#include QMK_KEYBOARD_H

#include "wrappers.h"
#include "eeprom.h"
#ifdef TAP_DANCE_ENABLE
#include "tap_dances.h"
#endif // TAP_DANCE_ENABLE

enum layer_number {
_WINBASE = 0,
_MACBASE,
_QWERTY,
_GAMER,
_GAMR1,
_GAMR2,
_NGMR,
_NUMB,
_MNMB,
_SYMB,
_FUNC,
_MDIA,
_MEME
};

enum userspace_custom_keycodes {
KC_MACBASE = SAFE_RANGE,
KC_QWERTY,
KC_WINBASE,
KC_GAMER,
KC_GAMR1,
KC_GAMR2,
NUMB,
MNMB,
SYMB,
FUNC,
MDIA,
RGBRST,
MAKEK,
MAKEKF,
SHRUG,
//DYNAMIC_MACRO_RANGE,
SAFE_RANGE_KEYMAP
};


/*
#ifdef UNICODEMAP_ENABLE
enum unicode_names {
BANG,
IRONY,
SNEK,
};
const uint32_t PROGMEM unicode_map[] = {
[BANG] = 0x203D, // ‽
[IRONY] = 0x2E2E, // ⸮
[SNEK] = 0x1F40D, // 🐍
};
#endif // UNICODEMAP_ENABLE
*/


//#include "dynamic_macro.h"



#if RGBLIGHT_ENABLE
uint8_t RGB_current_mode;

#endif
15 changes: 15 additions & 0 deletions users/klackygears/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Copyright<2019><James Smith><bronzegears@gmail.com> @klackygears

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/>.


Most of what I have here was copied and modified from drashna. If it looks a bit messy it's because I'm a total noob and trying to push myself to learn new things.
6 changes: 6 additions & 0 deletions users/klackygears/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SRC += klackygears.c


ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
SRC += tap_dances.c
endif
184 changes: 184 additions & 0 deletions users/klackygears/tap_dances.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
#include "tap_dances.h"

/*
void macroTogKey(qk_tap_dance_state_t *state, void *user_data) {
keyrecord_t kr;
if (state->count == 1)
{
kr.event.pressed = false;
process_record_dynamic_macro( DYN_MACRO_PLAY1, &kr );
}
else if (state->count == 2)
{
kr.event.pressed = true;
process_record_dynamic_macro( DYN_REC_STOP, &kr );
}
else if (state->count == 3)
{
kr.event.pressed = false;
process_record_dynamic_macro( DYN_REC_START1, &kr );
}
}
void macroTogKey2(qk_tap_dance_state_t *state, void *user_data) {
keyrecord_t kr;
if (state->count == 1)
{
kr.event.pressed = false;
process_record_dynamic_macro( DYN_MACRO_PLAY2, &kr );
}
else if (state->count == 2)
{
kr.event.pressed = true;
process_record_dynamic_macro( DYN_REC_STOP, &kr );
}
else if (state->count == 3)
{
kr.event.pressed = false;
process_record_dynamic_macro( DYN_REC_START2, &kr );
}
}
*/

void pstinsrt(qk_tap_dance_state_t *state, void *user_data) {
if (state->count > 1) {
register_code(KC_LALT);
tap_code(KC_I);
tap_code(KC_E);
unregister_code(KC_LALT);
} else {
tap_code16(C(KC_V));
}
reset_tap_dance(state);
}

void ccopy(qk_tap_dance_state_t *state, void *user_data) {
if (state->count > 1) {
tap_code16(C(KC_X));

// SEND_STRING( SS_DOWN(KC_LCTL) SS_TAP(KC_X) SS_UP(KC_LCTL));
} else {
tap_code16(C(KC_C));
}
reset_tap_dance(state);
}

void pstspecial(qk_tap_dance_state_t *state, void *user_data) {
if (state->count > 1) {
register_code(KC_LALT);
tap_code(KC_E);
tap_code(KC_S);
unregister_code(KC_LALT);
tap_code(KC_V);
} else {
register_code(KC_LALT);
tap_code(KC_E);
tap_code(KC_S);
unregister_code(KC_LALT);
tap_code(KC_T);
}
reset_tap_dance(state);
}

void deldel(qk_tap_dance_state_t *state, void *user_data) {
if (state->count > 1) {
register_code(KC_LALT);
tap_code(KC_E);
tap_code(KC_D);
unregister_code(KC_LALT);
} else {
tap_code(KC_DEL);
}
reset_tap_dance(state);
}

void findreplace(qk_tap_dance_state_t *state, void *user_data) {
if (state->count > 1) {
tap_code16(C(KC_H));
} else {
tap_code16(C(KC_F));
}
reset_tap_dance(state);
}

void cyclawin(qk_tap_dance_state_t *state, void *user_data) {
if (state->count > 1) {
tap_code16(C(S(KC_F6)));
} else {
tap_code16(C(KC_F6));
}
reset_tap_dance(state);
}

void SCRNSNP(qk_tap_dance_state_t *state, void *user_data) {
if (state->count > 1) {
tap_code16(A(KC_PSCR));
} else {
tap_code(KC_LGUI);
tap_code(KC_S);
tap_code(KC_N);
tap_code16(C(KC_N));
}
reset_tap_dance(state);
}

void mcccpy(qk_tap_dance_state_t *state, void *user_data) {
if (state->count > 1) {
tap_code16(G(KC_X));
} else {
tap_code16(G(KC_C));
}
reset_tap_dance(state);
}

void mcpstin(qk_tap_dance_state_t *state, void *user_data) {
if (state->count > 1) {
tap_code16(G(KC_I));
} else {
tap_code16(G(KC_V));
}
reset_tap_dance(state);
}

void enttab(qk_tap_dance_state_t *state, void *user_data) {
if (state->count > 1) {
tap_code(KC_ENT);
} else {
tap_code(KC_TAB);
}
reset_tap_dance(state);
}

void rgb_toggle(qk_tap_dance_state_t *state, void *user_data) {
#ifdef RGBLIGHT_ENABLE
if (state->count == 1) {
rgblight_step();
} else {
rgblight_increase_hue();
}
#endif
}

// Tap Dance Definitions
qk_tap_dance_action_t tap_dance_actions[] = {
[TD_PSTI] = ACTION_TAP_DANCE_FN(pstinsrt),
[TD_PTSP] = ACTION_TAP_DANCE_FN(pstspecial),
[TD_FNDR] = ACTION_TAP_DANCE_FN(findreplace),
[TD_CCPY] = ACTION_TAP_DANCE_FN(ccopy),
[TD_DDEL] = ACTION_TAP_DANCE_FN(deldel),
[TD_ACCW] = ACTION_TAP_DANCE_FN(cyclawin),
[TD_CAPESC] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS),
[TD_DTEX] = ACTION_TAP_DANCE_DOUBLE(KC_DOT, KC_EXLM),
[TD_COMQUES] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_QUES),
[TD_MINPLS] = ACTION_TAP_DANCE_DOUBLE(KC_PMNS, KC_PPLS),
[TD_DIVMLT] = ACTION_TAP_DANCE_DOUBLE(KC_PSLS, KC_PAST),
[TD_DOTEQL] = ACTION_TAP_DANCE_DOUBLE(KC_DOT, KC_EQL),
[TD_SCNSP] = ACTION_TAP_DANCE_FN(SCRNSNP),
[TD_MCCCPY] = ACTION_TAP_DANCE_FN(mcccpy),
[TD_MCPSTIN] = ACTION_TAP_DANCE_FN(mcpstin),
[TD_ENTAB] = ACTION_TAP_DANCE_FN(enttab),
[TD_XSPC] = ACTION_TAP_DANCE_DOUBLE(KC_SPACE, KC_X),
[TD_RGB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, rgb_toggle, NULL)
};
37 changes: 37 additions & 0 deletions users/klackygears/tap_dances.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#pragma once
#include "klackygears.h"

#ifdef TAP_DANCE_ENABLE
enum {
// TD_MCROTOG,
// TD_MCROTG2,
TD_BTK,
TD_TDE,
TD_LPRN,
TD_RPRN,
TD_MIN,
TD_USC,
TD_CMWN,
TD_ATSH,
TD_PSTI,
TD_PTSP,
TD_FNDR,
TD_CCPY,
TD_DDEL,
TD_ACCW,
TD_CAPESC,
TD_DTEX,
TD_COMQUES,
TD_MINPLS,
TD_DIVMLT,
TD_DOTEQL,
TD_LSHSYM,
TD_RSHSYM,
TD_SCNSP,
TD_MCCCPY,
TD_MCPSTIN,
TD_ENTAB,
TD_XSPC,
TD_RGB,
};
#endif
Loading

0 comments on commit 9413245

Please sign in to comment.