[Keymap] Reorganization, cleanup and readmes for drashna code (#15617)
This commit is contained in:
parent
1a8a842cfb
commit
c4551d7ef1
64 changed files with 1290 additions and 1162 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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -15,3 +15,8 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define RGBLIGHT_EFFECT_KNIGHT_LED_NUM 12
|
||||
|
||||
#undef RGB_MATRIX_MAXIMUM_BRIGHTNESS
|
||||
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -93,3 +93,7 @@
|
|||
#endif
|
||||
|
||||
#define TAPPING_TERM_PER_KEY
|
||||
#ifdef TAPPING_TERM
|
||||
# undef TAPPING_TERM
|
||||
#endif
|
||||
#define TAPPING_TERM 200
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
215
users/drashna/callbacks.c
Normal 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
25
users/drashna/callbacks.h
Normal 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
|
||||
71
users/drashna/callbacks.md
Normal file
71
users/drashna/callbacks.md
Normal 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();
|
||||
}
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue