Updating everything to use the new userspace format
This commit is contained in:
@@ -8,12 +8,14 @@
|
||||
|
||||
enum {
|
||||
TD_Q_ESC,
|
||||
TD_W_GRV
|
||||
TD_W_GRV,
|
||||
BRT_OPA
|
||||
};
|
||||
|
||||
// Tap dance keycodes
|
||||
#define Q_ESC TD(TD_Q_ESC)
|
||||
#define W_GRV TD(TD_W_GRV)
|
||||
#define TD_OPAR TD(BRT_OPA)
|
||||
|
||||
|
||||
// Custom keycodes
|
||||
@@ -21,7 +23,7 @@ enum {
|
||||
enum {
|
||||
CUSTOM_KEYCODE_START = SAFE_RANGE,
|
||||
M_PASS1,
|
||||
M_PASS12,
|
||||
M_PASS2,
|
||||
CUSTOM_KEYCODE_END
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// THUMB KEYS
|
||||
#define ___________THUMB_L3________ MUS_ESC, NAV_BKSP,MOUSE_TAB
|
||||
#define ___________THUMB_R3________ SYM_ENTER,NUM_SPC,FUN_DEL
|
||||
#define _________________BOOT_L1____________________ _______, _______, _______
|
||||
#define ___________THUMB_3__BLANK__ _______, _______, _______
|
||||
|
||||
#define ____THUMB_L2____ NAV_BKSP,FUN_TAB
|
||||
#define ____THUMB_R2____ SYM_ENTER,NUM_SPC
|
||||
@@ -50,27 +50,23 @@
|
||||
|
||||
// SYM
|
||||
#define __________________SYM_L1____________________ KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR
|
||||
#define __________________SYM_L1____________________ KC_COLN, KC_DLR, KC_PERC, KC_CIRC, KC_PLUS
|
||||
#define __________________SYM_L1____________________ KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE
|
||||
#define __________________SYM_L2____________________ KC_COLN, KC_DLR, KC_PERC, KC_CIRC, KC_PLUS
|
||||
#define __________________SYM_L3____________________ KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE
|
||||
#define _________SYM_TH_L3________ KC_LPRN, KC_RPRN, KC_UNDS
|
||||
#define _____SYM_TH_L2___ KC_RPRN, KC_UNDS
|
||||
|
||||
// FUN
|
||||
#define __________________FUN_R1____________________ _______, _______, _______, _______, QK_BOOTLOADER
|
||||
#define __________________FUN_L1____________________ KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR
|
||||
#define __________________FUN_L1____________________ KC_COLN, KC_DLR, KC_PERC, KC_CIRC, KC_PLUS
|
||||
#define __________________FUN_L1____________________ KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE
|
||||
#define __________________FUN_L1____________________ KC_F12, KC_F7, KC_F8, KC_F9, KC_PSCR
|
||||
#define __________________FUN_L2____________________ KC_F11, KC_F4, KC_F5, KC_F6, _______
|
||||
#define __________________FUN_L3____________________ KC_F10, KC_F1, KC_F2, KC_F3, _______
|
||||
|
||||
|
||||
// MUS
|
||||
#define __________________MUS_L1____________________ QK_BOOTLOADER, _______, _______, _______, _______
|
||||
|
||||
#define __________________MUS_R1____________________ KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR
|
||||
#define __________________MUS_R2____________________ KC_COLN, KC_DLR, KC_PERC, KC_CIRC, KC_PLUS
|
||||
#define __________________MUS_R3____________________ KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE
|
||||
#define __________________MUS_R2____________________ _______, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT
|
||||
#define __________________MUS_R3____________________ _______, KC_MSTP, KC_MPLY, KC_MUTE, _______
|
||||
|
||||
|
||||
// MOUSE
|
||||
#define __________________MOU_R1____________________ _______, KC_PSTE, KC_COPY, KC_CUT, KC_UNDO
|
||||
#define __________________MOU_R2____________________ KC_BTN1, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R
|
||||
#define __________________MOU_R3____________________ KC_BTN2, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R
|
||||
#define __________________MOU_R2____________________ KC_BTN1, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R
|
||||
#define __________________MOU_R3____________________ KC_BTN2, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R
|
||||
9
dgvigil/definitions/process_record.h
Normal file
9
dgvigil/definitions/process_record.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#define _PROCESS_RECORD_RESULT_H
|
||||
|
||||
typedef enum {
|
||||
PROCESS_RECORD_RETURN_TRUE,
|
||||
PROCESS_RECORD_RETURN_FALSE,
|
||||
PROCESS_RECORD_CONTINUE
|
||||
} process_record_result_t;
|
||||
@@ -1,8 +1,2 @@
|
||||
#include "dgvigil.h"
|
||||
|
||||
#include "definitions/layers.h"
|
||||
#include "definitions/keycodes.h"
|
||||
#include "definitions/keymap_blocks.h"
|
||||
#include "features/taphold.h"
|
||||
#include "features/tapdance.h"
|
||||
#include "features/macros.h"
|
||||
@@ -1,8 +1,9 @@
|
||||
#ifndef USERSPACE
|
||||
#define USERSPACE
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
void my_custom_function(void);
|
||||
|
||||
#endif
|
||||
#include "features/taphold.h"
|
||||
#include "features/tapdance.h"
|
||||
#include "features/macros.h"
|
||||
#include "definitions/layers.h"
|
||||
#include "definitions/process_record.h"
|
||||
#include "definitions/keycodes.h"
|
||||
#include "definitions/keymap_blocks.h"
|
||||
20
dgvigil/features/macros.c
Normal file
20
dgvigil/features/macros.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "macros.h"
|
||||
|
||||
|
||||
process_record_result_t process_macro_keycode(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case M_PASS1:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("T3lg3Ranch!2023");
|
||||
}
|
||||
return false;
|
||||
case M_PASS2:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("P0plarLake!2023");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "../definitions/keycodes.h"
|
||||
#include "../definitions/process_record.h"
|
||||
|
||||
|
||||
process_record_result_t process_macros(uint16_t keycode, keyrecord_t *record);
|
||||
72
dgvigil/features/tapdance.c
Normal file
72
dgvigil/features/tapdance.c
Normal file
@@ -0,0 +1,72 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "tapdance.h"
|
||||
|
||||
static td_tap_t tap_state = {.state = TD_NONE};
|
||||
|
||||
__attribute__((weak)) td_state_t dance_state(tap_dance_state_t *state) {
|
||||
if (state->count == 1) {
|
||||
if (state->interrupted || !state->pressed) return TD_SINGLE_TAP;
|
||||
// Key has not been interrupted, but the key is still held. Means you want to send a 'HOLD'.
|
||||
else
|
||||
return TD_SINGLE_HOLD;
|
||||
} else if (state->count == 2) {
|
||||
// TD_DOUBLE_SINGLE_TAP is to distinguish between typing "pepper", and actually wanting a double tap
|
||||
// action when hitting 'pp'. Suggested use case for this return value is when you want to send two
|
||||
// keystrokes of the key, and not the 'double tap' action/macro.
|
||||
if (state->interrupted)
|
||||
return TD_DOUBLE_SINGLE_TAP;
|
||||
else if (state->pressed)
|
||||
return TD_DOUBLE_HOLD;
|
||||
else
|
||||
return TD_DOUBLE_TAP;
|
||||
}
|
||||
|
||||
// Assumes no one is trying to type the same letter three times (at least not quickly).
|
||||
// If your tap dance key is 'KC_W', and you want to type "www." quickly - then you will need to add
|
||||
// an exception here to return a 'TD_TRIPLE_SINGLE_TAP', and define that enum just like 'TD_DOUBLE_SINGLE_TAP'
|
||||
if (state->count == 3) {
|
||||
if (state->interrupted || !state->pressed)
|
||||
return TD_TRIPLE_TAP;
|
||||
else
|
||||
return TD_TRIPLE_HOLD;
|
||||
} else
|
||||
return TD_UNKNOWN;
|
||||
}
|
||||
|
||||
bool is_shifted(void) {
|
||||
return get_mods() & MOD_MASK_SHIFT || get_oneshot_mods() & MOD_MASK_SHIFT ||
|
||||
get_oneshot_locked_mods() & MOD_MASK_SHIFT;
|
||||
}
|
||||
|
||||
void td_open_parentesis(tap_dance_state_t *state, void *user_data) {
|
||||
tap_state.state = dance_state(state);
|
||||
switch (tap_state.state) {
|
||||
case TD_SINGLE_TAP:
|
||||
tap_code16(KC_LPRN);
|
||||
break;
|
||||
case TD_SINGLE_HOLD:
|
||||
tap_code16(KC_END);
|
||||
tap_code16(KC_LPRN);
|
||||
break;
|
||||
case TD_DOUBLE_TAP:
|
||||
SEND_STRING("var ");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// clang-format off
|
||||
|
||||
// Tap dance declarations
|
||||
|
||||
tap_dance_action_t tap_dance_actions[] = {
|
||||
[TD_Q_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_ESC),
|
||||
[TD_W_GRV] = ACTION_TAP_DANCE_DOUBLE(KC_W, KC_GRAVE),
|
||||
[BRT_OPA] = ACTION_TAP_DANCE_FN(td_open_parentesis),
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "../definitions/keycodes.h"
|
||||
|
||||
typedef enum {
|
||||
TD_NONE,
|
||||
TD_UNKNOWN,
|
||||
TD_SINGLE_TAP,
|
||||
TD_SINGLE_HOLD,
|
||||
TD_DOUBLE_TAP,
|
||||
TD_DOUBLE_HOLD,
|
||||
TD_DOUBLE_SINGLE_TAP, // Send two single taps
|
||||
TD_TRIPLE_TAP,
|
||||
TD_TRIPLE_HOLD
|
||||
} td_state_t;
|
||||
|
||||
typedef struct {
|
||||
td_state_t state;
|
||||
bool recording;
|
||||
} td_tap_t;
|
||||
|
||||
td_state_t dance_state(tap_dance_state_t *state);
|
||||
@@ -1,13 +1,11 @@
|
||||
SRC += dgvigil.c
|
||||
SRC += secret.c
|
||||
SRC += definitions/keycodes.c
|
||||
SRC += features/tapdance.c
|
||||
SRC += features/combos.c
|
||||
SRC +=features/tapdance.c
|
||||
SRC +=features/macros.c
|
||||
|
||||
REPEAT_KEY_ENABLE = yes
|
||||
AUTO_SHIFT_ENABLE = yes
|
||||
CAPS_WORD_ENABLE = yes
|
||||
COMBO_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = yes
|
||||
RGBLIGHT_ENABLE = yes
|
||||
|
||||
LTO_ENABLE = yes
|
||||
|
||||
Reference in New Issue
Block a user