From 37a85e1f9b5d6ad28e52b800f1b17d68ee5e4892 Mon Sep 17 00:00:00 2001 From: Joshua Diamond Date: Sun, 28 Aug 2022 13:10:28 -0400 Subject: More spidey3 userspace cleanup (#18049) --- .../dmqdesign/spin/keymaps/spidey3_pad/config.h | 2 +- .../dmqdesign/spin/keymaps/spidey3_pad/keymap.c | 64 +++++++++------------- .../dmqdesign/spin/keymaps/spidey3_pad/rules.mk | 6 +- 3 files changed, 29 insertions(+), 43 deletions(-) (limited to 'keyboards/dmqdesign/spin/keymaps/spidey3_pad') diff --git a/keyboards/dmqdesign/spin/keymaps/spidey3_pad/config.h b/keyboards/dmqdesign/spin/keymaps/spidey3_pad/config.h index 1851f07f1d..b9a0b53fbf 100644 --- a/keyboards/dmqdesign/spin/keymaps/spidey3_pad/config.h +++ b/keyboards/dmqdesign/spin/keymaps/spidey3_pad/config.h @@ -24,7 +24,7 @@ #undef LOCKING_SUPPORT_ENABLE #define LAYER_STATE_8BIT -#define MAX_LAYER 4 +#define MAX_LAYER 5 #undef RGBLIGHT_ANIMATIONS #define RGBLIGHT_EFFECT_BREATHING diff --git a/keyboards/dmqdesign/spin/keymaps/spidey3_pad/keymap.c b/keyboards/dmqdesign/spin/keymaps/spidey3_pad/keymap.c index 58aa5554c2..8c9af7202b 100644 --- a/keyboards/dmqdesign/spin/keymaps/spidey3_pad/keymap.c +++ b/keyboards/dmqdesign/spin/keymaps/spidey3_pad/keymap.c @@ -61,11 +61,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { RGB_RMOD, RGB_TOG, RGB_MOD), [_FN] = LAYOUT( - KC_TRNS, DEBUG, QK_BOOT, KC_TRNS, + KC_NO, DEBUG, QK_BOOT, KC_TRNS, KC_NO, KC_NO, EEP_RST, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_TRNS, - KC_NO, KC_NO, KC_NO), + KC_TRNS, KC_NO, KC_NO), }; + +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_MACRO] = { ENCODER_CCW_CW(KC_BRID, KC_BRIU), ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_NUMPAD] = { ENCODER_CCW_CW(KC_BRID, KC_BRIU), ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_CURSOR] = { ENCODER_CCW_CW(KC_BRID, KC_BRIU), ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_RGB] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI ), ENCODER_CCW_CW(RGB_SAD, RGB_SAI ), ENCODER_CCW_CW(RGB_VAD, RGB_VAI) }, + [_FN] = { ENCODER_CCW_CW(KC_BRID, KC_BRIU), ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, +}; + // clang-format on typedef enum layer_ack { @@ -153,9 +162,22 @@ void spidey_glow(void) { rgblight_sethsv(255, 230, 128); } -void eeconfig_init_user(void) { spidey_glow(); } +void eeconfig_init_user(void) { + spidey_glow(); +} bool process_record_user(uint16_t keycode, keyrecord_t *record) { + dprintf("key event: kc: %02X, col: %02u, row: %02u, pressed: %u mods: %08b " +#if !defined(NO_ACTION_ONESHOT) + "os: %08b " +#endif + "weak: %08b\n", + keycode, record->event.key.col, record->event.key.row, record->event.pressed, bitrev(get_mods()), +#if !defined(NO_ACTION_ONESHOT) + bitrev(get_oneshot_mods()), +#endif + bitrev(get_weak_mods())); + if (record->event.pressed) { switch (keycode) { // Re-implement this here, but fix the persistence! @@ -208,39 +230,3 @@ void post_process_record_user(uint16_t keycode, keyrecord_t *record) { } } -bool encoder_update_user(uint8_t index, bool clockwise) { - switch (get_highest_layer(layer_state)) { - case _RGB: - if (index == 0) { - if (clockwise) { - rgblight_increase_hue(); - } else { - rgblight_decrease_hue(); - } - } else if (index == 1) { - if (clockwise) { - rgblight_increase_sat(); - } else { - rgblight_decrease_sat(); - } - } else if (index == 2) { - if (clockwise) { - rgblight_increase_val(); - } else { - rgblight_decrease_val(); - } - } - break; - - default: - if (index == 0) { - tap_code16(C(S(clockwise ? KC_EQL : KC_MINS))); - } else if (index == 1) { - tap_code16(C(clockwise ? KC_EQL : KC_MINS)); - } else if (index == 2) { - tap_code(clockwise ? KC_VOLU : KC_VOLD); - } - break; - } - return true; -} diff --git a/keyboards/dmqdesign/spin/keymaps/spidey3_pad/rules.mk b/keyboards/dmqdesign/spin/keymaps/spidey3_pad/rules.mk index 7fe1f992aa..5d543e2c7e 100644 --- a/keyboards/dmqdesign/spin/keymaps/spidey3_pad/rules.mk +++ b/keyboards/dmqdesign/spin/keymaps/spidey3_pad/rules.mk @@ -1,7 +1,7 @@ MOUSEKEY_ENABLE = no MIDI_ENABLE = no -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +BOOTMAGIC_ENABLE = yes LTO_ENABLE = yes -CONSOLE_ENABLE = yes # Console for debug +CONSOLE_ENABLE = yes GRAVE_ESC_ENABLE = no - +ENCODER_MAP_ENABLE = yes -- cgit v1.2.3