~ruther/qmk_firmware

906108fb486797ab2f3eb7c3a6f70e099c1199e6 — Drashna Jaelre 3 years ago bdce7c8
[Keyboard] Update to ZSA Keyboards (#15644)

M keyboards/ergodox_ez/config.h => keyboards/ergodox_ez/config.h +8 -6
@@ 43,12 43,14 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_EXPANDER_COL_PINS { 5, 4, 3, 2, 1, 0 }
#define MATRIX_EXPANDER_ROW_PINS { 0, 1, 2, 3, 4, 5, 6 }


#define MOUSEKEY_INTERVAL       20
#define MOUSEKEY_DELAY          0
#define MOUSEKEY_TIME_TO_MAX    60
#define MOUSEKEY_MAX_SPEED      7
#define MOUSEKEY_WHEEL_DELAY 0
#define MOUSEKEY_INTERVAL           20
#define MOUSEKEY_DELAY              0
#define MOUSEKEY_TIME_TO_MAX        60
#define MOUSEKEY_MAX_SPEED          7
#define MOUSEKEY_WHEEL_DELAY        400
#define MOUSEKEY_WHEEL_INTERVAL     MOUSEKEY_INTERVAL
#define MOUSEKEY_WHEEL_MAX_SPEED    MOUSEKEY_MAX_SPEED
#define MOUSEKEY_WHEEL_TIME_TO_MAX  MOUSEKEY_TIME_TO_MAX

#define DEBOUNCE 30


M keyboards/ergodox_ez/ergodox_ez.c => keyboards/ergodox_ez/ergodox_ez.c +51 -0
@@ 398,3 398,54 @@ void eeconfig_init_kb(void) {  // EEPROM is getting reset!
    eeconfig_update_kb(keyboard_config.raw);
    eeconfig_init_user();
}

#ifdef ORYX_ENABLE
static uint16_t loops = 0;
static bool is_on = false;
#endif

#ifdef DYNAMIC_MACRO_ENABLE
static bool is_dynamic_recording = false;
static uint16_t dynamic_loop_timer;

void dynamic_macro_record_start_user(void) {
    is_dynamic_recording = true;
    dynamic_loop_timer = timer_read();
    ergodox_right_led_1_on();
}

void dynamic_macro_record_end_user(int8_t direction) {
    is_dynamic_recording = false;
    layer_state_set_user(layer_state);
}
#endif

void matrix_scan_kb(void) {
#ifdef DYNAMIC_MACRO_ENABLE
    if (is_dynamic_recording) {
        ergodox_right_led_1_off();
        // if (timer_elapsed(dynamic_loop_timer) > 5)
        {
            static uint8_t counter;
            counter++;
            if (counter > 100) ergodox_right_led_1_on();
            dynamic_loop_timer = timer_read();
        }
    }
#endif

#ifdef CAPS_LOCK_STATUS
    led_t led_state = host_keyboard_led_state();
    if(led_state.caps_lock) {
        ergodox_right_led_3_on();
    }
    else {
        uint8_t layer = get_highest_layer(layer_state);
        if(layer != 1) {
        ergodox_right_led_3_off();
        }
    }
#endif

    matrix_scan_user();
}

M keyboards/ergodox_ez/ergodox_ez.h => keyboards/ergodox_ez/ergodox_ez.h +22 -0
@@ 292,3 292,25 @@ extern keyboard_config_t keyboard_config;
    { R05, R15, R25, R35, R45, R55 },     \
    { R06, R16, R26, R36, R46, KC_NO }    \
    }

/*  ---- LEFT HAND ----     ---- RIGHT HAND ---- */
#define LED_LAYOUT_ergodox_pretty(                \
    L01,L02,L03,L04,L05,    R01,R02,R03,R04,R05,  \
    L11,L12,L13,L14,L15,    R11,R12,R13,R14,R15,  \
    L21,L22,L23,L24,L25,    R21,R22,R23,R24,R25,  \
    L31,L32,L33,L34,L35,    R31,R32,R33,R34,R35,  \
    L41,L42,L43,L44,            R42,R43,R44,R45 ) \
                                                  \
   /* matrix positions */                         \
    { R01, R02, R03, R04, R05,                    \
      R11, R12, R13, R14, R15,                    \
      R21, R22, R23, R24, R25,                    \
      R31, R32, R33, R34, R35,                    \
           R42, R43, R44, R45,                    \
                                                  \
      L05, L04, L03, L02, L01,                    \
      L15, L14, L13, L12, L11,                    \
      L25, L24, L23, L22, L21,                    \
      L35, L34, L33, L32, L31,                    \
           L44, L43, L42, L41                     \
    }

M keyboards/ergodox_ez/rules.mk => keyboards/ergodox_ez/rules.mk +7 -5
@@ 12,15 12,15 @@ BOOTLOADER = halfkay
# Build Options
#   change yes to no to disable
#
BOOTMAGIC_ENABLE = no       # Enable Bootmagic Lite
BOOTMAGIC_ENABLE = no   # Enable Bootmagic Lite
MOUSEKEY_ENABLE  = yes  # Mouse keys
EXTRAKEY_ENABLE  = yes  # Audio control and System control
CONSOLE_ENABLE   = no   # Console for debug
COMMAND_ENABLE   = yes  # Commands for debug and configuration
COMMAND_ENABLE   = no   # Commands for debug and configuration
CUSTOM_MATRIX    = lite # Custom matrix file for the ErgoDox EZ
NKRO_ENABLE = yes           # Enable N-Key Rollover
UNICODE_ENABLE   = yes  # Unicode
SWAP_HANDS_ENABLE= yes  # Allow swapping hands of keyboard
NKRO_ENABLE      = yes           # Enable N-Key Rollover
UNICODE_ENABLE   = no  # Unicode
SWAP_HANDS_ENABLE= no   # Allow swapping hands of keyboard

RGB_MATRIX_ENABLE = no # enable later
RGB_MATRIX_DRIVER = IS31FL3731


@@ 36,3 36,5 @@ LAYOUTS = ergodox
# Disable unsupported hardware
AUDIO_SUPPORTED = no
BACKLIGHT_SUPPORTED = no

MOUSE_SHARED_EP = no

M keyboards/moonlander/config.h => keyboards/moonlander/config.h +12 -0
@@ 141,6 141,18 @@
#    define ENABLE_RGB_MATRIX_SOLID_SPLASH
#    define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH

// #define RGB_MATRIX_LED_PROCESS_LIMIT 5
// #define RGB_MATRIX_LED_FLUSH_LIMIT 26

#define MOUSEKEY_INTERVAL           20
#define MOUSEKEY_DELAY              0
#define MOUSEKEY_TIME_TO_MAX        60
#define MOUSEKEY_MAX_SPEED          7
#define MOUSEKEY_WHEEL_DELAY        400
#define MOUSEKEY_WHEEL_INTERVAL     MOUSEKEY_INTERVAL
#define MOUSEKEY_WHEEL_MAX_SPEED    MOUSEKEY_MAX_SPEED
#define MOUSEKEY_WHEEL_TIME_TO_MAX  MOUSEKEY_TIME_TO_MAX

#define MUSIC_MAP

#define FIRMWARE_VERSION_SIZE 17

M keyboards/moonlander/moonlander.c => keyboards/moonlander/moonlander.c +41 -70
@@ 19,9 19,6 @@


#include "moonlander.h"
#ifdef WEBUSB_ENABLE
#    include "webusb.h"
#endif

keyboard_config_t keyboard_config;



@@ 83,50 80,9 @@ void moonlander_led_task(void) {
        wait_ms(155);
    }
#endif
#ifdef WEBUSB_ENABLE
    else if (webusb_state.pairing == true) {
        static uint8_t led_mask;

        ML_LED_1(false);
        ML_LED_2(false);
        ML_LED_3(false);
        ML_LED_4(false);
        ML_LED_5(false);
        ML_LED_6(false);

        if (!led_mask) {
            led_mask = 1;
        } else {
            led_mask++;
            if (led_mask > 12) led_mask = 1;
        }
        switch (led_mask) {
            case 1:
            case 12:
                ML_LED_1(true);
                break;
            case 2:
            case 11:
                ML_LED_2(true);
                break;
            case 3:
            case 10:
                ML_LED_3(true);
                break;
            case 4:
            case 9:
                ML_LED_4(true);
                break;
            case 5:
            case 8:
                ML_LED_5(true);
                break;
            case 6:
            case 7:
                ML_LED_6(true);
                break;
        }
        wait_ms(150);
#if !defined(MOONLANDER_USER_LEDS)
    else {
        layer_state_set_kb(layer_state);
    }
#endif
}


@@ 163,40 119,53 @@ void keyboard_pre_init_kb(void) {
layer_state_t layer_state_set_kb(layer_state_t state) {
    state = layer_state_set_user(state);
    if (is_launching || !keyboard_config.led_level) return state;

    ML_LED_1(false);
    ML_LED_2(false);
    ML_LED_3(false);
    ML_LED_4(false);
    ML_LED_5(false);
    ML_LED_6(false);
    bool LED_1 = false;
    bool LED_2 = false;
    bool LED_3 = false;
    bool LED_4 = false;
    bool LED_5 = false;
    bool LED_6 = false;

    uint8_t layer = get_highest_layer(state);
    switch (layer) {
        case 1:
            ML_LED_1(1);
            ML_LED_4(1);
            LED_1 = true;
            LED_4 = true;
            break;
        case 2:
            ML_LED_2(1);
            ML_LED_5(1);
            LED_2 = true;
            LED_5 = true;
            break;
        case 3:
            ML_LED_3(1);
            LED_3 = true;
#if !defined(CAPS_LOCK_STATUS)
            LED_6 = true;
#endif
            break;
        case 4:
            ML_LED_4(1);
            LED_4 = true;
            break;
        case 5:
            ML_LED_5(1);
            LED_5 = true;
            break;
        case 6:
            ML_LED_6(1);
#if !defined(CAPS_LOCK_STATUS)
            LED_6 = true;
#endif
            break;
        default:
            break;
    }

    ML_LED_1(LED_1);
    ML_LED_2(LED_2);
    ML_LED_3(LED_3);
    ML_LED_4(LED_4);
    ML_LED_5(LED_5);
#if !defined(CAPS_LOCK_STATUS)
    ML_LED_6(LED_6);
#endif

    return state;
}
#endif


@@ 398,15 367,19 @@ const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS] = LAYOUT_moonlander(
// clang-format on
#endif

#ifdef ORYX_CONFIGURATOR
#ifdef CAPS_LOCK_STATUS
bool led_update_kb(led_t led_state) {
    bool res = led_update_user(led_state);
    if(res) {
        ML_LED_6(led_state.caps_lock);
    }
    return res;
}
#endif

bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
    if (!process_record_user(keycode, record)) { return false; }
    switch (keycode) {
#ifdef WEBUSB_ENABLE
        case WEBUSB_PAIR:
            if (!record->event.pressed && !webusb_state.pairing) layer_state_set_kb(layer_state);
            break;
#endif
#if !defined(MOONLANDER_USER_LEDS)
        case LED_LEVEL:
            if (record->event.pressed) {


@@ 454,8 427,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
    return true;
}

#endif

void matrix_init_kb(void) {
    keyboard_config.raw = eeconfig_read_kb();


M keyboards/moonlander/rules.mk => keyboards/moonlander/rules.mk +3 -0
@@ 16,6 16,7 @@ NKRO_ENABLE = yes           # Enable N-Key Rollover
BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
AUDIO_ENABLE = yes          # Audio output
AUDIO_DRIVER = dac_additive
CUSTOM_MATRIX = lite
SWAP_HANDS_ENABLE = yes
RGB_MATRIX_ENABLE = yes


@@ 25,3 26,5 @@ EEPROM_DRIVER = i2c
#project specific files
SRC += matrix.c
QUANTUM_LIB_SRC += i2c_master.c

MOUSE_SHARED_EP = no

M keyboards/planck/ez/config.h => keyboards/planck/ez/config.h +8 -5
@@ 183,8 183,11 @@

#define TAPPING_TOGGLE  1

#define MOUSEKEY_INTERVAL       20
#define MOUSEKEY_DELAY          0
#define MOUSEKEY_TIME_TO_MAX    60
#define MOUSEKEY_MAX_SPEED      7
#define MOUSEKEY_WHEEL_DELAY 0
#define MOUSEKEY_INTERVAL           20
#define MOUSEKEY_DELAY              0
#define MOUSEKEY_TIME_TO_MAX        60
#define MOUSEKEY_MAX_SPEED          7
#define MOUSEKEY_WHEEL_DELAY        400
#define MOUSEKEY_WHEEL_INTERVAL     MOUSEKEY_INTERVAL
#define MOUSEKEY_WHEEL_MAX_SPEED    MOUSEKEY_MAX_SPEED
#define MOUSEKEY_WHEEL_TIME_TO_MAX  MOUSEKEY_TIME_TO_MAX

M keyboards/planck/ez/ez.c => keyboards/planck/ez/ez.c +1 -11
@@ 106,16 106,6 @@ led_config_t g_led_config = { {
    1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1
} };

void suspend_power_down_kb(void) {
    rgb_matrix_set_color_all(0, 0, 0);
    rgb_matrix_set_suspend_state(true);
    suspend_power_down_user();
}

 void suspend_wakeup_init_kb(void) {
    rgb_matrix_set_suspend_state(false);
    suspend_wakeup_init_user();
}
#endif

/* Left B9   Right B8 */


@@ 259,7 249,7 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
    planck_ez_left_led_off();
    planck_ez_right_led_off();
    state = layer_state_set_user(state);
    uint8_t layer = biton32(state);
    uint8_t layer = get_highest_layer(state);
    switch (layer) {
        case PLANCK_EZ_LED_LOWER:
            planck_ez_left_led_on();

M keyboards/planck/ez/rules.mk => keyboards/planck/ez/rules.mk +5 -2
@@ 11,10 11,11 @@ BOOTMAGIC_ENABLE = yes      # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes       # Mouse keys
EXTRAKEY_ENABLE = yes       # Audio control and System control
CONSOLE_ENABLE = yes        # Console for debug
COMMAND_ENABLE = yes       # Commands for debug and configuration
COMMAND_ENABLE = yes        # Commands for debug and configuration
NKRO_ENABLE = yes           # Enable N-Key Rollover
BACKLIGHT_ENABLE = no      # Enable keyboard backlight functionality
BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
AUDIO_ENABLE = yes          # Audio output
AUDIO_DRIVER = dac_additive
RGBLIGHT_ENABLE = no        # Enable WS2812 RGB underlight.

ENCODER_ENABLE = yes


@@ 26,3 27,5 @@ LAYOUTS_HAS_RGB = no
RGB_MATRIX_SUPPORTED = yes
RGBLIGHT_SUPPORTED = no
BAKCLIGHT_SUPPORTED = no

MOUSE_SHARED_EP = no