diff options
| -rw-r--r-- | README.md | 10 | ||||
| -rw-r--r-- | common/action.c | 52 | ||||
| -rw-r--r-- | common/keycode.h | 7 | ||||
| -rw-r--r-- | converter/adb_usb/README.md | 4 | ||||
| -rw-r--r-- | converter/adb_usb/config.h | 14 | ||||
| -rw-r--r-- | converter/m0110_usb/config.h | 8 | ||||
| -rw-r--r-- | keyboard/gh60/config.h | 8 |
7 files changed, 75 insertions, 28 deletions
| @@ -164,12 +164,12 @@ TODO: Magic key combination to avoid unintentional press during plug in | |||
| 164 | **TBD** | 164 | **TBD** |
| 165 | 165 | ||
| 166 | 166 | ||
| 167 | Mechanical Locking support for CapsLock | 167 | Mechanical Locking support |
| 168 | --------------------------------------- | 168 | -------------------------- |
| 169 | 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. | 169 | 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. |
| 170 | 170 | ||
| 171 | #define CAPSLOCK_LOCKING_ENABLE | 171 | #define LOCKING_SUPPORT_ENABLE |
| 172 | #define CAPSLOCK_LOCKING_RESYNC_ENABLE | 172 | #define LOCKING_RESYNC_ENABLE |
| 173 | 173 | ||
| 174 | 174 | ||
| 175 | Start Your Own Project | 175 | Start Your Own Project |
diff --git a/common/action.c b/common/action.c index c22f681fb..59c6f252d 100644 --- a/common/action.c +++ b/common/action.c | |||
| @@ -336,9 +336,10 @@ void register_code(uint8_t code) | |||
| 336 | if (code == KC_NO) { | 336 | if (code == KC_NO) { |
| 337 | return; | 337 | return; |
| 338 | } | 338 | } |
| 339 | #ifdef CAPSLOCK_LOCKING_ENABLE | 339 | |
| 340 | #ifdef LOCKING_SUPPORT_ENABLE | ||
| 340 | else if (KC_LOCKING_CAPS == code) { | 341 | else if (KC_LOCKING_CAPS == code) { |
| 341 | #ifdef CAPSLOCK_LOCKING_RESYNC_ENABLE | 342 | #ifdef LOCKING_RESYNC_ENABLE |
| 342 | // Resync: ignore if caps lock already is on | 343 | // Resync: ignore if caps lock already is on |
| 343 | if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) return; | 344 | if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) return; |
| 344 | #endif | 345 | #endif |
| @@ -347,7 +348,28 @@ void register_code(uint8_t code) | |||
| 347 | host_del_key(KC_CAPSLOCK); | 348 | host_del_key(KC_CAPSLOCK); |
| 348 | host_send_keyboard_report(); | 349 | host_send_keyboard_report(); |
| 349 | } | 350 | } |
| 351 | |||
| 352 | else if (KC_LOCKING_NUM == code) { | ||
| 353 | #ifdef LOCKING_RESYNC_ENABLE | ||
| 354 | if (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) return; | ||
| 355 | #endif | ||
| 356 | host_add_key(KC_NUMLOCK); | ||
| 357 | host_send_keyboard_report(); | ||
| 358 | host_del_key(KC_NUMLOCK); | ||
| 359 | host_send_keyboard_report(); | ||
| 360 | } | ||
| 361 | |||
| 362 | else if (KC_LOCKING_SCROLL == code) { | ||
| 363 | #ifdef LOCKING_RESYNC_ENABLE | ||
| 364 | if (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) return; | ||
| 365 | #endif | ||
| 366 | host_add_key(KC_SCROLLLOCK); | ||
| 367 | host_send_keyboard_report(); | ||
| 368 | host_del_key(KC_SCROLLLOCK); | ||
| 369 | host_send_keyboard_report(); | ||
| 370 | } | ||
| 350 | #endif | 371 | #endif |
| 372 | |||
| 351 | else if IS_KEY(code) { | 373 | else if IS_KEY(code) { |
| 352 | // TODO: should push command_proc out of this block? | 374 | // TODO: should push command_proc out of this block? |
| 353 | if (command_proc(code)) return; | 375 | if (command_proc(code)) return; |
| @@ -386,9 +408,10 @@ void unregister_code(uint8_t code) | |||
| 386 | if (code == KC_NO) { | 408 | if (code == KC_NO) { |
| 387 | return; | 409 | return; |
| 388 | } | 410 | } |
| 389 | #ifdef CAPSLOCK_LOCKING_ENABLE | 411 | |
| 412 | #ifdef LOCKING_SUPPORT_ENABLE | ||
| 390 | else if (KC_LOCKING_CAPS == code) { | 413 | else if (KC_LOCKING_CAPS == code) { |
| 391 | #ifdef CAPSLOCK_LOCKING_RESYNC_ENABLE | 414 | #ifdef LOCKING_RESYNC_ENABLE |
| 392 | // Resync: ignore if caps lock already is off | 415 | // Resync: ignore if caps lock already is off |
| 393 | if (!(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) return; | 416 | if (!(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) return; |
| 394 | #endif | 417 | #endif |
| @@ -397,7 +420,28 @@ void unregister_code(uint8_t code) | |||
| 397 | host_del_key(KC_CAPSLOCK); | 420 | host_del_key(KC_CAPSLOCK); |
| 398 | host_send_keyboard_report(); | 421 | host_send_keyboard_report(); |
| 399 | } | 422 | } |
| 423 | |||
| 424 | else if (KC_LOCKING_NUM == code) { | ||
| 425 | #ifdef LOCKING_RESYNC_ENABLE | ||
| 426 | if (!(host_keyboard_leds() & (1<<USB_LED_NUM_LOCK))) return; | ||
| 427 | #endif | ||
| 428 | host_add_key(KC_NUMLOCK); | ||
| 429 | host_send_keyboard_report(); | ||
| 430 | host_del_key(KC_NUMLOCK); | ||
| 431 | host_send_keyboard_report(); | ||
| 432 | } | ||
| 433 | |||
| 434 | else if (KC_LOCKING_SCROLL == code) { | ||
| 435 | #ifdef LOCKING_RESYNC_ENABLE | ||
| 436 | if (!(host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK))) return; | ||
| 437 | #endif | ||
| 438 | host_add_key(KC_SCROLLLOCK); | ||
| 439 | host_send_keyboard_report(); | ||
| 440 | host_del_key(KC_SCROLLLOCK); | ||
| 441 | host_send_keyboard_report(); | ||
| 442 | } | ||
| 400 | #endif | 443 | #endif |
| 444 | |||
| 401 | else if IS_KEY(code) { | 445 | else if IS_KEY(code) { |
| 402 | host_del_key(code); | 446 | host_del_key(code); |
| 403 | host_send_keyboard_report(); | 447 | host_send_keyboard_report(); |
diff --git a/common/keycode.h b/common/keycode.h index 77d5b79ba..08c3cbf42 100644 --- a/common/keycode.h +++ b/common/keycode.h | |||
| @@ -60,10 +60,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 60 | #define KC_DEL KC_DELETE | 60 | #define KC_DEL KC_DELETE |
| 61 | #define KC_INS KC_INSERT | 61 | #define KC_INS KC_INSERT |
| 62 | #define KC_CAPS KC_CAPSLOCK | 62 | #define KC_CAPS KC_CAPSLOCK |
| 63 | #define KC_CLCK KC_CAPSLOCK | ||
| 63 | #define KC_RGHT KC_RIGHT | 64 | #define KC_RGHT KC_RIGHT |
| 64 | #define KC_PGDN KC_PGDOWN | 65 | #define KC_PGDN KC_PGDOWN |
| 65 | #define KC_PSCR KC_PSCREEN | 66 | #define KC_PSCR KC_PSCREEN |
| 66 | #define KC_SLCK KC_SCKLOCK | 67 | #define KC_SLCK KC_SCROLLLOCK |
| 67 | #define KC_PAUS KC_PAUSE | 68 | #define KC_PAUS KC_PAUSE |
| 68 | #define KC_BRK KC_PAUSE | 69 | #define KC_BRK KC_PAUSE |
| 69 | #define KC_NLCK KC_NUMLOCK | 70 | #define KC_NLCK KC_NUMLOCK |
| @@ -82,6 +83,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 82 | #define KC_NUHS KC_NONUS_HASH | 83 | #define KC_NUHS KC_NONUS_HASH |
| 83 | #define KC_NUBS KC_NONUS_BSLASH | 84 | #define KC_NUBS KC_NONUS_BSLASH |
| 84 | #define KC_LCAP KC_LOCKING_CAPS | 85 | #define KC_LCAP KC_LOCKING_CAPS |
| 86 | #define KC_LNUM KC_LOCKING_NUM | ||
| 87 | #define KC_LSCR KC_LOCKING_SCROLL | ||
| 85 | #define KC_ERAS KC_ALT_ERASE, | 88 | #define KC_ERAS KC_ALT_ERASE, |
| 86 | #define KC_CLR KC_CLEAR | 89 | #define KC_CLR KC_CLEAR |
| 87 | /* Japanese specific */ | 90 | /* Japanese specific */ |
| @@ -230,7 +233,7 @@ enum hid_keyboard_keypad_usage { | |||
| 230 | KC_F11, | 233 | KC_F11, |
| 231 | KC_F12, | 234 | KC_F12, |
| 232 | KC_PSCREEN, | 235 | KC_PSCREEN, |
| 233 | KC_SCKLOCK, | 236 | KC_SCROLLLOCK, |
| 234 | KC_PAUSE, | 237 | KC_PAUSE, |
| 235 | KC_INSERT, | 238 | KC_INSERT, |
| 236 | KC_HOME, | 239 | KC_HOME, |
diff --git a/converter/adb_usb/README.md b/converter/adb_usb/README.md index 3033cfa62..5301557d4 100644 --- a/converter/adb_usb/README.md +++ b/converter/adb_usb/README.md | |||
| @@ -9,10 +9,10 @@ Discuss: http://geekhack.org/showwiki.php?title=Island:14290 | |||
| 9 | 9 | ||
| 10 | Build | 10 | Build |
| 11 | ----- | 11 | ----- |
| 12 | 0. Connect ADB keyboard to Teensy by 3 lines(Vcc, GND, Data). By default Data line uses port F0. | 12 | 0. Connect ADB keyboard to Teensy by 3 lines(Vcc, GND, Data). By default Data line uses port D0. |
| 13 | This converter uses AVR's internal pull-up, but it seems to be too weak, in particular when you want to use a long or coiled cable. | 13 | This converter uses AVR's internal pull-up, but it seems to be too weak, in particular when you want to use a long or coiled cable. |
| 14 | The external pull-up resistor(1K-10K Ohm) on Data is strongly recommended. | 14 | The external pull-up resistor(1K-10K Ohm) on Data is strongly recommended. |
| 15 | 1. Define following macros for ADB connection in config.h if you use other than port F0. | 15 | 1. Define following macros for ADB connection in config.h if you use other than port D0. |
| 16 | ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT | 16 | ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT |
| 17 | 2. make | 17 | 2. make |
| 18 | 3. program Teensy | 18 | 3. program Teensy |
diff --git a/converter/adb_usb/config.h b/converter/adb_usb/config.h index 7e2372edf..4ce27bbfe 100644 --- a/converter/adb_usb/config.h +++ b/converter/adb_usb/config.h | |||
| @@ -34,10 +34,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 34 | #define MATRIX_COL(code) ((code)&0x07) | 34 | #define MATRIX_COL(code) ((code)&0x07) |
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | /* Mechanical locking CapsLock support. Use KC_LCAP instead of KC_CAPS in keymap */ | 37 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ |
| 38 | #define CAPSLOCK_LOCKING_ENABLE | 38 | #define LOCKING_SUPPORT_ENABLE |
| 39 | /* Locking CapsLock resynchronize hack */ | 39 | /* Locking resynchronize hack */ |
| 40 | #define CAPSLOCK_LOCKING_RESYNC_ENABLE | 40 | #define LOCKING_RESYNC_ENABLE |
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | /* legacy keymap support */ | 43 | /* legacy keymap support */ |
| @@ -51,9 +51,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 51 | 51 | ||
| 52 | 52 | ||
| 53 | /* ADB port setting */ | 53 | /* ADB port setting */ |
| 54 | #define ADB_PORT PORTF | 54 | #define ADB_PORT PORTD |
| 55 | #define ADB_PIN PINF | 55 | #define ADB_PIN PIND |
| 56 | #define ADB_DDR DDRF | 56 | #define ADB_DDR DDRD |
| 57 | #define ADB_DATA_BIT 0 | 57 | #define ADB_DATA_BIT 0 |
| 58 | //#define ADB_PSW_BIT 1 // optional | 58 | //#define ADB_PSW_BIT 1 // optional |
| 59 | 59 | ||
diff --git a/converter/m0110_usb/config.h b/converter/m0110_usb/config.h index ac1c40a38..dc446414b 100644 --- a/converter/m0110_usb/config.h +++ b/converter/m0110_usb/config.h | |||
| @@ -36,10 +36,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 36 | #define USE_LEGACY_KEYMAP | 36 | #define USE_LEGACY_KEYMAP |
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | /* Mechanical locking CapsLock support. Use KC_LCAP instead of KC_CAPS in keymap */ | 39 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ |
| 40 | #define CAPSLOCK_LOCKING_ENABLE | 40 | #define LOCKING_SUPPORT_ENABLE |
| 41 | /* Locking CapsLock resynchronize hack */ | 41 | /* Locking resynchronize hack */ |
| 42 | #define CAPSLOCK_LOCKING_RESYNC_ENABLE | 42 | #define LOCKING_RESYNC_ENABLE |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | /* magic key */ | 45 | /* magic key */ |
diff --git a/keyboard/gh60/config.h b/keyboard/gh60/config.h index 567b126b6..e9c0f4366 100644 --- a/keyboard/gh60/config.h +++ b/keyboard/gh60/config.h | |||
| @@ -37,10 +37,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 37 | /* Set 0 if debouncing isn't needed */ | 37 | /* Set 0 if debouncing isn't needed */ |
| 38 | #define DEBOUNCE 5 | 38 | #define DEBOUNCE 5 |
| 39 | 39 | ||
| 40 | /* Mechanical locking CapsLock support. Use KC_LCAP instead of KC_CAPS in keymap */ | 40 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ |
| 41 | #define CAPSLOCK_LOCKING_ENABLE | 41 | #define LOCKING_SUPPORT_ENABLE |
| 42 | /* Locking CapsLock resynchronize hack */ | 42 | /* Locking resynchronize hack */ |
| 43 | #define CAPSLOCK_LOCKING_RESYNC_ENABLE | 43 | #define LOCKING_RESYNC_ENABLE |
| 44 | 44 | ||
| 45 | /* key combination for command */ | 45 | /* key combination for command */ |
| 46 | #define IS_COMMAND() ( \ | 46 | #define IS_COMMAND() ( \ |
