summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/action.c149
-rw-r--r--quantum/action_code.h6
-rw-r--r--quantum/backlight/backlight_chibios.c51
-rw-r--r--quantum/backlight/backlight_driver_common.c2
-rw-r--r--quantum/backlight/backlight_software.c2
-rw-r--r--quantum/config_common.h4
-rw-r--r--quantum/dip_switch.c4
-rw-r--r--quantum/dynamic_keymap.c25
-rw-r--r--quantum/eeconfig.c13
-rw-r--r--quantum/encoder.c8
-rw-r--r--quantum/encoder.h8
-rw-r--r--quantum/joystick.c98
-rw-r--r--quantum/joystick.h28
-rw-r--r--quantum/keyboard.c24
-rw-r--r--quantum/keycode.h16
-rw-r--r--quantum/keycode_config.h1
-rw-r--r--quantum/keycode_legacy.h53
-rw-r--r--quantum/keymap.h25
-rw-r--r--quantum/keymap_common.c10
-rw-r--r--quantum/keymap_extras/keymap_colemak.h2
-rw-r--r--quantum/keymap_extras/keymap_us.h72
-rw-r--r--quantum/keymap_introspection.c22
-rw-r--r--quantum/keymap_introspection.h10
-rw-r--r--quantum/led.c48
-rw-r--r--quantum/led.h1
-rw-r--r--quantum/led_matrix/led_matrix.c54
-rw-r--r--quantum/led_matrix/led_matrix.h24
-rw-r--r--quantum/led_matrix/led_matrix_drivers.c2
-rw-r--r--quantum/led_matrix/led_matrix_types.h4
-rw-r--r--quantum/painter/qp.h4
-rw-r--r--quantum/painter/qp_draw_image.c43
-rw-r--r--quantum/painter/qp_draw_text.c49
-rw-r--r--quantum/painter/qp_stream.c47
-rw-r--r--quantum/painter/qp_stream.h5
-rw-r--r--quantum/painter/rules.mk34
-rw-r--r--quantum/pointing_device/pointing_device.c28
-rw-r--r--quantum/pointing_device/pointing_device.h11
-rw-r--r--quantum/pointing_device/pointing_device_auto_mouse.c384
-rw-r--r--quantum/pointing_device/pointing_device_auto_mouse.h87
-rw-r--r--quantum/pointing_device/pointing_device_drivers.c38
-rw-r--r--quantum/pointing_device_internal.h14
-rw-r--r--quantum/process_keycode/autocorrect_data_default.h85
-rw-r--r--quantum/process_keycode/process_auto_shift.c12
-rw-r--r--quantum/process_keycode/process_autocorrect.c292
-rw-r--r--quantum/process_keycode/process_autocorrect.h17
-rw-r--r--quantum/process_keycode/process_caps_word.c2
-rw-r--r--quantum/process_keycode/process_dynamic_macro.c22
-rw-r--r--quantum/process_keycode/process_joystick.c158
-rw-r--r--quantum/process_keycode/process_joystick.h21
-rw-r--r--quantum/process_keycode/process_key_lock.c8
-rw-r--r--quantum/process_keycode/process_key_override.c6
-rw-r--r--quantum/process_keycode/process_leader.c4
-rw-r--r--quantum/process_keycode/process_magic.c4
-rw-r--r--quantum/process_keycode/process_programmable_button.c8
-rw-r--r--quantum/process_keycode/process_secure.c8
-rw-r--r--quantum/process_keycode/process_tap_dance.c12
-rw-r--r--quantum/process_keycode/process_tap_dance.h2
-rw-r--r--quantum/process_keycode/process_ucis.c17
-rw-r--r--quantum/process_keycode/process_ucis.h6
-rw-r--r--quantum/process_keycode/process_unicode.c12
-rw-r--r--quantum/process_keycode/process_unicode.h5
-rw-r--r--quantum/process_keycode/process_unicode_common.c298
-rw-r--r--quantum/process_keycode/process_unicode_common.h184
-rw-r--r--quantum/process_keycode/process_unicodemap.c5
-rw-r--r--quantum/process_keycode/process_unicodemap.h6
-rw-r--r--quantum/programmable_button.c27
-rw-r--r--quantum/programmable_button.h75
-rw-r--r--quantum/quantum.c30
-rw-r--r--quantum/quantum.h5
-rw-r--r--quantum/quantum_keycodes.h366
-rw-r--r--quantum/quantum_keycodes_legacy.h92
-rw-r--r--quantum/rgb_matrix/animations/jellybean_raindrops_anim.h2
-rw-r--r--quantum/rgb_matrix/animations/pixel_flow_anim.h4
-rw-r--r--quantum/rgb_matrix/animations/pixel_rain_anim.h2
-rw-r--r--quantum/rgb_matrix/animations/raindrops_anim.h2
-rw-r--r--quantum/rgb_matrix/rgb_matrix.c56
-rw-r--r--quantum/rgb_matrix/rgb_matrix.h26
-rw-r--r--quantum/rgb_matrix/rgb_matrix_drivers.c26
-rw-r--r--quantum/rgb_matrix/rgb_matrix_types.h4
-rw-r--r--quantum/rgblight/rgblight.c22
-rw-r--r--quantum/secure.c3
-rw-r--r--quantum/send_string/send_string_keycodes.h568
-rw-r--r--quantum/sequencer/tests/rules.mk2
-rw-r--r--quantum/split_common/split_util.c57
-rw-r--r--quantum/split_common/split_util.h4
-rw-r--r--quantum/split_common/transaction_id_define.h4
-rw-r--r--quantum/split_common/transactions.c152
-rw-r--r--quantum/split_common/transport.h4
-rw-r--r--quantum/unicode/unicode.c386
-rw-r--r--quantum/unicode/unicode.h165
-rw-r--r--quantum/unicode/utf8.c (renamed from quantum/utf8.c)0
-rw-r--r--quantum/unicode/utf8.h (renamed from quantum/utf8.h)2
-rw-r--r--quantum/util.h52
-rw-r--r--quantum/via_ensure_keycode.h2
94 files changed, 3196 insertions, 1648 deletions
diff --git a/quantum/action.c b/quantum/action.c
index 6b2e9104e0..abf9834d2f 100644
--- a/quantum/action.c
+++ b/quantum/action.c
@@ -293,19 +293,56 @@ void process_record_handler(keyrecord_t *record) {
process_action(record, action);
}
-#if defined(PS2_MOUSE_ENABLE) || defined(POINTING_DEVICE_ENABLE)
-void register_button(bool pressed, enum mouse_buttons button) {
-# ifdef PS2_MOUSE_ENABLE
- tp_buttons = pressed ? tp_buttons | button : tp_buttons & ~button;
-# endif
-# ifdef POINTING_DEVICE_ENABLE
- report_mouse_t currentReport = pointing_device_get_report();
- currentReport.buttons = pressed ? currentReport.buttons | button : currentReport.buttons & ~button;
- pointing_device_set_report(currentReport);
+/**
+ * @brief handles all the messy mouse stuff
+ *
+ * Handles all the edgecases and special stuff that is needed for coexistense
+ * of the multiple mouse subsystems.
+ *
+ * @param mouse_keycode[in] uint8_t mouse keycode
+ * @param pressed[in] bool
+ */
+
+void register_mouse(uint8_t mouse_keycode, bool pressed) {
+#ifdef MOUSEKEY_ENABLE
+ // if mousekeys is enabled, let it do the brunt of the work
+ if (pressed) {
+ mousekey_on(mouse_keycode);
+ } else {
+ mousekey_off(mouse_keycode);
+ }
+ // should mousekeys send report, or does something else handle this?
+ switch (mouse_keycode) {
+# if defined(PS2_MOUSE_ENABLE) || defined(POINTING_DEVICE_ENABLE)
+ case KC_MS_BTN1 ... KC_MS_BTN8:
+ // let pointing device handle the buttons
+ // expand if/when it handles more of the code
+# if defined(POINTING_DEVICE_ENABLE)
+ pointing_device_keycode_handler(mouse_keycode, pressed);
+# endif
+ break;
# endif
-}
+ default:
+ mousekey_send();
+ break;
+ }
+#elif defined(POINTING_DEVICE_ENABLE)
+ // if mousekeys isn't enabled, and pointing device is enabled, then
+ // let pointing device do all the heavy lifting, then
+ if IS_MOUSEKEY (mouse_keycode) {
+ pointing_device_keycode_handler(mouse_keycode, pressed);
+ }
#endif
+#ifdef PS2_MOUSE_ENABLE
+ // make sure that ps2 mouse has button report synced
+ if (KC_MS_BTN1 <= mouse_keycode && mouse_keycode <= KC_MS_BTN3) {
+ uint8_t tmp_button_msk = MOUSE_BTN_MASK(mouse_keycode - KC_MS_BTN1);
+ tp_buttons = pressed ? tp_buttons | tmp_button_msk : tp_buttons & ~tmp_button_msk;
+ }
+#endif
+}
+
/** \brief Take an action and processes it.
*
* FIXME: Needs documentation.
@@ -403,9 +440,9 @@ void process_action(keyrecord_t *record, action_t action) {
# if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1
} else if (tap_count == ONESHOT_TAP_TOGGLE) {
dprint("MODS_TAP: Toggling oneshot");
+ register_mods(mods);
clear_oneshot_mods();
set_oneshot_locked_mods(mods | get_oneshot_locked_mods());
- register_mods(mods);
# endif
} else {
register_mods(mods | get_oneshot_mods());
@@ -418,16 +455,16 @@ void process_action(keyrecord_t *record, action_t action) {
// Retain Oneshot mods
# if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1
if (mods & get_mods()) {
+ unregister_mods(mods);
clear_oneshot_mods();
set_oneshot_locked_mods(~mods & get_oneshot_locked_mods());
- unregister_mods(mods);
}
} else if (tap_count == ONESHOT_TAP_TOGGLE) {
// Toggle Oneshot Layer
# endif
} else {
- clear_oneshot_mods();
unregister_mods(mods);
+ clear_oneshot_mods();
}
}
}
@@ -490,46 +527,18 @@ void process_action(keyrecord_t *record, action_t action) {
case ACT_USAGE:
switch (action.usage.page) {
case PAGE_SYSTEM:
- if (event.pressed) {
- host_system_send(action.usage.code);
- } else {
- host_system_send(0);
- }
+ host_system_send(event.pressed ? action.usage.code : 0);
break;
case PAGE_CONSUMER:
- if (event.pressed) {
- host_consumer_send(action.usage.code);
- } else {
- host_consumer_send(0);
- }
+ host_consumer_send(event.pressed ? action.usage.code : 0);
break;
}
break;
#endif
-#ifdef MOUSEKEY_ENABLE
/* Mouse key */
case ACT_MOUSEKEY:
- if (event.pressed) {
- mousekey_on(action.key.code);
- } else {
- mousekey_off(action.key.code);
- }
- switch (action.key.code) {
-# if defined(PS2_MOUSE_ENABLE) || defined(POINTING_DEVICE_ENABLE)
-# ifdef POINTING_DEVICE_ENABLE
- case KC_MS_BTN1 ... KC_MS_BTN8:
-# else
- case KC_MS_BTN1 ... KC_MS_BTN3:
-# endif
- register_button(event.pressed, MOUSE_BTN_MASK(action.key.code - KC_MS_BTN1));
- break;
-# endif
- default:
- mousekey_send();
- break;
- }
+ register_mouse(action.key.code, event.pressed);
break;
-#endif
#ifndef NO_ACTION_LAYER
case ACT_LAYER:
if (action.layer_bitop.on == 0) {
@@ -835,9 +844,9 @@ void process_action(keyrecord_t *record, action_t action) {
__attribute__((weak)) void register_code(uint8_t code) {
if (code == KC_NO) {
return;
- }
+
#ifdef LOCKING_SUPPORT_ENABLE
- else if (KC_LOCKING_CAPS_LOCK == code) {
+ } else if (KC_LOCKING_CAPS_LOCK == code) {
# ifdef LOCKING_RESYNC_ENABLE
// Resync: ignore if caps lock already is on
if (host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK)) return;
@@ -847,9 +856,8 @@ __attribute__((weak)) void register_code(uint8_t code) {
wait_ms(TAP_HOLD_CAPS_DELAY);
del_key(KC_CAPS_LOCK);
send_keyboard_report();
- }
- else if (KC_LOCKING_NUM_LOCK == code) {
+ } else if (KC_LOCKING_NUM_LOCK == code) {
# ifdef LOCKING_RESYNC_ENABLE
if (host_keyboard_leds() & (1 << USB_LED_NUM_LOCK)) return;
# endif
@@ -858,9 +866,8 @@ __attribute__((weak)) void register_code(uint8_t code) {
wait_ms(100);
del_key(KC_NUM_LOCK);
send_keyboard_report();
- }
- else if (KC_LOCKING_SCROLL_LOCK == code) {
+ } else if (KC_LOCKING_SCROLL_LOCK == code) {
# ifdef LOCKING_RESYNC_ENABLE
if (host_keyboard_leds() & (1 << USB_LED_SCROLL_LOCK)) return;
# endif
@@ -869,10 +876,9 @@ __attribute__((weak)) void register_code(uint8_t code) {
wait_ms(100);
del_key(KC_SCROLL_LOCK);
send_keyboard_report();
- }
#endif
- else if IS_KEY (code) {
+ } else if IS_KEY (code) {
// TODO: should push command_proc out of this block?
if (command_proc(code)) return;
@@ -905,20 +911,17 @@ __attribute__((weak)) void register_code(uint8_t code) {
} else if IS_MOD (code) {
add_mods(MOD_BIT(code));
send_keyboard_report();
- }
+
#ifdef EXTRAKEY_ENABLE
- else if IS_SYSTEM (code) {
+ } else if IS_SYSTEM (code) {
host_system_send(KEYCODE2SYSTEM(code));
} else if IS_CONSUMER (code) {
host_consumer_send(KEYCODE2CONSUMER(code));
- }
#endif
-#ifdef MOUSEKEY_ENABLE
- else if IS_MOUSEKEY (code) {
- mousekey_on(code);
- mousekey_send();
+
+ } else if IS_MOUSEKEY (code) {
+ register_mouse(code, true);
}
-#endif
}
/** \brief Utilities for actions. (FIXME: Needs better description)
@@ -928,9 +931,9 @@ __attribute__((weak)) void register_code(uint8_t code) {
__attribute__((weak)) void unregister_code(uint8_t code) {
if (code == KC_NO) {
return;
- }
+
#ifdef LOCKING_SUPPORT_ENABLE
- else if (KC_LOCKING_CAPS_LOCK == code) {
+ } else if (KC_LOCKING_CAPS_LOCK == code) {
# ifdef LOCKING_RESYNC_ENABLE
// Resync: ignore if caps lock already is off
if (!(host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK))) return;
@@ -939,9 +942,8 @@ __attribute__((weak)) void unregister_code(uint8_t code) {
send_keyboard_report();
del_key(KC_CAPS_LOCK);
send_keyboard_report();
- }
- else if (KC_LOCKING_NUM_LOCK == code) {
+ } else if (KC_LOCKING_NUM_LOCK == code) {
# ifdef LOCKING_RESYNC_ENABLE
if (!(host_keyboard_leds() & (1 << USB_LED_NUM_LOCK))) return;
# endif
@@ -949,9 +951,8 @@ __attribute__((weak)) void unregister_code(uint8_t code) {
send_keyboard_report();
del_key(KC_NUM_LOCK);
send_keyboard_report();
- }
- else if (KC_LOCKING_SCROLL_LOCK == code) {
+ } else if (KC_LOCKING_SCROLL_LOCK == code) {
# ifdef LOCKING_RESYNC_ENABLE
if (!(host_keyboard_leds() & (1 << USB_LED_SCROLL_LOCK))) ret