From 906108fb486797ab2f3eb7c3a6f70e099c1199e6 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 29 Dec 2021 06:14:48 -0800 Subject: [Keyboard] Update to ZSA Keyboards (#15644) --- keyboards/moonlander/config.h | 12 +++++ keyboards/moonlander/moonlander.c | 111 ++++++++++++++------------------------ keyboards/moonlander/rules.mk | 3 ++ 3 files changed, 56 insertions(+), 70 deletions(-) (limited to 'keyboards/moonlander') diff --git a/keyboards/moonlander/config.h b/keyboards/moonlander/config.h index 1c6cbb5c63..d6686425c4 100644 --- a/keyboards/moonlander/config.h +++ b/keyboards/moonlander/config.h @@ -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 diff --git a/keyboards/moonlander/moonlander.c b/keyboards/moonlander/moonlander.c index d5105c26cd..ea50226f0c 100644 --- a/keyboards/moonlander/moonlander.c +++ b/keyboards/moonlander/moonlander.c @@ -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(); diff --git a/keyboards/moonlander/rules.mk b/keyboards/moonlander/rules.mk index 01994ba93a..72682d29b1 100644 --- a/keyboards/moonlander/rules.mk +++ b/keyboards/moonlander/rules.mk @@ -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 -- cgit v1.2.1