diff options
Diffstat (limited to 'users')
72 files changed, 213 insertions, 1185 deletions
diff --git a/users/arkag/arkag.c b/users/arkag/arkag.c index da85d4f6d4..00abbf2ae3 100644 --- a/users/arkag/arkag.c +++ b/users/arkag/arkag.c @@ -190,7 +190,7 @@ void set_os (uint8_t os, bool update) { } switch (os) { case OS_MAC: - set_unicode_input_mode(UC_OSX); + set_unicode_input_mode(UC_MAC); underglow = (Color){ 213, 255, 255 }; break; case OS_WIN: diff --git a/users/arkag/mechmini2.jpg b/users/arkag/mechmini2.jpg Binary files differdeleted file mode 100644 index 611a0859c0..0000000000 --- a/users/arkag/mechmini2.jpg +++ /dev/null diff --git a/users/bbaserdem/bb-macro.c b/users/bbaserdem/bb-macro.c index a84a7bbc21..6a722e6db1 100644 --- a/users/bbaserdem/bb-macro.c +++ b/users/bbaserdem/bb-macro.c @@ -80,7 +80,7 @@ const uint32_t PROGMEM unicode_map[] = { bool process_record_macro(uint16_t keycode, keyrecord_t *record) { switch (keycode) { // AltGr + Caps should change the oled layout variable - case KC_CAPSLOCK: + case KC_CAPS_LOCK: if (record->event.pressed) { if (get_mods() & MOD_BIT(KC_RALT)) { userspace_config.layout = (userspace_config.layout + 1) % 3; diff --git a/users/bbaserdem/bb-rgb.c b/users/bbaserdem/bb-rgb.c index bdb7f12bbd..49b91129ba 100644 --- a/users/bbaserdem/bb-rgb.c +++ b/users/bbaserdem/bb-rgb.c @@ -23,7 +23,7 @@ // Allow hooking into the RGB matrix indications using keymap code -// Modulates the brightness of indicator +// Modulates the brightness of indicator RGB helper_dimmer(uint8_t r, uint8_t g, uint8_t b) { RGB output; output.r = r / 2; @@ -63,12 +63,12 @@ __attribute__ ((weak)) bool rgb_matrix_indicators_advanced_keymap(uint8_t led_mi return false; } // Set RGB state depending on layer -void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { +bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { uint8_t thisInd = 3; RGB thisCol; // Load keymap hooks if(rgb_matrix_indicators_advanced_keymap(led_min, led_max)) { - return; + return false; } // Grab color info switch (get_highest_layer(layer_state)) { @@ -110,6 +110,7 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { break; } helper_painter(led_min, led_max, thisCol, thisInd); + return false; } // Hook into shutdown code to make all perkey LED's red on hitting reset @@ -120,11 +121,3 @@ void shutdown_rgb(void) { // Delay until this registers while(timer_elapsed(timer_start) < 250) {wait_ms(1);} } - -// Hook into suspend code -void suspend_power_down_rgb(void) { - rgb_matrix_set_suspend_state(true); -} -void suspend_wakeup_init_rgb(void) { - rgb_matrix_set_suspend_state(false); -} diff --git a/users/bbaserdem/bb-rgb.h b/users/bbaserdem/bb-rgb.h index 62b6da9f2f..3e96b997fe 100644 --- a/users/bbaserdem/bb-rgb.h +++ b/users/bbaserdem/bb-rgb.h @@ -21,7 +21,7 @@ */ // For custom indicators -void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max); +bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max); // Hook into shutdown code void shutdown_rgb(void); void suspend_wakeup_init_rgb(void); diff --git a/users/bbaserdem/config.h b/users/bbaserdem/config.h index 477378102b..3c467d5e7d 100644 --- a/users/bbaserdem/config.h +++ b/users/bbaserdem/config.h @@ -121,7 +121,7 @@ // For perkey leds #ifdef RGB_MATRIX_ENABLE // This is not working -//# define RGB_DISABLE_TIMEOUT 1800000 +//# define RGB_MATRIX_TIMEOUT 1800000 # define RGB_DISABLE_WHEN_USB_SUSPENDED true // Start using this mode # define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_RAINBOW_BEACON diff --git a/users/brandonschlack/process_records.h b/users/brandonschlack/process_records.h index 057233fb0e..b377ffaed2 100644 --- a/users/brandonschlack/process_records.h +++ b/users/brandonschlack/process_records.h @@ -119,9 +119,9 @@ void matrix_scan_cmd_tab(void); * Common shortcuts used in macOS * Reference: https://support.apple.com/en-us/HT201236 */ -#define MC_POWR KC_POWER // Power (KC_POWER) -#define MC_SLEP LOPT(LCMD(KC_POWER)) // Sleep (Option-Command-Power) -#define MC_SLPD LCTL(LSFT(KC_POWER)) // Sleep Display (Control-Shift-Power) +#define MC_POWR KC_PWR // Power (KC_PWR) +#define MC_SLEP LOPT(LCMD(KC_PWR)) // Sleep (Option-Command-Power) +#define MC_SLPD LCTL(LSFT(KC_PWR)) // Sleep Display (Control-Shift-Power) #define MC_LOCK LCTL(LCMD(KC_Q)) // Lock Screen (Control-Command-Q) #define MC_MSSN KC_FIND // Mission Control: Configure karabiner for find -> mission_control #define MC_LHPD KC_MENU // Launchpad: Configure karabiner for menu -> launchpad diff --git a/users/brandonschlack/rgb_bs.c b/users/brandonschlack/rgb_bs.c index 1abf785b49..6b88503f41 100644 --- a/users/brandonschlack/rgb_bs.c +++ b/users/brandonschlack/rgb_bs.c @@ -75,7 +75,7 @@ void rgb_theme_step_reverse(void) { rgb_theme_color_t get_rgb_theme_color(uint8_t index) { rgb_theme_t theme = get_rgb_theme(); - size_t rgb_theme_color_max = sizeof theme.colors / sizeof *theme.colors; + size_t rgb_theme_color_max = ARRAY_SIZE(theme.colors); if (index == _ADJUST) { return default_adjust; @@ -98,7 +98,7 @@ void rgb_theme_layer(layer_state_t state) { #ifdef RGB_MATRIX_ENABLE void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, uint8_t led_type) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { if (!HAS_ANY_FLAGS(g_led_config.flags[i], led_type)) { rgb_matrix_set_color( i, red, green, blue ); } diff --git a/users/byungyoonc/saturated_solid_multisplash.h b/users/byungyoonc/saturated_solid_multisplash.h index f302348524..c6850a7873 100644 --- a/users/byungyoonc/saturated_solid_multisplash.h +++ b/users/byungyoonc/saturated_solid_multisplash.h @@ -43,7 +43,7 @@ static bool saturated_solid_multisplash(effect_params_t* params) { RGB rgb = rgb_matrix_hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } - return led_max < DRIVER_LED_TOTAL; + return led_max < RGB_MATRIX_LED_COUNT; } # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/users/cedrikl/cedrikl.c b/users/cedrikl/cedrikl.c index 0479e22b5d..f9f4f1fbc0 100644 --- a/users/cedrikl/cedrikl.c +++ b/users/cedrikl/cedrikl.c @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // Turn on/off NUM LOCK if current state is different void activate_numlock(bool turn_on) { if (host_keyboard_led_state().num_lock != turn_on) { - tap_code(KC_NUMLOCK); + tap_code(KC_NUM_LOCK); } } diff --git a/users/curry/oled.c b/users/curry/oled.c index 5a8f0de61d..89112af121 100644 --- a/users/curry/oled.c +++ b/users/curry/oled.c @@ -41,7 +41,7 @@ void add_keylog(uint16_t keycode) { keylog_str[i] = keylog_str[i - 1]; } - if (keycode < (sizeof(code_to_name) / sizeof(char))) { + if (keycode < ARRAY_SIZE(code_to_name)) { keylog_str[0] = pgm_read_byte(&code_to_name[keycode]); } diff --git a/users/curry/rgb_matrix_user.c b/users/curry/rgb_matrix_user.c index 96f1f1d4f3..3c2008aa01 100644 --- a/users/curry/rgb_matrix_user.c +++ b/users/curry/rgb_matrix_user.c @@ -36,7 +36,7 @@ void check_default_layer(uint8_t mode, uint8_t type) { } } -void rgb_matrix_indicators_user(void) { +bool rgb_matrix_indicators_user(void) { if (userspace_config.rgb_layer_change && rgb_matrix_config.enable) { switch (get_highest_layer(layer_state)) { case _RAISE: @@ -55,6 +55,7 @@ void rgb_matrix_indicators_user(void) { } check_default_layer(0, LED_FLAG_MODIFIER); } + return false; } bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { @@ -131,7 +132,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode uint16_t time = scale16by8(RGBLED_NUM, speed / 8); hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); RGB rgb = hsv_to_rgb(hsv); - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { if (HAS_FLAGS(g_led_config.flags[i], led_type)) { rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } @@ -141,7 +142,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode default: // Solid Color { RGB rgb = hsv_to_rgb(hsv); - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { if (HAS_FLAGS(g_led_config.flags[i], led_type)) { rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/users/cwebster2/my_miryoku.h b/users/cwebster2/my_miryoku.h index 2c8ab6fe2b..8b167cd619 100644 --- a/users/cwebster2/my_miryoku.h +++ b/users/cwebster2/my_miryoku.h @@ -56,7 +56,7 @@ #define _______NUM______L3____ KC_GRV, KC_1, KC_2, KC_3, KC_BSLS #define _______NUM_______T____ KC_DOT, KC_0, KC_MINS -#define _______FN_______L1____ KC_F12, KC_F7, KC_F8, KC_F9, KC_SYSREQ +#define _______FN_______L1____ KC_F12, KC_F7, KC_F8, KC_F9, KC_SYRQ #define _______FN_______L2____ KC_F11, KC_F4, KC_F5, KC_F6, KC_TRNS #define _______FN_______L3____ KC_F10, KC_F1, KC_F2, KC_F3, KC_PAUSE #define _______FN________T____ KC_MENU, KC_SPC, KC_TAB diff --git a/users/davidkristoffersen/util/functions.c b/users/davidkristoffersen/util/functions.c index 781d8f214d..3ab4ace2d6 100644 --- a/users/davidkristoffersen/util/functions.c +++ b/users/davidkristoffersen/util/functions.c @@ -33,14 +33,14 @@ code_set_t EN_SHIFT_CODES [] = { const shift_code_t SHIFT_CODES [] = { #ifdef LAYER_NO {.lang = LAYER_NO, - .size = ARR_LEN(NO_SHIFT_CODES), + .size = ARRAY_SIZE(NO_SHIFT_CODES), .codes = NO_SHIFT_CODES}, #endif {.lang = LAYER_EN, - .size = ARR_LEN(EN_SHIFT_CODES), + .size = ARRAY_SIZE(EN_SHIFT_CODES), .codes = EN_SHIFT_CODES}, }; -const int SHIFT_CODES_SIZE = ARR_LEN(SHIFT_CODES); +const int SHIFT_CODES_SIZE = ARRAY_SIZE(SHIFT_CODES); #endif #ifdef LAYER_NO @@ -72,7 +72,7 @@ const code_set_t EN2NO_CODES [] = { {KC_DLR, NO_DLR}, {KC_GRV, NO_GRV} }; -const int EN2NO_CODES_SIZE = ARR_LEN(EN2NO_CODES); +const int EN2NO_CODES_SIZE = ARRAY_SIZE(EN2NO_CODES); #endif // Check if layer is an active default layer diff --git a/users/davidkristoffersen/util/functions.h b/users/davidkristoffersen/util/functions.h index eee1dadc57..5fef010694 100644 --- a/users/davidkristoffersen/util/functions.h +++ b/users/davidkristoffersen/util/functions.h @@ -15,8 +15,6 @@ // Return false if test equal false #define HANDLE_FALSE(bool) if (!bool) return false; -// Generic array lenght define -#define ARR_LEN(arr) (sizeof(arr) / sizeof(arr)[0]) // Printf-like functionality for send_string #define SEND_VAR(str, ...) \ do { \ diff --git a/users/dennytom/chording_engine/engine.part.1 b/users/dennytom/chording_engine/engine.part.1 index 73df4cdeaa..a2b39284f5 100644 --- a/users/dennytom/chording_engine/engine.part.1 +++ b/users/dennytom/chording_engine/engine.part.1 @@ -85,10 +85,10 @@ bool handle_US_ANSI_shifted_keys(int16_t keycode, bool in) { regular_keycode = KC_EQUAL; break; case KC_LEFT_CURLY_BRACE: - regular_keycode = KC_LBRACKET; + regular_keycode = KC_LEFT_BRACKET; break; case KC_RIGHT_CURLY_BRACE: - regular_keycode = KC_RBRACKET; + regular_keycode = KC_RIGHT_BRACKET; break; case KC_PIPE: regular_keycode = KC_BSLASH; diff --git a/users/dennytom/chording_engine/tests/minunit.h b/users/dennytom/chording_engine/tests/minunit.h index ed71b62533..c7ddc9e444 100644 --- a/users/dennytom/chording_engine/tests/minunit.h +++ b/users/dennytom/chording_engine/tests/minunit.h @@ -113,9 +113,9 @@ enum keycodes { KC_PLUS, KC_EQUAL, KC_LEFT_CURLY_BRACE, - KC_LBRACKET, + KC_LEFT_BRACKET, KC_RIGHT_CURLY_BRACE, - KC_RBRACKET, + KC_RIGHT_BRACKET, KC_PIPE, KC_BSLASH, KC_COLON, diff --git a/users/drashna/callbacks.c b/users/drashna/callbacks.c index 111b5f79d7..40383f124f 100644 --- a/users/drashna/callbacks.c +++ b/users/drashna/callbacks.c @@ -49,7 +49,7 @@ void keyboard_post_init_user(void) { keyboard_post_init_transport_sync(); #endif #ifdef I2C_SCANNER_ENABLE - matrix_scan_i2c(); + keyboard_post_init_i2c(); #endif keyboard_post_init_keymap(); diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 91f3a06b7c..d63f05b590 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -129,3 +129,15 @@ void keyboard_post_init_i2c(void) { scan_timer = timer_read(); } #endif + +#if defined(AUTOCORRECT_ENABLE) && defined(AUDIO_ENABLE) +# ifdef USER_SONG_LIST +float autocorrect_song[][2] = SONG(MARIO_GAMEOVER); +# else +float autocorrect_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +# endif +bool apply_autocorrect(uint8_t backspaces, const char *str) { + PLAY_SONG(autocorrect_song); + return true; +} +#endif diff --git a/users/drashna/keyrecords/autocorrection/autocorrection.c b/users/drashna/keyrecords/autocorrection/autocorrection.c deleted file mode 100644 index 90fdba8f5e..0000000000 --- a/users/drashna/keyrecords/autocorrection/autocorrection.c +++ /dev/null @@ -1,304 +0,0 @@ -// Copyright 2021 Google LLC -// Copyright 2021 @filterpaper -// SPDX-License-Identifier: Apache-2.0 -// Original source: https://getreuer.info/posts/keyboards/autocorrection - -#include "autocorrection.h" -#include <string.h> - -#if __has_include("autocorrection_data.h") -# pragma GCC push_options -# pragma GCC optimize("O0") -# include "autocorrection_data.h" -# ifndef AUTOCORRECTION_MIN_LENGTH -# define AUTOCORRECTION_MIN_LENGTH AUTOCORRECT_MIN_LENGTH -# endif -# ifndef AUTOCORRECTION_MAX_LENGTH -# define AUTOCORRECTION_MAX_LENGTH AUTOCORRECT_MAX_LENGTH -# endif -# define autocorrection_data autocorrect_data -# if AUTOCORRECTION_MIN_LENGTH < 4 -# error Minimum Length is too short and may cause overflows -# endif -# if DICTIONARY_SIZE > SIZE_MAX -# error Dictionary size excees maximum size permitted -# endif - -static uint8_t typo_buffer[AUTOCORRECT_MAX_LENGTH] = {KC_SPC}; -static uint8_t typo_buffer_size = 1; - -/** - * @brief function for querying the enabled state of autocorrect - * - * @return true if enabled - * @return false if disabled - */ -bool autocorrect_is_enabled(void) { - return userspace_config.autocorrection; -} - -/** - * @brief Enables autocorrect and saves state to eeprom - * - */ -void autocorrect_enable(void) { - userspace_config.autocorrection = true; - eeconfig_update_user(userspace_config.raw); -} - -/** - * @brief Disables autocorrect and saves state to eeprom - * - */ -void autocorrect_disable(void) { - userspace_config.autocorrection = false; - typo_buffer_size = 0; - eeconfig_update_user(userspace_config.raw); -} - -/** - * @brief Toggles autocorrect's status and save state to eeprom - * - */ -void autocorrect_toggle(void) { - userspace_config.autocorrection = !userspace_config.autocorrection; - typo_buffer_size = 0; - eeconfig_update_user(userspace_config.raw); -} - -/** - * @brief handler for determining if autocorrect should process keypress - * - * @param keycode Keycode registered by matrix press, per keymap - * @param record keyrecord_t structure - * @param typo_buffer_size passed along to allow resetting of autocorrect buffer - * @param mods allow processing of mod status - * @return true Allow autocorection - * @return false Stop processing and escape from autocorrect. - */ -__attribute__((weak)) bool process_autocorrect_user(uint16_t *keycode, keyrecord_t *record, uint8_t *typo_buffer_size, uint8_t *mods) { - // See quantum_keycodes.h for reference on these matched ranges. - switch (*keycode) { - // Exclude these keycodes from processing. - case KC_LSFT: - case KC_RSFT: - case KC_CAPS: - case QK_TO ... QK_ONE_SHOT_LAYER_MAX: - case QK_LAYER_TAP_TOGGLE ... QK_LAYER_MOD_MAX: - case QK_ONE_SHOT_MOD ... QK_ONE_SHOT_MOD_MAX: - return false; - - // Mask for base keycode from shifted keys. - case QK_LSFT ... QK_LSFT + 255: - case QK_RSFT ... QK_RSFT + 255: - if (*keycode >= QK_LSFT && *keycode <= (QK_LSFT + 255)) { - *mods |= MOD_LSFT; - } else { - *mods |= MOD_RSFT; - } - *keycode &= 0xFF; // Get the basic keycode. - return true; -# ifndef NO_ACTION_TAPPING - // Exclude tap-hold keys when they are held down - // and mask for base keycode when they are tapped. - case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: -# ifdef NO_ACTION_LAYER - // Exclude Layer Tap, if layers are disabled - // but action tapping is still enabled. - return false; -# endif - case QK_MOD_TAP ... QK_MOD_TAP_MAX: - // Exclude hold keycode - if (!record->tap.count) { - return false; - } - *keycode &= 0xFF; - break; -# else - case QK_MOD_TAP ... QK_MOD_TAP_MAX: - case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: - // Exclude if disabled - return false; -# endif - // Exclude swap hands keys when they are held down - // and mask for base keycode when they are tapped. - case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX: -# ifdef SWAP_HANDS_ENABLE - if (*keycode >= 0x56F0 || !record->tap.count) { - return false; - } - *keycode &= 0xFF; - break; -# else - // Exclude if disabled - return false; -# endif - } - - // Disable autocorrect while a mod other than shift is active. - if ((*mods & ~MOD_MASK_SHIFT) != 0) { - *typo_buffer_size = 0; - return false; - } - - return true; -} - -/** - * @brief handling for when autocorrection has been triggered - * - * @param backspaces number of characters to remove - * @param str pointer to PROGMEM string to replace mistyped seletion with - * @return true apply correction - * @return false user handled replacement - */ -__attribute__((weak)) bool apply_autocorrect(uint8_t backspaces, const char *str) { - return true; -} - -/** - * @brief Process handler for autocorrect feature - * - * @param keycode Keycode registered by matrix press, per keymap - * @param record keyrecord_t structure - * @return true Continue processing keycodes, and send to host - * @return false Stop processing keycodes, and don't send to host - */ -bool process_autocorrection(uint16_t keycode, keyrecord_t *record) { - uint8_t mods = get_mods(); -# ifndef NO_ACTION_ONESHOT - mods |= get_oneshot_mods(); -# endif - - if ((keycode >= AUTOCORRECT_ON && keycode <= AUTOCORRECT_TOGGLE) && record->event.pressed) { - if (keycode == AUTOCORRECT_ON) { - autocorrect_enable(); - } else if (keycode == AUTOCORRECT_OFF) { - autocorrect_disable(); - } else if (keycode == AUTOCORRECT_TOGGLE) { - autocorrect_toggle(); - } else { - return true; - } - - return false; - } - - if (!autocorrect_is_enabled()) { - typo_buffer_size = 0; - return true; - } - - if (!record->event.pressed) { - return true; - } - - // autocorrect keycode verification and extraction - if (!process_autocorrect_user(&keycode, record, &typo_buffer_size, &mods)) { - return true; - } - - // keycode buffer check - switch (keycode) { - case KC_A ... KC_Z: - // process normally - break; - case KC_1 ... KC_0: - case KC_TAB ... KC_SEMICOLON: - case KC_GRAVE ... KC_SLASH: - // Set a word boundary if space, period, digit, etc. is pressed. - keycode = KC_SPC; - break; - case KC_ENTER: - // Behave more conservatively for the enter key. Reset, so that enter - // can't be used on a word ending. - typo_buffer_size = 0; - keycode = KC_SPC; - break; - case KC_BSPC: - // Remove last character from the buffer. - if (typo_buffer_size > 0) { - --typo_buffer_size; - } - return true; - case KC_QUOTE: - // Treat " (shifted ') as a word boundary. - if ((mods & MOD_MASK_SHIFT) != 0) { - keycode = KC_SPC; - } - break; - default: - // Clear state if some other non-alpha key is pressed. - typo_buffer_size = 0; - return true; - } - - // Rotate oldest character if buffer is full. - if (typo_buffer_size >= AUTOCORRECT_MAX_LENGTH) { - memmove(typo_buffer, typo_buffer + 1, AUTOCORRECT_MAX_LENGTH - 1); - typo_buffer_size = AUTOCORRECT_MAX_LENGTH - 1; - } - - // Append `keycode` to buffer. - typo_buffer[typo_buffer_size++] = keycode; - // Return if buffer is smaller than the shortest word. - if (typo_buffer_size < AUTOCORRECT_MIN_LENGTH) { - return true; - } - - // Check for typo in buffer using a trie stored in `autocorrect_data`. - uint16_t state = 0; - uint8_t code = pgm_read_byte(autocorrect_data + state); - for (int8_t i = typo_buffer_size - 1; i >= 0; --i) { - uint8_t const key_i = typo_buffer[i]; - - if (code & 64) { // Check for match in node with multiple children. - code &= 63; - for (; code != key_i; code = pgm_read_byte(autocorrect_data + (state += 3))) { - if (!code) return true; - } - // Follow link to child node. - state = (pgm_read_byte(autocorrect_data + state + 1) | pgm_read_byte(autocorrect_data + state + 2) << 8); - // Check for match in node with single child. - } else if (code != key_i) { - return true; - } else if (!(code = pgm_read_byte(autocorrect_data + (++state)))) { - ++state; - } - - // Stop if `state` becomes an invalid index. This should not normally - // happen, it is a safeguard in case of a bug, data corruption, etc. - if (state >= DICTIONARY_SIZE) { - return true; - } - - code = pgm_read_byte(autocorrect_data + state); - - if (code & 128) { // A typo was found! Apply autocorrect. - const uint8_t backspaces = (code & 63) + !record->event.pressed; - if (apply_autocorrect(backspaces, (char const *)(autocorrect_data + state + 1))) { - for (uint8_t i = 0; i < backspaces; ++i) { - tap_code(KC_BSPC); - } - send_string_P((char const *)(autocorrect_data + state + 1)); - } - - if (keycode == KC_SPC) { - typo_buffer[0] = KC_SPC; - typo_buffer_size = 1; - return true; - } else { - typo_buffer_size = 0; - return false; - } - } - } - return true; -} -# pragma GCC pop_options -#else -# pragma message "Warning!!! Autocorrect is not corretly setup!" -bool process_autocorrection(uint16_t keycode, keyrecord_t* record) { - return true; -} -#endif diff --git a/users/drashna/keyrecords/autocorrection/autocorrection.h b/users/drashna/keyrecords/autocorrection/autocorrection.h deleted file mode 100644 index 8946b91f1f..0000000000 --- a/users/drashna/keyrecords/autocorrection/autocorrection.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2021 Google LLC -// Copyright 2021 @filterpaper -// SPDX-License-Identifier: Apache-2.0 -// Original source: https://getreuer.info/posts/keyboards/autocorrection - -#pragma once - -#include "drashna.h" - -bool process_autocorrection(uint16_t keycode, keyrecord_t *record); -bool process_autocorrect_user(uint16_t *keycode, keyrecord_t *record, uint8_t *typo_buffer_size, uint8_t *mods); -bool apply_autocorrect(uint8_t backspaces, const char *str); - -bool autocorrect_is_enabled(void); -void autocorrect_enable(void); -void autocorrect_disable(void); -void autocorrect_toggle(void); diff --git a/users/drashna/keyrecords/autocorrection/autocorrection_data.h b/users/drashna/keyrecords/autocorrection/autocorrection_data.h deleted file mode 100644 index 90484d3b12..0000000000 --- a/users/drashna/keyrecords/autocorrection/autocorrection_data.h +++ /dev/null @@ -1 +0,0 @@ -#include "autocorrect_data.h" diff --git a/users/drashna/keyrecords/autocorrection/make_autocorrection_data.py b/users/drashna/keyrecords/autocorrection/make_autocorrection_data.py deleted file mode 100755 index 0dd9b78b9c..0000000000 --- a/users/drashna/keyrecords/autocorrection/make_autocorrection_data.py +++ /dev/null @@ -1,298 +0,0 @@ -# Copyright 2021-2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Python program to make autocorrection_data.h. - -This program reads "autocorrection_dict.txt" and generates a C source file -"autocorrection_data.h" with a serialized trie embedded as an array. Run this -program without arguments like - -$ python3 make_autocorrection_data.py - -Or to read from a different typo dict file, pass it as the first argument like - -$ python3 make_autocorrection_data.py dict.txt - -Each line of the dict file defines one typo and its correction with the syntax -"typo -> correction". Blank lines or lines starting with '#' are ignored. -Example: - - :thier -> their - dosen't -> doesn't - fitler -> filter - lenght -> length - ouput -> output - widht -> width - -See autocorrection_dict_extra.txt for a larger example. - -For full documentation, see -https://getreuer.info/posts/keyboards/autocorrection -""" - -import sys -import textwrap -from typing import Any, Dict, Iterator, List, Tuple - -try: - from english_words import english_words_lower_alpha_set as CORRECT_WORDS -except ImportError: - print('Autocorrection will falsely trigger when a typo is a substring of a ' - 'correctly spelled word. To check for this, install the english_words ' - 'package and rerun this script:\n\n pip install english_words\n') - # Use a minimal word list as a fallback. - CORRECT_WORDS = ('apparent', 'association', 'available', 'classification', - 'effect', 'entertainment', 'fantastic', 'information', - 'integrate', 'international', 'language', 'loosest', - 'manual', 'nothing', 'provides', 'reference', 'statehood', - 'technology', 'virtually', 'wealthier', 'wonderful') - -KC_A = 4 -KC_SPC = 0x2c -KC_QUOT = 0x34 - -TYPO_CHARS = dict( - [ - ("'", KC_QUOT), - (':', KC_SPC), # "Word break" character. - ] + - # Characters a-z. - [(chr(c), c + KC_A - ord('a')) for c in range(ord('a'), ord('z') + 1)] -) - - -def parse_file(file_name: str) -> List[Tuple[str, str]]: - """Parses autocorrections dictionary file. - - Each line of the file defines one typo and its correction with the syntax - "typo -> correction". Blank lines or lines starting with '#' are ignored. The - function validates that typos only have characters in TYPO_CHARS, that - typos are not substrings of other typos, and checking that typos don't trigger - on CORRECT_WORDS. - - Args: - file_name: String, path of the autocorrections dictionary. - Returns: - List of (typo, correction) tuples. - """ - correct_words = ('information', 'available', 'international', 'language', 'loosest', 'reference', 'wealthier', 'entertainment', 'association', 'provides', 'technology', 'statehood') - autocorrections = [] - typos = set() - for line_number, typo, correction in parse_file_lines(file_name): - if typo in typos: - print(f'Warning:{line_number}: Ignoring duplicate typo: "{typo}"') - continue - - # Check that `typo` is valid. - if not(all([c in TYPO_CHARS for c in typo])): - print(f'Error:{line_number}: Typo "{typo}" has ' - 'characters other than ' + ''.join(TYPO_CHARS.keys())) - sys.exit(1) - for other_typo in typos: - if typo in other_typo or other_typo in typo: - print(f'Error:{line_number}: Typos may not be substrings of one ' - f'another, otherwise the longer typo would never trigger: ' - f'"{typo}" vs. "{other_typo}".') - sys.exit(1) - if len(typo) < 5: - print(f'Warning:{line_number}: It is suggested that typos are at ' - f'least 5 characters long to avoid false triggers: "{typo}"') - - check_typo_against_dictionary(typo, line_number, correct_words) - - autocorrections.append((typo, correction)) - typos.add(typo) - - return autocorrections - - -def make_trie(autocorrections: List[Tuple[str, str]]) -> Dict[str, Any]: - """Makes a trie from the the typos, writing in reverse. - - Args: - autocorrections: List of (typo, correction) tuples. - Returns: - Dict of dict, representing the trie. - """ - trie = {} - for typo, correction in autocorrections: - node = trie - for letter in typo[::-1]: - node = node.setdefault(letter, {}) - node['LEAF'] = (typo, correction) - - return trie - - -def parse_file_lines(file_name: str) -> Iterator[Tuple[int, str, str]]: - """Parses lines read from `file_name` into typo-correction pairs.""" - - line_number = 0 - for line in open(file_name, 'rt'): - line_number += 1 - line = line.strip() - if line and line[0] != '#': - # Parse syntax "typo -> correction", using strip to ignore indenting. - tokens = [token.strip() for token in line.split('->', 1)] - if len(tokens) != 2 or not tokens[0]: - print(f'Error:{line_number}: Invalid syntax: "{line}"') - sys.exit(1) - - typo, correction = tokens - typo = typo.lower() # Force typos to lowercase. - typo = typo.replace(' ', ':') - - yield line_number, typo, correction - - -def check_typo_against_dictionary(typo: str, line_number: int, correct_words) -> None: - """Checks `typo` against English dictionary words.""" - - if typo.startswith(':') and typo.endswith(':'): - if typo[1:-1] in correct_words: - print(f'Warning:{line_number}: Typo "{typo}" is a correctly spelled dictionary word.') - elif typo.startswith(':') and not typo.endswith(':'): - for word in correct_words: - if word.startswith(typo[1:]): - print(f'Warning:{line_number}: Typo "{typo}" would falsely trigger on correctly spelled word "{word}".') - elif not typo.startswith(':') and typo.endswith(':'): - for word in correct_words: - if word.endswith(typo[:-1]): - print(f'Warning:{line_number}: Typo "{typo}" would falsely trigger on correctly spelled word "{word}".') - elif not typo.startswith(':') and not typo.endswith(':'): - for word in correct_words: - if typo in word: - print(f'Warning:{line_number}: Typo "{typo}" would falsely trigger on correctly spelled word "{word}".') - - -def serialize_trie(autocorrections: List[Tuple[str, str]], - trie: Dict[str, Any]) -> List[int]: - """Serializes trie and correction data in a form readable by the C code. - - Args: - autocorrections: List of (typo, correction) tuples. - trie: Dict of dicts. - Returns: - List of ints in the range 0-255. - """ - table = [] - - # Traverse trie in depth first order. - def traverse(trie_node: Dict[str, Any]) -> Dict[str, Any]: - if 'LEAF' in trie_node: # Handle a leaf trie node. - typo, correction = trie_node['LEAF'] - word_boundary_ending = typo[-1] == ':' - typo = typo.strip(':') - i = 0 # Make the autocorrection data for this entry and serialize it. - while i < min(len(typo), len(correction)) and typo[i] == correction[i]: - i += 1 - backspaces = len(typo) - i - 1 + word_boundary_ending - assert 0 <= backspaces <= 63 - correction = correction[i:] - data = [backspaces + 128] + list(bytes(correction, 'ascii')) + [0] - - entry = {'data': data, 'links': [], 'byte_offset': 0} - table.append(entry) - elif len(trie_node) == 1: # Handle trie node with a single child. - c, trie_node = next(iter(trie_node.items())) - entry = {'chars': c, 'byte_offset': 0} - - # It's common for a trie to have long chains of single-child nodes. We - # find the whole chain so that we can serialize it more efficiently. - while len(trie_node) == 1 and 'LEAF' not in trie_node: - c, trie_node = next(iter(trie_node.items())) - entry['chars'] += c - - table.append(entry) - entry['links'] = [traverse(trie_node)] - else: # Handle trie node with multiple children. - entry = {'chars': ''.join(sorted(trie_node.keys())), 'byte_offset': 0} - table.append(entry) - entry['links'] = [traverse(trie_node[c]) for c in entry['chars']] - return entry - - traverse(trie) - - def serialize(e: Dict[str, Any]) -> List[int]: - if not e['links']: # Handle a leaf table entry. - return e['data'] - elif len(e['links']) == 1: # Handle a chain table entry. - return [TYPO_CHARS[c] for c in e['chars']] + [0] - else: # Handle a branch table entry. - data = [] - for c, link in zip(e['chars'], e['links']): - data += [TYPO_CHARS[c] | (0 if data else 64)] + encode_link(link) - return data + [0] - - byte_offset = 0 - for e in table: # To encode links, first compute byte offset of each entry. - e['byte_offset'] = byte_offset - byte_offset += len(serialize(e)) - - return [b for e in table for b in serialize(e)] # Serialize final table. - - -def encode_link(link: Dict[str, Any]) -> List[int]: - """Encodes a node link as two bytes.""" - byte_offset = link['byte_offset'] - if not (0 <= byte_offset <= 0xffff): - print('Error: The autocorrection table is too large, a node link exceeds ' - '64KB limit. Try reducing the autocorrection dict to fewer entries.') - sys.exit(1) - return [byte_offset & 255, byte_offset >> 8] - - -def write_generated_code(autocorrections: List[Tuple[str, str]], - data: List[int], - file_name: str) -> None: - """Writes autocorrection data as generated C code to `file_name`. - - Args: - autocorrections: List of (typo, correction) tuples. - data: List of ints in 0-255, the serialized trie. - file_name: String, path of the output C file. - """ - assert all(0 <= b <= 255 for b in data) - - def typo_len(e: Tuple[str, str]) -> int: - return len(e[0]) - - min_typo = min(autocorrections, key=typo_len)[0] - max_typo = max(autocorrections, key=typo_len)[0] - generated_code = ''.join([ - '// Generated code.\n\n', - f'// Autocorrection dictionary ({len(autocorrections)} entries):\n', - ''.join(sorted(f'// {typo:<{len(max_typo)}} -> {correction}\n' - for typo, correction in autocorrections)), - f'\n#define AUTOCORRECTION_MIN_LENGTH {len(min_typo)} // "{min_typo}"\n', - f'#define AUTOCORRECTION_MAX_LENGTH {len(max_typo)} // "{max_typo}"\n\n', - textwrap.fill('static const uint8_t autocorrection_data[%d] PROGMEM = {%s};' % ( - len(data), ', '.join(map(str, data))), width=80, subsequent_indent=' '), - '\n\n']) - - with open(file_name, 'wt') as f: - f.write(generated_code) - - -def main(argv): - dict_file = argv[1] if len(argv) > 1 else 'autocorrection_dict.txt' - autocorrections = parse_file(dict_file) - trie = make_trie(autocorrections) - data = serialize_trie(autocorrections, trie) - print(f'Processed %d autocorrection entries to table with %d bytes.' - % (len(autocorrections), len(data))) - write_generated_code(autocorrections, data, 'autocorrection_data.h') - -if __name__ == '__main__': - main(sys.argv) diff --git a/users/drashna/keyrecords/autocorrection/readme.md b/users/drashna/keyrecords/autocorrection/readme.md deleted file mode 100644 index d920508793..0000000000 --- a/users/drashna/keyrecords/autocorrection/readme.md +++ /dev/null @@ -1,301 +0,0 @@ -# Autocorrection - -This is taken from [Pascal Getreuer's implemenation](https://getreuer.info/posts/keyboards/autocorrection/index.html), with a number of modifications. - -To enabled Autocorrection, add `AUTOCORRECTION_ENABLE = yes` to your `rules.mk` file. - -This is mostly a reproduction of Pascal's docs: - -## Overview -Some words are more prone to typos than others. I have a habit of typo-ing *ouput* and *fitler*. This post describes a rudimentary autocorrection implementation that runs on your keyboard with QMK. - -The animation below shows the effect as I type *aparent*. As I press the final t, the autocorrection feature detects the typo and automatically sends keys to correct it: - -Example: Autocorrecting *aparent* → apparent. - -**Features**: -* It runs on your keyboard, so it is always active no matter what software. -* Low resource cost: for an autocorrection dictionary of 70 entries, firmware size cost is 1620 bytes and average CPU cost per key press is about 20 µs. -* It is case insensitive. It corrects Fitler to Filter and FITLER to FILTER. -* It works within words. It corrects fitlered, fitlering, and useful for programming, within longer identifiers like DesignButterworthFitle*r. - -**Limitations**: Running autocorrection on the keyboard comes with some constraints. It is rudimentary like I said: -* It is limited to alphabet characters a–z. No accented or Unicode letters; I’m sorry this probably isn’t useful for languages besides English. -* It does not follow mouse or hotkey driven cursor movement. - -## Taking autocorrection for a test drive -With the above flashed to your keyboard, try for instance typing the misspelled word ouput. The instant you type the final t, the word should be speedily autocorrected to output. As further tests, try becuase and invliad. - -Here is the full list of typos corrected using the provided autocorrection_data.h file. : is a special character denoting a word break. See below for how to change the autocorrection dictionary. - -``` -:guage -> gauge -:the:the: -> the -:thier -> their -:ture -> true -accomodate -> accommodate -acommodate -> accommodate -aparent -> apparent -aparrent -> apparent -apparant -> apparent -apparrent -> apparent -aquire -> acquire -becuase -> because -cauhgt -> caught -cheif -> chief -choosen -> chosen -cieling -> ceiling -collegue -> colleague -concensus -> consensus -contians -> contains -cosnt -> const -dervied -> derived -fales -> false -fasle -> false -fitler -> filter -flase -> false -foward -> forward -frequecy -> frequency -gaurantee -> guarantee -guaratee -> guarantee -heigth -> height -heirarchy -> hierarchy -inclued -> include -interator -> iterator -intput -> input -invliad -> invalid -lenght -> length -liasion -> liaison -libary -> library -listner -> listener -looses: -> loses -looup -> lookup -manefist -> manifest -namesapce -> namespace -namespcae -> namespace -occassion -> occasion -occured -> occurred -ouptut -> output -ouput -> output -overide -> override -postion -> position -priviledge -> privilege -psuedo -> pseudo -recieve -> receive -refered -> referred -relevent -> relevant -repitition -> repetition -reuslt -> result -retrun -> return -retun -> return -reutrn -> return -saftey -> safety -seperate -> separate -singed -> signed -stirng -> string -strign -> string -swithc -> switch -swtich -> switch -thresold -> threshold -udpate -> update -widht -> width -``` - -## Firmware size and CPU costs -I am anxiously aware that a keyboard microcontroller has limited resources. So I was sure to measure how much memory and CPU time autocorrection consumes during development. These measurements are for the example autocorrection dictionary as used above, which has 70 entries: -* **Firmware size**: Autocorrection increases my firmware size by a total of 1620 bytes. Breaking that down, 1104 bytes are for the autocorrection_data array and 516 bytes for the autocorrection code. -* **CPU time**: On my Elite-C microcontrollers, the average CPU time for process_autocorrection to process an alpha key press is around 20 µs. Consider this a rough order-of-magnitude cost. Processing cost increases (more trie nodes are visited) when recent input is close to a known typo, with the max being when a long typo is matched. - -The costs are not free but reasonable. For reference, the firmware size cost for mouse keys is 2124 bytes and the CPU time to process a layer switch is about 70 µs, so autocorrection is cheaper than those things. Of course, the cost scales with the size of the autocorrection dictionary, so keep that in mind if you add a lot more entries. - -## How does it work? -The function process_autocorrection maintains a small buffer of recent key presses. On each key press, it checks whether the buffer ends in a recognized typo, and if so, automatically sends keystrokes to correct it. - -The tricky part is how to efficiently check the buffer for typos. We don’t want to spend too much memory or time on storing or searching the typos. A good solution is to represent the typos with a trie data structure. A trie is a tree data structure where each node is a letter, and words are formed by following a path to one of the leaves. - - -An example trie. -Since we search whether the buffer ends in a typo, we store the trie writing in reverse. The trie is queried starting from the last letter, then second to last letter, and so on, until either a letter doesn’t match or we reach a leaf, meaning a typo was found. - -## Changing the autocorrection dictionary -The file autocorrection_data.h encodes the typos to correct. While you could simply use the version of this file provided above for a practical configuration, you can make your own to personalize the autocorrection to your most troublesome typos: - -1. First, create an autocorrection dictionary autocorrection_dict.txt, like - - ``` -:thier -> their -fitler -> filter -lenght -> length -ouput -> output -widht -> width -``` - For a practical 70-entry example, see autocorrection_dict.txt. And for a yet larger 400-entry example, see autocorrection_dict_extra.txt. - - The syntax is `typo -> correction`. Typos and corrections are case insensitive, and any whitespace before or after the typo and correction is ignored. The typo must be only the letters a–z, or the special character : representing a word break. The correction may have any characters. - -2. Use the make_autocorrection_data.py Python script to process the dictionary - -``` -$ python3 make_autocorrection_data.py -Processed 70 autocorrection entries to table with 1104 bytes. -``` -The script arranges the entries in autocorrection_dict.txt into a trie and generates autocorrection_data.h with the serialized trie embedded as an array. - -3. Finally, recompile and flash your keymap. - -The generated C header looks like this: - -autocorrection_data.h -```c -// Generated code. - -#define AUTOCORRECTION_MIN_LENGTH 5 // "cheif" -#define AUTOCORRECTION_MAX_LENGTH 10 // "accomodate" - -static const uint8_t autocorrection_data[1104] PROGMEM = {108, 43, 0, 6, - 71, 0, 7, 81, 0, 8, 199, 0, 9, 240, 1, 10, 250, 1, 11, 26, 2, 17, 53, 2, - 18, 190, 2, 19, 202, 2, 21, 212, 2, 22, 20, 3, 23, 67, 3, 28, 16, 4, 0, - 72, 50, 0, 22, 60, 0, 0, 11, 23, 44, 8, 11, 23, 44, 0, 132, 0, 8, 22, 18, - 18, 15, 0, 132, 115, 101, 115, 0, 11, 23, 12, 26, 22, 0, 129, 99, 104, 0, - 68, 94, 0, 8, 106, 0, 15, 174, 0, 21, 187, 0, 0, 12, 15, 25, 17, 12, 0, - 131, 97, 108, 105, 100, 0, 74, 119, 0, 12, 129, 0, 21, 140, 0, 24, 165, - 0, 0, 17, 12, 22, 0, 131, 103, 110, 101, 100, 0, 25, 21, 8, 7, 0, 131, - 105, 118, 101, 100, 0, 72, 147, 0, 24, 156, 0, 0, 9, 8, 21, 0, 129, 114, - 101, 100, 0, 6, 6, 18, 0, 129, 114, 101, 100, 0, 15, 6, 17, 12, 0, 129, - 100, 101, 0, 18, 22, 8, 21, 11, 23, 0, 130, 104, 111, 108, 100, 0, 4, 26, - 18, 9, 0, 131, 114, 119, 97, 114, 100, 0, 68, 233, 0, 6, 246, 0, 7, 4, 1, - 8, 16, 1, 10, 52, 1, 15, 81, 1, 21, 90, 1, 22, 117, 1, 23, 144, 1, 24, - 215, 1, 25, 228, 1, 0, 6, 19, 22, 8, 16, 4, 17, 0, 130, 97, 99, 101, 0, - 19, 4, 22, 8, 16, 4, 17, 0, 131, 112, 97, 99, 101, 0, 12, 21, 8, 25, 18, - 0, 130, 114, 105, 100, 101, 0, 23, 0, 68, 25, 1, 17, 36, 1, 0, 21, 4, 24, - 10, 0, 130, 110, 116, 101, 101, 0, 4, 21, 24, 4, 10, 0, 135, 117, 97, - 114, 97, 110, 116, 101, 101, 0, 68, 59, 1, 7, 69, 1, 0, 24, 10, 44, 0, - 131, 97, 117, 103, 101, 0, 8, 15, 12, 25, 12, 21, 19, 0, 130, 103, 101, - 0, 22, 4, 9, 0, 130, 108, 115, 101, 0, 76, 97, 1, 24, 109, 1, 0, 24, 20, - 4, 0, 132, 99, 113, 117, 105, 114, 101, 0, 23, 44, 0, 130, 114, 117, 101, - 0, 4, 0, 79, 126, 1, 24, 134, 1, 0, 9, 0, 131, 97, 108, 115, 101, 0, 6, - 8, 5, 0, 131, 97, 117, 115, 101, 0, 4, 0, 71, 156, 1, 19, 193, 1, 21, - 203, 1, 0, 18, 16, 0, 80, 166, 1, 18, 181, 1, 0, 18, 6, 4, 0, 135, 99, - 111, 109, 109, 111, 100, 97, 116, 101, 0, 6, 6, 4, 0, 132, 109, 111, 100, - 97, 116, 101, 0, 7, 24, 0, 132, 112, 100, 97, 116, 101, 0, 8, 19, 8, 22, - 0, 132, 97, 114, 97, 116, 101, 0, 10, 8, 15, 15, 18, 6, 0, 130, 97, 103, - 117, 101, 0, 8, 12, 6, 8, 21, 0, 131, 101, 105, 118, 101, 0, 12, 8, 11, - 6, 0, 130, 105, 101, 102, 0, 17, 0, 76, 3, 2, 21, 16, 2, 0, 15, 8, 12, 6, - 0, 133, 101, 105, 108, 105, 110, 103, 0, 12, 23, 22, 0, 131, 114, 105, - 110, 103, 0, 70, 33, 2, 23, 44, 2, 0, 12, 23, 26, 22, 0, 131, 105, 116, - 99, 104, 0, 10, 12, 8, 11, 0, 129, 104, 116, 0, 72, 69, 2, 10, 80, 2, 18, - 89, 2, 21, 156, 2, 24, 167, 2, 0, 22, 18, 18, 11, 6, 0, 131, 115, 101, - 110, 0, 12, 21, 23, 22, 0, 129, 110, 103, 0, 12, 0, 86, 98, 2, 23, 124, - 2, 0, 68, 105, 2, 22, 114, 2, 0, 12, 15, 0, 131, 105, 115, 111, 110, 0, - 4, 6, 6, 18, 0, 131, 105, 111, 110, 0, 76, 131, 2, 22, 146, 2, 0, 23, 12, - 19, 8, 21, 0, 134, 101, 116, 105, 116, 105, 111, 110, 0, 18, 19, 0, 131, - 105, 116, 105, 111, 110, 0, 23, 24, 8, 21, 0, 131, 116, 117, 114, 110, 0, - 85, 174, 2, 23, 183, 2, 0, 23, 8, 21, 0, 130, 117, 114, 110, 0, 8, 21, 0, - 128, 114, 110, 0, 7, 8, 24, 22, 19, 0, 131, 101, 117, 100, 111, 0, 24, - 18, 18, 15, 0, 129, 107, 117, 112, 0, 72, 219, 2, 18, 3, 3, 0, 76, 229, - 2, 15, 238, 2, 17, 248, 2, 0, 11, 23, 44, 0, 130, 101, 105, 114, 0, 23, - 12, 9, 0, 131, 108, 116, 101, 114, 0, 23, 22, 12, 15, 0, 130, 101, 110, - 101, 114, 0, 23, 4, 21, 8, 23, 17, 12, 0, 135, 116, 101, 114, 97, 116, - 111, 114, 0, 72, 30, 3, 17, 38, 3, 24, 51, 3, 0, 15, 4, 9, 0, 129, 115, - 101, 0, 4, 12, 23, 17, 18, 6, 0, 131, 97, 105, 110, 115, 0, 22, 17, 8, 6, - 17, 18, 6, 0, 133, 115, 101, 110, 115, 117, 115, 0, 74, 86, 3, 11, 96, 3, - 15, 118, 3, 17, 129, 3, 22, 218, 3, 24, 232, 3, 0, 11, 24, 4, 6, 0, 130, - 103, 104, 116, 0, 71, 103, 3, 10, 110, 3, 0, 12, 26, 0, 129, 116, 104, 0, - 17, 8, 15, 0, 129, 116, 104, 0, 22, 24, 8, 21, 0, 131, 115, 117, 108, - 116, 0, 68, 139, 3, 8, 150, 3, 22, 210, 3, 0, 21, 4, 19, 19, 4, 0, 130, - 101, 110, 116, 0, 85, 157, 3, 25, 200, 3, 0, 68, 164, 3, 21, 175, 3, 0, - 19, 4, 0, 132, 112, 97, 114, 101, 110, 116, 0, 4, 19, 0, 68, 185, 3, 19, - 193, 3, 0, 133, 112, 97, 114, 101, 110, 116, 0, 4, 0, 131, 101, 110, 116, - 0, 8, 15, 8, 21, 0, 130, 97, 110, 116, 0, 18, 6, 0, 130, 110, 115, 116, - 0, 12, 9, 8, 17, 4, 16, 0, 132, 105, 102, 101, 115, 116, 0, 83, 239, 3, - 23, 6, 4, 0, 87, 246, 3, 24, 254, 3, 0, 17, 12, 0, 131, 112, 117, 116, 0, - 18, 0, 130, 116, 112, 117, 116, 0, 19, 24, 18, 0, 131, 116, 112, 117, - 116, 0, 70, 29, 4, 8, 41, 4, 11, 51, 4, 21, 69, 4, 0, 8, 24, 20, 8, 21, - 9, 0, 129, 110, 99, 121, 0, 23, 9, 4, 22, 0, 130, 101, 116, 121, 0, 6, - 21, 4, 21, 12, 8, 11, 0, 135, 105, 101, 114, 97, 114, 99, 104, 121, 0, 4, - 5, 12, 15, 0, 130, 114, 97, 114, 121, 0}; -``` - -## Troubleshooting -### Avoiding false triggers -By default, typos are searched within words, to find typos within longer identifiers like maxFitlerOuput. While this is useful, a consequence is that autocorrection will falsely trigger when a typo happens to be a substring of a correctly-spelled word. For instance, if we had thier -> their as an entry, it would falsely trigger on (correct, though relatively uncommon) words like “wealthier” and “filthier.” - -The solution is to set a word break : before and/or after the typo to constrain matching. : matches space, period, comma, underscore, digits, and most other non-alpha characters. - -| Text | thier | :thier | thier: | :thier: | -|------|-------|--------|--------|---------| -|see thier typo|matches|matches|matches|matches| -it’s thiers |matches|matches|no|no| -wealthier words|matches|no|matches|no| - -:thier: is most restrictive, matching only when thier is a whole word. - -The make_autocorrection_data.py script makes an effort to check for entries that would false trigger as substrings of correct words. It searches each typo against a dictionary of 25K English words from the english_words Python package, provided it’s installed. - -### Overriding autocorrection -Occasionally you might actually want to type a typo (for instance, while editing autocorrection_dict.txt) without being autocorrected. Here is a way to do that: - -1. Begin typing the typo. -2. Before typing the last letter, press and release the Ctrl or Alt key. -3. Type the remaining letters. - -This works because the autocorrection implementation doesn’t understand hotkeys, so it resets itself whenever a modifier other than shift is held. - -Alternatively, the `AUTO_CTN` keycode will toggle autocorrection on and off. - -## Closing thoughts -Based on my own use, an autocorrection dictionary of a few dozen entries is enough to help in day-to-day writing. On the other hand, it is of course far from comprehensively checking that every word is spelled correctly. Keyboard microcontrollers might not have the resources check against a full English dictionary any time soon, but a lot of editors and other software have good integrated spell check features. - -I suggest to enable and use spell check in combination with autocorrection: -* Sublime: Open the View menu and enable “Spell Check.” -* Eclipse: Open the Window menu, click Preferences, and search for “Spelling.” -* Vim: Type :set spell, and misspellings will be highlighted. Use ]s to jump to the next misspelled word and z= to get suggested corrections for the word under the cursor. See the :help spell documentation. Vim also has an abbreviations feature that can autocorrect misspellings (see :help abbreviations). -* Emacs: Use M-x flyspell-mode to enable Flyspell mode in the current buffer. Or for programming, use M-x flyspell-prog-mode to check comments and strings only. See the spelling documentation. There is also an abbreviations feature that can do autocorrection. - -Some useful resources: - -* Wikipedia has a [large list of common typos](https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines). -* EmacsWiki has another [list of typos](https://www.emacswiki.org/emacs/autocorrection_abbrev_defs). -* You can find data on English word frequencies at https://www.wordfrequency.info/samples.asp. - -# Appendix: Trie binary data format -This section details how the trie is serialized to byte data in autocorrection_data. You don’t need to care about this to use this autocorrection implementation. But I document it for the record in case anyone is interested in modifying the implementation, or just curious how it works. - -What I did here is fairly arbitrary, but it is simple to decode and gets the job done. - -## Encoding -All autocorrection data is stored in a single flat array autocorrection_data. Each trie node is associated with a byte offset into this array, where data for that node is encoded, beginning with root at offset 0. There are three kinds of nodes. The highest two bits of the first byte of the node indicate what kind: - -* 00 ⇒ chain node: a trie node with a single child. -* 01 ⇒ branching node: a trie node with multiple children. -* 10 ⇒ leaf node: a leaf, corresponding to a typo and storing its correction. - -An example trie. -Branching node. Each branch is encoded with one byte for the keycode (KC_A–KC_Z) followed by a link to the child node. Links between nodes are 16-bit byte offsets relative to the beginning of the array, serialized in little endian order. - -All branches are serialized this way, one after another, and terminated with a zero byte. As described above, the node is identified as a branch by setting the two high bits of the first byte to 01, done by bitwise ORing the first keycode with 64. keycode. The root node for the above figure would be serialized like: - - +-------+-------+-------+-------+-------+-------+-------+ - | R|64 | node 2 | T | node 3 | 0 | - +-------+-------+-------+-------+-------+-------+-------+ - -Chain node. Tries tend to have long chains of single-child nodes, as seen in the example above with f-i-t-l in fitler. So to save space, we use a different format to encode chains than branching nodes. A chain is encoded as a string of keycodes, beginning with the node closest to the root, and terminated with a zero byte. The child of the last node in the chain is encoded immediately after. That child could be either a branching node or a leaf. - -In the figure above, the f-i-t-l chain is encoded as - - +-------+-------+-------+-------+-------+ - | L | T | I | F | 0 | - +-------+-------+-------+-------+-------+ -If we were to encode this chain using the same format used for branching nodes, we would encode a 16-bit node link with every node, costing 8 more bytes in this example. Across the whole trie, this adds up. Conveniently, we can point to intermediate points in the chain and interpret the bytes in the same way as before. E.g. starting at the i instead of the l, and the subchain has the same format. - -Leaf node. A leaf node corresponds to a particular typo and stores data to correct the typo. The leaf begins with a byte for the number of backspaces to type, and is followed by a null-terminated ASCII string of the replacement text. The idea is, after tapping backspace the indicated number of times, we can simply pass this string to QMK’s send_string_P function. For fitler, we need to tap backspace 3 times (not 4, because we catch the typo as the final ‘r’ is pressed) and replace it with lter. To identify the node as a leaf, the two high bits are set to 10 by ORing the backspace count with 128: - - +-------+-------+-------+-------+-------+-------+ - | 3|128 | 'l' | 't' | 'e' | 'r' | 0 | - +-------+-------+-------+-------+-------+-------+ -## Decoding -This format is by design decodable with fairly simple logic. A 16-bit variable state represents our current position in the trie, initialized with 0 to start at the root node. Then, for each keycode, test the highest two bits in the byte at state to identify the kind of node. - -* 00 ⇒ chain node: If the node’s byte matches the keycode, increment state by one to go to the next byte. If the next byte is zero, increment again to go to the following node. -* 01 ⇒ branching node: Search the branches for one that matches the keycode, and follow its node link. -* 10 ⇒ leaf node: a typo has been found! We read its first byte for the number of backspaces to type, then pass its following bytes to send_string_P to type the correction. diff --git a/users/drashna/keyrecords/process_records.c b/users/drashna/keyrecords/process_records.c index 197fd94171..89d1c80b8f 100644 --- a/users/drashna/keyrecords/process_records.c +++ b/users/drashna/keyrecords/process_records.c @@ -3,9 +3,6 @@ #include "drashna.h" #include "version.h" -#ifdef AUTOCORRECTION_ENABLE -# include "autocorrection/autocorrection.h" -#endif uint16_t copy_paste_timer; bool host_driver_disabled = false; @@ -65,9 +62,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #if defined(CUSTOM_POINTING_DEVICE) && process_record_pointing(keycode, record) #endif -#ifdef AUTOCORRECTION_ENABLE - && process_autocorrection(keycode, record) -#endif && true)) { return false; } diff --git a/users/drashna/keyrecords/process_records.h b/users/drashna/keyrecords/process_records.h index be31f992cb..cae3620fe4 100644 --- a/users/drashna/keyrecords/process_records.h +++ b/users/drashna/keyrecords/process_records.h @@ -46,9 +46,6 @@ enum userspace_custom_keycodes { KC_ZALGO, KC_SUPER, KC_ACCEL, - AUTOCORRECT_ON, - AUTOCORRECT_OFF, - AUTOCORRECT_TOGGLE, NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes }; diff --git a/users/drashna/keyrecords/tap_dance.md b/users/drashna/keyrecords/tap_dance.md index 0bf67cbd5a..fef1435918 100644 --- a/users/drashna/keyrecords/tap_dance.md +++ b/users/drashna/keyrecords/tap_dance.md @@ -88,7 +88,7 @@ void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) { diablo_timer[diablo_keys->index].keycode = diablo_keys->keycode; // if the tapdance is hit more than the number of elemints in the array, reset - if (state->count >= (sizeof(diablo_times) / sizeof(uint8_t) ) ) { + if (state->count >= ARRAY_SIZE(diablo_times) ) { diablo_timer[diablo_keys->index].key_interval = 0; reset_tap_dance(state); } else { // else set the interval (tapdance count starts at 1, array starts at 0, so offset by one) diff --git a/users/drashna/keyrecords/tap_dances.c b/users/drashna/keyrecords/tap_dances.c index 6caf6b6b3e..7bdea3cae3 100644 --- a/users/drashna/keyrecords/tap_dances.c +++ b/users/drashna/keyrecords/tap_dances.c @@ -23,7 +23,7 @@ void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) { diablo_timer[diablo_keys->index].keycode = diablo_keys->keycode; // if the tapdance is hit more than the number of elemints in the array, reset - if (state->count >= (sizeof(diablo_times) / sizeof(uint8_t))) { + if (state->count >= ARRAY_SIZE(diablo_times)) { diablo_timer[diablo_keys->index].key_interval = 0; reset_tap_dance(state); } else { // else set the interval (tapdance count starts at 1, array starts at 0, so offset by one) diff --git a/users/drashna/keyrecords/unicode.c b/users/drashna/keyrecords/unicode.c index b3fc71cb09..bfce38f555 100644 --- a/users/drashna/keyrecords/unicode.c +++ b/users/drashna/keyrecords/unicode.c @@ -43,7 +43,7 @@ typedef uint32_t (*translator_function_t)(bool is_shifted, uint32_t keycode); static inline uint32_t translator_name(bool is_shifted, uint32_t keycode) { \ static const uint32_t translation[] = {__VA_ARGS__}; \ uint32_t ret = keycode; \ - if ((keycode - KC_A) < (sizeof(translation) / sizeof(uint32_t))) { \ + if ((keycode - KC_A) < ARRAY_SIZE(translation)) { \ ret = translation[keycode - KC_A]; \ } \ return ret; \ diff --git a/users/drashna/oled/oled_stuff.c b/users/drashna/oled/oled_stuff.c index e082f8ab3e..7aee350baf 100644 --- a/users/drashna/oled/oled_stuff.c +++ b/users/drashna/oled/oled_stuff.c @@ -23,9 +23,6 @@ #ifdef AUDIO_CLICKY # include "process_clicky.h" #endif -#if defined(AUTOCORRECTION_ENABLE) -# include "keyrecords/autocorrection/autocorrection.h" -#endif #include <string.h> bool is_oled_enabled = true; @@ -87,7 +84,7 @@ void add_keylog(uint16_t keycode, keyrecord_t *record) { memmove(keylog_str, keylog_str + 1, OLED_KEYLOGGER_LENGTH - 1); - if (keycode < (sizeof(code_to_name) / sizeof(char))) { + if (keycode < ARRAY_SIZE(code_to_name)) { keylog_str[(OLED_KEYLOGGER_LENGTH - 1)] = pgm_read_byte(&code_to_name[keycode]); } @@ -458,10 +455,6 @@ void render_bootmagic_status(uint8_t col, uint8_t line) { #endif } -#if defined(CUSTOM_POINTING_DEVICE) -extern bool tap_toggling; -#endif - void render_user_status(uint8_t col, uint8_t line) { #ifdef AUDIO_ENABLE bool is_audio_on = false, l_is_clicky_on = false; @@ -490,9 +483,9 @@ void render_user_status(uint8_t col, uint8_t line) { # if !defined(OLED_DISPLAY_VERBOSE) oled_write_P(PSTR(" "), false); # endif -#elif defined(CUSTOM_POINTING_DEVICE) +#elif defined(POINTING_DEVICE_ENABLE) && defined(POINTING_DEVICE_AUTO_MOUSE_ENABLE) static const char PROGMEM mouse_lock[3] = {0xF2, 0xF3, 0}; - oled_write_P(mouse_lock, tap_toggling); + oled_write_P(mouse_lock, get_auto_mouse_toggle()); #endif #ifdef AUDIO_ENABLE static const char PROGMEM audio_status[2][3] = {{0xE0, 0xE1, 0}, {0xE2, 0xE3, 0}}; @@ -771,8 +764,8 @@ void render_unicode_mode(uint8_t col, uint8_t line) { uint32_t kitty_animation_phases(uint32_t triger_time, void *cb_arg) { static uint32_t anim_frame_duration = 500; -#ifdef CUSTOM_POINTING_DEVICE - if (tap_toggling) { +#if defined(POINTING_DEVICE_ENABLE) && defined(POINTING_DEVICE_AUTO_MOUSE_ENABLE) + if (get_auto_mouse_toggle()) { animation_frame = (animation_frame + 1) % OLED_RTOGI_FRAMES; animation_type = 3; anim_frame_duration = 300; diff --git a/users/drashna/pointing/pointing.c b/users/drashna/pointing/pointing.c index c9a7945a84..1b64502ed3 100644 --- a/users/drashna/pointing/pointing.c +++ b/users/drashna/pointing/pointing.c @@ -3,10 +3,8 @@ #include "pointing.h" -static uint16_t mouse_timer = 0; -static uint16_t mouse_debounce_timer = 0; -static uint8_t mouse_keycode_tracker = 0; -bool tap_toggling = false, enable_acceleration = false; +static uint16_t mouse_debounce_timer = 0; +bool enable_acceleration = false; #ifdef TAPPING_TERM_PER_KEY # define TAP_CHECK get_tapping_term(KC_BTN1, NULL) @@ -17,6 +15,15 @@ bool tap_toggling = false, enable_acceleration = false; # define TAP_CHECK TAPPING_TERM #endif +__attribute__((weak)) void pointing_device_init_keymap(void) {} + +void pointing_device_init_user(void) { + set_auto_mouse_layer(_MOUSE); + set_auto_mouse_enable(true); + + pointing_device_init_keymap(); +} + __attribute__((weak)) report_mouse_t pointing_device_task_keymap(report_mouse_t mouse_report) { return mouse_report; } @@ -26,28 +33,16 @@ report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { mouse_report.x = 0; mouse_report.y = 0; - if (x != 0 && y != 0) { - mouse_timer = timer_read(); + if (x != 0 && y != 0 && (timer_elapsed(mouse_debounce_timer) > TAP_CHECK)) { #ifdef OLED_ENABLE oled_timer_reset(); #endif - if (timer_elapsed(mouse_debounce_timer) > TAP_CHECK) { - if (enable_acceleration) { - x = (mouse_xy_report_t)(x > 0 ? x * x / 16 + x : -x * x / 16 + x); - y = (mouse_xy_report_t)(y > 0 ? y * y / 16 + y : -y * y / 16 + y); - } - mouse_report.x = x; - mouse_report.y = y; - if (!layer_state_is(_MOUSE)) { - layer_on(_MOUSE); - } - } - } else if (timer_elapsed(mouse_timer) > 650 && layer_state_is(_MOUSE) && !mouse_keycode_tracker && !tap_toggling) { - layer_off(_MOUSE); - } else if (tap_toggling) { - if (!layer_state_is(_MOUSE)) { - layer_on(_MOUSE); + if (enable_acceleration) { + x = (mouse_xy_report_t)(x > 0 ? x * x / 16 + x : -x * x / 16 + x); + y = (mouse_xy_report_t)(y > 0 ? y * y / 16 + y : -y * y / 16 + y); } + mouse_report.x = x; + mouse_report.y = y; } return pointing_device_task_keymap(mouse_report); @@ -55,64 +50,10 @@ report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { bool process_record_pointing(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 TG(_MOUSE): - if (record->event.pressed) { - tap_toggling ^= 1; - } - break; - case MO(_MOUSE): -#if defined(KEYBOARD_ploopy) - case DPI_CONFIG: -#elif (defined(KEYBOARD_bastardkb_charybdis) || defined(KEYBOARD_handwired_tractyl_manuform)) && !defined(NO_CHARYBDIS_KEYCODES) - case SAFE_RANGE ... (CHARYBDIS_SAFE_RANGE-1): -#endif - case KC_MS_UP ... KC_MS_WH_RIGHT: - record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--; - mouse_timer = timer_read(); - break; case KC_ACCEL: enable_acceleration = record->event.pressed; - record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--; - mouse_timer = timer_read(); - break; -#if 0 - case QK_ONE_SHOT_MOD ... QK_ONE_SHOT_MOD_MAX: break; -#endif - case QK_MOD_TAP ... QK_MOD_TAP_MAX: - if (record->event.pressed || !record->tap.count) { - break; - } default: - if (IS_NOEVENT(record->event)) break; - if ((keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) && (((keycode >> 0x8) & 0xF) == _MOUSE)) { - record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--; - mouse_timer = timer_read(); - break; - } - if (layer_state_is(_MOUSE) && !mouse_keycode_tracker && !tap_toggling) { - layer_off(_MOUSE); - } - mouse_keycode_tracker = 0; mouse_debounce_timer = timer_read(); break; } @@ -122,6 +63,32 @@ bool process_record_pointing(uint16_t keycode, keyrecord_t* record) { layer_state_t layer_state_set_pointing(layer_state_t state) { if (layer_state_cmp(state, _GAMEPAD) || layer_state_cmp(state, _DIABLO) || layer_state_cmp(state, _DIABLOII)) { state |= ((layer_state_t)1 << _MOUSE); + set_auto_mouse_enable(false); // auto mouse can be disabled any time during run time + } else { + set_auto_mouse_enable(true); } return state; } + + +#if defined(POINTING_DEVICE_AUTO_MOUSE_ENABLE) +__attribute__((weak)) bool is_mouse_record_keymap(uint16_t keycode, keyrecord_t *record) { return false; } + +bool is_mouse_record_user(uint16_t keycode, keyrecord_t* record) { + if (is_mouse_record_keymap(keycode, record)) { + return true; + } + switch (keycode) { +# if defined(KEYBOARD_ploopy) + case DPI_CONFIG: +# elif (defined(KEYBOARD_bastardkb_charybdis) || defined(KEYBOARD_handwired_tractyl_manuform)) && !defined(NO_CHARYBDIS_KEYCODES) + case SAFE_RANGE ...(CHARYBDIS_SAFE_RANGE - 1): +# elif (defined(KEYBOARD_bastardkb_dilemma) && !defined(NO_DILEMMA_KEYCODES)) + case SAFE_RANGE ...(DILEMMA_SAFE_RANGE - 1): +# endif + case KC_ACCEL: + return true; + } + return false; +} +#endif diff --git a/users/drashna/pointing/pointing.h b/users/drashna/pointing/pointing.h index 8b00ffc0ec..28d8610148 100644 --- a/users/drashna/pointing/pointing.h +++ b/users/drashna/pointing/pointing.h @@ -3,8 +3,8 @@ #include "drashna.h" +void pointing_device_init_keymap(void); report_mouse_t pointing_device_task_keymap(report_mouse_t mouse_report); void matrix_scan_pointing(void); bool process_record_pointing(uint16_t keycode, keyrecord_t* record); layer_state_t layer_state_set_pointing(layer_state_t state); -extern bool tap_toggling, enable_acceleration; diff --git a/users/drashna/post_config.h b/users/drashna/post_config.h index ec9aa49462..ed80174819 100644 --- a/users/drashna/post_config.h +++ b/users/drashna/post_config.h @@ -127,3 +127,7 @@ } \ } #endif + +#if defined(SPLIT_KEYBOARD) && defined(PROTOCOL_CHIBIOS) && !defined(USB_SUSPEND_WAKEUP_DELAY) +# define USB_SUSPEND_WAKEUP_DELAY 200 +#endif diff --git a/users/drashna/rgb/rgb_matrix_config.h b/users/drashna/rgb/rgb_matrix_config.h index 33979a198e..86f238f392 100644 --- a/users/drashna/rgb/rgb_matrix_config.h +++ b/users/drashna/rgb/rgb_matrix_config.h @@ -6,7 +6,6 @@ #define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot) // # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened) #define RGB_MATRIX_FRAMEBUFFER_EFFECTS -// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects // # define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended #undef ENABLE_RGB_MATRIX_ALPHAS_MODS diff --git a/users/drashna/rgb/rgb_matrix_stuff.c b/users/drashna/rgb/rgb_matrix_stuff.c index 2c23c29784..2867641a3e 100644 --- a/users/drashna/rgb/rgb_matrix_stuff.c +++ b/users/drashna/rgb/rgb_matrix_stuff.c @@ -20,7 +20,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode uint16_t time = scale16by8(g_rgb_timer, speed / 8); hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); RGB rgb = hsv_to_rgb(hsv); - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { if (HAS_FLAGS(g_led_config.flags[i], led_type)) { RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b); } @@ -30,7 +30,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode default: // Solid Color { RGB rgb = hsv_to_rgb(hsv); - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { if (HAS_FLAGS(g_led_config.flags[i], led_type)) { RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b); } @@ -91,9 +91,9 @@ bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record) { __attribute__((weak)) bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) { return true; } -void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { +bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { if (!rgb_matrix_indicators_advanced_keymap(led_min, led_max)) { - return; + return false; } #if defined(RGBLIGHT_ENABLE) @@ -140,11 +140,12 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { break; } } + return false; } __attribute__((weak)) bool rgb_matrix_indicators_keymap(void) { return true; } -void rgb_matrix_indicators_user(void) { - rgb_matrix_indicators_keymap(); +bool rgb_matrix_indicators_user(void) { + return rgb_matrix_indicators_keymap(); } diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index 5644aad2c4..76bb5debe1 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk @@ -9,9 +9,9 @@ ifneq ($(PLATFORM),CHIBIOS) ifneq ($(strip $(LTO_SUPPORTED)), no) LTO_ENABLE = yes endif + SPACE_CADET_ENABLE = no + GRAVE_ESC_ENABLE = no endif -SPACE_CADET_ENABLE = no -GRAVE_ESC_ENABLE = no # DEBUG_MATRIX_SCAN_RATE_ENABLE = api ifneq ($(strip $(NO_SECRETS)), yes) @@ -115,6 +115,7 @@ ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes) ifeq ($(strip $(CUSTOM_POINTING_DEVICE)), yes) SRC += $(USER_PATH)/pointing/pointing.c OPT_DEFS += -DCUSTOM_POINTING_DEVICE + OPT_DEFS += -DPOINTING_DEVICE_AUTO_MOUSE_ENABLE endif endif @@ -127,11 +128,8 @@ ifeq ($(strip $(CUSTOM_SPLIT_TRANSPORT_SYNC)), yes) endif -AUTOCORRECTION_ENABLE ?= no ifeq ($(strip $(AUTOCORRECTION_ENABLE)), yes) - SRC += $(USER_PATH)/keyrecords/autocorrection/autocorrection.c - $(shell touch $(USER_PATH)/keyrecords/autocorrection/autocorrection.c) - OPT_DEFS += -DAUTOCORRECTION_ENABLE + AUTOCORRECT_ENABLE = yes endif ifeq ($(strip $(BOOTMAGIC_ENABLE)), yes) diff --git a/users/drashna/split/transport_sync.c b/users/drashna/split/transport_sync.c index 6b5c384480..11c56849eb 100644 --- a/users/drashna/split/transport_sync.c +++ b/users/drashna/split/transport_sync.c @@ -98,8 +98,8 @@ void user_transport_update(void) { #if defined(OLED_ENABLE) && !defined(SPLIT_OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER) user_state.is_oled_enabled = is_oled_enabled; #endif -#if defined(CUSTOM_POINTING_DEVICE) - user_state.tap_toggling = tap_toggling; +#if defined(POINTING_DEVICE_ENABLE) && defined(POINTING_DEVICE_AUTO_MOUSE_ENABLE) + user_state.tap_toggling = get_auto_mouse_toggle(); #endif #ifdef UNICODE_COMMON_ENABLE user_state.unicode_mode = unicode_config.input_mode; @@ -122,8 +122,10 @@ void user_transport_update(void) { #if defined(OLED_ENABLE) && !defined(SPLIT_OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER) is_oled_enabled = user_state.is_oled_enabled; #endif -#if defined(CUSTOM_POINTING_DEVICE) - tap_toggling = user_state.tap_toggling; +#if defined(POINTING_DEVICE_ENABLE) && defined(POINTING_DEVICE_AUTO_MOUSE_ENABLE) + if (get_auto_mouse_toggle() != user_state.tap_toggling) { + auto_mouse_toggle(); + } #endif #ifdef SWAP_HANDS_ENABLE swap_hands = user_state.swap_hands; diff --git a/users/edvorakjp/edvorakjp.h b/users/edvorakjp/edvorakjp.h index a878f71ca8..9d04eb744e 100644 --- a/users/edvorakjp/edvorakjp.h +++ b/users/edvorakjp/edvorakjp.h @@ -23,8 +23,8 @@ #define __EDVORAKJP_SYMBOL_L__ KC_EXCLAIM, KC_AT, KC_HASH, KC_DOLLAR #define __EDVORAKJP_SYMBOL_R__ KC_PERCENT, KC_CIRCUMFLEX, KC_AMPERSAND, KC_ASTERISK -#define __EDVORAKJP_BRACKET_L__ KC_LEFT_CURLY_BRACE, KC_LBRACKET, KC_LEFT_PAREN -#define __EDVORAKJP_BRACKET_R__ KC_RIGHT_PAREN, KC_RBRACKET, KC_RIGHT_CURLY_BRACE +#define __EDVORAKJP_BRACKET_L__ KC_LEFT_CURLY_BRACE, KC_LBRC, KC_LEFT_PAREN +#define __EDVORAKJP_BRACKET_R__ KC_RIGHT_PAREN, KC_RBRC, KC_RIGHT_CURLY_BRACE #define __EDVORAKJP_PAGE__ KC_HOME, KC_PGDOWN, KC_PGUP, KC_END #define __EDVORAKJP_CURSOR__ KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT diff --git a/users/gary/gary.h b/users/gary/gary.h index 10f2331591..ce920cf776 100644 --- a/users/gary/gary.h +++ b/users/gary/gary.h @@ -1,7 +1,6 @@ #include QMK_KEYBOARD_H #pragma once -#define USE_SERIAL #define MASTER_LEFT // Layers diff --git a/users/gordon/gordon.h b/users/gordon/gordon.h index 49b4f0569f..567e7343ec 100644 --- a/users/gordon/gordon.h +++ b/users/gordon/gordon.h @@ -12,10 +12,10 @@ // KC codes that are too long #define DOLLAR KC_DOLLAR -#define LSQUIGLY KC_LBRACKET -#define RSQUIGLY KC_RBRACKET -#define NUMLOCK KC_NUMLOCK -#define CAPLOCK KC_CAPSLOCK +#define LSQUIGLY KC_LBRC +#define RSQUIGLY KC_RBRC +#define NUMLOCK KC_NUM_LOCK +#define CAPLOCK KC_CAPS_LOCK #define BK_SLASH KC_BSLASH #define ASTERSK KC_KP_ASTERISK diff --git a/users/gourdo1/gourdo1.c b/users/gourdo1/gourdo1.c index 26ecd8c1c0..b724a2f48d 100644 --- a/users/gourdo1/gourdo1.c +++ b/users/gourdo1/gourdo1.c @@ -593,7 +593,7 @@ bool caps_word_press_user(uint16_t keycode) { // Turn on/off NUM LOCK if current state is different void activate_numlock(bool turn_on) { if (IS_HOST_LED_ON(USB_LED_NUM_LOCK) != turn_on) { - tap_code(KC_NUMLOCK); + tap_code(KC_NUM_LOCK); } } diff --git a/users/gourdo1/gourdo1.h b/users/gourdo1/gourdo1.h index ecf6eaf25d..a198fd0805 100644 --- a/users/gourdo1/gourdo1.h +++ b/users/gourdo1/gourdo1.h @@ -17,9 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once -// DEFINE MACROS -#define ARRAYSIZE(arr) sizeof(arr) / sizeof(arr[0]) - // LAYERS -- Note: to avoid compile problems, make sure total layers matches DYNAMIC_KEYMAP_LAYER_COUNT defined in config.h (where _COLEMAK layer is defined) enum custom_user_layers { _BASE, diff --git a/users/issmirnov/rows.h b/users/issmirnov/rows.h index d35af2175c..d15693f2b2 100644 --- a/users/issmirnov/rows.h +++ b/users/issmirnov/rows.h @@ -22,7 +22,7 @@ #define _________________SYMB_L1___________________ KC_MINS , KC_AT , KC_LCBR , KC_RCBR , KC_GRV #define _________________SYMB_L2___________________ KC_CIRC , KC_UNDS , KC_LPRN , KC_RPRN , KC_DLR -#define _________________SYMB_L3___________________ KC_LABK , KC_RABK , KC_LBRACKET , KC_RBRACKET , KC_TILD +#define _________________SYMB_L3___________________ KC_LABK , KC_RABK , KC_LBRC , KC_RBRC , KC_TILD #define _________________SYMB_R1___________________ KC_ASTR , KC_EXLM , KC_PIPE , KC_PERC , KC_PLUS #define _________________SYMB_R2___________________ KC_HASH , KC_EQL , KC_COLN , KC_SCLN , TAP_TOG_LAYER diff --git a/users/jjerrell/wrappers.h b/users/jjerrell/wrappers.h index cc0f963e8d..ac150a794f 100644 --- a/users/jjerrell/wrappers.h +++ b/users/jjerrell/wrappers.h @@ -319,9 +319,9 @@ #define __________________RAISE_R3___________________ KC_AT, KC_QUOT, KC_DQUO, KC_PLUS, KC_CIRC // Adjust -#define __________________ADJUST_L1__________________ KC_MAKE, DEBUG, RESET, TERM_ON, TERM_OFF -#define __________________ADJUST_L2__________________ KC__MUTE, KC__VOLDOWN, KC__VOLUP, KC_MPLY, KC_MNXT -#define __________________ADJUST_L3__________________ KC_VRSN, AU_ON, AU_OFF, CG_SWAP, CG_NORM +#define __________________ADJUST_L1__________________ KC_MAKE, DEBUG, RESET, XXXXXXX, XXXXXXX +#define __________________ADJUST_L2__________________ KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY, KC_MNXT +#define __________________ADJUST_L3__________________ KC_VRSN, AU_ON, AU_OFF, CG_SWAP, CG_NORM #define __________________ADJUST_R1__________________ MU_MOD, MU_ON, MU_OFF, MI_ON, MI_OFF #define __________________ADJUST_R2__________________ MUV_IN, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD diff --git a/users/jonavin/jonavin.c b/users/jonavin/jonavin.c index b66b444f36..f203bd77df 100644 --- a/users/jonavin/jonavin.c +++ b/users/jonavin/jonavin.c @@ -213,7 +213,7 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { // Turn on/off NUM LOCK if current state is different void activate_numlock(bool turn_on) { if (IS_HOST_LED_ON(USB_LED_NUM_LOCK) != turn_on) { - tap_code(KC_NUMLOCK); + tap_code(KC_NUM_LOCK); } } diff --git a/users/jonavin/jonavin.h b/users/jonavin/jonavin.h index 3ebd3fe9f2..97f72c1248 100644 --- a/users/jonavin/jonavin.h +++ b/users/jonavin/jonavin.h @@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define ARRAYSIZE(arr) sizeof(arr)/sizeof(arr[0]) #endif // !ARRAYSIZE - // LAYERS enum custom_user_layers { _BASE, diff --git a/users/muppetjones/wrappers.h b/users/muppetjones/wrappers.h index 301554f5d5..ba94d0eda4 100644 --- a/users/muppetjones/wrappers.h +++ b/users/muppetjones/wrappers.h @@ -65,7 +65,7 @@ * `----------------------------------' `----------------------------------' */ // NOTE: The "BACKLIT" keycode is planck specific -#define __ADJUST_L1________________________________ RESET, DEBUG, XXXXXXX, TERM_ON, TERM_OFF +#define __ADJUST_L1________________________________ RESET, DEBUG, XXXXXXX, XXXXXXX, XXXXXXX #define __ADJUST_L2________________________________ RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, RGB_MOD #define __ADJUST_L3________________________________ XXXXXXX, RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX diff --git a/users/ninjonas/ninjonas.h b/users/ninjonas/ninjonas.h index 94b4712a63..99a31db056 100644 --- a/users/ninjonas/ninjonas.h +++ b/users/ninjonas/ninjonas.h @@ -132,8 +132,8 @@ uint16_t encoder_rotated_timer; #define _____________MOD_RIGHT____________ LT_LOW, KC_BSPC, MT_DEL, T_CPAP #define _________MEDIA_1_________ KC_BRIU, KC_MPLY, KC_MUTE -#define _________MEDIA_2_________ KC_BRID, KC_MFFD, KC__VOLUP -#define _________MEDIA_3_________ XXXXXXX, KC_MRWD, KC__VOLDOWN +#define _________MEDIA_2_________ KC_BRID, KC_MFFD, KC_VOLU +#define _________MEDIA_3_________ XXXXXXX, KC_MRWD, KC_VOLD #if defined(KEYBOARD_crkbd_rev1) || defined(KEYBOARD_kyria_rev1) #define ________MOD_LEFT_________ T_GUI, KC_LCTL, LT_RAI diff --git a/users/not-quite-neo/nqn-keys-on-quertz-de-latin1.h b/users/not-quite-neo/nqn-keys-on-quertz-de-latin1.h index 8276cf207f..81bddca4cb 100644 --- a/users/not-quite-neo/nqn-keys-on-quertz-de-latin1.h +++ b/users/not-quite-neo/nqn-keys-on-quertz-de-latin1.h @@ -23,7 +23,7 @@ Additionally, there are some common chars that we dit not yet define: // NQN key definitions in no particular order -#define N_LT KC_NONUS_BSLASH +#define N_LT KC_NONUS_BACKSLASH #define N_HS KC_NONUS_HASH #define N_DOTS RALT(KC_DOT) // … #define N_USC LSFT(KC_SLASH) // _ @@ -31,7 +31,7 @@ Additionally, there are some common chars that we dit not yet define: #define N_RSQBR RALT(KC_9) // ] #define N_CIRC KC_GRAVE // ^ #define N_EXKL LSFT(KC_1) // ! -#define N_GT LSFT(KC_NONUS_BSLASH) // > +#define N_GT LSFT(KC_NONUS_BACKSLASH) // > #define N_EQ LSFT(KC_0) // = #define N_AMP LSFT(KC_6) // & #define N_BSLS RALT(KC_MINS) // \ backslash @@ -46,7 +46,7 @@ Additionally, there are some common chars that we dit not yet define: #define N_COLN LSFT(KC_DOT) // : #define N_HASH KC_BSLASH // # #define N_DLR LSFT(KC_4) // $ -#define N_PIPE RALT(KC_NONUS_BSLASH) // | +#define N_PIPE RALT(KC_NONUS_BACKSLASH) // | #define N_TILD RALT(KC_RBRC) // ~ #define N_GRAVE LSFT(KC_EQUAL) // ` #define N_PLUS KC_RBRC // + @@ -60,7 +60,7 @@ Additionally, there are some common chars that we dit not yet define: #define N_Y KC_Z #define N_AE KC_QUOTE // ä #define N_OE KC_SCOLON // ö -#define N_UE KC_LBRACKET // ü +#define N_UE KC_LBRC // ü #define N_MU RALT(KC_M) // µ #define N_SS KC_MINS // ß #define N_DEGRE LSFT(KC_GRAVE) // ° diff --git a/users/pcoves/tapDance.c b/users/pcoves/tapDance.c index f8c9aaf466..548ed35274 100644 --- a/users/pcoves/tapDance.c +++ b/users/pcoves/tapDance.c @@ -6,7 +6,7 @@ void left(qk_tap_dance_state_t* state, void* user_data) { switch (state->count) { case 1: if (state->pressed) - tap_code16(S(KC_LBRACKET)); + tap_code16(S(KC_LEFT_BRACKET)); else tap_code16(S(KC_9)); break; @@ -14,7 +14,7 @@ void left(qk_tap_dance_state_t* state, void* user_data) { if (state->pressed) tap_code16(S(KC_COMM)); else - tap_code(KC_LBRACKET); + tap_code(KC_LEFT_BRACKET); break; default: reset_tap_dance(state); @@ -25,7 +25,7 @@ void right(qk_tap_dance_state_t* state, void* user_data) { switch (state->count) { case 1: if (state->pressed) - tap_code16(S(KC_RBRACKET)); + tap_code16(S(KC_RIGHT_BRACKET)); else tap_code16(S(KC_0)); break; @@ -33,7 +33,7 @@ void right(qk_tap_dance_state_t* state, void* user_data) { if (state->pressed) tap_code16(S(KC_DOT)); else - tap_code(KC_RBRACKET); + tap_code(KC_RIGHT_BRACKET); break; default: reset_tap_dance(state); diff --git a/users/romus/romus.h b/users/romus/romus.h index b65e32eb5b..a72b78c138 100644 --- a/users/romus/romus.h +++ b/users/romus/romus.h @@ -184,7 +184,7 @@ enum { * `------------------------------------------------------------------------' */ #define ALTCHAR \ KC_GRV, DBL_QUO,DBL_DQT,CUR_EUR,CUR_BPN,_______,_______,KC_HOME,KC_PGUP,KC_PSCREEN, KC_BSLASH, KC_SLSH, \ - REDO, DBL_ANG,DBL_PAR,DBL_SQR,DBL_BRC,KC_LALT,KC_INS, KC_END, KC_PGDN,KC_SCROLLLOCK, CUR_BIT, KC_MINUS, \ + REDO, DBL_ANG,DBL_PAR,DBL_SQR,DBL_BRC,KC_LALT,KC_INS, KC_END, KC_PGDN,KC_SCRL, CUR_BIT, KC_MINUS, \ UNDO, CUT, COPY, PASTE, EXIT, KC_LSFT,_______,_______,_______,_______, CUR_YEN, KC_EQUAL, \ _______,_______,_______,_______,_______,_______,_______,DBL_SPC,_______,_______, _______, _______ diff --git a/users/scheiklp/koy_keys_on_quertz_de_latin1.h b/users/scheiklp/koy_keys_on_quertz_de_latin1.h index e098e75dfc..0062803bd4 100644 --- a/users/scheiklp/koy_keys_on_quertz_de_latin1.h +++ b/users/scheiklp/koy_keys_on_quertz_de_latin1.h @@ -16,7 +16,7 @@ Additionally, there are some common chars that we dit not yet define: // NQN key definitions in no particular order -#define N_LT KC_NONUS_BSLASH +#define N_LT KC_NONUS_BACKSLASH #define N_HS KC_NONUS_HASH #define N_DOTS RALT(KC_DOT) // … #define N_USC LSFT(KC_SLASH) // _ @@ -24,7 +24,7 @@ Additionally, there are some common chars that we dit not yet define: #define N_RSQBR RALT(KC_9) // ] #define N_CIRC KC_GRAVE // ^ #define N_EXKL LSFT(KC_1) // ! -#define N_GT LSFT(KC_NONUS_BSLASH) // > +#define N_GT LSFT(KC_NONUS_BACKSLASH) // > #define N_EQ LSFT(KC_0) // = #define N_AMP LSFT(KC_6) // & #define N_BSLS RALT(KC_MINS) // \ backslash @@ -39,7 +39,7 @@ Additionally, there are some common chars that we dit not yet define: #define N_COLN LSFT(KC_DOT) // : #define N_HASH KC_BSLASH // # #define N_DLR LSFT(KC_4) // $ -#define N_PIPE RALT(KC_NONUS_BSLASH) // | +#define N_PIPE RALT(KC_NONUS_BACKSLASH) // | #define N_TILD RALT(KC_RBRC) // ~ #define N_GRAVE LSFT(KC_EQUAL) // ` #define N_PLUS KC_RBRC // + @@ -53,7 +53,7 @@ Additionally, there are some common chars that we dit not yet define: #define N_Y KC_Z #define N_AE KC_QUOTE // ä #define N_OE KC_SCOLON // ö -#define N_UE KC_LBRACKET // ü +#define N_UE KC_LBRC // ü #define N_MU RALT(KC_M) // µ #define N_SS KC_MINS // ß #define N_DEGRE LSFT(KC_GRAVE) // ° diff --git a/users/sigma/sigma.c b/users/sigma/sigma.c index 8470060a53..64fa68228b 100644 --- a/users/sigma/sigma.c +++ b/users/sigma/sigma.c @@ -67,7 +67,7 @@ void set_os(uint8_t os) { #if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) switch (os) { case _OS_MACOS: - set_unicode_input_mode(UC_OSX); + set_unicode_input_mode(UC_MAC); break; case _OS_LINUX: set_unicode_input_mode(UC_LNX); diff --git a/users/snowe/wrappers.h b/users/snowe/wrappers.h index 9ef7dce607..47fe4a5ace 100644 --- a/users/snowe/wrappers.h +++ b/users/snowe/wrappers.h @@ -88,5 +88,5 @@ NOTE: These are all the same length. If you do a search/replace #define _________________ADJUST_L2_________________ MU_TOG , TG(_GAMING), AU_ON, AU_OFF, AG_NORM #define _________________ADJUST_L3_________________ RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, _______ #define _________________ADJUST_R1_________________ _______, _______, _______, _______, _______ -#define _________________ADJUST_R2_________________ RESET, CG_TOGG, _______, _______, _______ +#define _________________ADJUST_R2_________________ KC_RESET,CG_TOGG, _______, _______, _______ #define _________________ADJUST_R3_________________ _______, KC_MNXT, KC_VOLU, KC_VOLD, KC_MPLY diff --git a/users/spidey3/config.h b/users/spidey3/config.h index 91bcf910ee..36d59b6a5d 100644 --- a/users/spidey3/config.h +++ b/users/spidey3/config.h @@ -42,7 +42,7 @@ #define SPI_DEBUG_SCAN_RATE #undef MANUFACTURER -#define MANUFACTURER Window of Fire +#define MANUFACTURER "Window of Fire" // Some keyboards enable BACKLIGHT_CAPS_LOCK without checking if backlight is enabled. // Undef as appropriate to avoid compiler warnings in that case. diff --git a/users/spidey3/layer_rgb.c b/users/spidey3/layer_rgb.c index c867468194..bdf4584ef1 100644 --- a/users/spidey3/layer_rgb.c +++ b/users/spidey3/layer_rgb.c @@ -97,7 +97,7 @@ const rgblight_segment_t *const PROGMEM _rgb_layers[] = { // clang-format on -const uint8_t PROGMEM _n_rgb_layers = sizeof(_rgb_layers) / sizeof(_rgb_layers[0]) - 1; +const uint8_t PROGMEM _n_rgb_layers = ARRAY_SIZE(_rgb_layers) - 1; void clear_rgb_layers() { for (uint8_t i = 0; i < _n_rgb_layers; i++) { @@ -112,8 +112,7 @@ void do_rgb_layers(layer_state_t state, uint8_t start, uint8_t end) { } } -void do_rgb_unicode(void) { - uint8_t uc_mode = get_unicode_input_mode(); +void do_rgb_unicode(uint8_t uc_mode) { for (uint8_t i = 0; i < UC__COUNT; i++) { bool is_on = i == uc_mode; rgblight_set_layer_state(UNICODE_OFFSET + i, is_on); @@ -123,7 +122,7 @@ void do_rgb_unicode(void) { void do_rgb_all(void) { do_rgb_layers(default_layer_state, LAYER_BASE_DEFAULT, LAYER_BASE_REGULAR); do_rgb_layers(layer_state, LAYER_BASE_REGULAR, LAYER_BASE_END); - do_rgb_unicode(); + do_rgb_unicode(get_unicode_input_mode()); rgblight_set_layer_state(MISC_OFFSET + 0, spi_gflock); rgblight_set_layer_state(MISC_OFFSET + 1, spi_replace_mode != SPI_NORMAL); } @@ -148,7 +147,7 @@ extern rgblight_status_t rgblight_status; # define STARTUP_ANIMATION_CYCLE_STEP 2 # define STARTUP_ANIMATION_RAMP_TO_STEPS 70 # define STARTUP_ANIMATION_STEP_TIME 10 -# define STARTUP_ANIMATION_INITIAL_DELAY 0 // milliseconds, must be < 255 * STEP_TIME +# define STARTUP_ANIMATION_INITIAL_DELAY 0 // milliseconds, must be < 255 * STEP_TIME // clang-format off typedef enum { @@ -382,6 +381,13 @@ bool led_update_user_rgb(led_t led_state) { return true; } +#if defined(UNICODE_COMMON_ENABLE) +void unicode_input_mode_set_user_rgb(uint8_t input_mode) { + rgb_layer_ack(ACK_MEH); + do_rgb_unicode(input_mode); +} +#endif + void rgb_layer_ack_yn(bool yn) { rgb_layer_ack(yn ? ACK_YES : ACK_NO); } void rgb_layer_ack(layer_ack_t n) { @@ -458,7 +464,7 @@ void post_process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { break; case RGB_TOG: - // Hack - we only get called on the press for RGB_TOG, + // Hack - we only get called on the press for RGB_TOG, // but the flag is only flipped on the release... rgb_layer_ack_yn(!rgblight_config.enable); break; @@ -476,20 +482,5 @@ void post_process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { rgb_layer_ack_yn(keymap_config.nkro); break; #endif - -#if defined(UNICODE_COMMON_ENABLE) - case UC_M_MA: - case UC_M_LN: - case UC_M_WI: - case UC_M_BS: - case UC_M_WC: - case UC_M_EM: - - case UC_MOD: - case UC_RMOD: - rgb_layer_ack(ACK_MEH); - do_rgb_unicode(); - break; -#endif } } diff --git a/users/spidey3/rules.mk b/users/spidey3/rules.mk index c95582e176..35cfdb4187 100644 --- a/users/spidey3/rules.mk +++ b/users/spidey3/rules.mk @@ -11,5 +11,5 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) SRC += layer_rgb.c endif ifeq ($(strip $(UNICODEMAP_ENABLE)), yes) - SRC += unicode.c + SRC += spidey3_unicode.c endif diff --git a/users/spidey3/spidey3.c b/users/spidey3/spidey3.c index 842bb465f7..b4c261ce1d 100644 --- a/users/spidey3/spidey3.c +++ b/users/spidey3/spidey3.c @@ -98,14 +98,14 @@ bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uin clear_oneshot_mods(); #endif - bool caps = host_keyboard_led_state().caps_lock; + bool caps = host_keyboard_led_state().caps_lock; uint32_t base = ((shifted == caps) ? baseAlphaLower : baseAlphaUpper); _register(base + (keycode - KC_A)); set_mods(temp_mod); } return false; case KC_0: - if (shifted) { // skip shifted numbers, so that we can still use symbols etc. + if (shifted) { // skip shifted numbers, so that we can still use symbols etc. return true; } if (record->event.pressed) { @@ -113,7 +113,7 @@ bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uin } return false; case KC_1 ... KC_9: - if (shifted) { // skip shifted numbers, so that we can still use symbols etc. + if (shifted) { // skip shifted numbers, so that we can still use symbols etc. return true; } if (record->event.pressed) { @@ -122,7 +122,7 @@ bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uin return false; case KC_SPACE: if (record->event.pressed) { - _register(spaceGlyph); // em space + _register(spaceGlyph); // em space } return false; } @@ -199,8 +199,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // clang-format off - case CH_CPNL: host_consumer_send(AL_CONTROL_PANEL); return false; - case CH_ASST: host_consumer_send(AL_ASSISTANT); return false; case CH_SUSP: tap_code16(LGUI(LSFT(KC_L))); return true; // clang-format on @@ -285,11 +283,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } else { switch (keycode) { - case CH_CPNL: - case CH_ASST: - host_consumer_send(0); - return false; - case SPI_KP_00: unregister_code(KC_KP_0); return false; @@ -338,7 +331,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { set_mods(mods); return false; } - } else { // on release of KC_BSPC + } else { // on release of KC_BSPC // In case KC_DEL is still being sent even after the release of KC_BSPC if (delkey_registered) { unregister_code(KC_DEL); @@ -387,3 +380,11 @@ bool led_update_user(led_t led_state) { return true; #endif } + +#if defined(UNICODE_COMMON_ENABLE) +void unicode_input_mode_set_user(uint8_t input_mode) { +# ifdef RGBLIGHT_ENABLE + unicode_input_mode_set_user_rgb(input_mode); +# endif +} +#endif diff --git a/users/spidey3/spidey3.h b/users/spidey3/spidey3.h index e91b299e55..2b2cac0a20 100644 --- a/users/spidey3/spidey3.h +++ b/users/spidey3/spidey3.h @@ -6,7 +6,7 @@ #include QMK_KEYBOARD_H #ifdef UNICODEMAP_ENABLE -# include "unicode.h" +# include "spidey3_unicode.h" #endif enum userspace_layers { @@ -17,9 +17,7 @@ enum userspace_layers { }; enum custom_keycodes { - CH_CPNL = SAFE_RANGE, // AL Control Panel - CH_ASST, // AL Context-aware Desktop Assistant - CH_SUSP, // Suspend + CH_SUSP = SAFE_RANGE, // Suspend SPI_NORMAL, SPI_WIDE, @@ -65,6 +63,11 @@ void rgb_layer_ack(layer_ack_t n); void rgb_layer_ack_yn(bool yn); void clear_rgb_layers(void); void shutdown_user_rgb(void); + +# if defined(UNICODE_COMMON_ENABLE) +void unicode_input_mode_set_user_rgb(uint8_t input_mode); +# endif + #endif #ifdef UNICODEMAP_ENABLE diff --git a/users/spidey3/unicode.c b/users/spidey3/spidey3_unicode.c index 5292b0809b..c2804d8805 100644 --- a/users/spidey3/unicode.c +++ b/users/spidey3/spidey3_unicode.c @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later -#include "unicode.h" +#include "spidey3_unicode.h" const uint32_t PROGMEM unicode_map[] = { [BUL1] = 0x2022, // • diff --git a/users/spidey3/unicode.h b/users/spidey3/spidey3_unicode.h index ee8e00056c..ee8e00056c 100644 --- a/users/spidey3/unicode.h +++ b/users/spidey3/spidey3_unicode.h diff --git a/users/tominabox1/config.h b/users/tominabox1/config.h index f853e18605..5fd8ba3a74 100644 --- a/users/tominabox1/config.h +++ b/users/tominabox1/config.h @@ -22,7 +22,7 @@ #ifdef RGB_MATRIX_ENABLE #undef RGBLED_NUM #define RGBLED_NUM 50 - #define DRIVER_LED_TOTAL RGBLED_NUM + #define RGB_MATRIX_LED_COUNT RGBLED_NUM #endif // RGBL_MATRIX_ENABLE #endif // KEYBOARD_lazydesigners_dimple diff --git a/users/tominabox1/dimple_rgb.c b/users/tominabox1/dimple_rgb.c index 49d95eb43a..299dc830f1 100644 --- a/users/tominabox1/dimple_rgb.c +++ b/users/tominabox1/dimple_rgb.c @@ -1,7 +1,7 @@ #include "dz60rgb.h" #include "config.h" #if defined (dzrgb60_iso) -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led g_is31_leds[RGB_MATRIX_LED_COUNT] = { {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, {0, K_12, J_12, L_12}, @@ -86,7 +86,7 @@ led_config_t g_led_config = { { } }; #elif defined (dzrgb60_hhkb) -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led g_is31_leds[RGB_MATRIX_LED_COUNT] = { {0, H_15, G_15, I_15}, {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, @@ -172,7 +172,7 @@ led_config_t g_led_config = { { } }; #elif defined (dzrgb60_hhkb_iso) -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led g_is31_leds[RGB_MATRIX_LED_COUNT] = { {0, H_15, G_15, I_15}, {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, @@ -258,7 +258,7 @@ led_config_t g_led_config = { { } }; #elif defined (dzrgb60_ansi) -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led g_is31_leds[RGB_MATRIX_LED_COUNT] = { {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, {0, K_12, J_12, L_12}, @@ -343,7 +343,7 @@ led_config_t g_led_config = { { } }; #else -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led g_is31_leds[RGB_MATRIX_LED_COUNT] = { {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, {0, K_12, J_12, L_12}, diff --git a/users/tominabox1/tominabox1.c b/users/tominabox1/tominabox1.c index b4ec224d07..999222fa67 100644 --- a/users/tominabox1/tominabox1.c +++ b/users/tominabox1/tominabox1.c @@ -58,7 +58,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode uint16_t time = scale16by8(g_rgb_counters.tick, speed / 8); hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); RGB rgb = hsv_to_rgb(hsv); - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { if (HAS_FLAGS(g_led_config.flags[i], led_type)) { rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } @@ -68,7 +68,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode default: // Solid Color { RGB rgb = hsv_to_rgb(hsv); - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { if (HAS_FLAGS(g_led_config.flags[i], led_type)) { rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/users/twschum/xtonhasvim.c b/users/twschum/xtonhasvim.c index a1adf39f04..15d1b0d940 100644 --- a/users/twschum/xtonhasvim.c +++ b/users/twschum/xtonhasvim.c @@ -70,7 +70,7 @@ static void comma_period(uint16_t keycode) { case VIM_COMMA: if (SHIFTED) { // indent - tap_code16(LGUI(KC_LBRACKET)); + tap_code16(LGUI(KC_LEFT_BRACKET)); } else { // toggle comment tap_code16(LGUI(KC_SLASH)); @@ -79,7 +79,7 @@ static void comma_period(uint16_t keycode) { case VIM_PERIOD: if (SHIFTED) { // outdent - tap_code16(LGUI(KC_RBRACKET)); + tap_code16(LGUI(KC_RIGHT_BRACKET)); } break; } diff --git a/users/uqs/uqs.c b/users/uqs/uqs.c index 72284143c6..7e2d09e0f6 100644 --- a/users/uqs/uqs.c +++ b/users/uqs/uqs.c @@ -78,9 +78,9 @@ const rgblight_segment_t* const PROGMEM my_rgb_layers[] = { my_rgb_segments[L_MOUSE], }; -_Static_assert(sizeof(my_rgb_layers) / sizeof(my_rgb_layers[0]) == - sizeof(my_rgb_segments) / sizeof(my_rgb_segments[0]), - "Number of rgb_segment definitions does not match up!"); +_Static_assert(ARRAY_SIZE(my_rgb_layers) == + ARRAY_SIZE(my_rgb_segments), + "Number of rgb_segment definitions does not match up!"); #endif #ifdef COMBO_ENABLE @@ -125,7 +125,7 @@ const uint16_t PROGMEM my_combos[][4] = { {KC_BTN1, KC_BTN2, KC_BTN3, COMBO_END}, }; -const uint16_t COMBO_LEN = sizeof(my_action_combos) / sizeof(my_action_combos[0]) + sizeof(my_combos) / sizeof(my_combos[0]); +const uint16_t COMBO_LEN = ARRAY_SIZE(my_action_combos) + ARRAY_SIZE(my_combos); #define MY_ACTION_COMBO(ck) \ [ck] = { .keys = &(my_action_combos[ck][0]) } @@ -162,11 +162,11 @@ combo_t key_combos[] = { MY_COMBO(14), }; -_Static_assert(sizeof(key_combos) / sizeof(key_combos[0]) == - (sizeof(my_action_combos) / sizeof(my_action_combos[0]) + sizeof(my_combos) / sizeof(my_combos[0])), - "Number of combo definitions does not match up!"); +_Static_assert(ARRAY_SIZE(key_combos) == + (ARRAY_SIZE(my_action_combos) + ARRAY_SIZE(my_combos)), + "Number of combo definitions does not match up!"); #else -combo_t key_combos[sizeof(my_action_combos) / sizeof(my_action_combos[0]) + sizeof(my_combos) / sizeof(my_combos[0])]; +combo_t key_combos[ARRAY_SIZE(my_action_combos) + ARRAY_SIZE(my_combos)]; #endif void process_combo_event(uint16_t combo_index, bool pressed) { @@ -235,10 +235,10 @@ void keyboard_post_init_user(void) { #endif #if defined(COMBO_ENABLE) && !defined(COMBO_STATICALLY) uint8_t i = 0; - for (; i < sizeof(my_action_combos) / sizeof(my_action_combos[0]); i++) { + for (; i < ARRAY_SIZE(my_action_combos); i++) { key_combos[i].keys = &(my_action_combos[i][0]); } - for (uint8_t j = 0; j < sizeof(my_combos) / sizeof(my_combos[0]); j++, i++) { + for (uint8_t j = 0; j < ARRAY_SIZE(my_combos); j++, i++) { key_combos[i].keycode = my_combos[j][0]; key_combos[i].keys = &(my_combos[j][1]); } diff --git a/users/vitoni/rgb_matrix_effects.h b/users/vitoni/rgb_matrix_effects.h index ed74500b18..c3234b159b 100644 --- a/users/vitoni/rgb_matrix_effects.h +++ b/users/vitoni/rgb_matrix_effects.h @@ -22,7 +22,7 @@ enum states { #if defined(RGB_DISABLE_WITH_FADE_OUT) ,FADE_OUT //!< before supending #endif - ,SUSPENDED //!< expecting to be suspended by RGB_DISABLE_TIMEOUT any time + ,SUSPENDED //!< expecting to be suspended by RGB_MATRIX_TIMEOUT any time }; /** @@ -99,8 +99,8 @@ bool fade_in(const uint8_t time); #endif #if defined(RGB_DISABLE_WITH_FADE_OUT) -# if !defined(RGB_DISABLE_TIMEOUT) -# warning "RGB_DISABLE_WITH_FADE_OUT expects RGB_DISABLE_TIMEOUT to be defined" +# if !defined(RGB_MATRIX_TIMEOUT) +# warning "RGB_DISABLE_WITH_FADE_OUT expects RGB_MATRIX_TIMEOUT to be defined" # endif #endif diff --git a/users/vitoni/vitoni.c b/users/vitoni/vitoni.c index 2a0ff5c46f..f8cb50ea78 100644 --- a/users/vitoni/vitoni.c +++ b/users/vitoni/vitoni.c @@ -31,17 +31,17 @@ void matrix_scan_user_rgb(void) { #endif #if defined(RGB_DISABLE_WITH_FADE_OUT) const uint32_t fade_out_duration = scale_2_rgb_time(128); - const uint32_t start_fade_out_after_millis = (RGB_DISABLE_TIMEOUT) > fade_out_duration - ? (RGB_DISABLE_TIMEOUT) - fade_out_duration + const uint32_t start_fade_out_after_millis = (RGB_MATRIX_TIMEOUT) > fade_out_duration + ? (RGB_MATRIX_TIMEOUT) - fade_out_duration : 0; if (start_fade_out_after_millis <= inactivity_millis) { update_value(&state, FADE_OUT, &calc_offset); } -#elif defined(RGB_DISABLE_TIMEOUT) +#elif defined(RGB_MATRIX_TIMEOUT) // having to set brightness "manually" to black as starting point for fade in // for the time when returning from suspended state - if (RGB_DISABLE_TIMEOUT <= inactivity_millis + 15) { + if (RGB_MATRIX_TIMEOUT <= inactivity_millis + 15) { rgb_matrix_config.hsv.v = 0; state = SUSPENDED; } diff --git a/users/xtonhasvim/xtonhasvim.c b/users/xtonhasvim/xtonhasvim.c index 5f6701830f..1bb5781c47 100644 --- a/users/xtonhasvim/xtonhasvim.c +++ b/users/xtonhasvim/xtonhasvim.c @@ -108,7 +108,7 @@ static void comma_period(uint16_t keycode) { case VIM_COMMA: if (SHIFTED) { // indent - CMD(KC_LBRACKET); + CMD(KC_LEFT_BRACKET); } else { // toggle comment CMD(KC_SLASH); @@ -117,7 +117,7 @@ static void comma_period(uint16_t keycode) { case VIM_PERIOD: if (SHIFTED) { // outdent - CMD(KC_RBRACKET); + CMD(KC_RIGHT_BRACKET); } break; } diff --git a/users/xulkal/config.h b/users/xulkal/config.h index 88e3efbe72..7f7782807e 100644 --- a/users/xulkal/config.h +++ b/users/xulkal/config.h @@ -31,5 +31,5 @@ #undef ENABLE_RGB_MATRIX_SOLID_SPLASH // 20m timeout (20m * 60s * 1000mil) -#define RGB_DISABLE_TIMEOUT 1200000 +#define RGB_MATRIX_TIMEOUT 1200000 #define OLED_SCROLL_TIMEOUT 20000 diff --git a/users/xulkal/layouts.h b/users/xulkal/layouts.h index 63e73c32e6..e30427b3cd 100644 --- a/users/xulkal/layouts.h +++ b/users/xulkal/layouts.h @@ -96,7 +96,7 @@ * ,-----------------------------------------. ,-----------------------------------------. * | | | | | | | | | | | | | | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | RESET| DEBUG| | | | | |TERM_ON|TERM_OFF| | | | + * | | RESET| DEBUG| | | | | | | | | | | * |------+------+------+------+------+------| |------+------+------+------+------+------| * | | |MusMod|Aud on|AudOff|AGnorm| |AGswap|ClkUp |ClkDwn| | | | * |------+------+------+------+------+------| |------+------+------+------+------+------| @@ -113,7 +113,7 @@ #define _________________ADJUST_L5_________________ _______, _______, _______, _______, _______, _______ #define _________________ADJUST_R1_________________ _______, _______, _______, _______, _______, _______ -#define _________________ADJUST_R2_________________ _______, TERM_ON, TERM_OFF, _______, _______, _______ +#define _________________ADJUST_R2_________________ _______, _______, _______, _______, _______, _______ #define _________________ADJUST_R3_________________ AG_SWAP, CK_UP, CK_DOWN, _______, _______, _______ #define _________________ADJUST_R4_________________ MI_OFF, CK_ON, CK_OFF, _______, _______, _______ #define _________________ADJUST_R5_________________ _______, _______, _______, _______, _______, _______ diff --git a/users/zigotica/combos.c b/users/zigotica/combos.c index 8fb5b3c9fc..a4d4f15618 100644 --- a/users/zigotica/combos.c +++ b/users/zigotica/combos.c @@ -25,7 +25,7 @@ const uint16_t PROGMEM caps_combo[] = {KC_C, KC_L, COMBO_END}; combo_t key_combos[] = { [EM_EMAIL] = COMBO_ACTION(email_combo), - [CL_CAPSL] = COMBO(caps_combo, KC_CAPSLOCK), + [CL_CAPSL] = COMBO(caps_combo, KC_CAPS), }; void process_combo_event(uint16_t combo_index, bool pressed) { |