[Keymap] Reorganization, cleanup and readmes for drashna code (#15617)
This commit is contained in:
parent
1a8a842cfb
commit
c4551d7ef1
64 changed files with 1291 additions and 1163 deletions
|
@ -115,103 +115,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
),
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
#ifdef POINTING_DEVICE_ENABLE
|
||||
static uint16_t mouse_timer = 0;
|
||||
static uint16_t mouse_debounce_timer = 0;
|
||||
static uint8_t mouse_keycode_tracker = 0;
|
||||
bool tap_toggling = false;
|
||||
|
||||
void process_mouse_user(report_mouse_t* mouse_report, int8_t x, int8_t y) {
|
||||
if ((x || y) && timer_elapsed(mouse_timer) > 125) {
|
||||
mouse_timer = timer_read();
|
||||
if (!layer_state_is(_MOUSE) && !(layer_state_is(_GAMEPAD) || layer_state_is(_DIABLO)) && timer_elapsed(mouse_debounce_timer) > 125) {
|
||||
layer_on(_MOUSE);
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef TAPPING_TERM_PER_KEY
|
||||
if (timer_elapsed(mouse_debounce_timer) > get_tapping_term(KC_BTN1, NULL)
|
||||
# else
|
||||
if (timer_elapsed(mouse_debounce_timer) > TAPPING_TERM
|
||||
# endif
|
||||
|| (layer_state_is(_GAMEPAD) || layer_state_is(_DIABLO))) {
|
||||
mouse_report->x = x;
|
||||
mouse_report->y = y;
|
||||
}
|
||||
# ifdef OLED_ENABLE
|
||||
if (x || y) oled_timer = timer_read32();
|
||||
# endif
|
||||
}
|
||||
|
||||
void matrix_scan_keymap(void) {
|
||||
if (timer_elapsed(mouse_timer) > 650 && layer_state_is(_MOUSE) && !mouse_keycode_tracker && !tap_toggling) {
|
||||
layer_off(_MOUSE);
|
||||
}
|
||||
if (tap_toggling) {
|
||||
if (!layer_state_is(_MOUSE)) {
|
||||
layer_on(_MOUSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool process_record_keymap(uint16_t keycode, keyrecord_t* record) {
|
||||
switch (keycode) {
|
||||
case TT(_MOUSE):
|
||||
{
|
||||
if (record->event.pressed) {
|
||||
mouse_keycode_tracker++;
|
||||
} else {
|
||||
# if TAPPING_TOGGLE != 0
|
||||
if (record->tap.count == TAPPING_TOGGLE) {
|
||||
tap_toggling ^= 1;
|
||||
# if TAPPING_TOGGLE == 1
|
||||
if (!tap_toggling) mouse_keycode_tracker -= record->tap.count + 1;
|
||||
# else
|
||||
if (!tap_toggling) mouse_keycode_tracker -= record->tap.count;
|
||||
# endif
|
||||
} else {
|
||||
mouse_keycode_tracker--;
|
||||
}
|
||||
# endif
|
||||
}
|
||||
mouse_timer = timer_read();
|
||||
break;
|
||||
}
|
||||
case MO(_MOUSE):
|
||||
case DPI_CONFIG:
|
||||
case KC_MS_UP ... KC_MS_WH_RIGHT:
|
||||
record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--;
|
||||
mouse_timer = timer_read();
|
||||
break;
|
||||
default:
|
||||
if (layer_state_is(_MOUSE) && !mouse_keycode_tracker) {
|
||||
layer_off(_MOUSE);
|
||||
}
|
||||
mouse_keycode_tracker = 0;
|
||||
mouse_debounce_timer = timer_read();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_keymap(layer_state_t state) {
|
||||
if (layer_state_cmp(state, _GAMEPAD) || layer_state_cmp(state, _DIABLO)) {
|
||||
state |= (1UL << _MOUSE);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
#endif
|
||||
|
||||
void matrix_init_keymap(void) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
extern audio_config_t audio_config;
|
||||
|
||||
if (!is_keyboard_master()) {
|
||||
audio_stop_all();
|
||||
audio_config.enable = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void keyboard_post_init_keymap(void) { matrix_init_keymap(); }
|
||||
|
|
|
@ -1,14 +1,34 @@
|
|||
RGBLIGHT_ENABLE = yes
|
||||
RGBLIGHT_STARTUP_ANIMATION = yes
|
||||
AUDIO_ENABLE = yes
|
||||
HAPTIC_ENABLE = no
|
||||
COMMAND_ENABLE = no
|
||||
TAP_DANCE_ENABLE = yes
|
||||
UNICODE_ENABLE = yes
|
||||
OLED_ENABLE = yes
|
||||
WPM_ENABLE = yes
|
||||
ENCODER_ENABLE = yes
|
||||
ENCODER_MAP_ENABLE = yes
|
||||
# DEBOUNCE_TYPE = sym_eager_pk
|
||||
COMMAND_ENABLE = no
|
||||
RGBLIGHT_ENABLE = yes
|
||||
RGBLIGHT_STARTUP_ANIMATION = yes
|
||||
AUDIO_ENABLE = yes
|
||||
HAPTIC_ENABLE = no
|
||||
TAP_DANCE_ENABLE = yes
|
||||
OLED_ENABLE = yes
|
||||
WPM_ENABLE = yes
|
||||
ENCODER_ENABLE = yes
|
||||
ENCODER_MAP_ENABLE = yes
|
||||
AUTOCORRECTION_ENABLE = yes
|
||||
CAPS_WORD_ENABLE = yes
|
||||
|
||||
LTO_SUPPORTED = no
|
||||
ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/elite_c)
|
||||
RGBLIGHT_ENABLE = no
|
||||
AUDIO_ENABLE = no
|
||||
HAPTIC_ENABLE = no
|
||||
TAP_DANCE_ENABLE = no
|
||||
OLED_ENABLE = no
|
||||
WPM_ENABLE = no
|
||||
ENCODER_ENABLE = no
|
||||
AUTOCORRECTION_ENABLE = no
|
||||
LTO_SUPPORTED = yes
|
||||
SWAP_HANDS_ENABLE = no
|
||||
CUSTOM_UNICODE_ENABLE = no
|
||||
CAPS_WORD_ENABLE = no
|
||||
BOOTLOADER = qmk-hid
|
||||
BOOTLOADER_SIZE = 512
|
||||
endif
|
||||
ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/teensy2pp)
|
||||
AUTOCORRECTION_ENABLE = no
|
||||
CAPS_WORD_ENABLE = yes
|
||||
endif
|
||||
# DEBOUNCE_TYPE = sym_eager_pk
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue