diff options
| author | Akaash Suresh <casa.akaash@gmail.com> | 2020-01-02 11:52:23 -0600 |
|---|---|---|
| committer | Akaash Suresh <casa.akaash@gmail.com> | 2020-01-02 11:52:23 -0600 |
| commit | 3650d59afe69484c7d8c489763e04ddd3d79c03b (patch) | |
| tree | 71577d528142f51f3610c81486074eb5af079311 /users | |
| parent | 8ec0b378bc5cd0f0154e24c4a765f91b60791f2c (diff) | |
| download | qmk_firmware-3650d59afe69484c7d8c489763e04ddd3d79c03b.tar.gz qmk_firmware-3650d59afe69484c7d8c489763e04ddd3d79c03b.zip | |
Merge upstream/master with userspace
Diffstat (limited to 'users')
| -rw-r--r-- | users/curry/.gitignore | 1 | ||||
| -rw-r--r-- | users/curry/config.h | 116 | ||||
| -rw-r--r-- | users/curry/curry.c | 131 | ||||
| -rw-r--r-- | users/curry/curry.h | 57 | ||||
| -rw-r--r-- | users/curry/oled.c | 162 | ||||
| -rw-r--r-- | users/curry/process_records.c | 85 | ||||
| -rw-r--r-- | users/curry/process_records.h | 104 | ||||
| -rw-r--r-- | users/curry/rgb_stuff.c | 471 | ||||
| -rw-r--r-- | users/curry/rgb_stuff.h | 32 | ||||
| -rw-r--r-- | users/curry/rgblight_breathe_table.h | 118 | ||||
| -rw-r--r-- | users/curry/rules.mk | 61 | ||||
| -rw-r--r-- | users/curry/tap_dances.c | 3 | ||||
| -rw-r--r-- | users/curry/tap_dances.h | 3 | ||||
| -rw-r--r-- | users/curry/wrappers.h | 92 |
14 files changed, 1436 insertions, 0 deletions
diff --git a/users/curry/.gitignore b/users/curry/.gitignore new file mode 100644 index 000000000..c6df8c013 --- /dev/null +++ b/users/curry/.gitignore | |||
| @@ -0,0 +1 @@ | |||
| secrets.c | |||
diff --git a/users/curry/config.h b/users/curry/config.h new file mode 100644 index 000000000..ac4a8f070 --- /dev/null +++ b/users/curry/config.h | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | // Use custom magic number so that when switching branches, EEPROM always gets reset | ||
| 4 | #define EECONFIG_MAGIC_NUMBER (uint16_t)0x420 | ||
| 5 | |||
| 6 | /* Set Polling rate to 1000Hz */ | ||
| 7 | #define USB_POLLING_INTERVAL_MS 1 | ||
| 8 | |||
| 9 | #ifdef RGBLIGHT_ENABLE | ||
| 10 | # undef RGBLIGHT_ANIMATIONS | ||
| 11 | # if defined(__AVR__) && !defined(__AVR_AT90USB1286__) | ||
| 12 | # define RGBLIGHT_SLEEP | ||
| 13 | # define RGBLIGHT_EFFECT_BREATHING | ||
| 14 | # define RGBLIGHT_EFFECT_SNAKE | ||
| 15 | # define RGBLIGHT_EFFECT_KNIGHT | ||
| 16 | # else | ||
| 17 | # define RGBLIGHT_ANIMATIONS | ||
| 18 | # endif | ||
| 19 | #endif // RGBLIGHT_ENABLE | ||
| 20 | |||
| 21 | #ifdef RGB_MATRIX_ENABLE | ||
| 22 | # define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot) | ||
| 23 | // # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened) | ||
| 24 | # define RGB_MATRIX_FRAMEBUFFER_EFFECTS | ||
| 25 | // # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects | ||
| 26 | # define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended | ||
| 27 | // # define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 | ||
| 28 | // # define EECONFIG_RGB_MATRIX (uint32_t *)16 | ||
| 29 | |||
| 30 | # if defined(__AVR__) && !defined(__AVR_AT90USB1286__) | ||
| 31 | # define DISABLE_RGB_MATRIX_ALPHAS_MODS | ||
| 32 | # define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN | ||
| 33 | # define DISABLE_RGB_MATRIX_BREATHING | ||
| 34 | # define DISABLE_RGB_MATRIX_BAND_SAT | ||
| 35 | # define DISABLE_RGB_MATRIX_BAND_VAL | ||
| 36 | # define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT | ||
| 37 | # define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL | ||
| 38 | # define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT | ||
| 39 | # define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL | ||
| 40 | # define DISABLE_RGB_MATRIX_CYCLE_ALL | ||
| 41 | # define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT | ||
| 42 | # define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN | ||
| 43 | # define DISABLE_RGB_MATRIX_CYCLE_OUT_IN | ||
| 44 | // # define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL | ||
| 45 | # define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON | ||
| 46 | # define DISABLE_RGB_MATRIX_DUAL_BEACON | ||
| 47 | # define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL | ||
| 48 | # define DISABLE_RGB_MATRIX_CYCLE_SPIRAL | ||
| 49 | # define DISABLE_RGB_MATRIX_RAINBOW_BEACON | ||
| 50 | # define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS | ||
| 51 | # define DISABLE_RGB_MATRIX_RAINDROPS | ||
| 52 | # define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS | ||
| 53 | // # define DISABLE_RGB_MATRIX_TYPING_HEATMAP | ||
| 54 | # define DISABLE_RGB_MATRIX_DIGITAL_RAIN | ||
| 55 | # define DISABLE_RGB_MATRIX_SOLID_REACTIVE | ||
| 56 | # define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE | ||
| 57 | # define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE | ||
| 58 | # define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE | ||
| 59 | # define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS | ||
| 60 | # define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS | ||
| 61 | # define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS | ||
| 62 | # define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS | ||
| 63 | # define DISABLE_RGB_MATRIX_SPLASH | ||
| 64 | # define DISABLE_RGB_MATRIX_MULTISPLASH | ||
| 65 | # define DISABLE_RGB_MATRIX_SOLID_SPLASH | ||
| 66 | # define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH | ||
| 67 | # endif // AVR | ||
| 68 | #endif // RGB_MATRIX_ENABLE | ||
| 69 | |||
| 70 | #ifndef ONESHOT_TAP_TOGGLE | ||
| 71 | # define ONESHOT_TAP_TOGGLE 2 | ||
| 72 | #endif // !ONESHOT_TAP_TOGGLE | ||
| 73 | |||
| 74 | #ifndef ONESHOT_TIMEOUT | ||
| 75 | # define ONESHOT_TIMEOUT 3000 | ||
| 76 | #endif // !ONESHOT_TIMEOUT | ||
| 77 | |||
| 78 | #ifndef QMK_KEYS_PER_SCAN | ||
| 79 | # define QMK_KEYS_PER_SCAN 4 | ||
| 80 | #endif // !QMK_KEYS_PER_SCAN | ||
| 81 | |||
| 82 | // this makes it possible to do rolling combos (zx) with keys that | ||
| 83 | // convert to other keys on hold (z becomes ctrl when you hold it, | ||
| 84 | // and when this option isn't enabled, z rapidly followed by x | ||
| 85 | // actually sends Ctrl-x. That's bad.) | ||
| 86 | #define IGNORE_MOD_TAP_INTERRUPT | ||
| 87 | #undef PERMISSIVE_HOLD | ||
| 88 | //#define TAPPING_FORCE_HOLD | ||
| 89 | //#define RETRO_TAPPING | ||
| 90 | |||
| 91 | #define FORCE_NKRO | ||
| 92 | |||
| 93 | #ifndef TAPPING_TOGGLE | ||
| 94 | # define TAPPING_TOGGLE 1 | ||
| 95 | #endif | ||
| 96 | |||
| 97 | #ifdef TAPPING_TERM | ||
| 98 | # undef TAPPING_TERM | ||
| 99 | #endif // TAPPING_TERM | ||
| 100 | #if defined(KEYBOARD_ergodox_ez) | ||
| 101 | # define TAPPING_TERM 185 | ||
| 102 | #elif defined(KEYBOARD_crkbd) | ||
| 103 | # define TAPPING_TERM 200 | ||
| 104 | #else | ||
| 105 | # define TAPPING_TERM 175 | ||
| 106 | #endif | ||
| 107 | |||
| 108 | #define TAP_CODE_DELAY 5 | ||
| 109 | |||
| 110 | /* Disable unused and unneeded features to reduce on firmware size */ | ||
| 111 | #ifdef LOCKING_SUPPORT_ENABLE | ||
| 112 | # undef LOCKING_SUPPORT_ENABLE | ||
| 113 | #endif | ||
| 114 | #ifdef LOCKING_RESYNC_ENABLE | ||
| 115 | # undef LOCKING_RESYNC_ENABLE | ||
| 116 | #endif | ||
diff --git a/users/curry/curry.c b/users/curry/curry.c new file mode 100644 index 000000000..b6afa5ef2 --- /dev/null +++ b/users/curry/curry.c | |||
| @@ -0,0 +1,131 @@ | |||
| 1 | #include "curry.h" | ||
| 2 | |||
| 3 | userspace_config_t userspace_config; | ||
| 4 | |||
| 5 | #define CURRY_UNICODE_MODE 1 | ||
| 6 | |||
| 7 | void bootmagic_lite(void) { | ||
| 8 | matrix_scan(); | ||
| 9 | #if defined(DEBOUNCING_DELAY) && DEBOUNCING_DELAY > 0 | ||
| 10 | wait_ms(DEBOUNCING_DELAY * 2); | ||
| 11 | #elif defined(DEBOUNCE) && DEBOUNCE > 0 | ||
| 12 | wait_ms(DEBOUNCE * 2); | ||
| 13 | #else | ||
| 14 | wait_ms(30); | ||
| 15 | #endif | ||
| 16 | matrix_scan(); | ||
| 17 | if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) { | ||
| 18 | bootloader_jump(); | ||
| 19 | } | ||
| 20 | } | ||
| 21 | |||
| 22 | __attribute__((weak)) void keyboard_pre_init_keymap(void) {} | ||
| 23 | |||
| 24 | void keyboard_pre_init_user(void) { | ||
| 25 | userspace_config.raw = eeconfig_read_user(); | ||
| 26 | keyboard_pre_init_keymap(); | ||
| 27 | } | ||
| 28 | |||
| 29 | __attribute__((weak)) void matrix_init_keymap(void) {} | ||
| 30 | |||
| 31 | // Call user matrix init, set default RGB colors and then | ||
| 32 | // call the keymap's init function | ||
| 33 | void matrix_init_user(void) { | ||
| 34 | #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) | ||
| 35 | set_unicode_input_mode(CURRY_UNICODE_MODE); | ||
| 36 | get_unicode_input_mode(); | ||
| 37 | #endif // UNICODE_ENABLE | ||
| 38 | matrix_init_keymap(); | ||
| 39 | } | ||
| 40 | |||
| 41 | __attribute__((weak)) void keyboard_post_init_keymap(void) {} | ||
| 42 | |||
| 43 | void keyboard_post_init_user(void) { | ||
| 44 | #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) | ||
| 45 | keyboard_post_init_rgb(); | ||
| 46 | #endif | ||
| 47 | keyboard_post_init_keymap(); | ||
| 48 | } | ||
| 49 | |||
| 50 | __attribute__((weak)) void shutdown_keymap(void) {} | ||
| 51 | |||
| 52 | void rgb_matrix_update_pwm_buffers(void); | ||
| 53 | |||
| 54 | // On RESET, set all RGB to red, shutdown the keymap. | ||
| 55 | void shutdown_user(void) { | ||
| 56 | #ifdef RGBLIGHT_ENABLE | ||
| 57 | rgblight_enable_noeeprom(); | ||
| 58 | rgblight_mode_noeeprom(1); | ||
| 59 | rgblight_setrgb_red(); | ||
| 60 | #endif // RGBLIGHT_ENABLE | ||
| 61 | #ifdef RGB_MATRIX_ENABLE | ||
| 62 | rgb_matrix_set_color_all(0xFF, 0x00, 0x00); | ||
| 63 | rgb_matrix_update_pwm_buffers(); | ||
| 64 | #endif // RGB_MATRIX_ENABLE | ||
| 65 | shutdown_keymap(); | ||
| 66 | } | ||
| 67 | |||
| 68 | __attribute__((weak)) void suspend_power_down_keymap(void) {} | ||
| 69 | |||
| 70 | void suspend_power_down_user(void) { suspend_power_down_keymap(); } | ||
| 71 | |||
| 72 | __attribute__((weak)) void suspend_wakeup_init_keymap(void) {} | ||
| 73 | |||
| 74 | void suspend_wakeup_init_user(void) { suspend_wakeup_init_keymap(); } | ||
| 75 | |||
| 76 | __attribute__((weak)) void matrix_scan_keymap(void) {} | ||
| 77 | |||
| 78 | // No global matrix scan code, so just run keymap's matrix | ||
| 79 | // scan function | ||
| 80 | void matrix_scan_user(void) { | ||
| 81 | static bool has_ran_yet; | ||
| 82 | if (!has_ran_yet) { | ||
| 83 | has_ran_yet = true; | ||
| 84 | startup_user(); | ||
| 85 | } | ||
| 86 | |||
| 87 | #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) | ||
| 88 | matrix_scan_rgb(); | ||
| 89 | #endif // RGBLIGHT_ENABLE | ||
| 90 | |||
| 91 | matrix_scan_keymap(); | ||
| 92 | } | ||
| 93 | |||
| 94 | __attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; } | ||
| 95 | |||
| 96 | // On Layer change, run keymap's layer change check | ||
| 97 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
| 98 | state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); | ||
| 99 | #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) | ||
| 100 | state = layer_state_set_rgb(state); | ||
| 101 | #endif // RGBLIGHT_ENABLE | ||
| 102 | return layer_state_set_keymap(state); | ||
| 103 | } | ||
| 104 | |||
| 105 | __attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; } | ||
| 106 | |||
| 107 | // Runs state check and changes underglow color and animation | ||
| 108 | layer_state_t default_layer_state_set_user(layer_state_t state) { | ||
| 109 | return default_layer_state_set_keymap(state); | ||
| 110 | } | ||
| 111 | |||
| 112 | __attribute__((weak)) void led_set_keymap(uint8_t usb_led) {} | ||
| 113 | |||
| 114 | // Any custom LED code goes here. | ||
| 115 | void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); } | ||
| 116 | |||
| 117 | __attribute__((weak)) void eeconfig_init_keymap(void) {} | ||
| 118 | |||
| 119 | void eeconfig_init_user(void) { | ||
| 120 | userspace_config.raw = 0; | ||
| 121 | userspace_config.rgb_layer_change = true; | ||
| 122 | eeconfig_update_user(userspace_config.raw); | ||
| 123 | #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) | ||
| 124 | set_unicode_input_mode(CURRY_UNICODE_MODE); | ||
| 125 | get_unicode_input_mode(); | ||
| 126 | #else | ||
| 127 | eeprom_update_byte(EECONFIG_UNICODEMODE, CURRY_UNICODE_MODE); | ||
| 128 | #endif | ||
| 129 | eeconfig_init_keymap(); | ||
| 130 | keyboard_init(); | ||
| 131 | } | ||
diff --git a/users/curry/curry.h b/users/curry/curry.h new file mode 100644 index 000000000..985453c49 --- /dev/null +++ b/users/curry/curry.h | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include QMK_KEYBOARD_H | ||
| 4 | |||
| 5 | #include "version.h" | ||
| 6 | #include "eeprom.h" | ||
| 7 | #include "wrappers.h" | ||
| 8 | #include "process_records.h" | ||
| 9 | |||
| 10 | #ifdef TAP_DANCE_ENABLE | ||
| 11 | # include "tap_dances.h" | ||
| 12 | #endif // TAP_DANCE_ENABLE | ||
| 13 | #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) | ||
| 14 | # include "rgb_stuff.h" | ||
| 15 | #endif | ||
| 16 | #if defined(KEYBOARD_lily58_rev1) & defined(PROTOCOL_LUFA) | ||
| 17 | # include "lufa.h" | ||
| 18 | # include "split_util.h" | ||
| 19 | #endif | ||
| 20 | |||
| 21 | /* Define layer names */ | ||
| 22 | enum userspace_layers { | ||
| 23 | _QWERTY = 0, | ||
| 24 | _NUMLOCK = 0, | ||
| 25 | _COLEMAK, | ||
| 26 | _DVORAK, | ||
| 27 | _MODS, | ||
| 28 | _LOWER, | ||
| 29 | _RAISE, | ||
| 30 | _ADJUST, | ||
| 31 | }; | ||
| 32 | |||
| 33 | void matrix_init_keymap(void); | ||
| 34 | void shutdown_keymap(void); | ||
| 35 | void suspend_power_down_keymap(void); | ||
| 36 | void suspend_wakeup_init_keymap(void); | ||
| 37 | void matrix_scan_keymap(void); | ||
| 38 | layer_state_t layer_state_set_keymap(layer_state_t state); | ||
| 39 | layer_state_t default_layer_state_set_keymap(layer_state_t state); | ||
| 40 | void led_set_keymap(uint8_t usb_led); | ||
| 41 | void eeconfig_init_keymap(void); | ||
| 42 | |||
| 43 | // clang-format off | ||
| 44 | typedef union { | ||
| 45 | uint32_t raw; | ||
| 46 | struct { | ||
| 47 | bool rgb_layer_change :1; | ||
| 48 | bool is_overwatch :1; | ||
| 49 | bool nuke_switch :1; | ||
| 50 | uint8_t unicode_mod :4; | ||
| 51 | bool swapped_numbers :1; | ||
| 52 | bool rgb_matrix_idle_anim :1; | ||
| 53 | }; | ||
| 54 | } userspace_config_t; | ||
| 55 | // clang-format on | ||
| 56 | |||
| 57 | extern userspace_config_t userspace_config; | ||
diff --git a/users/curry/oled.c b/users/curry/oled.c new file mode 100644 index 000000000..4eb23423e --- /dev/null +++ b/users/curry/oled.c | |||
| @@ -0,0 +1,162 @@ | |||
| 1 | #include "curry.h" | ||
| 2 | |||
| 3 | #ifdef OLED_DRIVER_ENABLE | ||
| 4 | #define KEYLOGGER_LENGTH 5 | ||
| 5 | static uint32_t oled_timer = 0; | ||
| 6 | static char keylog_str[KEYLOGGER_LENGTH + 1] = {"\n"}; | ||
| 7 | static uint16_t log_timer = 0; | ||
| 8 | // clang-format off | ||
| 9 | static const char PROGMEM code_to_name[0xFF] = { | ||
| 10 | // 0 1 2 3 4 5 6 7 8 9 A B c D E F | ||
| 11 | ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', // 0x | ||
| 12 | 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', // 1x | ||
| 13 | '3', '4', '5', '6', '7', '8', '9', '0', 20, 19, 27, 26, 22, '-', '=', '[', // 2x | ||
| 14 | ']','\\', '#', ';','\'', '`', ',', '.', '/', 128, ' ', ' ', ' ', ' ', ' ', ' ', // 3x | ||
| 15 | ' ', ' ', ' ', ' ', ' ', ' ', 'P', 'S', ' ', ' ', ' ', ' ', 16, ' ', ' ', ' ', // 4x | ||
| 16 | ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 5x | ||
| 17 | ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 6x | ||
| 18 | ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 7x | ||
| 19 | ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 8x | ||
| 20 | ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 9x | ||
| 21 | ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ax | ||
| 22 | ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Bx | ||
| 23 | ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Cx | ||
| 24 | ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Dx | ||
| 25 | 'C', 'S', 'A', 'C', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ex | ||
| 26 | ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' // Fx | ||
| 27 | }; | ||
| 28 | |||
| 29 | void add_keylog(uint16_t keycode); | ||
| 30 | |||
| 31 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; } | ||
| 32 | |||
| 33 | void add_keylog(uint16_t keycode) { | ||
| 34 | if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) || (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) { | ||
| 35 | keycode = keycode & 0xFF; | ||
| 36 | } else if (keycode > 0xFF) { | ||
| 37 | keycode = 0; | ||
| 38 | } | ||
| 39 | |||
| 40 | for (uint8_t i = (KEYLOGGER_LENGTH - 1); i > 0; --i) { | ||
| 41 | keylog_str[i] = keylog_str[i - 1]; | ||
| 42 | } | ||
| 43 | |||
| 44 | if (keycode < (sizeof(code_to_name) / sizeof(char))) { | ||
| 45 | keylog_str[0] = pgm_read_byte(&code_to_name[keycode]); | ||
| 46 | } | ||
| 47 | |||
| 48 | log_timer = timer_read(); | ||
| 49 | } | ||
| 50 | |||
| 51 | void render_keylogger_status(void) { | ||
| 52 | oled_write_P(PSTR("Keys"), false); | ||
| 53 | oled_write(keylog_str, false); | ||
| 54 | } | ||
| 55 | |||
| 56 | void render_default_layer_state(void) { | ||
| 57 | oled_write_P(PSTR("Lyout"), false); | ||
| 58 | switch (get_highest_layer(default_layer_state)) { | ||
| 59 | case _QWERTY: | ||
| 60 | oled_write_P(PSTR(" QRTY"), false); | ||
| 61 | break; | ||
| 62 | case _COLEMAK: | ||
| 63 | oled_write_P(PSTR(" COLE"), false); | ||
| 64 | break; | ||
| 65 | case _DVORAK: | ||
| 66 | oled_write_P(PSTR(" DVRK"), false); | ||
| 67 | break; | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 71 | void render_layer_state(void) { | ||
| 72 | oled_write_P(PSTR("LAYER"), false); | ||
| 73 | oled_write_P(PSTR("Lower"), layer_state_is(_LOWER)); | ||
| 74 | oled_write_P(PSTR("Raise"), layer_state_is(_RAISE)); | ||
| 75 | oled_write_P(PSTR(" Mods"), layer_state_is(_MODS)); | ||
| 76 | } | ||
| 77 | |||
| 78 | void render_keylock_status(uint8_t led_usb_state) { | ||
| 79 | oled_write_P(PSTR("Lock:"), false); | ||
| 80 | oled_write_P(PSTR(" "), false); | ||
| 81 | oled_write_P(PSTR("N"), led_usb_state & (1 << USB_LED_NUM_LOCK)); | ||
| 82 | oled_write_P(PSTR("C"), led_usb_state & (1 << USB_LED_CAPS_LOCK)); | ||
| 83 | oled_write_ln_P(PSTR("S"), led_usb_state & (1 << USB_LED_SCROLL_LOCK)); | ||
| 84 | } | ||
| 85 | |||
| 86 | void render_mod_status(uint8_t modifiers) { | ||
| 87 | oled_write_P(PSTR("Mods:"), false); | ||
| 88 | oled_write_P(PSTR(" "), false); | ||
| 89 | oled_write_P(PSTR("S"), (modifiers & MOD_MASK_SHIFT)); | ||
| 90 | oled_write_P(PSTR("C"), (modifiers & MOD_MASK_CTRL)); | ||
| 91 | oled_write_P(PSTR("A"), (modifiers & MOD_MASK_ALT)); | ||
| 92 | oled_write_P(PSTR("G"), (modifiers & MOD_MASK_GUI)); | ||
| 93 | } | ||
| 94 | |||
| 95 | void render_bootmagic_status(void) { | ||
| 96 | /* Show Ctrl-Gui Swap options */ | ||
| 97 | static const char PROGMEM logo[][2][3] = { | ||
| 98 | {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}, | ||
| 99 | {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, | ||
| 100 | }; | ||
| 101 | oled_write_P(PSTR("BTMGK"), false); | ||
| 102 | oled_write_P(PSTR(" "), false); | ||
| 103 | oled_write_P(logo[0][0], !keymap_config.swap_lctl_lgui); | ||
| 104 | oled_write_P(logo[1][0], keymap_config.swap_lctl_lgui); | ||
| 105 | oled_write_P(PSTR(" "), false); | ||
| 106 | oled_write_P(logo[0][1], !keymap_config.swap_lctl_lgui); | ||
| 107 | oled_write_P(logo[1][1], keymap_config.swap_lctl_lgui); | ||
| 108 | oled_write_P(PSTR(" NKRO"), keymap_config.nkro); | ||
| 109 | } | ||
| 110 | |||
| 111 | void render_user_status(void) { | ||
| 112 | oled_write_P(PSTR("USER:"), false); | ||
| 113 | oled_write_P(PSTR(" Anim"), userspace_config.rgb_matrix_idle_anim); | ||
| 114 | oled_write_P(PSTR(" Layr"), userspace_config.rgb_layer_change); | ||
| 115 | oled_write_P(PSTR(" Nuke"), userspace_config.nuke_switch); | ||
| 116 | } | ||
| 117 | |||
| 118 | void render_status_main(void) { | ||
| 119 | /* Show Keyboard Layout */ | ||
| 120 | render_default_layer_state(); | ||
| 121 | render_keylock_status(host_keyboard_leds()); | ||
| 122 | render_bootmagic_status(); | ||
| 123 | render_user_status(); | ||
| 124 | |||
| 125 | render_keylogger_status(); | ||
| 126 | } | ||
| 127 | |||
| 128 | void render_status_secondary(void) { | ||
| 129 | /* Show Keyboard Layout */ | ||
| 130 | render_default_layer_state(); | ||
| 131 | render_layer_state(); | ||
| 132 | render_mod_status(get_mods() | get_oneshot_mods()); | ||
| 133 | |||
| 134 | render_keylogger_status(); | ||
| 135 | } | ||
| 136 | |||
| 137 | void oled_task_user(void) { | ||
| 138 | if (timer_elapsed32(oled_timer) > 30000) { | ||
| 139 | oled_off(); | ||
| 140 | return; | ||
| 141 | } | ||
| 142 | # ifndef SPLIT_KEYBOARD | ||
| 143 | else { | ||
| 144 | oled_on(); | ||
| 145 | } | ||
| 146 | # endif | ||
| 147 | if (is_keyboard_master()) { | ||
| 148 | render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc) | ||
| 149 | } else { | ||
| 150 | render_status_secondary(); | ||
| 151 | } | ||
| 152 | } | ||
| 153 | |||
| 154 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | ||
| 155 | if (record->event.pressed) { | ||
| 156 | oled_timer = timer_read32(); | ||
| 157 | add_keylog(keycode); | ||
| 158 | } | ||
| 159 | return true; | ||
| 160 | } | ||
| 161 | |||
| 162 | #endif | ||
diff --git a/users/curry/process_records.c b/users/curry/process_records.c new file mode 100644 index 000000000..fd1d61ad9 --- /dev/null +++ b/users/curry/process_records.c | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | #include "curry.h" | ||
| 2 | |||
| 3 | uint16_t copy_paste_timer; | ||
| 4 | |||
| 5 | __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } | ||
| 6 | |||
| 7 | __attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; } | ||
| 8 | |||
| 9 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 10 | xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed); | ||
| 11 | switch (keycode) { | ||
| 12 | case KC_MAKE: | ||
| 13 | if (!record->event.pressed) { | ||
| 14 | uint8_t temp_mod = mod_config(get_mods()); | ||
| 15 | uint8_t temp_osm = mod_config(get_oneshot_mods()); | ||
| 16 | clear_mods(); | ||
| 17 | clear_oneshot_mods(); | ||
| 18 | send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), TAP_CODE_DELAY); | ||
| 19 | if ((temp_mod | temp_osm) & MOD_MASK_SHIFT) { | ||
| 20 | send_string_with_delay_P(PSTR(":flash"), TAP_CODE_DELAY); | ||
| 21 | } | ||
| 22 | if ((temp_mod | temp_osm) & MOD_MASK_CTRL) { | ||
| 23 | send_string_with_delay_P(PSTR(" -j8 --output-sync"), TAP_CODE_DELAY); | ||
| 24 | } | ||
| 25 | #ifdef RGB_MATRIX_SPLIT_RIGHT | ||
| 26 | send_string_with_delay_P(PSTR(" RGB_MATRIX_SPLIT_RIGHT=yes"), TAP_CODE_DELAY); | ||
| 27 | # ifndef OLED_DRIVER_ENABLE | ||
| 28 | send_string_with_delay_P(PSTR(" OLED_DRIVER_ENABLE=no"), TAP_CODE_DELAY); | ||
| 29 | # endif | ||
| 30 | #endif | ||
| 31 | send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), TAP_CODE_DELAY); | ||
| 32 | } | ||
| 33 | |||
| 34 | break; | ||
| 35 | |||
| 36 | case VRSN: // Prints firmware version | ||
| 37 | if (record->event.pressed) { | ||
| 38 | send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY); | ||
| 39 | } | ||
| 40 | break; | ||
| 41 | |||
| 42 | case KC_CCCV: // One key copy/paste | ||
| 43 | if (record->event.pressed) { | ||
| 44 | copy_paste_timer = timer_read(); | ||
| 45 | } else { | ||
| 46 | if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy | ||
| 47 | register_code(KC_LCTL); | ||
| 48 | tap_code(KC_C); | ||
| 49 | unregister_code(KC_LCTL); | ||
| 50 | } else { // Tap, paste | ||
| 51 | register_code(KC_LCTL); | ||
| 52 | tap_code(KC_V); | ||
| 53 | unregister_code(KC_LCTL); | ||
| 54 | } | ||
| 55 | } | ||
| 56 | break; | ||
| 57 | #ifdef UNICODE_ENABLE | ||
| 58 | case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻ | ||
| 59 | if (record->event.pressed) { | ||
| 60 | send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); | ||
| 61 | } | ||
| 62 | break; | ||
| 63 | case UC_TABL: // ┬─┬ノ( º _ ºノ) | ||
| 64 | if (record->event.pressed) { | ||
| 65 | send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 30CE 0029"); | ||
| 66 | } | ||
| 67 | break; | ||
| 68 | case UC_SHRG: // ¯\_(ツ)_/¯ | ||
| 69 | if (record->event.pressed) { | ||
| 70 | send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF"); | ||
| 71 | } | ||
| 72 | break; | ||
| 73 | case UC_DISA: // ಠ_ಠ | ||
| 74 | if (record->event.pressed) { | ||
| 75 | send_unicode_hex_string("0CA0 005F 0CA0"); | ||
| 76 | } | ||
| 77 | break; | ||
| 78 | #endif | ||
| 79 | } | ||
| 80 | return process_record_keymap(keycode, record) && | ||
| 81 | #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) | ||
| 82 | process_record_user_rgb(keycode, record) && | ||
| 83 | #endif // RGBLIGHT_ENABLE | ||
| 84 | process_record_secrets(keycode, record); | ||
| 85 | } | ||
diff --git a/users/curry/process_records.h b/users/curry/process_records.h new file mode 100644 index 000000000..6170ed4c7 --- /dev/null +++ b/users/curry/process_records.h | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | #pragma once | ||
| 2 | #include "curry.h" | ||
| 3 | |||
| 4 | #if defined(KEYMAP_SAFE_RANGE) | ||
| 5 | # define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE | ||
| 6 | #else | ||
| 7 | # define PLACEHOLDER_SAFE_RANGE SAFE_RANGE | ||
| 8 | #endif | ||
| 9 | |||
| 10 | enum userspace_custom_keycodes { | ||
| 11 | VRSN = PLACEHOLDER_SAFE_RANGE, // Prints QMK Firmware and board info | ||
| 12 | KC_QWERTY, // Sets default layer to QWERTY | ||
| 13 | KC_COLEMAK, // Sets default layer to COLEMAK | ||
| 14 | KC_DVORAK, // Sets default layer to DVORAK | ||
| 15 | KC_MAKE, // Run keyboard's customized make command | ||
| 16 | KC_RGB_T, // Toggles RGB Layer Indication mode | ||
| 17 | RGB_IDL, // RGB Idling animations | ||
| 18 | KC_SECRET_1, // test1 | ||
| 19 | KC_SECRET_2, // test2 | ||
| 20 | KC_SECRET_3, // test3 | ||
| 21 | KC_SECRET_4, // test4 | ||
| 22 | KC_SECRET_5, // test5 | ||
| 23 | KC_CCCV, // Hold to copy, tap to paste | ||
| 24 | KC_NUKE, // NUCLEAR LAUNCH DETECTED!!! | ||
| 25 | UC_FLIP, // (ಠ痊ಠ)┻━┻ | ||
| 26 | UC_TABL, // ┬─┬ノ( º _ ºノ) | ||
| 27 | UC_SHRG, // ¯\_(ツ)_/¯ | ||
| 28 | UC_DISA, // ಠ_ಠ | ||
| 29 | KC_DT1, | ||
| 30 | KC_DT2, | ||
| 31 | KC_DT3, | ||
| 32 | KC_DT4, | ||
| 33 | NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes | ||
| 34 | }; | ||
| 35 | |||
| 36 | bool process_record_secrets(uint16_t keycode, keyrecord_t *record); | ||
| 37 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record); | ||
| 38 | |||
| 39 | #define LOWER MO(_LOWER) | ||
| 40 | #define RAISE MO(_RAISE) | ||
| 41 | #define ADJUST MO(_ADJUST) | ||
| 42 | #define TG_MODS TG(_MODS) | ||
| 43 | #define OS_LWR OSL(_LOWER) | ||
| 44 | #define OS_RSE OSL(_RAISE) | ||
| 45 | |||
| 46 | #define KC_SEC1 KC_SECRET_1 | ||
| 47 | #define KC_SEC2 KC_SECRET_2 | ||
| 48 | #define KC_SEC3 KC_SECRET_3 | ||
| 49 | #define KC_SEC4 KC_SECRET_4 | ||
| 50 | #define KC_SEC5 KC_SECRET_5 | ||
| 51 | |||
| 52 | #define QWERTY KC_QWERTY | ||
| 53 | #define DVORAK KC_DVORAK | ||
| 54 | #define COLEMAK KC_COLEMAK | ||
| 55 | |||
| 56 | #define KC_RESET RESET | ||
| 57 | #define KC_RST KC_RESET | ||
| 58 | |||
| 59 | #ifdef SWAP_HANDS_ENABLE | ||
| 60 | # define KC_C1R3 SH_T(KC_TAB) | ||
| 61 | #else // SWAP_HANDS_ENABLE | ||
| 62 | # define KC_C1R3 KC_TAB | ||
| 63 | #endif // SWAP_HANDS_ENABLE | ||
| 64 | |||
| 65 | #define BK_LWER LT(_LOWER, KC_BSPC) | ||
| 66 | #define SP_LWER LT(_LOWER, KC_SPC) | ||
| 67 | #define DL_RAIS LT(_RAISE, KC_DEL) | ||
| 68 | #define ET_RAIS LT(_RAISE, KC_ENTER) | ||
| 69 | |||
| 70 | /* OSM keycodes, to keep things clean and easy to change */ | ||
| 71 | #define KC_MLSF OSM(MOD_LSFT) | ||
| 72 | #define KC_MRSF OSM(MOD_RSFT) | ||
| 73 | |||
| 74 | #define OS_LGUI OSM(MOD_LGUI) | ||
| 75 | #define OS_RGUI OSM(MOD_RGUI) | ||
| 76 | #define OS_LSFT OSM(MOD_LSFT) | ||
| 77 | #define OS_RSFT OSM(MOD_RSFT) | ||
| 78 | #define OS_LCTL OSM(MOD_LCTL) | ||
| 79 | #define OS_RCTL OSM(MOD_RCTL) | ||
| 80 | #define OS_LALT OSM(MOD_LALT) | ||
| 81 | #define OS_RALT OSM(MOD_RALT) | ||
| 82 | #define OS_MEH OSM(MOD_MEH) | ||
| 83 | #define OS_HYPR OSM(MOD_HYPR) | ||
| 84 | |||
| 85 | #define M_LALT ALT_T(KC_TAB) | ||
| 86 | #define M_RALT RALT_T(KC_QUOT) | ||
| 87 | |||
| 88 | #define M_LCTL CTL_T(KC_TAB) | ||
| 89 | #define M_RCTL RCTL_T(KC_QUOT) | ||
| 90 | |||
| 91 | #define MT_ESC MT(MOD_LCTL, KC_ESC) | ||
| 92 | |||
| 93 | #define ALT_APP ALT_T(KC_APP) | ||
| 94 | |||
| 95 | #define MG_NKRO MAGIC_TOGGLE_NKRO | ||
| 96 | |||
| 97 | #define UC_IRNY UC(0x2E2E) | ||
| 98 | #define UC_CLUE UC(0x203D) | ||
| 99 | |||
| 100 | // KWin Window Switching | ||
| 101 | #define KC_DT1 LCTL(KC_F1) | ||
| 102 | #define KC_DT2 LCTL(KC_F2) | ||
| 103 | #define KC_DT3 LCTL(KC_F3) | ||
| 104 | #define KC_DT4 LCTL(KC_F4) | ||
diff --git a/users/curry/rgb_stuff.c b/users/curry/rgb_stuff.c new file mode 100644 index 000000000..1129f70be --- /dev/null +++ b/users/curry/rgb_stuff.c | |||
| @@ -0,0 +1,471 @@ | |||
| 1 | #include "curry.h" | ||
| 2 | #include "rgb_stuff.h" | ||
| 3 | #include "eeprom.h" | ||
| 4 | |||
| 5 | #if defined(RGBLIGHT_ENABLE) | ||
| 6 | extern rgblight_config_t rgblight_config; | ||
| 7 | bool has_initialized; | ||
| 8 | |||
| 9 | void rgblight_sethsv_default_helper(uint8_t index) { rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, index); } | ||
| 10 | #endif // RGBLIGHT_ENABLE | ||
| 11 | |||
| 12 | #if defined(RGB_MATRIX_ENABLE) | ||
| 13 | static uint32_t hypno_timer; | ||
| 14 | # if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_crkbd) | ||
| 15 | # define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL | ||
| 16 | # else | ||
| 17 | # define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN | ||
| 18 | # endif | ||
| 19 | |||
| 20 | void suspend_power_down_keymap(void) { rgb_matrix_set_suspend_state(true); } | ||
| 21 | |||
| 22 | void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); } | ||
| 23 | |||
| 24 | void check_default_layer(uint8_t mode, uint8_t type) { | ||
| 25 | switch (get_highest_layer(default_layer_state)) { | ||
| 26 | case _QWERTY: | ||
| 27 | rgb_matrix_layer_helper(HSV_CYAN, mode, rgb_matrix_config.speed, type); | ||
| 28 | break; | ||
| 29 | case _COLEMAK: | ||
| 30 | rgb_matrix_layer_helper(HSV_MAGENTA, mode, rgb_matrix_config.speed, type); | ||
| 31 | break; | ||
| 32 | case _DVORAK: | ||
| 33 | rgb_matrix_layer_helper(HSV_SPRINGGREEN, mode, rgb_matrix_config.speed, type); | ||
| 34 | break; | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | void rgb_matrix_indicators_user(void) { | ||
| 39 | if (userspace_config.rgb_layer_change && | ||
| 40 | # ifdef RGB_DISABLE_WHEN_USB_SUSPENDED | ||
| 41 | !g_suspend_state && | ||
| 42 | # endif | ||
| 43 | # if defined(RGBLIGHT_ENABLE) | ||
| 44 | (!rgblight_config.enable && rgb_matrix_config.enable) | ||
| 45 | # else | ||
| 46 | rgb_matrix_config.enable | ||
| 47 | # endif | ||
| 48 | ) { | ||
| 49 | switch (get_highest_layer(layer_state)) { | ||
| 50 | case _RAISE: | ||
| 51 | rgb_matrix_layer_helper(HSV_YELLOW, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW); | ||
| 52 | break; | ||
| 53 | case _LOWER: | ||
| 54 | rgb_matrix_layer_helper(HSV_GREEN, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW); | ||
| 55 | break; | ||
| 56 | case _ADJUST: | ||
| 57 | rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW); | ||
| 58 | break; | ||
| 59 | default: { | ||
| 60 | check_default_layer(IS_LAYER_ON(_MODS), LED_FLAG_UNDERGLOW); | ||
| 61 | break; | ||
| 62 | } | ||
| 63 | } | ||
| 64 | check_default_layer(0, LED_FLAG_MODIFIER); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | #endif | ||
| 68 | |||
| 69 | /* Custom indicators for modifiers. | ||
| 70 | * This allows for certain lights to be lit up, based on what mods are active, giving some visual feedback. | ||
| 71 | * This is especially useful for One Shot Mods, since it's not always obvious if they're still lit up. | ||
| 72 | */ | ||
| 73 | #ifdef RGBLIGHT_ENABLE | ||
| 74 | # ifdef INDICATOR_LIGHTS | ||
| 75 | void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { | ||
| 76 | if (userspace_config.rgb_layer_change && get_highest_layer(layer_state) == 0) { | ||
| 77 | if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) { | ||
| 78 | # ifdef SHFT_LED1 | ||
| 79 | rgblight_sethsv_at(120, 255, 255, SHFT_LED1); | ||
| 80 | # endif // SHFT_LED1 | ||
| 81 | # ifdef SHFT_LED2 | ||
| 82 | rgblight_sethsv_at(120, 255, 255, SHFT_LED2); | ||
| 83 | # endif // SHFT_LED2 | ||
| 84 | } else { | ||
| 85 | # ifdef SHFT_LED1 | ||
| 86 | rgblight_sethsv_default_helper(SHFT_LED1); | ||
| 87 | # endif // SHFT_LED1 | ||
| 88 | # ifdef SHFT_LED2 | ||
| 89 | rgblight_sethsv_default_helper(SHFT_LED2); | ||
| 90 | # endif // SHFT_LED2 | ||
| 91 | } | ||
| 92 | if ((this_mod | this_osm) & MOD_MASK_CTRL) { | ||
| 93 | # ifdef CTRL_LED1 | ||
| 94 | rgblight_sethsv_at(0, 255, 255, CTRL_LED1); | ||
| 95 | # endif // CTRL_LED1 | ||
| 96 | # ifdef CTRL_LED2 | ||
| 97 | rgblight_sethsv_at(0, 255, 255, CTRL_LED2); | ||
| 98 | # endif // CTRL_LED2 | ||
| 99 | } else { | ||
| 100 | # ifdef CTRL_LED1 | ||
| 101 | rgblight_sethsv_default_helper(CTRL_LED1); | ||
| 102 | # endif // CTRL_LED1 | ||
| 103 | # ifdef CTRL_LED2 | ||
| 104 | rgblight_sethsv_default_helper(CTRL_LED2); | ||
| 105 | # endif // CTRL_LED2 | ||
| 106 | } | ||
| 107 | if ((this_mod | this_osm) & MOD_MASK_GUI) { | ||
| 108 | # ifdef GUI_LED1 | ||
| 109 | rgblight_sethsv_at(51, 255, 255, GUI_LED1); | ||
| 110 | # endif // GUI_LED1 | ||
| 111 | # ifdef GUI_LED2 | ||
| 112 | rgblight_sethsv_at(51, 255, 255, GUI_LED2); | ||
| 113 | # endif // GUI_LED2 | ||
| 114 | } else { | ||
| 115 | # ifdef GUI_LED1 | ||
| 116 | rgblight_sethsv_default_helper(GUI_LED1); | ||
| 117 | # endif // GUI_LED1 | ||
| 118 | # ifdef GUI_LED2 | ||
| 119 | rgblight_sethsv_default_helper(GUI_LED2); | ||
| 120 | # endif // GUI_LED2 | ||
| 121 | } | ||
| 122 | if ((this_mod | this_osm) & MOD_MASK_ALT) { | ||
| 123 | # ifdef ALT_LED1 | ||
| 124 | rgblight_sethsv_at(240, 255, 255, ALT_LED1); | ||
| 125 | # endif // ALT_LED1 | ||
| 126 | # ifdef GUI_LED2 | ||
| 127 | rgblight_sethsv_at(240, 255, 255, ALT_LED2); | ||
| 128 | # endif // GUI_LED2 | ||
| 129 | } else { | ||
| 130 | # ifdef GUI_LED1 | ||
| 131 | rgblight_sethsv_default_helper(ALT_LED1); | ||
| 132 | # endif // GUI_LED1 | ||
| 133 | # ifdef GUI_LED2 | ||
| 134 | rgblight_sethsv_default_helper(ALT_LED2); | ||
| 135 | # endif // GUI_LED2 | ||
| 136 | } | ||
| 137 | } | ||
| 138 | } | ||
| 139 | |||
| 140 | /* Function for the indicators */ | ||
| 141 | void matrix_scan_indicator(void) { | ||
| 142 | if (has_initialized) { | ||
| 143 | set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods()); | ||
| 144 | } | ||
| 145 | } | ||
| 146 | # endif // INDICATOR_LIGHTS | ||
| 147 | |||
| 148 | # ifdef RGBLIGHT_TWINKLE | ||
| 149 | static rgblight_fadeout lights[RGBLED_NUM]; | ||
| 150 | |||
| 151 | __attribute__((weak)) bool rgblight_twinkle_is_led_used_keymap(uint8_t index) { return false; } | ||
| 152 | |||
| 153 | /* This function checks for used LEDs. This way, collisions don't occur and cause weird rendering */ | ||
| 154 | bool rgblight_twinkle_is_led_used(uint8_t index) { | ||
| 155 | switch (index) { | ||
| 156 | # ifdef INDICATOR_LIGHTS | ||
| 157 | # ifdef SHFT_LED1 | ||
| 158 | case SHFT_LED1: | ||
| 159 | return true; | ||
| 160 | # endif // SHFT_LED1 | ||
| 161 | # ifdef SHFT_LED2 | ||
| 162 | case SHFT_LED2: | ||
| 163 | return true; | ||
| 164 | # endif // SHFT_LED2 | ||
| 165 | # ifdef CTRL_LED1 | ||
| 166 | case CTRL_LED1: | ||
| 167 | return true; | ||
| 168 | # endif // CTRL_LED1 | ||
| 169 | # ifdef CTRL_LED2 | ||
| 170 | case CTRL_LED2: | ||
| 171 | return true; | ||
| 172 | # endif // CTRL_LED2 | ||
| 173 | # ifdef GUI_LED1 | ||
| 174 | case GUI_LED1: | ||
| 175 | return true; | ||
| 176 | # endif // GUI_LED1 | ||
| 177 | # ifdef GUI_LED2 | ||
| 178 | case GUI_LED2: | ||
| 179 | return true; | ||
| 180 | # endif // GUI_LED2 | ||
| 181 | # ifdef ALT_LED1 | ||
| 182 | case ALT_LED1: | ||
| 183 | return true; | ||
| 184 | # endif // ALT_LED1 | ||
| 185 | # ifdef ALT_LED2 | ||
| 186 | case ALT_LED2: | ||
| 187 | return true; | ||
| 188 | # endif // ALT_LED2 | ||
| 189 | # endif // INDICATOR_LIGHTS | ||
| 190 | default: | ||
| 191 | return rgblight_twinkle_is_led_used_keymap(index); | ||
| 192 | } | ||
| 193 | } | ||
| 194 | |||
| 195 | /* Handler for fading/twinkling effect */ | ||
| 196 | void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive | ||
| 197 | bool litup = false; | ||
| 198 | for (uint8_t light_index = 0; light_index < RGBLED_NUM; ++light_index) { | ||
| 199 | if (lights[light_index].enabled && timer_elapsed(lights[light_index].timer) > 10) { | ||
| 200 | rgblight_fadeout *light = &lights[light_index]; | ||
| 201 | litup = true; | ||
| 202 | |||
| 203 | if (light->life) { | ||
| 204 | light->life -= 1; | ||
| 205 | if (get_highest_layer(layer_state) == 0) { | ||
| 206 | sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]); | ||
| 207 | } | ||
| 208 | light->timer = timer_read(); | ||
| 209 | } else { | ||
| 210 | if (light->enabled && get_highest_layer(layer_state) == 0) { | ||
| 211 | rgblight_sethsv_default_helper(light_index); | ||
| 212 | } | ||
| 213 | litup = light->enabled = false; | ||
| 214 | } | ||
| 215 | } | ||
| 216 | } | ||
| 217 | if (litup && get_highest_layer(layer_state) == 0) { | ||
| 218 | rgblight_set(); | ||
| 219 | } | ||
| 220 | } | ||
| 221 | |||
| 222 | /* Triggers a LED to fade/twinkle. | ||
| 223 | * This function handles the selection of the LED and prepres for it to be used. | ||
| 224 | */ | ||
| 225 | void start_rgb_light(void) { | ||
| 226 | uint8_t indices[RGBLED_NUM]; | ||
| 227 | uint8_t indices_count = 0; | ||
| 228 | uint8_t min_life = 0xFF; | ||
| 229 | uint8_t min_life_index = -1; | ||
| 230 | for (uint8_t index = 0; index < RGBLED_NUM; ++index) { | ||
| 231 | if (rgblight_twinkle_is_led_used(index)) { | ||
| 232 | continue; | ||
| 233 | } | ||
| 234 | if (lights[index].enabled) { | ||
| 235 | if (min_life_index == -1 || lights[index].life < min_life) { | ||
| 236 | min_life = lights[index].life; | ||
| 237 | min_life_index = index; | ||
| 238 | } | ||
| 239 | continue; | ||
| 240 | } | ||
| 241 | |||
| 242 | indices[indices_count] = index; | ||
| 243 | ++indices_count; | ||
| 244 | } | ||
| 245 | |||
| 246 | uint8_t light_index; | ||
| 247 | if (!indices_count) { | ||
| 248 | light_index = min_life_index; | ||
| 249 | } else { | ||
| 250 | light_index = indices[rand() % indices_count]; | ||
| 251 | } | ||
| 252 | |||
| 253 | rgblight_fadeout *light = &lights[light_index]; | ||
| 254 | light->enabled = true; | ||
| 255 | light->timer = timer_read(); | ||
| 256 | light->life = 0xC0 + rand() % 0x40; | ||
| 257 | |||
| 258 | light->hue = rgblight_config.hue + (rand() % 0xB4) - 0x54; | ||
| 259 | |||
| 260 | rgblight_sethsv_at(light->hue, 255, light->life, light_index); | ||
| 261 | } | ||
| 262 | # endif | ||
| 263 | #endif // RGBLIGHT_ENABLE | ||
| 264 | |||
| 265 | bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { | ||
| 266 | uint16_t temp_keycode = keycode; | ||
| 267 | // Filter out the actual keycode from MT and LT keys. | ||
| 268 | if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { | ||
| 269 | temp_keycode &= 0xFF; | ||
| 270 | } | ||
| 271 | |||
| 272 | #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) | ||
| 273 | hypno_timer = timer_read32(); | ||
| 274 | if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_REST_MODE) { | ||
| 275 | rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP); | ||
| 276 | } | ||
| 277 | #endif | ||
| 278 | |||
| 279 | switch (temp_keycode) { | ||
| 280 | #ifdef RGBLIGHT_TWINKLE | ||
| 281 | case KC_A ... KC_SLASH: | ||
| 282 | case KC_F1 ... KC_F12: | ||
| 283 | case KC_INSERT ... KC_UP: | ||
| 284 | case KC_KP_SLASH ... KC_KP_DOT: | ||
| 285 | case KC_F13 ... KC_F24: | ||
| 286 | case KC_AUDIO_MUTE ... KC_MEDIA_REWIND: | ||
| 287 | if (record->event.pressed) { | ||
| 288 | start_rgb_light(); | ||
| 289 | } | ||
| 290 | break; | ||
| 291 | #endif // RGBLIGHT_TWINKLE | ||
| 292 | case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal | ||
| 293 | #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) | ||
| 294 | if (record->event.pressed) { | ||
| 295 | userspace_config.rgb_layer_change ^= 1; | ||
| 296 | dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); | ||
| 297 | eeconfig_update_user(userspace_config.raw); | ||
| 298 | if (userspace_config.rgb_layer_change) { | ||
| 299 | layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) | ||
| 300 | } | ||
| 301 | } | ||
| 302 | #endif // RGBLIGHT_ENABLE | ||
| 303 | break; | ||
| 304 | case RGB_IDL: // This allows me to use underglow as layer indication, or as normal | ||
| 305 | #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) | ||
| 306 | if (record->event.pressed) { | ||
| 307 | userspace_config.rgb_matrix_idle_anim ^= 1; | ||
| 308 | dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim); | ||
| 309 | eeconfig_update_user(userspace_config.raw); | ||
| 310 | if (userspace_config.rgb_matrix_idle_anim) { | ||
| 311 | rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP); | ||
| 312 | } | ||
| 313 | } | ||
| 314 | #endif | ||
| 315 | break; | ||
| 316 | case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions | ||
| 317 | if (record->event.pressed) { | ||
| 318 | bool is_eeprom_updated = false; | ||
| 319 | #ifdef RGBLIGHT_ENABLE | ||
| 320 | // This disables layer indication, as it's assumed that if you're changing this ... you want that disabled | ||
| 321 | if (userspace_config.rgb_layer_change) { | ||
| 322 | userspace_config.rgb_layer_change = false; | ||
| 323 | dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); | ||
| 324 | is_eeprom_updated = true; | ||
| 325 | } | ||
| 326 | #endif | ||
| 327 | #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) | ||
| 328 | if (userspace_config.rgb_matrix_idle_anim) { | ||
| 329 | userspace_config.rgb_matrix_idle_anim = false; | ||
| 330 | dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim); | ||
| 331 | is_eeprom_updated = true; | ||
| 332 | } | ||
| 333 | #endif | ||
| 334 | if (is_eeprom_updated) { | ||
| 335 | eeconfig_update_user(userspace_config.raw); | ||
| 336 | } | ||
| 337 | } | ||
| 338 | break; | ||
| 339 | } | ||
| 340 | return true; | ||
| 341 | } | ||
| 342 | |||
| 343 | void keyboard_post_init_rgb(void) { | ||
| 344 | #if defined(RGBLIGHT_ENABLE) | ||
| 345 | # if defined(RGBLIGHT_STARTUP_ANIMATION) | ||
| 346 | bool is_enabled = rgblight_config.enable; | ||
| 347 | if (userspace_config.rgb_layer_change) { | ||
| 348 | rgblight_enable_noeeprom(); | ||
| 349 | } | ||
| 350 | if (rgblight_config.enable) { | ||
| 351 | layer_state_set_user(layer_state); | ||
| 352 | uint16_t old_hue = rgblight_config.hue; | ||
| 353 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); | ||
| 354 | for (uint16_t i = 255; i > 0; i--) { | ||
| 355 | rgblight_sethsv_noeeprom((i + old_hue) % 255, 255, 255); | ||
| 356 | matrix_scan(); | ||
| 357 | wait_ms(10); | ||
| 358 | } | ||
| 359 | } | ||
| 360 | if (!is_enabled) { | ||
| 361 | rgblight_disable_noeeprom(); | ||
| 362 | } | ||
| 363 | |||
| 364 | # endif | ||
| 365 | layer_state_set_user(layer_state); | ||
| 366 | #endif | ||
| 367 | #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) | ||
| 368 | if (userspace_config.rgb_matrix_idle_anim) { | ||
| 369 | rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE); | ||
| 370 | } | ||
| 371 | #endif | ||
| 372 | } | ||
| 373 | |||
| 374 | void matrix_scan_rgb(void) { | ||
| 375 | #ifdef RGBLIGHT_ENABLE | ||
| 376 | # ifdef RGBLIGHT_TWINKLE | ||
| 377 | scan_rgblight_fadeout(); | ||
| 378 | # endif // RGBLIGHT_ENABLE | ||
| 379 | |||
| 380 | # ifdef INDICATOR_LIGHTS | ||
| 381 | matrix_scan_indicator(); | ||
| 382 | # endif | ||
| 383 | #endif | ||
| 384 | |||
| 385 | #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) | ||
| 386 | if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_TYPING_HEATMAP && timer_elapsed32(hypno_timer) > 15000) { | ||
| 387 | rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE); | ||
| 388 | } | ||
| 389 | #endif | ||
| 390 | } | ||
| 391 | |||
| 392 | #ifdef RGBLIGHT_ENABLE | ||
| 393 | void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) { | ||
| 394 | rgblight_sethsv_noeeprom(hue, sat, val); | ||
| 395 | wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly | ||
| 396 | rgblight_mode_noeeprom(mode); | ||
| 397 | } | ||
| 398 | #endif | ||
| 399 | |||
| 400 | layer_state_t layer_state_set_rgb(layer_state_t state) { | ||
| 401 | #ifdef RGBLIGHT_ENABLE | ||
| 402 | if (userspace_config.rgb_layer_change) { | ||
| 403 | switch (get_highest_layer(state)) { | ||
| 404 | case _RAISE: | ||
| 405 | rgblight_set_hsv_and_mode(HSV_YELLOW, RGBLIGHT_MODE_BREATHING + 3); | ||
| 406 | break; | ||
| 407 | case _LOWER: | ||
| 408 | rgblight_set_hsv_and_mode(HSV_GREEN, RGBLIGHT_MODE_BREATHING + 3); | ||
| 409 | break; | ||
| 410 | case _ADJUST: | ||
| 411 | rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_KNIGHT + 2); | ||
| 412 | break; | ||
| 413 | default: // for any other layers, or the default layer | ||
| 414 | { | ||
| 415 | uint8_t mode = get_highest_layer(state) == _MODS ? RGBLIGHT_MODE_BREATHING : RGBLIGHT_MODE_STATIC_LIGHT; | ||
| 416 | switch (get_highest_layer(default_layer_state)) { | ||
| 417 | case _COLEMAK: | ||
| 418 | rgblight_set_hsv_and_mode(HSV_MAGENTA, mode); | ||
| 419 | break; | ||
| 420 | case _DVORAK: | ||
| 421 | rgblight_set_hsv_and_mode(HSV_SPRINGGREEN, mode); | ||
| 422 | break; | ||
| 423 | default: | ||
| 424 | rgblight_set_hsv_and_mode(HSV_CYAN, mode); | ||
| 425 | break; | ||
| 426 | } | ||
| 427 | break; | ||
| 428 | } | ||
| 429 | } | ||
| 430 | } | ||
| 431 | #endif // RGBLIGHT_ENABLE | ||
| 432 | |||
| 433 | return state; | ||
| 434 | } | ||
| 435 | |||
| 436 | #ifdef RGB_MATRIX_ENABLE | ||
| 437 | # include "lib/lib8tion/lib8tion.h" | ||
| 438 | extern led_config_t g_led_config; | ||
| 439 | |||
| 440 | void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type) { | ||
| 441 | HSV hsv = {hue, sat, val}; | ||
| 442 | if (hsv.v > rgb_matrix_config.hsv.v) { | ||
| 443 | hsv.v = rgb_matrix_config.hsv.v; | ||
| 444 | } | ||
| 445 | |||
| 446 | switch (mode) { | ||
| 447 | case 1: // breathing | ||
| 448 | { | ||
| 449 | uint16_t time = scale16by8(g_rgb_counters.tick, speed / 8); | ||
| 450 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); | ||
| 451 | RGB rgb = hsv_to_rgb(hsv); | ||
| 452 | for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { | ||
| 453 | if (HAS_FLAGS(g_led_config.flags[i], led_type)) { | ||
| 454 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | ||
| 455 | } | ||
| 456 | } | ||
| 457 | break; | ||
| 458 | } | ||
| 459 | default: // Solid Color | ||
| 460 | { | ||
| 461 | RGB rgb = hsv_to_rgb(hsv); | ||
| 462 | for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { | ||
| 463 | if (HAS_FLAGS(g_led_config.flags[i], led_type)) { | ||
| 464 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | ||
| 465 | } | ||
| 466 | } | ||
| 467 | break; | ||
| 468 | } | ||
| 469 | } | ||
| 470 | } | ||
| 471 | #endif | ||
diff --git a/users/curry/rgb_stuff.h b/users/curry/rgb_stuff.h new file mode 100644 index 000000000..50b73c1c3 --- /dev/null +++ b/users/curry/rgb_stuff.h | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | #pragma once | ||
| 2 | #include "quantum.h" | ||
| 3 | #ifdef RGB_MATRIX_ENABLE | ||
| 4 | # include "rgb_matrix.h" | ||
| 5 | #endif | ||
| 6 | |||
| 7 | #if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_TWINKLE) | ||
| 8 | typedef struct { | ||
| 9 | bool enabled; | ||
| 10 | uint8_t hue; | ||
| 11 | uint16_t timer; | ||
| 12 | uint8_t life; | ||
| 13 | } rgblight_fadeout; | ||
| 14 | #endif | ||
| 15 | |||
| 16 | bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record); | ||
| 17 | void keyboard_post_init_rgb(void); | ||
| 18 | void matrix_scan_rgb(void); | ||
| 19 | layer_state_t layer_state_set_rgb(layer_state_t state); | ||
| 20 | layer_state_t default_layer_state_set_rgb(layer_state_t state); | ||
| 21 | |||
| 22 | #if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_TWINKLE) | ||
| 23 | void scan_rgblight_fadeout(void); | ||
| 24 | #endif | ||
| 25 | #if defined(RGBLIGHT_ENABLE) | ||
| 26 | void rgblight_sethsv_default_helper(uint8_t index); | ||
| 27 | #endif | ||
| 28 | |||
| 29 | #ifdef RGB_MATRIX_ENABLE | ||
| 30 | void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue); | ||
| 31 | void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type); | ||
| 32 | #endif | ||
diff --git a/users/curry/rgblight_breathe_table.h b/users/curry/rgblight_breathe_table.h new file mode 100644 index 000000000..4c6ae38fa --- /dev/null +++ b/users/curry/rgblight_breathe_table.h | |||
| @@ -0,0 +1,118 @@ | |||
| 1 | #ifndef RGBLIGHT_EFFECT_BREATHE_TABLE | ||
| 2 | #define RGBLIGHT_EFFECT_BREATHE_TABLE | ||
| 3 | |||
| 4 | // clang-format off | ||
| 5 | const uint8_t rgblight_effect_breathe_table[] PROGMEM = { | ||
| 6 | /* #define RGBLIGHT_EFFECT_BREATHE_CENTER 0.00 */ | ||
| 7 | /* #define RGBLIGHT_EFFECT_BREATHE_MAX 255 */ | ||
| 8 | |||
| 9 | #if RGBLIGHT_BREATHE_TABLE_SIZE == 256 | ||
| 10 | 0x44, 0x45, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x4e, | ||
| 11 | 0x4f, 0x51, 0x52, 0x54, 0x55, 0x57, 0x58, 0x5a, | ||
| 12 | 0x5c, 0x5d, 0x5f, 0x60, 0x62, 0x64, 0x65, 0x67, | ||
| 13 | 0x69, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x73, 0x75, | ||
| 14 | 0x77, 0x79, 0x7b, 0x7c, 0x7e, 0x80, 0x82, 0x84, | ||
| 15 | 0x86, 0x88, 0x8a, 0x8b, 0x8d, 0x8f, 0x91, 0x93, | ||
| 16 | 0x95, 0x97, 0x99, 0x9b, 0x9d, 0x9f, 0xa1, 0xa3, | ||
| 17 | 0xa5, 0xa7, 0xa9, 0xaa, 0xac, 0xae, 0xb0, 0xb2, | ||
| 18 | 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, 0xbf, 0xc1, | ||
| 19 | 0xc3, 0xc5, 0xc7, 0xc9, 0xca, 0xcc, 0xce, 0xd0, | ||
| 20 | 0xd1, 0xd3, 0xd5, 0xd6, 0xd8, 0xda, 0xdb, 0xdd, | ||
| 21 | 0xde, 0xe0, 0xe1, 0xe3, 0xe4, 0xe5, 0xe7, 0xe8, | ||
| 22 | 0xe9, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, | ||
| 23 | 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf8, | ||
| 24 | 0xf9, 0xfa, 0xfa, 0xfb, 0xfc, 0xfc, 0xfc, 0xfd, | ||
| 25 | 0xfd, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, | ||
| 26 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd, | ||
| 27 | 0xfd, 0xfc, 0xfc, 0xfc, 0xfb, 0xfa, 0xfa, 0xf9, | ||
| 28 | 0xf8, 0xf8, 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, | ||
| 29 | 0xf1, 0xf0, 0xef, 0xee, 0xed, 0xec, 0xeb, 0xe9, | ||
| 30 | 0xe8, 0xe7, 0xe5, 0xe4, 0xe3, 0xe1, 0xe0, 0xde, | ||
| 31 | 0xdd, 0xdb, 0xda, 0xd8, 0xd6, 0xd5, 0xd3, 0xd1, | ||
| 32 | 0xd0, 0xce, 0xcc, 0xca, 0xc9, 0xc7, 0xc5, 0xc3, | ||
| 33 | 0xc1, 0xbf, 0xbe, 0xbc, 0xba, 0xb8, 0xb6, 0xb4, | ||
| 34 | 0xb2, 0xb0, 0xae, 0xac, 0xaa, 0xa9, 0xa7, 0xa5, | ||
| 35 | 0xa3, 0xa1, 0x9f, 0x9d, 0x9b, 0x99, 0x97, 0x95, | ||
| 36 | 0x93, 0x91, 0x8f, 0x8d, 0x8b, 0x8a, 0x88, 0x86, | ||
| 37 | 0x84, 0x82, 0x80, 0x7e, 0x7c, 0x7b, 0x79, 0x77, | ||
| 38 | 0x75, 0x73, 0x72, 0x70, 0x6e, 0x6c, 0x6a, 0x69, | ||
| 39 | 0x67, 0x65, 0x64, 0x62, 0x60, 0x5f, 0x5d, 0x5c, | ||
| 40 | 0x5a, 0x58, 0x57, 0x55, 0x54, 0x52, 0x51, 0x4f, | ||
| 41 | 0x4e, 0x4c, 0x4b, 0x4a, 0x48, 0x47, 0x45, 0x44 | ||
| 42 | #endif /* 256 bytes table */ | ||
| 43 | |||
| 44 | #if RGBLIGHT_BREATHE_TABLE_SIZE == 128 | ||
| 45 | 0x44, 0x47, 0x4a, 0x4c, | ||
| 46 | 0x4f, 0x52, 0x55, 0x58, | ||
| 47 | 0x5c, 0x5f, 0x62, 0x65, | ||
| 48 | 0x69, 0x6c, 0x70, 0x73, | ||
| 49 | 0x77, 0x7b, 0x7e, 0x82, | ||
| 50 | 0x86, 0x8a, 0x8d, 0x91, | ||
| 51 | 0x95, 0x99, 0x9d, 0xa1, | ||
| 52 | 0xa5, 0xa9, 0xac, 0xb0, | ||
| 53 | 0xb4, 0xb8, 0xbc, 0xbf, | ||
| 54 | 0xc3, 0xc7, 0xca, 0xce, | ||
| 55 | 0xd1, 0xd5, 0xd8, 0xdb, | ||
| 56 | 0xde, 0xe1, 0xe4, 0xe7, | ||
| 57 | 0xe9, 0xec, 0xee, 0xf0, | ||
| 58 | 0xf2, 0xf4, 0xf6, 0xf8, | ||
| 59 | 0xf9, 0xfa, 0xfc, 0xfc, | ||
| 60 | 0xfd, 0xfe, 0xfe, 0xfe, | ||
| 61 | 0xfe, 0xfe, 0xfe, 0xfe, | ||
| 62 | 0xfd, 0xfc, 0xfb, 0xfa, | ||
| 63 | 0xf8, 0xf7, 0xf5, 0xf3, | ||
| 64 | 0xf1, 0xef, 0xed, 0xeb, | ||
| 65 | 0xe8, 0xe5, 0xe3, 0xe0, | ||
| 66 | 0xdd, 0xda, 0xd6, 0xd3, | ||
| 67 | 0xd0, 0xcc, 0xc9, 0xc5, | ||
| 68 | 0xc1, 0xbe, 0xba, 0xb6, | ||
| 69 | 0xb2, 0xae, 0xaa, 0xa7, | ||
| 70 | 0xa3, 0x9f, 0x9b, 0x97, | ||
| 71 | 0x93, 0x8f, 0x8b, 0x88, | ||
| 72 | 0x84, 0x80, 0x7c, 0x79, | ||
| 73 | 0x75, 0x72, 0x6e, 0x6a, | ||
| 74 | 0x67, 0x64, 0x60, 0x5d, | ||
| 75 | 0x5a, 0x57, 0x54, 0x51, | ||
| 76 | 0x4e, 0x4b, 0x48, 0x45 | ||
| 77 | #endif /* 128 bytes table */ | ||
| 78 | |||
| 79 | #if RGBLIGHT_BREATHE_TABLE_SIZE == 64 | ||
| 80 | 0x44, 0x4a, | ||
| 81 | 0x4f, 0x55, | ||
| 82 | 0x5c, 0x62, | ||
| 83 | 0x69, 0x70, | ||
| 84 | 0x77, 0x7e, | ||
| 85 | 0x86, 0x8d, | ||
| 86 | 0x95, 0x9d, | ||
| 87 | 0xa5, 0xac, | ||
| 88 | 0xb4, 0xbc, | ||
| 89 | 0xc3, 0xca, | ||
| 90 | 0xd1, 0xd8, | ||
| 91 | 0xde, 0xe4, | ||
| 92 | 0xe9, 0xee, | ||
| 93 | 0xf2, 0xf6, | ||
| 94 | 0xf9, 0xfc, | ||
| 95 | 0xfd, 0xfe, | ||
| 96 | 0xfe, 0xfe, | ||
| 97 | 0xfd, 0xfb, | ||
| 98 | 0xf8, 0xf5, | ||
| 99 | 0xf1, 0xed, | ||
| 100 | 0xe8, 0xe3, | ||
| 101 | 0xdd, 0xd6, | ||
| 102 | 0xd0, 0xc9, | ||
| 103 | 0xc1, 0xba, | ||
| 104 | 0xb2, 0xaa, | ||
| 105 | 0xa3, 0x9b, | ||
| 106 | 0x93, 0x8b, | ||
| 107 | 0x84, 0x7c, | ||
| 108 | 0x75, 0x6e, | ||
| 109 | 0x67, 0x60, | ||
| 110 | 0x5a, 0x54, | ||
| 111 | 0x4e, 0x48 | ||
| 112 | #endif /* 64 bytes table */ | ||
| 113 | }; | ||
| 114 | // clang-format on | ||
| 115 | |||
| 116 | static const int table_scale = 256 / sizeof(rgblight_effect_breathe_table); | ||
| 117 | |||
| 118 | #endif /* RGBLIGHT_EFFECT_BREATHE_TABLE */ | ||
diff --git a/users/curry/rules.mk b/users/curry/rules.mk new file mode 100644 index 000000000..2ebb80794 --- /dev/null +++ b/users/curry/rules.mk | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | SRC += curry.c \ | ||
| 2 | process_records.c | ||
| 3 | |||
| 4 | LTO_ENABLE = yes | ||
| 5 | SPACE_CADET_ENABLE = no | ||
| 6 | |||
| 7 | ifneq ($(strip $(NO_SECRETS)), yes) | ||
| 8 | ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") | ||
| 9 | SRC += secrets.c | ||
| 10 | endif | ||
| 11 | ifeq ($(strip $(NO_SECRETS)), lite) | ||
| 12 | OPT_DEFS += -DNO_SECRETS | ||
| 13 | endif | ||
| 14 | endif | ||
| 15 | |||
| 16 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) | ||
| 17 | SRC += tap_dances.c | ||
| 18 | endif | ||
| 19 | |||
| 20 | ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes) | ||
| 21 | SRC += oled.c | ||
| 22 | endif | ||
| 23 | |||
| 24 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) | ||
| 25 | SRC += rgb_stuff.c | ||
| 26 | ifeq ($(strip $(INDICATOR_LIGHTS)), yes) | ||
| 27 | OPT_DEFS += -DINDICATOR_LIGHTS | ||
| 28 | endif | ||
| 29 | ifeq ($(strip $(RGBLIGHT_TWINKLE)), yes) | ||
| 30 | OPT_DEFS += -DRGBLIGHT_TWINKLE | ||
| 31 | endif | ||
| 32 | ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes) | ||
| 33 | OPT_DEFS += -DRGBLIGHT_NOEEPROM | ||
| 34 | endif | ||
| 35 | ifeq ($(strip $(RGBLIGHT_STARTUP_ANIMATION)), yes) | ||
| 36 | OPT_DEFS += -DRGBLIGHT_STARTUP_ANIMATION | ||
| 37 | endif | ||
| 38 | endif | ||
| 39 | |||
| 40 | RGB_MATRIX_ENABLE ?= no | ||
| 41 | ifneq ($(strip $(RGB_MATRIX_ENABLE)), no) | ||
| 42 | SRC += rgb_stuff.c | ||
| 43 | endif | ||
| 44 | |||
| 45 | |||
| 46 | ifdef CONSOLE_ENABLE | ||
| 47 | ifeq ($(strip $(KEYLOGGER_ENABLE)), yes) | ||
| 48 | OPT_DEFS += -DKEYLOGGER_ENABLE | ||
| 49 | endif | ||
| 50 | endif | ||
| 51 | |||
| 52 | ifeq ($(strip $(MAKE_BOOTLOADER)), yes) | ||
| 53 | OPT_DEFS += -DMAKE_BOOTLOADER | ||
| 54 | endif | ||
| 55 | |||
| 56 | # At least until build.mk or the like drops, this is here to prevent | ||
| 57 | # VUSB boards from enabling NKRO, as they do not support it. Ideally | ||
| 58 | # this should be handled per keyboard, but until that happens ... | ||
| 59 | ifeq ($(strip $(PROTOCOL)), VUSB) | ||
| 60 | NKRO_ENABLE = no | ||
| 61 | endif | ||
diff --git a/users/curry/tap_dances.c b/users/curry/tap_dances.c new file mode 100644 index 000000000..fe62def0d --- /dev/null +++ b/users/curry/tap_dances.c | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | #include "curry.h" | ||
| 2 | |||
| 3 | qk_tap_dance_action_t tap_dance_actions[] = {}; | ||
diff --git a/users/curry/tap_dances.h b/users/curry/tap_dances.h new file mode 100644 index 000000000..43ce12ffc --- /dev/null +++ b/users/curry/tap_dances.h | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | #pragma once | ||
| 2 | #include "curry.h" | ||
| 3 | |||
diff --git a/users/curry/wrappers.h b/users/curry/wrappers.h new file mode 100644 index 000000000..fa181af2e --- /dev/null +++ b/users/curry/wrappers.h | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | #pragma once | ||
| 2 | #include "curry.h" | ||
| 3 | /* | ||
| 4 | Since our quirky block definitions are basically a list of comma separated | ||
| 5 | arguments, we need a wrapper in order for these definitions to be | ||
| 6 | expanded before being used as arguments to the LAYOUT_xxx macro. | ||
| 7 | */ | ||
| 8 | #if (!defined(LAYOUT) && defined(KEYMAP)) | ||
| 9 | # define LAYOUT KEYMAP | ||
| 10 | #endif | ||
| 11 | |||
| 12 | // clang-format off | ||
| 13 | #define KEYMAP_wrapper(...) LAYOUT(__VA_ARGS__) | ||
| 14 | #define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) | ||
| 15 | #define LAYOUT_ortho_4x12_wrapper(...) LAYOUT_ortho_4x12(__VA_ARGS__) | ||
| 16 | #define LAYOUT_ortho_5x12_wrapper(...) LAYOUT_ortho_5x12(__VA_ARGS__) | ||
| 17 | |||
| 18 | /* | ||
| 19 | Blocks for each of the four major keyboard layouts | ||
| 20 | Organized so we can quickly adapt and modify all of them | ||
| 21 | at once, rather than for each keyboard, one at a time. | ||
| 22 | And this allows for much cleaner blocks in the keymaps. | ||
| 23 | For instance Tap/Hold for Control on all of the layouts | ||
| 24 | |||
| 25 | NOTE: These are all the same length. If you do a search/replace | ||
| 26 | then you need to add/remove underscores to keep the | ||
| 27 | lengths consistent. | ||
| 28 | */ | ||
| 29 | |||
| 30 | #define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T | ||
| 31 | #define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G | ||
| 32 | #define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B | ||
| 33 | |||
| 34 | #define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P | ||
| 35 | #define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN | ||
| 36 | #define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLASH | ||
| 37 | |||
| 38 | #define _________________COLEMAK_L1________________ KC_Q, KC_W, KC_F, KC_P, KC_B | ||
| 39 | #define _________________COLEMAK_L2________________ KC_A, KC_R, KC_S, KC_T, KC_G | ||
| 40 | #define _________________COLEMAK_L3________________ KC_Z, KC_X, KC_C, KC_D, KC_V | ||
| 41 | |||
| 42 | #define _________________COLEMAK_R1________________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN | ||
| 43 | #define _________________COLEMAK_R2________________ KC_M, KC_N, KC_E, KC_I, KC_O | ||
| 44 | #define _________________COLEMAK_R3________________ KC_K, KC_H, KC_COMM, KC_DOT, KC_SLASH | ||
| 45 | |||
| 46 | #define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y | ||
| 47 | #define _________________DVORAK_L2_________________ KC_A, KC_O, KC_E, KC_U, KC_I | ||
| 48 | #define _________________DVORAK_L3_________________ KC_SCLN, KC_Q, KC_J, KC_K, KC_X | ||
| 49 | |||
| 50 | #define _________________DVORAK_R1_________________ KC_F, KC_G, KC_C, KC_R, KC_L | ||
| 51 | #define _________________DVORAK_R2_________________ KC_D, KC_H, KC_T, KC_N, KC_S | ||
| 52 | #define _________________DVORAK_R3_________________ KC_B, KC_M, KC_W, KC_V, KC_Z | ||
| 53 | |||
| 54 | |||
| 55 | #define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5 | ||
| 56 | #define ________________NUMBER_RIGHT_______________ KC_6, KC_7, KC_8, KC_9, KC_0 | ||
| 57 | |||
| 58 | #define _________________FUNC_LEFT_________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 | ||
| 59 | #define _________________FUNC_RIGHT________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 | ||
| 60 | |||
| 61 | #define _________________SYM_LEFT__________________ KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC | ||
| 62 | #define _________________SYM_RIGHT_________________ KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN | ||
| 63 | |||
| 64 | |||
| 65 | #define ___________________BLANK___________________ _______, _______, _______, _______, _______ | ||
| 66 | |||
| 67 | |||
| 68 | #define _________________LOWER_L1__________________ _________________FUNC_LEFT_________________ | ||
| 69 | #define _________________LOWER_L2__________________ _________________SYM_LEFT__________________ | ||
| 70 | #define _________________LOWER_L3__________________ KC_DT1, KC_DT2, KC_DT3, KC_DT4, _______ | ||
| 71 | |||
| 72 | #define _________________LOWER_R1__________________ _________________FUNC_RIGHT________________ | ||
| 73 | #define _________________LOWER_R2__________________ _________________SYM_RIGHT_________________ | ||
| 74 | #define _________________LOWER_R3__________________ _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR | ||
| 75 | |||
| 76 | #define _________________RAISE_L1__________________ ________________NUMBER_LEFT________________ | ||
| 77 | #define _________________RAISE_L2__________________ KC_PGUP, KC_PGDN, KC_HOME, KC_END, _______ | ||
| 78 | #define _________________RAISE_L3__________________ _______, _______, _______, _______, _______ | ||
| 79 | |||
| 80 | #define _________________RAISE_R1__________________ ________________NUMBER_RIGHT_______________ | ||
| 81 | #define _________________RAISE_R2__________________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______ | ||
| 82 | #define _________________RAISE_R3__________________ _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC | ||
| 83 | |||
| 84 | #define _________________ADJUST_L1_________________ RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG | ||
| 85 | #define _________________ADJUST_L2_________________ MU_TOG , CK_TOGG, AU_ON, AU_OFF, CG_NORM | ||
| 86 | #define _________________ADJUST_L3_________________ RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T | ||
| 87 | |||
| 88 | #define _________________ADJUST_R1_________________ KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5 | ||
| 89 | #define _________________ADJUST_R2_________________ CG_SWAP, QWERTY, COLEMAK, DVORAK, XXXXXXX | ||
| 90 | #define _________________ADJUST_R3_________________ MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT | ||
| 91 | |||
| 92 | // clang-format on | ||
