diff options
author | James Young <18669334+noroadsleft@users.noreply.github.com> | 2021-05-29 13:53:10 -0700 |
---|---|---|
committer | James Young <18669334+noroadsleft@users.noreply.github.com> | 2021-05-29 13:53:10 -0700 |
commit | 7d1194de01ea94f065bd5176607b4d66279ef51b (patch) | |
tree | 337ab0498a929285a234518fee34a4d9dcf51656 /tmk_core/common | |
parent | e628051505cca7674c37b417ba91af1c69dbbd86 (diff) | |
download | qmk_firmware-7d1194de01ea94f065bd5176607b4d66279ef51b.tar.gz qmk_firmware-7d1194de01ea94f065bd5176607b4d66279ef51b.zip |
run: qmk cformat --core-only
Diffstat (limited to 'tmk_core/common')
-rw-r--r-- | tmk_core/common/action.c | 83 | ||||
-rw-r--r-- | tmk_core/common/action.h | 2 | ||||
-rw-r--r-- | tmk_core/common/chibios/sleep_led.c | 4 | ||||
-rw-r--r-- | tmk_core/common/keyboard.h | 6 |
4 files changed, 44 insertions, 51 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index f41665b06..bd41d28b6 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c | |||
@@ -773,10 +773,9 @@ void register_code(uint8_t code) { | |||
773 | } | 773 | } |
774 | #endif | 774 | #endif |
775 | 775 | ||
776 | else if | 776 | else if IS_KEY (code) { |
777 | IS_KEY(code) { | 777 | // TODO: should push command_proc out of this block? |
778 | // TODO: should push command_proc out of this block? | 778 | if (command_proc(code)) return; |
779 | if (command_proc(code)) return; | ||
780 | 779 | ||
781 | #ifndef NO_ACTION_ONESHOT | 780 | #ifndef NO_ACTION_ONESHOT |
782 | /* TODO: remove | 781 | /* TODO: remove |
@@ -793,35 +792,33 @@ void register_code(uint8_t code) { | |||
793 | } else | 792 | } else |
794 | */ | 793 | */ |
795 | #endif | 794 | #endif |
796 | { | 795 | { |
797 | // Force a new key press if the key is already pressed | 796 | // Force a new key press if the key is already pressed |
798 | // without this, keys with the same keycode, but different | 797 | // without this, keys with the same keycode, but different |
799 | // modifiers will be reported incorrectly, see issue #1708 | 798 | // modifiers will be reported incorrectly, see issue #1708 |
800 | if (is_key_pressed(keyboard_report, code)) { | 799 | if (is_key_pressed(keyboard_report, code)) { |
801 | del_key(code); | 800 | del_key(code); |
802 | send_keyboard_report(); | ||
803 | } | ||
804 | add_key(code); | ||
805 | send_keyboard_report(); | 801 | send_keyboard_report(); |
806 | } | 802 | } |
807 | } | 803 | add_key(code); |
808 | else if | ||
809 | IS_MOD(code) { | ||
810 | add_mods(MOD_BIT(code)); | ||
811 | send_keyboard_report(); | 804 | send_keyboard_report(); |
812 | } | 805 | } |
806 | } else if IS_MOD (code) { | ||
807 | add_mods(MOD_BIT(code)); | ||
808 | send_keyboard_report(); | ||
809 | } | ||
813 | #ifdef EXTRAKEY_ENABLE | 810 | #ifdef EXTRAKEY_ENABLE |
814 | else if | 811 | else if IS_SYSTEM (code) { |
815 | IS_SYSTEM(code) { host_system_send(KEYCODE2SYSTEM(code)); } | 812 | host_system_send(KEYCODE2SYSTEM(code)); |
816 | else if | 813 | } else if IS_CONSUMER (code) { |
817 | IS_CONSUMER(code) { host_consumer_send(KEYCODE2CONSUMER(code)); } | 814 | host_consumer_send(KEYCODE2CONSUMER(code)); |
815 | } | ||
818 | #endif | 816 | #endif |
819 | #ifdef MOUSEKEY_ENABLE | 817 | #ifdef MOUSEKEY_ENABLE |
820 | else if | 818 | else if IS_MOUSEKEY (code) { |
821 | IS_MOUSEKEY(code) { | 819 | mousekey_on(code); |
822 | mousekey_on(code); | 820 | mousekey_send(); |
823 | mousekey_send(); | 821 | } |
824 | } | ||
825 | #endif | 822 | #endif |
826 | } | 823 | } |
827 | 824 | ||
@@ -866,26 +863,22 @@ void unregister_code(uint8_t code) { | |||
866 | } | 863 | } |
867 | #endif | 864 | #endif |
868 | 865 | ||
869 | else if | 866 | else if IS_KEY (code) { |
870 | IS_KEY(code) { | 867 | del_key(code); |
871 | del_key(code); | 868 | send_keyboard_report(); |
872 | send_keyboard_report(); | 869 | } else if IS_MOD (code) { |
873 | } | 870 | del_mods(MOD_BIT(code)); |
874 | else if | 871 | send_keyboard_report(); |
875 | IS_MOD(code) { | 872 | } else if IS_SYSTEM (code) { |
876 | del_mods(MOD_BIT(code)); | 873 | host_system_send(0); |
877 | send_keyboard_report(); | 874 | } else if IS_CONSUMER (code) { |
878 | } | 875 | host_consumer_send(0); |
879 | else if | 876 | } |
880 | IS_SYSTEM(code) { host_system_send(0); } | ||
881 | else if | ||
882 | IS_CONSUMER(code) { host_consumer_send(0); } | ||
883 | #ifdef MOUSEKEY_ENABLE | 877 | #ifdef MOUSEKEY_ENABLE |
884 | else if | 878 | else if IS_MOUSEKEY (code) { |
885 | IS_MOUSEKEY(code) { | 879 | mousekey_off(code); |
886 | mousekey_off(code); | 880 | mousekey_send(); |
887 | mousekey_send(); | 881 | } |
888 | } | ||
889 | #endif | 882 | #endif |
890 | } | 883 | } |
891 | 884 | ||
diff --git a/tmk_core/common/action.h b/tmk_core/common/action.h index 6c8456178..8cb4722c6 100644 --- a/tmk_core/common/action.h +++ b/tmk_core/common/action.h | |||
@@ -77,7 +77,7 @@ extern bool disable_action_cache; | |||
77 | 77 | ||
78 | /* Code for handling one-handed key modifiers. */ | 78 | /* Code for handling one-handed key modifiers. */ |
79 | #ifdef SWAP_HANDS_ENABLE | 79 | #ifdef SWAP_HANDS_ENABLE |
80 | extern bool swap_hands; | 80 | extern bool swap_hands; |
81 | extern const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS]; | 81 | extern const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS]; |
82 | # if (MATRIX_COLS <= 8) | 82 | # if (MATRIX_COLS <= 8) |
83 | typedef uint8_t swap_state_row_t; | 83 | typedef uint8_t swap_state_row_t; |
diff --git a/tmk_core/common/chibios/sleep_led.c b/tmk_core/common/chibios/sleep_led.c index 477056a45..1c65016a4 100644 --- a/tmk_core/common/chibios/sleep_led.c +++ b/tmk_core/common/chibios/sleep_led.c | |||
@@ -65,7 +65,7 @@ void sleep_led_timer_callback(void) { | |||
65 | 65 | ||
66 | /* LPTMR clock options */ | 66 | /* LPTMR clock options */ |
67 | # define LPTMR_CLOCK_MCGIRCLK 0 /* 4MHz clock */ | 67 | # define LPTMR_CLOCK_MCGIRCLK 0 /* 4MHz clock */ |
68 | # define LPTMR_CLOCK_LPO 1 /* 1kHz clock */ | 68 | # define LPTMR_CLOCK_LPO 1 /* 1kHz clock */ |
69 | # define LPTMR_CLOCK_ERCLK32K 2 /* external 32kHz crystal */ | 69 | # define LPTMR_CLOCK_ERCLK32K 2 /* external 32kHz crystal */ |
70 | # define LPTMR_CLOCK_OSCERCLK 3 /* output from OSC */ | 70 | # define LPTMR_CLOCK_OSCERCLK 3 /* output from OSC */ |
71 | 71 | ||
@@ -121,7 +121,7 @@ void sleep_led_init(void) { | |||
121 | MCG->C2 |= MCG_C2_IRCS; // fast (4MHz) internal ref clock | 121 | MCG->C2 |= MCG_C2_IRCS; // fast (4MHz) internal ref clock |
122 | # if defined(KL27) // divide the 8MHz IRC by 2, to have the same MCGIRCLK speed as others | 122 | # if defined(KL27) // divide the 8MHz IRC by 2, to have the same MCGIRCLK speed as others |
123 | MCG->MC |= MCG_MC_LIRC_DIV2_DIV2; | 123 | MCG->MC |= MCG_MC_LIRC_DIV2_DIV2; |
124 | # endif /* KL27 */ | 124 | # endif /* KL27 */ |
125 | MCG->C1 |= MCG_C1_IRCLKEN; // enable internal ref clock | 125 | MCG->C1 |= MCG_C1_IRCLKEN; // enable internal ref clock |
126 | // to work in stop mode, also MCG_C1_IREFSTEN | 126 | // to work in stop mode, also MCG_C1_IREFSTEN |
127 | // Divide 4MHz by 2^N (N=6) => 62500 irqs/sec => | 127 | // Divide 4MHz by 2^N (N=6) => 62500 irqs/sec => |
diff --git a/tmk_core/common/keyboard.h b/tmk_core/common/keyboard.h index 779973f1d..08f4e84f9 100644 --- a/tmk_core/common/keyboard.h +++ b/tmk_core/common/keyboard.h | |||
@@ -70,9 +70,9 @@ void keyboard_pre_init_user(void); | |||
70 | void keyboard_post_init_kb(void); | 70 | void keyboard_post_init_kb(void); |
71 | void keyboard_post_init_user(void); | 71 | void keyboard_post_init_user(void); |
72 | 72 | ||
73 | void housekeeping_task(void); // To be executed by the main loop in each backend TMK protocol | 73 | void housekeeping_task(void); // To be executed by the main loop in each backend TMK protocol |
74 | void housekeeping_task_kb(void); // To be overridden by keyboard-level code | 74 | void housekeeping_task_kb(void); // To be overridden by keyboard-level code |
75 | void housekeeping_task_user(void); // To be overridden by user/keymap-level code | 75 | void housekeeping_task_user(void); // To be overridden by user/keymap-level code |
76 | 76 | ||
77 | uint32_t last_input_activity_time(void); // Timestamp of the last matrix or encoder activity | 77 | uint32_t last_input_activity_time(void); // Timestamp of the last matrix or encoder activity |
78 | uint32_t last_input_activity_elapsed(void); // Number of milliseconds since the last matrix or encoder activity | 78 | uint32_t last_input_activity_elapsed(void); // Number of milliseconds since the last matrix or encoder activity |