diff options
| -rw-r--r-- | common/command.c | 23 | ||||
| -rw-r--r-- | common/keyboard.c | 2 | ||||
| -rw-r--r-- | common/matrix.h | 2 |
3 files changed, 22 insertions, 5 deletions
diff --git a/common/command.c b/common/command.c index bbc45f45a..8e2e21a70 100644 --- a/common/command.c +++ b/common/command.c | |||
| @@ -46,10 +46,12 @@ static bool command_common(uint8_t code); | |||
| 46 | static void command_common_help(void); | 46 | static void command_common_help(void); |
| 47 | static bool command_console(uint8_t code); | 47 | static bool command_console(uint8_t code); |
| 48 | static void command_console_help(void); | 48 | static void command_console_help(void); |
| 49 | #ifdef MOUSEKEY_ENABLE | ||
| 49 | static bool mousekey_console(uint8_t code); | 50 | static bool mousekey_console(uint8_t code); |
| 50 | static void mousekey_console_help(void); | 51 | static void mousekey_console_help(void); |
| 52 | #endif | ||
| 51 | 53 | ||
| 52 | static uint8_t kc2int(uint8_t code); | 54 | static uint8_t numkey2num(uint8_t code); |
| 53 | static void switch_layer(uint8_t layer); | 55 | static void switch_layer(uint8_t layer); |
| 54 | static void clear_keyboard(void); | 56 | static void clear_keyboard(void); |
| 55 | 57 | ||
| @@ -68,9 +70,11 @@ bool command_proc(uint8_t code) | |||
| 68 | case CONSOLE: | 70 | case CONSOLE: |
| 69 | command_console(code); | 71 | command_console(code); |
| 70 | break; | 72 | break; |
| 73 | #ifdef MOUSEKEY_ENABLE | ||
| 71 | case MOUSEKEY: | 74 | case MOUSEKEY: |
| 72 | mousekey_console(code); | 75 | mousekey_console(code); |
| 73 | break; | 76 | break; |
| 77 | #endif | ||
| 74 | default: | 78 | default: |
| 75 | state = ONESHOT; | 79 | state = ONESHOT; |
| 76 | return false; | 80 | return false; |
| @@ -111,12 +115,24 @@ static void command_common_help(void) | |||
| 111 | print("3/F3: switch to Layer3 \n"); | 115 | print("3/F3: switch to Layer3 \n"); |
| 112 | print("4/F4: switch to Layer4 \n"); | 116 | print("4/F4: switch to Layer4 \n"); |
| 113 | print("PScr: power down/remote wake-up\n"); | 117 | print("PScr: power down/remote wake-up\n"); |
| 118 | print("Caps: Lock Keyboard(Child Proof)\n"); | ||
| 114 | print("Paus: jump to bootloader\n"); | 119 | print("Paus: jump to bootloader\n"); |
| 115 | } | 120 | } |
| 116 | 121 | ||
| 117 | static bool command_common(uint8_t code) | 122 | static bool command_common(uint8_t code) |
| 118 | { | 123 | { |
| 124 | static host_driver_t *host_driver = 0; | ||
| 119 | switch (code) { | 125 | switch (code) { |
| 126 | case KC_CAPSLOCK: | ||
| 127 | if (host_get_driver()) { | ||
| 128 | host_driver = host_get_driver(); | ||
| 129 | host_set_driver(0); | ||
| 130 | print("Locked.\n"); | ||
| 131 | } else { | ||
| 132 | host_set_driver(host_driver); | ||
| 133 | print("Unlocked.\n"); | ||
| 134 | } | ||
| 135 | break; | ||
| 120 | case KC_H: | 136 | case KC_H: |
| 121 | case KC_SLASH: /* ? */ | 137 | case KC_SLASH: /* ? */ |
| 122 | command_common_help(); | 138 | command_common_help(); |
| @@ -241,6 +257,7 @@ static bool command_common(uint8_t code) | |||
| 241 | } | 257 | } |
| 242 | #else | 258 | #else |
| 243 | host_system_send(SYSTEM_POWER_DOWN); | 259 | host_system_send(SYSTEM_POWER_DOWN); |
| 260 | _delay_ms(100); | ||
| 244 | host_system_send(0); | 261 | host_system_send(0); |
| 245 | _delay_ms(500); | 262 | _delay_ms(500); |
| 246 | #endif | 263 | #endif |
| @@ -478,7 +495,7 @@ static bool mousekey_console(uint8_t code) | |||
| 478 | case KC_8: | 495 | case KC_8: |
| 479 | case KC_9: | 496 | case KC_9: |
| 480 | case KC_0: | 497 | case KC_0: |
| 481 | mousekey_param = kc2int(code); | 498 | mousekey_param = numkey2num(code); |
| 482 | print("selected parameter: "); pdec(mousekey_param); print("\n"); | 499 | print("selected parameter: "); pdec(mousekey_param); print("\n"); |
| 483 | break; | 500 | break; |
| 484 | case KC_UP: | 501 | case KC_UP: |
| @@ -515,7 +532,7 @@ static bool mousekey_console(uint8_t code) | |||
| 515 | /*********************************************************** | 532 | /*********************************************************** |
| 516 | * Utilities | 533 | * Utilities |
| 517 | ***********************************************************/ | 534 | ***********************************************************/ |
| 518 | static uint8_t kc2int(uint8_t code) | 535 | static uint8_t numkey2num(uint8_t code) |
| 519 | { | 536 | { |
| 520 | switch (code) { | 537 | switch (code) { |
| 521 | case KC_1: return 1; | 538 | case KC_1: return 1; |
diff --git a/common/keyboard.c b/common/keyboard.c index d7ced430e..e973c46d5 100644 --- a/common/keyboard.c +++ b/common/keyboard.c | |||
| @@ -563,7 +563,7 @@ void keyboard_task(void) | |||
| 563 | matrix_row = matrix_get_row(r); | 563 | matrix_row = matrix_get_row(r); |
| 564 | matrix_change = matrix_row ^ matrix_prev[r]; | 564 | matrix_change = matrix_row ^ matrix_prev[r]; |
| 565 | if (matrix_change) { | 565 | if (matrix_change) { |
| 566 | matrix_debug(); | 566 | if (debug_matrix) matrix_print(); |
| 567 | 567 | ||
| 568 | for (int c = 0; c < MATRIX_COLS; c++) { | 568 | for (int c = 0; c < MATRIX_COLS; c++) { |
| 569 | if (matrix_change & (1<<c)) { | 569 | if (matrix_change & (1<<c)) { |
diff --git a/common/matrix.h b/common/matrix.h index 91231e765..b3332d5ff 100644 --- a/common/matrix.h +++ b/common/matrix.h | |||
| @@ -54,7 +54,7 @@ matrix_row_t matrix_get_row(uint8_t row); | |||
| 54 | /* count keys pressed */ | 54 | /* count keys pressed */ |
| 55 | uint8_t matrix_key_count(void); | 55 | uint8_t matrix_key_count(void); |
| 56 | /* print matrix for debug */ | 56 | /* print matrix for debug */ |
| 57 | void matrix_debug(void); | 57 | void matrix_print(void); |
| 58 | 58 | ||
| 59 | 59 | ||
| 60 | #endif | 60 | #endif |
