diff options
Diffstat (limited to 'common')
| -rw-r--r-- | common/action.c | 30 | ||||
| -rw-r--r-- | common/keyboard.c | 1 | ||||
| -rw-r--r-- | common/keycode.h | 1 |
3 files changed, 31 insertions, 1 deletions
diff --git a/common/action.c b/common/action.c index 15e125a3e..4fafbfa79 100644 --- a/common/action.c +++ b/common/action.c | |||
| @@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 23 | #include "command.h" | 23 | #include "command.h" |
| 24 | #include "util.h" | 24 | #include "util.h" |
| 25 | #include "debug.h" | 25 | #include "debug.h" |
| 26 | #include "led.h" | ||
| 26 | #include "layer_switch.h" | 27 | #include "layer_switch.h" |
| 27 | #include "action_macro.h" | 28 | #include "action_macro.h" |
| 28 | #include "action.h" | 29 | #include "action.h" |
| @@ -889,6 +890,18 @@ void register_code(uint8_t code) | |||
| 889 | if (code == KC_NO) { | 890 | if (code == KC_NO) { |
| 890 | return; | 891 | return; |
| 891 | } | 892 | } |
| 893 | #ifdef CAPSLOCK_LOCKING_ENABLE | ||
| 894 | else if (KC_LOCKING_CAPS == code) { | ||
| 895 | #ifdef CAPSLOCK_LOCKING_RESYNC_ENABLE | ||
| 896 | // Resync: ignore if caps lock already is on | ||
| 897 | if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) return; | ||
| 898 | #endif | ||
| 899 | host_add_key(KC_CAPSLOCK); | ||
| 900 | host_send_keyboard_report(); | ||
| 901 | host_del_key(KC_CAPSLOCK); | ||
| 902 | host_send_keyboard_report(); | ||
| 903 | } | ||
| 904 | #endif | ||
| 892 | else if IS_KEY(code) { | 905 | else if IS_KEY(code) { |
| 893 | // TODO: should push command_proc out of this block? | 906 | // TODO: should push command_proc out of this block? |
| 894 | if (command_proc(code)) return; | 907 | if (command_proc(code)) return; |
| @@ -914,7 +927,22 @@ void register_code(uint8_t code) | |||
| 914 | 927 | ||
| 915 | void unregister_code(uint8_t code) | 928 | void unregister_code(uint8_t code) |
| 916 | { | 929 | { |
| 917 | if IS_KEY(code) { | 930 | if (code == KC_NO) { |
| 931 | return; | ||
| 932 | } | ||
| 933 | #ifdef CAPSLOCK_LOCKING_ENABLE | ||
| 934 | else if (KC_LOCKING_CAPS == code) { | ||
| 935 | #ifdef CAPSLOCK_LOCKING_RESYNC_ENABLE | ||
| 936 | // Resync: ignore if caps lock already is off | ||
| 937 | if (!(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) return; | ||
| 938 | #endif | ||
| 939 | host_add_key(KC_CAPSLOCK); | ||
| 940 | host_send_keyboard_report(); | ||
| 941 | host_del_key(KC_CAPSLOCK); | ||
| 942 | host_send_keyboard_report(); | ||
| 943 | } | ||
| 944 | #endif | ||
| 945 | else if IS_KEY(code) { | ||
| 918 | host_del_key(code); | 946 | host_del_key(code); |
| 919 | host_send_keyboard_report(); | 947 | host_send_keyboard_report(); |
| 920 | } | 948 | } |
diff --git a/common/keyboard.c b/common/keyboard.c index 401fdb4e1..42c57ac96 100644 --- a/common/keyboard.c +++ b/common/keyboard.c | |||
| @@ -134,5 +134,6 @@ MATRIX_LOOP_END: | |||
| 134 | 134 | ||
| 135 | void keyboard_set_leds(uint8_t leds) | 135 | void keyboard_set_leds(uint8_t leds) |
| 136 | { | 136 | { |
| 137 | if (debug_keyboard) { debug("keyboard_set_led: "); debug_hex8(leds); debug("\n"); } | ||
| 137 | led_set(leds); | 138 | led_set(leds); |
| 138 | } | 139 | } |
diff --git a/common/keycode.h b/common/keycode.h index 364679994..aea630846 100644 --- a/common/keycode.h +++ b/common/keycode.h | |||
| @@ -81,6 +81,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 81 | #define KC_APP KC_APPLICATION | 81 | #define KC_APP KC_APPLICATION |
| 82 | #define KC_NUHS KC_NONUS_HASH | 82 | #define KC_NUHS KC_NONUS_HASH |
| 83 | #define KC_NUBS KC_NONUS_BSLASH | 83 | #define KC_NUBS KC_NONUS_BSLASH |
| 84 | #define KC_LCAP KC_LOCKING_CAPS | ||
| 84 | #define KC_ERAS KC_ALT_ERASE, | 85 | #define KC_ERAS KC_ALT_ERASE, |
| 85 | #define KC_CLR KC_CLEAR | 86 | #define KC_CLR KC_CLEAR |
| 86 | /* Japanese specific */ | 87 | /* Japanese specific */ |
