Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
QMK Bot
2021-12-30 04:18:05 +00:00
64 changed files with 1291 additions and 1163 deletions

View File

@ -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(); }

View File

@ -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

View File

@ -16,15 +16,6 @@
#pragma once
/* Use I2C or Serial, not both */
// #define USE_SERIAL
#define USE_I2C
/* Select hand configuration */
// #define MASTER_LEFT
// #define MASTER_RIGHT
#define EE_HANDS
#ifdef RGBLIGHT_ENABLE

View File

@ -4,7 +4,6 @@ EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
TAP_DANCE_ENABLE = no
RGBLIGHT_ENABLE = yes
AUDIO_ENABLE = no
NKRO_ENABLE = yes
BACKLIGHT_ENABLE = no
@ -15,3 +14,7 @@ INDICATOR_LIGHTS = no
RGBLIGHT_STARTUP_ANIMATION = no
CUSTOM_UNICODE_ENABLE = no
CUSTOM_SPLIT_TRANSPORT_SYNC = no
ifneq ($(strip $(KEYBOARD)), keebio/iris/rev6)
RGBLIGHT_ENABLE = yes
endif

View File

@ -63,27 +63,27 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_GAMEPAD] = LAYOUT_moonlander_wrapper(
KC_ESC, KC_NO, KC_1, KC_2, KC_3, KC_4, HYPR(KC_Q), KC_TRNS, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO,
KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, KC_T, UC_SHRG, UC_DISA, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, KC_TRNS, TG_GAME, KC_I, KC_O, KC_NO, KC_NO, KC_NO, KC_NO,
KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_N, KC_M, KC_NO, KC_NO, KC_NO, KC_NO,
KC_ESC, XXXXXXX, KC_1, KC_2, KC_3, KC_4, HYPR(KC_Q), _______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, KC_NO,
KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, KC_T, UC_SHRG, UC_DISA, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO,
KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, _______, TG_GAME, KC_I, KC_O, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO,
KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO,
KC_GRV, KC_U, KC_I, KC_Y, KC_T, KC_PSCR, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO,
KC_V, KC_SPC, KC_H, KC_NO, KC_NO, KC_SWAP_NUM
KC_V, KC_SPC, KC_H, KC_NO, XXXXXXX,KC_SWAP_NUM
),
[_DIABLO] = LAYOUT_moonlander_wrapper(
KC_ESC, KC_V, KC_D, KC_LALT, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO,
KC_TAB, KC_S, KC_I, KC_F, KC_M, KC_T, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_1, KC_2, KC_3, KC_4, KC_G, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_LCTL, KC_D3_1, KC_D3_2, KC_D3_3, KC_D3_4, KC_Z, KC_N, KC_M, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_L, KC_J, KC_F, KC_PSCR, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_ESC, KC_V, KC_D, KC_LALT, XXXXXXX, XXXXXXX, XXXXXXX, _______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, KC_NO,
KC_TAB, KC_S, KC_I, KC_F, KC_M, KC_T, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO,
XXXXXXX, KC_1, KC_2, KC_3, KC_4, KC_G, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO,
KC_LCTL, KC_D3_1, KC_D3_2, KC_D3_3, KC_D3_4, KC_Z, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO,
XXXXXXX, XXXXXXX, KC_L, KC_J, KC_F, KC_PSCR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO,
KC_DIABLO_CLEAR, SFT_T(KC_SPACE), ALT_T(KC_Q), KC_PGDN, KC_DEL, KC_ENT
),
[_DIABLOII] = LAYOUT_moonlander_wrapper(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_GRV, KC_NO, KC_TRNS, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO,
KC_TAB, KC_A, KC_T, KC_Q, KC_I, KC_M, TG(_DIABLOII), KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_S, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_LCTL, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_N, KC_M, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_G, KC_F, KC_L, KC_V, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_GRV, XXXXXXX, _______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, KC_NO,
KC_TAB, KC_A, KC_T, KC_Q, KC_I, KC_M, TG(_DIABLOII), _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO,
KC_S, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO,
KC_LCTL, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO,
XXXXXXX, XXXXXXX, KC_G, KC_F, KC_L, KC_V, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO,
KC_G, KC_LSFT, KC_LCTL, KC_PGDN, KC_DEL, KC_ENT
),
@ -164,7 +164,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
}
#ifdef RGB_MATRIX_ENABLE
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
if (layer_state_is(_GAMEPAD)) {
RGB_MATRIX_INDICATOR_SET_COLOR(11, 0x00, 0xFF, 0x00); // Q
RGB_MATRIX_INDICATOR_SET_COLOR(16, 0x00, 0xFF, 0xFF); // W
@ -180,37 +180,7 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
RGB_MATRIX_INDICATOR_SET_COLOR(20, 0x7A, 0x00, 0xFF); // 3
}
if (userspace_config.rgb_layer_change) {
switch (get_highest_layer(layer_state|default_layer_state)) {
case _DEFAULT_LAYER_1:
rgb_matrix_layer_helper(DEFAULT_LAYER_1_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DEFAULT_LAYER_2:
rgb_matrix_layer_helper(DEFAULT_LAYER_2_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DEFAULT_LAYER_3:
rgb_matrix_layer_helper(DEFAULT_LAYER_3_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DEFAULT_LAYER_4:
rgb_matrix_layer_helper(DEFAULT_LAYER_4_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _GAMEPAD:
rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DIABLO:
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _RAISE:
rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _LOWER:
rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _ADJUST:
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
}
}
return true;
}
#endif

View File

@ -1,4 +1,6 @@
TAP_DANCE_ENABLE = yes
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
UNICODE_ENABLE = yes
UNICODEMAP_ENABLE = no
TAP_DANCE_ENABLE = yes
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
UNICODE_ENABLE = yes
UNICODEMAP_ENABLE = no
AUTOCORRECTION_ENABLE = yes
CAPS_WORD_ENABLE = yes

View File

@ -1,20 +1,27 @@
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes # Mouse keys
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # USB Nkey Rollover
UNICODE_ENABLE = yes # Unicode
OLED_ENABLE = yes
OLED_DRIVER = SSD1306 # Enables the use of OLED displays
ENCODER_ENABLE = yes # Enables the use of one or more encoders
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
RGBLIGHT_STARTUP_ANIMATION = yes
RGB_MATRIX_ENABLE = yes
TAP_DANCE_ENABLE = yes
KEY_LOCK_ENABLE = no
WPM_ENABLE = yes
SWAP_HANDS_ENABLE = yes
LTO_ENABLE = no
CTPC = yes
ifeq ($(strip $(KEYBOARD)), splitkb/kyria/rev1/proton_c)
RGB_MATRIX_ENABLE = yes
CONSOLE_ENABLE = yes # Console for debug
MOUSEKEY_ENABLE = yes # Mouse keys
TAP_DANCE_ENABLE = yes
SWAP_HANDS_ENABLE = yes
LTO_ENABLE = no
CTPC = yes
AUTOCORRECTION_ENABLE = yes
CAPS_WORD_ENABLE = yes
else
LTO_ENABLE = yes
BOOTLOADER = qmk-hid
BOOTLOADER_SIZE = 512
endif

View File

@ -15,3 +15,8 @@
*/
#pragma once
#define RGBLIGHT_EFFECT_KNIGHT_LED_NUM 12
#undef RGB_MATRIX_MAXIMUM_BRIGHTNESS
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255

View File

@ -126,45 +126,12 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
#endif
void rgb_matrix_indicators_user(void) {}
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
uint8_t this_mod = get_mods();
uint8_t this_led = host_keyboard_leds();
uint8_t this_osm = get_oneshot_mods();
#define THUMB_LED 6
#define RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(...) RGB_MATRIX_INDICATOR_SET_COLOR(__VA_ARGS__)
if (!userspace_config.rgb_layer_change) {
switch (get_highest_layer(layer_state | default_layer_state)) {
case _GAMEPAD:
rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DIABLO:
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _RAISE:
rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _LOWER:
rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _ADJUST:
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DEFAULT_LAYER_1:
rgb_matrix_layer_helper(DEFAULT_LAYER_1_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DEFAULT_LAYER_2:
rgb_matrix_layer_helper(DEFAULT_LAYER_2_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DEFAULT_LAYER_3:
rgb_matrix_layer_helper(DEFAULT_LAYER_3_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DEFAULT_LAYER_4:
rgb_matrix_layer_helper(DEFAULT_LAYER_4_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
}
}
extern bool host_driver_disabled;
if (host_driver_disabled) {
@ -214,4 +181,6 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
RGB_MATRIX_INDICATOR_SET_COLOR(4, 0xFF, 0xFF, 0x00);
RGB_MATRIX_INDICATOR_SET_COLOR(5, 0xFF, 0xFF, 0x00);
}
return true;
}

View File

@ -1,6 +1,10 @@
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
EXTRAKEY_ENABLE = yes
MOUSEKEY_ENABLE = yes
TAP_DANCE_ENABLE = no
NKRO_ENABLE = yes
RGBLIGHT_STARTUP_ANIMATION = yes
ENCODER_MAP_ENABLE = yes
AUTOCORRECTION_ENABLE = no
CUSTOM_UNICODE_ENABLE = no

View File

@ -45,6 +45,7 @@
# endif
#endif
#define PIMORONI_TRACKBALL_INVERT_X
#define PIMORONI_TRACKBALL_INVERT_Y
#define PIMORONI_TRACKBALL_CLICK
#ifdef TAPPING_TERM
# undef TAPPING_TERM
#endif
#define TAPPING_TERM 185

View File

@ -317,7 +317,7 @@ void suspend_power_down_keymap(void) { rgb_matrix_set_suspend_state(true); }
void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); }
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
if (layer_state_is(_GAMEPAD)) {
RGB_MATRIX_INDICATOR_SET_COLOR(32, 0x00, 0xFF, 0x00); // Q
RGB_MATRIX_INDICATOR_SET_COLOR(31, 0x00, 0xFF, 0xFF); // W
@ -332,43 +332,7 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
RGB_MATRIX_INDICATOR_SET_COLOR((userspace_config.swapped_numbers ? 27 : 26), 0x00, 0xFF, 0x00); // 2
RGB_MATRIX_INDICATOR_SET_COLOR(25, 0x7A, 0x00, 0xFF); // 3
}
# if defined(RGBLIGHT_ENABLE)
if (!userspace_config.rgb_layer_change)
# else
if (userspace_config.rgb_layer_change)
# endif
{
switch (get_highest_layer(layer_state | default_layer_state)) {
case _GAMEPAD:
rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DIABLO:
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _RAISE:
rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _LOWER:
rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _ADJUST:
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DEFAULT_LAYER_1:
rgb_matrix_layer_helper(DEFAULT_LAYER_1_HSV, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DEFAULT_LAYER_2:
rgb_matrix_layer_helper(DEFAULT_LAYER_2_HSV, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DEFAULT_LAYER_3:
rgb_matrix_layer_helper(DEFAULT_LAYER_3_HSV, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DEFAULT_LAYER_4:
rgb_matrix_layer_helper(DEFAULT_LAYER_4_HSV, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
}
}
return true;
}
#endif // RGB_MATRIX_INIT

View File

@ -201,17 +201,8 @@ led_config_t g_led_config = {
// clange-format on
# endif
// clang-format off
void suspend_power_down_keymap(void) {
rgb_matrix_set_suspend_state(true);
}
void suspend_wakeup_init_keymap(void) {
rgb_matrix_set_suspend_state(false);
}
// clang-format on
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
uint8_t this_mod = get_mods();
uint8_t this_led = host_keyboard_leds();
uint8_t this_osm = get_oneshot_mods();
@ -221,48 +212,6 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
# define THUMB_LED 42
# endif
# define RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(...) RGB_MATRIX_INDICATOR_SET_COLOR(__VA_ARGS__)
# if defined(RGBLIGHT_ENABLE)
if (!userspace_config.rgb_layer_change)
# else
if (userspace_config.rgb_layer_change)
# endif
{
switch (get_highest_layer(layer_state)) {
case _GAMEPAD:
rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DIABLO:
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _RAISE:
rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _LOWER:
rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _ADJUST:
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
default:
{
switch (get_highest_layer(default_layer_state)) {
case _DEFAULT_LAYER_1:
rgb_matrix_layer_helper(DEFAULT_LAYER_1_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DEFAULT_LAYER_2:
rgb_matrix_layer_helper(DEFAULT_LAYER_2_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DEFAULT_LAYER_3:
rgb_matrix_layer_helper(DEFAULT_LAYER_3_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
case _DEFAULT_LAYER_4:
rgb_matrix_layer_helper(DEFAULT_LAYER_4_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
break;
}
break;
}
}
}
switch (get_highest_layer(default_layer_state)) {
case _DEFAULT_LAYER_1:
@ -296,6 +245,8 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if ((this_mod | this_osm) & MOD_MASK_ALT) {
RGB_MATRIX_INDICATOR_SET_COLOR(38, 0x00, 0x00, 0xFF);
}
return true;
}
void matrix_init_keymap(void) {

View File

@ -1,33 +1,35 @@
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
TAP_DANCE_ENABLE = no
SPACE_CADET_ENABLE = no
NKRO_ENABLE = yes
CAPS_WORD_ENABLE = no
ifneq ($(strip $(KEYBOARD)), planck/rev6)
CONSOLE_ENABLE = no
COMMAND_ENABLE = no
CONSOLE_ENABLE = no
COMMAND_ENABLE = no
ifeq ($(strip $(LAYOUT_HAS_RGB)), yes)
RGBLIGHT_ENABLE = yes
INDICATOR_LIGHTS = yes
INDICATOR_LIGHTS = yes
RGBLIGHT_STARTUP_ANIMATION = yes
endif
else
CONSOLE_ENABLE = yes
COMMAND_ENABLE = yes
CONSOLE_ENABLE = yes
RGBLIGHT_ENABLE = yes
RGBLIGHT_STARTUP_ANIMATION = yes
RGB_MATRIX_ENABLE = no
AUDIO_ENABLE = yes
EEPROM_DRIVER = i2c
AUDIO_ENABLE = yes
EEPROM_DRIVER = i2c
ENCODER_MAP_ENABLE = yes
AUTOCORRECTION_ENABLE = yes
CAPS_WORD_ENABLE = yes
endif
ifeq ($(strip $(KEYBOARD)), planck/light)
RGB_MATRIX_ENABLE = yes
RGBLIGHT_ENABLE = yes
RGBLIGHT_STARTUP_ANIMATION = yes
AUDIO_ENABLE = yes
AUDIO_ENABLE = yes
endif
ifeq ($(strip $(KEYBOARD)), planck/ez)
RGBLIGHT_ENABLE = no
@ -39,4 +41,6 @@ ifeq ($(strip $(KEYBOARD)), planck/ez)
CONSOLE_ENABLE = yes
COMMAND_ENABLE = yes
AUDIO_ENABLE = yes
AUTOCORRECTION_ENABLE = yes
CAPS_WORD_ENABLE = yes
endif

View File

@ -93,3 +93,7 @@
#endif
#define TAPPING_TERM_PER_KEY
#ifdef TAPPING_TERM
# undef TAPPING_TERM
#endif
#define TAPPING_TERM 200

View File

@ -90,7 +90,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RESET,
VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EEP_RST,
KEYLOCK, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, RGB_IDL,
HPT_TOG, KC_NUKE, _______, _______, TG_MODS, HPT_FBK
AUTO_CTN,KC_NUKE, _______, _______, TG_MODS, HPT_FBK
)
};
// clang-format on
@ -265,7 +265,7 @@ void check_default_layer(uint8_t mode, uint8_t type, uint8_t led_min, uint8_t le
}
}
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
if (userspace_config.rgb_layer_change) {
switch (get_highest_layer(layer_state)) {
case _GAMEPAD:
@ -291,5 +291,6 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
}
check_default_layer(0, LED_FLAG_MODIFIER, led_min, led_max);
}
return false;
}
#endif

View File

@ -1,9 +1,8 @@
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
# change to "no" to disable the options
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
@ -12,27 +11,25 @@ NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see her
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
AUDIO_ENABLE = no # Audio output
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
SWAP_HANDS_ENABLE = no # Enable one-hand typing
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
ifeq ($(strip $(KEYBOARD)), crkbd/rev1)
OLED_ENABLE = yes
RGB_MATRIX_ENABLE = yes
HAPTIC_ENABLE = no
OLED_ENABLE = yes
RGB_MATRIX_ENABLE = yes
HAPTIC_ENABLE = no
endif
ifeq ($(strip $(CTPC)), yes)
HAPTIC_ENABLE = no
WS2812_DRIVER = pwm # won't work without a patch to the ctpc mk file
SERIAL_DRIVER = usart
SWAP_HANDS_ENABLE = yes
WPM_ENABLE = yes
HAPTIC_ENABLE = no
WS2812_DRIVER = pwm # won't work without a patch to the ctpc mk file
SERIAL_DRIVER = usart
SWAP_HANDS_ENABLE = yes
WPM_ENABLE = yes
AUTOCORRECTION_ENABLE = yes
CAPS_WORD_ENABLE = yes
else
CUSTOM_UNICODE_ENABLE = no
BOOTLOADER = qmk-hid
BOOTLOADER_SIZE = 512
CUSTOM_UNICODE_ENABLE = no
BOOTLOADER = qmk-hid
BOOTLOADER_SIZE = 512
endif

215
users/drashna/callbacks.c Normal file
View File

@ -0,0 +1,215 @@
// Copyright 2021 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "drashna.h"
__attribute__((weak)) void keyboard_pre_init_keymap(void) {}
void keyboard_pre_init_user(void) {
userspace_config.raw = eeconfig_read_user();
keyboard_pre_init_keymap();
}
// Add reconfigurable functions here, for keymap customization
// This allows for a global, userspace functions, and continued
// customization of the keymap. Use _keymap instead of _user
// functions in the keymaps
// Call user matrix init, set default RGB colors and then
// call the keymap's init function
__attribute__((weak)) void matrix_init_keymap(void) {}
__attribute__((weak)) void matrix_init_secret(void) {}
void matrix_init_user(void) {
#if defined(BOOTLOADER_CATERINA) && defined(__AVR__) && defined(__AVR_ATmega32U4__)
DDRD &= ~(1 << 5);
PORTD &= ~(1 << 5);
DDRB &= ~(1 << 0);
PORTB &= ~(1 << 0);
#endif
#ifdef CUSTOM_UNICODE_ENABLE
matrix_init_unicode();
#endif
matrix_init_secret();
matrix_init_keymap();
}
__attribute__((weak)) void keyboard_post_init_keymap(void) {}
void keyboard_post_init_user(void) {
#if defined(RGBLIGHT_ENABLE)
keyboard_post_init_rgb_light();
#endif
#if defined(RGB_MATRIX_ENABLE)
keyboard_post_init_rgb_matrix();
#endif
#if defined(SPLIT_KEYBOARD) && defined(SPLIT_TRANSACTION_IDS_USER)
keyboard_post_init_transport_sync();
#endif
keyboard_post_init_keymap();
}
#ifdef RGB_MATRIX_ENABLE
void rgb_matrix_update_pwm_buffers(void);
#endif
__attribute__((weak)) void shutdown_keymap(void) {}
void shutdown_user(void) {
#ifdef RGBLIGHT_ENABLE
rgblight_enable_noeeprom();
rgblight_mode_noeeprom(1);
rgblight_setrgb_red();
#endif // RGBLIGHT_ENABLE
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_set_color_all(0xFF, 0x00, 0x00);
rgb_matrix_update_pwm_buffers();
#endif // RGB_MATRIX_ENABLE
#ifdef OLED_ENABLE
oled_off();
#endif
shutdown_keymap();
}
__attribute__((weak)) void suspend_power_down_keymap(void) {}
void suspend_power_down_user(void) {
#ifdef OLED_ENABLE
oled_off();
#endif
suspend_power_down_keymap();
}
__attribute__((weak)) void suspend_wakeup_init_keymap(void) {}
void suspend_wakeup_init_user(void) {
if (layer_state_is(_GAMEPAD)) {
layer_off(_GAMEPAD);
}
if (layer_state_is(_DIABLO)) {
layer_off(_DIABLO);
}
suspend_wakeup_init_keymap();
}
// No global matrix scan code, so just run keymap's matrix
// scan function
__attribute__((weak)) void matrix_scan_keymap(void) {}
__attribute__((weak)) void matrix_scan_secret(void) {}
void matrix_scan_user(void) {
static bool has_ran_yet;
if (!has_ran_yet) {
has_ran_yet = true;
startup_user();
}
#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
run_diablo_macro_check();
#endif // TAP_DANCE_ENABLE
#if defined(RGBLIGHT_ENABLE)
matrix_scan_rgb_light();
#endif // RGBLIGHT_ENABLE
#if defined(RGB_MATRIX_ENABLE)
matrix_scan_rgb_matrix();
#endif
#if defined(POINTING_DEVICE_ENABLE)
matrix_scan_pointing();
#endif
matrix_scan_secret();
matrix_scan_keymap();
}
#ifdef AUDIO_ENABLE
float doom_song[][2] = SONG(E1M1_DOOM);
#endif
// on layer change, no matter where the change was initiated
// Then runs keymap's layer change check
__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
layer_state_t layer_state_set_user(layer_state_t state) {
if (!is_keyboard_master()) {
return state;
}
state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
#if defined(POINTING_DEVICE_ENABLE)
state = layer_state_set_pointing(state);
#endif
#if defined(RGBLIGHT_ENABLE)
state = layer_state_set_rgb_light(state);
#endif // RGBLIGHT_ENABLE
#if defined(AUDIO_ENABLE) && !defined(__arm__)
static bool is_gamepad_on = false;
if (layer_state_cmp(state, _GAMEPAD) != is_gamepad_on) {
is_gamepad_on = layer_state_cmp(state, _GAMEPAD);
if (is_gamepad_on) {
PLAY_LOOP(doom_song);
} else {
stop_all_notes();
}
}
#endif
state = layer_state_set_keymap(state);
return state;
}
// Runs state check and changes underglow color and animation
__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; }
layer_state_t default_layer_state_set_user(layer_state_t state) {
if (!is_keyboard_master()) {
return state;
}
state = default_layer_state_set_keymap(state);
#if 0
# if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
state = default_layer_state_set_rgb(state);
# endif // RGBLIGHT_ENABLE
#endif
return state;
}
__attribute__((weak)) void led_set_keymap(uint8_t usb_led) {}
void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); }
__attribute__((weak)) void eeconfig_init_keymap(void) {}
void eeconfig_init_user(void) {
userspace_config.raw = 0;
userspace_config.rgb_layer_change = true;
eeconfig_update_user(userspace_config.raw);
eeconfig_init_keymap();
}
#ifdef SPLIT_KEYBOARD
__attribute__((weak)) void matrix_slave_scan_keymap(void) {}
void matrix_slave_scan_user(void) {
# if defined(AUDIO_ENABLE)
# if !defined(NO_MUSIC_MODE)
music_task();
# endif
# ifdef AUDIO_INIT_DELAY
if (!is_keyboard_master()) {
static bool delayed_tasks_run = false;
static uint16_t delayed_task_timer = 0;
if (!delayed_tasks_run) {
if (!delayed_task_timer) {
delayed_task_timer = timer_read();
} else if (timer_elapsed(delayed_task_timer) > 300) {
audio_startup();
delayed_tasks_run = true;
}
}
}
# endif
# endif
# ifdef SEQUENCER_ENABLE
sequencer_task();
# endif
# ifdef LED_MATRIX_ENABLE
led_matrix_task();
# endif
# ifdef HAPTIC_ENABLE
haptic_task();
# endif
matrix_slave_scan_keymap();
}
#endif

25
users/drashna/callbacks.h Normal file
View File

@ -0,0 +1,25 @@
// Copyright 2021 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "quantum.h"
void matrix_init_keymap(void);
void matrix_init_secret(void);
void shutdown_keymap(void);
void suspend_power_down_keymap(void);
void suspend_wakeup_init_keymap(void);
void matrix_scan_keymap(void);
void matrix_scan_secret(void);
layer_state_t layer_state_set_keymap(layer_state_t state);
layer_state_t default_layer_state_set_keymap(layer_state_t state);
void led_set_keymap(uint8_t usb_led);
void eeconfig_init_keymap(void);
#ifdef CUSTOM_UNICODE_ENABLE
void matrix_init_unicode(void);
#endif
#ifdef SPLIT_KEYBOARD
void matrix_slave_scan_keymap(void);
#endif

View File

@ -0,0 +1,71 @@
# Custom Userspace Callback Functions
Specifically QMK works by using customized callback functions for everything. This allows for multiple levels of customization.
`matrix_scan` calls `matrix_scan_quantum`, which calls `matrix_scan_kb`, which calls `matrix_scan_user`.
`process_record` calls a bunch of stuff, but eventually calls `process_record_kb` which calls `process_record_user`
The same goes for `matrix_init`, `layer_state_set`, `led_set`, and a few other functions.
All (most) `_user` functions are handled here, in the userspace instead. To allow keyboard specific configuration, I've created `_keymap` functions that can be called by the keymap.c files instead.
This allows for keyboard specific configuration while maintaining the ability to customize the board.
My [Ergodox EZ Keymap](https://github.com/qmk/qmk_firmware/blob/master/layouts/community/ergodox/drashna/keymap.c) is a good example of this, as it uses the LEDs as modifier indicators.
You can see a list of these files in [callbacks.c](callbacks.c), or a shortend list here
```c
__attribute__((weak)) void matrix_init_keymap(void) {}
void matrix_init_user(void) {
matrix_init_keymap();
}
__attribute__((weak)) void keyboard_post_init_keymap(void) {}
void keyboard_post_init_user(void) {
keyboard_post_init_keymap();
}
__attribute__((weak)) void matrix_scan_keymap(void) {}
void matrix_scan_user(void) {
matrix_scan_keymap();
}
__attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (!process_record_keymap(keycode, record)) { return false; }
return true;
}
__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
layer_state_t layer_state_set_user(layer_state_t state) {
state = layer_state_set_keymap(state);
return state;
}
__attribute__ ((weak)) void led_set_keymap(uint8_t usb_led) {}
void led_set_user(uint8_t usb_led) {
led_set_keymap(usb_led);
}
__attribute__ ((weak)) void suspend_power_down_keymap(void) {}
void suspend_power_down_user(void) {
suspend_power_down_keymap();
}
__attribute__ ((weak)) void suspend_wakeup_init_keymap(void) {}
void suspend_wakeup_init_user(void) {
suspend_wakeup_init_keymap();
}
__attribute__ ((weak)) void shutdown_keymap(void) {}
void shutdown_user (void) {
shutdown_keymap();
}
__attribute__ ((weak)) void eeconfig_init_keymap(void) {}
void eeconfig_init_user(void) {
eeconfig_update_user(0);
eeconfig_init_keymap();
}
```

View File

@ -1,24 +1,16 @@
/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
*
* 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/>.
*/
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
// Use custom magic number so that when switching branches, EEPROM always gets reset
#define EECONFIG_MAGIC_NUMBER (uint16_t)0x1339
#ifdef IS_COMMAND
#undef IS_COMMAND
#endif
#define IS_COMMAND() (((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) == MOD_MASK_SHIFT)
/* Set Polling rate to 1000Hz */
#define USB_POLLING_INTERVAL_MS 1
@ -37,7 +29,7 @@
# define SELECT_SOFT_SERIAL_SPEED 1
# endif
# ifdef CUSTOM_SPLIT_TRANSPORT_SYNC
# define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC, RPC_ID_USER_KEYMAP_SYNC, RPC_ID_USER_CONFIG_SYNC
# define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC, RPC_ID_USER_KEYMAP_SYNC, RPC_ID_USER_CONFIG_SYNC, RPC_ID_USER_WATCHDOG_SYNC
# endif
#endif
@ -251,17 +243,6 @@
# define TAPPING_TOGGLE 1
#endif
#ifdef TAPPING_TERM
# undef TAPPING_TERM
#endif // TAPPING_TERM
#if defined(KEYBOARD_ergodox_ez)
# define TAPPING_TERM 185
#elif defined(KEYBOARD_crkbd)
# define TAPPING_TERM 200
#else
# define TAPPING_TERM 175
#endif
#define TAP_CODE_DELAY 5
/* Disable unused and unneeded features to reduce on firmware size */

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,5 @@
/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
*
* 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/>.
*/
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include QMK_KEYBOARD_H
@ -20,6 +7,8 @@
#include "eeprom.h"
#include "keyrecords/wrappers.h"
#include "keyrecords/process_records.h"
#include "callbacks.h"
#ifdef TAP_DANCE_ENABLE
# include "keyrecords/tap_dances.h"
#endif // TAP_DANCE_ENABLE
@ -58,7 +47,7 @@ enum userspace_layers {
_ADJUST,
};
#define _MACROS _MOUSE
#define _MACROS _MOUSE
#define _DEFAULT_LAYER_1 FIRST_DEFAULT_LAYER
#define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 1)
#define _DEFAULT_LAYER_3 (FIRST_DEFAULT_LAYER + 2)
@ -86,23 +75,10 @@ enum userspace_layers {
#define DEFAULT_LAYER_3_RGB RGB_MAGENTA
#define DEFAULT_LAYER_4_RGB RGB_GOLDENROD
bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed);
bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
void matrix_init_keymap(void);
void matrix_init_secret(void);
void shutdown_keymap(void);
void suspend_power_down_keymap(void);
void suspend_wakeup_init_keymap(void);
void matrix_scan_keymap(void);
void matrix_scan_secret(void);
layer_state_t layer_state_set_keymap(layer_state_t state);
layer_state_t default_layer_state_set_keymap(layer_state_t state);
void led_set_keymap(uint8_t usb_led);
void eeconfig_init_keymap(void);
bool hasAllBitsInMask(uint8_t value, uint8_t mask);
#ifdef SPLIT_KEYBOARD
void matrix_slave_scan_keymap(void);
#endif
bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed);
bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
bool hasAllBitsInMask(uint8_t value, uint8_t mask);
void tap_code16_nomods(uint8_t kc);
// clang-format off
typedef union {
@ -119,20 +95,3 @@ typedef union {
// clang-format on
extern userspace_config_t userspace_config;
/*
Custom Keycodes for Diablo 3 layer
But since TD() doesn't work when tap dance is disabled
We use custom codes here, so we can substitute the right stuff
*/
#ifdef TAP_DANCE_ENABLE
# define KC_D3_1 TD(TD_D3_1)
# define KC_D3_2 TD(TD_D3_2)
# define KC_D3_3 TD(TD_D3_3)
# define KC_D3_4 TD(TD_D3_4)
#else // TAP_DANCE_ENABLE
# define KC_D3_1 KC_1
# define KC_D3_2 KC_2
# define KC_D3_3 KC_3
# define KC_D3_4 KC_4
#endif // TAP_DANCE_ENABLE

View File

@ -1,5 +1,5 @@
// Copyright 2021 Google LLC
// Copyright 2022 @filterpaper
// Copyright 2021 @filterpaper
// SPDX-License-Identifier: Apache-2.0
// Original source: https://getreuer.info/posts/keyboards/autocorrection
@ -7,10 +7,15 @@
#include <string.h>
#if __has_include("autocorrection_data.h")
# pragma GCC push_options
# pragma GCC optimize("O0")
# include "autocorrection_data.h"
# if AUTOCORRECTION_MIN_LENGTH < 4
# error Minimum Length is too short and may cause overflows
# endif
# if DICTIONARY_SIZE > SIZE_MAX
# error Dictionary size excees maximum size permitted
# endif
bool process_autocorrection(uint16_t keycode, keyrecord_t* record) {
static uint8_t typo_buffer[AUTOCORRECTION_MAX_LENGTH] = {KC_SPC};
@ -55,11 +60,17 @@ bool process_autocorrection(uint16_t keycode, keyrecord_t* record) {
}
# endif
default:
// Disable autocorrection while a mod other than shift is active.
if (((get_mods() | get_oneshot_mods()) & ~MOD_MASK_SHIFT) != 0) {
typo_buffer_size = 0;
return true;
}
if (!record->event.pressed) {
return true;
}
}
// Subtract buffer for Backspace key, reset for other non-alpha.
if (!(KC_A <= keycode && keycode <= KC_Z)) {
if (keycode == KC_BSPC) {
@ -137,6 +148,7 @@ bool process_autocorrection(uint16_t keycode, keyrecord_t* record) {
}
return true;
}
# pragma GCC pop_options
#else
# pragma message "Warning!!! Autocorrect is not corretly setup!"
bool process_autocorrection(uint16_t keycode, keyrecord_t* record) { return true; }

View File

@ -1,5 +1,5 @@
// Copyright 2021 Google LLC
// Copyright 2022 @filterpaper
// Copyright 2021 @filterpaper
// SPDX-License-Identifier: Apache-2.0
// Original source: https://getreuer.info/posts/keyboards/autocorrection

View File

@ -252,8 +252,9 @@ def write_generated_code(autocorrections: List[Tuple[str, str]],
for typo, correction in autocorrections)),
f'\n#define AUTOCORRECTION_MIN_LENGTH {len(min_typo)} // "{min_typo}"\n',
f'#define AUTOCORRECTION_MAX_LENGTH {len(max_typo)} // "{max_typo}"\n\n',
textwrap.fill('static const uint8_t autocorrection_data[%d] PROGMEM = {%s};' % (
len(data), ', '.join(map(str, data))), width=80, subsequent_indent=' '),
f'#define DICTIONARY_SIZE {len(data)}\n\n',
textwrap.fill('static const uint8_t autocorrection_data[DICTIONARY_SIZE] PROGMEM = {%s};' % (
', '.join(map(str, data))), width=120, subsequent_indent=' '),
'\n\n'])
with open(file_name, 'wt') as f:

File diff suppressed because it is too large Load Diff

View File

@ -3,13 +3,17 @@
#include "caps_word.h"
#ifndef IS_COMMAND
# define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT)
#endif
bool caps_word_enabled = false;
bool caps_word_shifted = false;
bool process_caps_word(uint16_t keycode, keyrecord_t* record) {
if (!caps_word_enabled) {
// Pressing both shift keys at the same time enables caps word.
if (((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) == MOD_MASK_SHIFT) {
if (IS_COMMAND()) {
clear_mods();
clear_oneshot_mods();
caps_word_shifted = false;

View File

@ -0,0 +1,36 @@
# Cap Words
This is taken from [Pascal Getreuer's implemenation](https://getreuer.info/posts/keyboards/caps-word/index.html), with a number of modifications.
To enable Caps Word, add `CAPS_WORD_ENABLE = yes` to your `rules.mk`.
This is mostly a reproduction of Pascal's docs:
## Overview
All-caps identifiers like “MOD_MASK_ALT” are awkward to type.
Caps Lock would be the standard solution to this problem, but it is awkward: it needs a dedicated key to toggle it (an imposition on smaller keyboards), and we need to remember to toggle it off after typing the word. Or with normal shifting, we either perform finger gymnastics or need to stop typing in the middle of the word to release shift with one hand to switch to holding shift with the other hand. In my experience, this is a nuisance especially if your shift keys are mod-taps, as in home row mods.
Caps Word, implemented here, is a modern alternative to Caps Lock:
* Caps Word is activated by pressing the left and right shift keys at the same time. This way you dont need a dedicated key for using Caps Word.
* Caps Word automatically disables itself at the end of the word.
**Compatibility**: Ive tested that this implementation works with one-shot mods and Space Cadet Shift, and it predictably handles key repeating.
Unlike some other QMK Caps Word implementations, this library does not use the Caps Lock (KC_CAPS) keycode. It works even if the OS remaps Caps Lock to Ctrl or something else, as Emacs and Vim users often do.
## Using Caps Word
With the above flashed to your keyboard:
1. **Activating**: Press and release both left and right shift keys at the same time. If your shift keys are mod-taps, activate Caps Word by holding both shift mod-tap keys until the tapping term, then release them.
2. Then begin typing to get capitalized letters.
3. **Disabling**: Caps Word disables itself when the next word breaking key is typed.
If you want to explicitly stop Caps Word, press and release Ctrl or another non-shift modifier or layer key. This also disables Caps Word.
## Explanation
The code checks the mod bits on each key event, enabling Caps Word when both left and right shifts are active.
While enabled, Caps Word automatically presses and releases left shift (KC_LSFT) as needed so that letters are shifted and other keys are not. The word continues while typing az, 09, -, _, and backspace. Any other key is considered “word breaking” and disables Caps Word. You can edit the switch statement at the end of the process_caps_word() function to adjust which keys count as word breaking.

View File

@ -0,0 +1,18 @@
# Custom Keycodes
Keycodes are defined in the `process_record.h` file and need to be included in the keymap.c files, so that they can be used there.
A bunch of macros are present and are only included on boards that are not the Ergodox EZ or Orthodox, as they are not needed for those boards.
* `KC_MAKE` - outputs `qmk compile -kb (keyboard) -km (keymap)` and enter, to start compiling the currenct keyboard. This uses generated variables to always use the current keyboard and keymap. Will work with any keyboard and any keymap.
* If you are holding shift, it will use `qmk flash` instead of `qmk compile`.
* If `MAKE_BOOTLOADER` is defined, it will always use `qmk flash` instead of `qmk compile`.
* `DEFAULT_LAYER_1` ... `DEFAULT_LAYER_4` - This sets layer 0-3 as the default layer, and writes that to eeprom, and plays a chime.
* `VRSN`, outputs the keyboard, keymap, commit and date info. Eg:
* `handwired/tractyl_manuform/5x6_right/f411/drashna @ 0.15.9-162-g087d08, Built on: 2021-12-19-21:10:26`
* `KC_DIABLO_CLEAR` - clears the diablo tapdance status.
* `KC_CCCV` - Copy on hold, paste on tap.
* `KEYLOCK` - This unloads the host driver, and prevents any data from being sent to the host. Hitting it again loads the driver, back.
* `REBOOT` - Uses watchdog timer on AVR, and `NVIC_SystemReset()` on ChibiOS to reset the board, without jumping to the bootloader.
* `EEP_RST` - Overrides the default behavior, disables EEPROM (which will trigger a reset on init), and reboots the keyboard as per `REBOOT` keycode.

Some files were not shown because too many files have changed in this diff Show More