From 0cb80001b408e884995c36fe117ed0fc4bf4eb7d Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 23 Jul 2013 10:56:03 +0900 Subject: [PATCH] Add mechanical locking switch support for NumLock and ScrollLock --- README.md | 10 +++++----- common/action.c | 52 ++++++++++++++++++++++++++++++++++++++++++++---- common/keycode.h | 7 +++++-- 3 files changed, 58 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index aae350d0..8864795c 100644 --- a/README.md +++ b/README.md @@ -164,12 +164,12 @@ TODO: Magic key combination to avoid unintentional press during plug in **TBD** -Mechanical Locking support for CapsLock ---------------------------------------- -To enable this feature define these two macros in `config.h` and use `KC_LCAP` for locking CapsLock in keymap instead of normal `KC_CAPS`. Resync option tries to keep lock switch state consistent with keyboard LED state. +Mechanical Locking support +-------------------------- +This feature makes it possible for you to use mechanical switch for `CapsLock`, `NumLock` or `ScrollLock`. To enable this feature define these macros in `config.h` and use `KC_LCAP`, `KC_LNUM` or `KC_LSCR` in keymap for locking key instead of normal `KC_CAPS`, `KC_NLCK` or `KC_SLCK`. Resync option tries to keep lock switch state consistent with keyboard LED state. - #define CAPSLOCK_LOCKING_ENABLE - #define CAPSLOCK_LOCKING_RESYNC_ENABLE + #define LOCKING_SUPPORT_ENABLE + #define LOCKING_RESYNC_ENABLE Start Your Own Project diff --git a/common/action.c b/common/action.c index c22f681f..59c6f252 100644 --- a/common/action.c +++ b/common/action.c @@ -336,9 +336,10 @@ void register_code(uint8_t code) if (code == KC_NO) { return; } -#ifdef CAPSLOCK_LOCKING_ENABLE + +#ifdef LOCKING_SUPPORT_ENABLE else if (KC_LOCKING_CAPS == code) { -#ifdef CAPSLOCK_LOCKING_RESYNC_ENABLE +#ifdef LOCKING_RESYNC_ENABLE // Resync: ignore if caps lock already is on if (host_keyboard_leds() & (1<. #define KC_DEL KC_DELETE #define KC_INS KC_INSERT #define KC_CAPS KC_CAPSLOCK +#define KC_CLCK KC_CAPSLOCK #define KC_RGHT KC_RIGHT #define KC_PGDN KC_PGDOWN #define KC_PSCR KC_PSCREEN -#define KC_SLCK KC_SCKLOCK +#define KC_SLCK KC_SCROLLLOCK #define KC_PAUS KC_PAUSE #define KC_BRK KC_PAUSE #define KC_NLCK KC_NUMLOCK @@ -82,6 +83,8 @@ along with this program. If not, see . #define KC_NUHS KC_NONUS_HASH #define KC_NUBS KC_NONUS_BSLASH #define KC_LCAP KC_LOCKING_CAPS +#define KC_LNUM KC_LOCKING_NUM +#define KC_LSCR KC_LOCKING_SCROLL #define KC_ERAS KC_ALT_ERASE, #define KC_CLR KC_CLEAR /* Japanese specific */ @@ -230,7 +233,7 @@ enum hid_keyboard_keypad_usage { KC_F11, KC_F12, KC_PSCREEN, - KC_SCKLOCK, + KC_SCROLLLOCK, KC_PAUSE, KC_INSERT, KC_HOME,