diff options
| -rw-r--r-- | common.mk | 1 | ||||
| -rw-r--r-- | common/action.c | 195 | ||||
| -rw-r--r-- | common/action.h | 133 | ||||
| -rw-r--r-- | common/command.c | 27 | ||||
| -rw-r--r-- | common/layer_stack.c | 108 | ||||
| -rw-r--r-- | common/layer_stack.h | 45 | ||||
| -rw-r--r-- | keyboard/gh60/Makefile.lufa | 3 | ||||
| -rw-r--r-- | keyboard/gh60/Makefile.pjrc | 3 | ||||
| -rw-r--r-- | keyboard/gh60/keymap.c | 2 | ||||
| -rw-r--r-- | keyboard/gh60/keymap_poker.h | 37 | ||||
| -rw-r--r-- | keyboard/gh60/keymap_poker_stack.h | 77 | ||||
| -rw-r--r-- | rules.mk | 3 |
12 files changed, 500 insertions, 134 deletions
| @@ -3,6 +3,7 @@ SRC += $(COMMON_DIR)/host.c \ | |||
| 3 | $(COMMON_DIR)/keyboard.c \ | 3 | $(COMMON_DIR)/keyboard.c \ |
| 4 | $(COMMON_DIR)/action.c \ | 4 | $(COMMON_DIR)/action.c \ |
| 5 | $(COMMON_DIR)/action_macro.c \ | 5 | $(COMMON_DIR)/action_macro.c \ |
| 6 | $(COMMON_DIR)/layer_stack.c \ | ||
| 6 | $(COMMON_DIR)/keymap.c \ | 7 | $(COMMON_DIR)/keymap.c \ |
| 7 | $(COMMON_DIR)/command.c \ | 8 | $(COMMON_DIR)/command.c \ |
| 8 | $(COMMON_DIR)/timer.c \ | 9 | $(COMMON_DIR)/timer.c \ |
diff --git a/common/action.c b/common/action.c index 6528cd46c..9a8d75596 100644 --- a/common/action.c +++ b/common/action.c | |||
| @@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 24 | #include "util.h" | 24 | #include "util.h" |
| 25 | #include "debug.h" | 25 | #include "debug.h" |
| 26 | #include "action.h" | 26 | #include "action.h" |
| 27 | #include "layer_stack.h" | ||
| 27 | 28 | ||
| 28 | 29 | ||
| 29 | /* default layer indicates base layer */ | 30 | /* default layer indicates base layer */ |
| @@ -209,14 +210,27 @@ void action_exec(keyevent_t event) | |||
| 209 | 210 | ||
| 210 | static action_t get_action(key_t key) | 211 | static action_t get_action(key_t key) |
| 211 | { | 212 | { |
| 212 | action_t action = action_for_key(current_layer, key); | 213 | action_t action; |
| 214 | action.code = ACTION_NO; | ||
| 213 | 215 | ||
| 214 | /* Transparently use default layer */ | 216 | /* layer stack */ |
| 215 | if (action.code == ACTION_TRANSPARENT) { | 217 | action = layer_stack_get_action(key); |
| 216 | // TODO: layer stacking | 218 | if (action.code != ACTION_TRANSPARENT) { |
| 217 | action = action_for_key(default_layer, key); | 219 | return action; |
| 218 | debug("TRNASPARENT: "); debug_hex16(action.code); debug("\n"); | ||
| 219 | } | 220 | } |
| 221 | |||
| 222 | /* current layer: 0 means default layer */ | ||
| 223 | if (current_layer) { | ||
| 224 | action = action_for_key(current_layer, key); | ||
| 225 | if (action.code != ACTION_TRANSPARENT) { | ||
| 226 | debug("current layer: used. "); debug_dec(current_layer); debug("\n"); | ||
| 227 | return action; | ||
| 228 | } | ||
| 229 | } | ||
| 230 | |||
| 231 | /* default layer */ | ||
| 232 | debug("default layer: used. \n"); | ||
| 233 | action = action_for_key(default_layer, key); | ||
| 220 | return action; | 234 | return action; |
| 221 | } | 235 | } |
| 222 | 236 | ||
| @@ -287,7 +301,7 @@ static void process_action(keyrecord_t *record) | |||
| 287 | } else { | 301 | } else { |
| 288 | if (tap_count == 0) { | 302 | if (tap_count == 0) { |
| 289 | debug("MODS_TAP: Oneshot: cancel/del_mods\n"); | 303 | debug("MODS_TAP: Oneshot: cancel/del_mods\n"); |
| 290 | // cancel oneshot by holding. | 304 | // cancel oneshot on hold |
| 291 | oneshot_cancel(); | 305 | oneshot_cancel(); |
| 292 | del_mods(mods); | 306 | del_mods(mods); |
| 293 | } | 307 | } |
| @@ -377,7 +391,7 @@ static void process_action(keyrecord_t *record) | |||
| 377 | } | 391 | } |
| 378 | else { | 392 | else { |
| 379 | // NOTE: This is needed by legacy keymap support | 393 | // NOTE: This is needed by legacy keymap support |
| 380 | layer_switch(default_layer); | 394 | layer_switch(0); |
| 381 | } | 395 | } |
| 382 | break; | 396 | break; |
| 383 | case LAYER_ON_PRESS: | 397 | case LAYER_ON_PRESS: |
| @@ -390,22 +404,8 @@ static void process_action(keyrecord_t *record) | |||
| 390 | layer_switch(action.layer.val); | 404 | layer_switch(action.layer.val); |
| 391 | } | 405 | } |
| 392 | break; | 406 | break; |
| 393 | case LAYER_DEFAULT: /* default layer */ | 407 | case LAYER_ON_BOTH: |
| 394 | switch (action.layer.val) { | 408 | layer_switch(action.layer.val); |
| 395 | case DEFAULT_ON_BOTH: | ||
| 396 | layer_switch(default_layer); | ||
| 397 | break; | ||
| 398 | case DEFAULT_ON_PRESS: | ||
| 399 | if (event.pressed) { | ||
| 400 | layer_switch(default_layer); | ||
| 401 | } | ||
| 402 | break; | ||
| 403 | case DEFAULT_ON_RELEASE: | ||
| 404 | if (!event.pressed) { | ||
| 405 | layer_switch(default_layer); | ||
| 406 | } | ||
| 407 | break; | ||
| 408 | } | ||
| 409 | break; | 409 | break; |
| 410 | case LAYER_TAP_TOGGLE: /* switch on hold and toggle on several taps */ | 410 | case LAYER_TAP_TOGGLE: /* switch on hold and toggle on several taps */ |
| 411 | if (event.pressed) { | 411 | if (event.pressed) { |
| @@ -419,30 +419,40 @@ static void process_action(keyrecord_t *record) | |||
| 419 | } | 419 | } |
| 420 | } | 420 | } |
| 421 | break; | 421 | break; |
| 422 | case LAYER_CHANGE_DEFAULT: /* change default layer */ | 422 | case LAYER_SET_DEFAULT_ON_PRESS: |
| 423 | if (event.pressed) { | 423 | if (event.pressed) { |
| 424 | default_layer = action.layer.val; | 424 | default_layer = action.layer.val; |
| 425 | layer_switch(default_layer); | 425 | layer_switch(0); |
| 426 | } | 426 | } |
| 427 | break; | 427 | break; |
| 428 | default: /* switch layer on hold and key on tap*/ | 428 | case LAYER_SET_DEFAULT_ON_RELEASE: |
| 429 | if (!event.pressed) { | ||
| 430 | default_layer = action.layer.val; | ||
| 431 | layer_switch(0); | ||
| 432 | } | ||
| 433 | break; | ||
| 434 | case LAYER_SET_DEFAULT_ON_BOTH: | ||
| 435 | default_layer = action.layer.val; | ||
| 436 | layer_switch(0); | ||
| 437 | break; | ||
| 438 | default: | ||
| 439 | /* tap key */ | ||
| 429 | if (event.pressed) { | 440 | if (event.pressed) { |
| 430 | if (tap_count > 0) { | 441 | if (IS_TAPPING_KEY(event.key) && tap_count > 0) { |
| 431 | debug("LAYER_PRESSED: Tap: register_code\n"); | 442 | debug("LAYER_SET: Tap: register_code\n"); |
| 432 | register_code(action.layer.code); | 443 | register_code(action.layer.code); |
| 433 | } else { | 444 | } else { |
| 434 | debug("LAYER_PRESSED: No tap: layer_switch\n"); | 445 | debug("LAYER_SET: No tap: layer_set(on press)\n"); |
| 435 | layer_switch(action.layer.val); | 446 | layer_switch(action.layer.val); |
| 436 | } | 447 | } |
| 437 | } else { | 448 | } else { |
| 438 | if (tap_count > 0) { | 449 | if (IS_TAPPING_KEY(event.key) && tap_count > 0) { |
| 439 | debug("LAYER_PRESSED: Tap: unregister_code\n"); | 450 | debug("LAYER_SET: Tap: unregister_code\n"); |
| 440 | unregister_code(action.layer.code); | 451 | unregister_code(action.layer.code); |
| 441 | } else { | 452 | } else { |
| 442 | //debug("LAYER_PRESSED: No tap: NO ACTION\n"); | ||
| 443 | // NOTE: This is needed by legacy keymap support | 453 | // NOTE: This is needed by legacy keymap support |
| 444 | debug("LAYER_PRESSED: No tap: return to default layer\n"); | 454 | debug("LAYER_SET: No tap: return to default layer(on release)\n"); |
| 445 | layer_switch(default_layer); | 455 | layer_switch(0); |
| 446 | } | 456 | } |
| 447 | } | 457 | } |
| 448 | break; | 458 | break; |
| @@ -452,9 +462,9 @@ static void process_action(keyrecord_t *record) | |||
| 452 | switch (action.layer.code) { | 462 | switch (action.layer.code) { |
| 453 | case LAYER_MOMENTARY: /* momentary */ | 463 | case LAYER_MOMENTARY: /* momentary */ |
| 454 | if (event.pressed) { | 464 | if (event.pressed) { |
| 455 | layer_switch(current_layer ^ action.layer.val); | 465 | layer_switch(current_layer | action.layer.val); |
| 456 | } else { | 466 | } else { |
| 457 | layer_switch(current_layer ^ action.layer.val); | 467 | layer_switch(current_layer & ~action.layer.val); |
| 458 | } | 468 | } |
| 459 | break; | 469 | break; |
| 460 | case LAYER_ON_PRESS: | 470 | case LAYER_ON_PRESS: |
| @@ -467,6 +477,9 @@ static void process_action(keyrecord_t *record) | |||
| 467 | layer_switch(current_layer ^ action.layer.val); | 477 | layer_switch(current_layer ^ action.layer.val); |
| 468 | } | 478 | } |
| 469 | break; | 479 | break; |
| 480 | case LAYER_ON_BOTH: | ||
| 481 | layer_switch(current_layer ^ action.layer.val); | ||
| 482 | break; | ||
| 470 | case LAYER_TAP_TOGGLE: /* switch on hold and toggle on several taps */ | 483 | case LAYER_TAP_TOGGLE: /* switch on hold and toggle on several taps */ |
| 471 | if (event.pressed) { | 484 | if (event.pressed) { |
| 472 | if (tap_count < TAPPING_TOGGLE) { | 485 | if (tap_count < TAPPING_TOGGLE) { |
| @@ -480,24 +493,30 @@ static void process_action(keyrecord_t *record) | |||
| 480 | } | 493 | } |
| 481 | } | 494 | } |
| 482 | break; | 495 | break; |
| 483 | case 0xFF: | 496 | case LAYER_SET_DEFAULT_ON_PRESS: |
| 484 | // change default layer | ||
| 485 | if (event.pressed) { | 497 | if (event.pressed) { |
| 486 | default_layer = current_layer ^ action.layer.val; | 498 | default_layer = default_layer ^ action.layer.val; |
| 487 | layer_switch(default_layer); | 499 | layer_switch(0); |
| 488 | } else { | 500 | } |
| 489 | default_layer = current_layer ^ action.layer.val; | 501 | break; |
| 490 | layer_switch(default_layer); | 502 | case LAYER_SET_DEFAULT_ON_RELEASE: |
| 503 | if (!event.pressed) { | ||
| 504 | default_layer = default_layer ^ action.layer.val; | ||
| 505 | layer_switch(0); | ||
| 491 | } | 506 | } |
| 492 | break; | 507 | break; |
| 508 | case LAYER_SET_DEFAULT_ON_BOTH: | ||
| 509 | default_layer = default_layer ^ action.layer.val; | ||
| 510 | layer_switch(0); | ||
| 511 | break; | ||
| 493 | default: | 512 | default: |
| 494 | // with tap key | 513 | // tap key |
| 495 | if (event.pressed) { | 514 | if (event.pressed) { |
| 496 | if (IS_TAPPING_KEY(event.key) && tap_count > 0) { | 515 | if (IS_TAPPING_KEY(event.key) && tap_count > 0) { |
| 497 | debug("LAYER_BIT: Tap: register_code\n"); | 516 | debug("LAYER_BIT: Tap: register_code\n"); |
| 498 | register_code(action.layer.code); | 517 | register_code(action.layer.code); |
| 499 | } else { | 518 | } else { |
| 500 | debug("LAYER_BIT: No tap: layer_switch(bit on)\n"); | 519 | debug("LAYER_BIT: No tap: layer_bit(on press)\n"); |
| 501 | layer_switch(current_layer ^ action.layer.val); | 520 | layer_switch(current_layer ^ action.layer.val); |
| 502 | } | 521 | } |
| 503 | } else { | 522 | } else { |
| @@ -505,13 +524,79 @@ static void process_action(keyrecord_t *record) | |||
| 505 | debug("LAYER_BIT: Tap: unregister_code\n"); | 524 | debug("LAYER_BIT: Tap: unregister_code\n"); |
| 506 | unregister_code(action.layer.code); | 525 | unregister_code(action.layer.code); |
| 507 | } else { | 526 | } else { |
| 508 | debug("LAYER_BIT: No tap: layer_switch(bit off)\n"); | 527 | debug("LAYER_BIT: No tap: layer_bit(on release)\n"); |
| 509 | layer_switch(current_layer ^ action.layer.val); | 528 | layer_switch(current_layer ^ action.layer.val); |
| 510 | } | 529 | } |
| 511 | } | 530 | } |
| 512 | break; | 531 | break; |
| 513 | } | 532 | } |
| 514 | break; | 533 | break; |
| 534 | case ACT_LAYER_STACK: | ||
| 535 | switch (action.layer.code) { | ||
| 536 | case LAYER_MOMENTARY: /* momentary */ | ||
| 537 | if (event.pressed) { | ||
| 538 | layer_stack_remove_then_push(action.layer.val); | ||
| 539 | layer_stack_debug(); | ||
| 540 | } else { | ||
| 541 | layer_stack_remove(action.layer.val); | ||
| 542 | layer_stack_debug(); | ||
| 543 | } | ||
| 544 | break; | ||
| 545 | case LAYER_ON_PRESS: | ||
| 546 | if (event.pressed) { | ||
| 547 | layer_stack_remove_or_push(action.layer.val); | ||
| 548 | layer_stack_debug(); | ||
| 549 | } | ||
| 550 | break; | ||
| 551 | case LAYER_ON_RELEASE: | ||
| 552 | if (!event.pressed) { | ||
| 553 | layer_stack_remove_or_push(action.layer.val); | ||
| 554 | layer_stack_debug(); | ||
| 555 | } | ||
| 556 | break; | ||
| 557 | case LAYER_ON_BOTH: | ||
| 558 | layer_stack_remove_or_push(action.layer.val); | ||
| 559 | layer_stack_debug(); | ||
| 560 | break; | ||
| 561 | case LAYER_TAP_TOGGLE: /* switch on hold and toggle on several taps */ | ||
| 562 | if (event.pressed) { | ||
| 563 | if (tap_count < TAPPING_TOGGLE) { | ||
| 564 | debug("LAYER_STACK: tap toggle(press).\n"); | ||
| 565 | layer_stack_remove_or_push(action.layer.val); | ||
| 566 | layer_stack_debug(); | ||
| 567 | } | ||
| 568 | } else { | ||
| 569 | if (tap_count <= TAPPING_TOGGLE) { | ||
| 570 | debug("LAYER_STACK: tap toggle(release).\n"); | ||
| 571 | layer_stack_remove_or_push(action.layer.val); | ||
| 572 | layer_stack_debug(); | ||
| 573 | } | ||
| 574 | } | ||
| 575 | break; | ||
| 576 | default: | ||
| 577 | // tap key | ||
| 578 | if (event.pressed) { | ||
| 579 | if (IS_TAPPING_KEY(event.key) && tap_count > 0) { | ||
| 580 | debug("LAYER_STACK: Tap: register_code\n"); | ||
| 581 | register_code(action.layer.code); | ||
| 582 | } else { | ||
| 583 | debug("LAYER_STACK: No tap: layer_stack(on press)\n"); | ||
| 584 | layer_stack_remove_or_push(action.layer.val); | ||
| 585 | layer_stack_debug(); | ||
| 586 | } | ||
| 587 | } else { | ||
| 588 | if (IS_TAPPING_KEY(event.key) && tap_count > 0) { | ||
| 589 | debug("LAYER_STACK: Tap: unregister_code\n"); | ||
| 590 | unregister_code(action.layer.code); | ||
| 591 | } else { | ||
| 592 | debug("LAYER_STACK: No tap: layer_stack(on release)\n"); | ||
| 593 | layer_stack_remove_or_push(action.layer.val); | ||
| 594 | layer_stack_debug(); | ||
| 595 | } | ||
| 596 | } | ||
| 597 | break; | ||
| 598 | } | ||
| 599 | break; | ||
| 515 | 600 | ||
| 516 | /* Extentions */ | 601 | /* Extentions */ |
| 517 | case ACT_MACRO: | 602 | case ACT_MACRO: |
| @@ -839,7 +924,10 @@ bool is_tap_key(key_t key) | |||
| 839 | case LAYER_MOMENTARY: | 924 | case LAYER_MOMENTARY: |
| 840 | case LAYER_ON_PRESS: | 925 | case LAYER_ON_PRESS: |
| 841 | case LAYER_ON_RELEASE: | 926 | case LAYER_ON_RELEASE: |
| 842 | case LAYER_DEFAULT: | 927 | case LAYER_ON_BOTH: |
| 928 | case LAYER_SET_DEFAULT_ON_PRESS: | ||
| 929 | case LAYER_SET_DEFAULT_ON_RELEASE: | ||
| 930 | case LAYER_SET_DEFAULT_ON_BOTH: | ||
| 843 | return false; | 931 | return false; |
| 844 | case LAYER_TAP_TOGGLE: | 932 | case LAYER_TAP_TOGGLE: |
| 845 | default: /* tap key */ | 933 | default: /* tap key */ |
| @@ -876,8 +964,9 @@ static void debug_action(action_t action) | |||
| 876 | case ACT_RMODS_TAP: debug("ACT_RMODS_TAP"); break; | 964 | case ACT_RMODS_TAP: debug("ACT_RMODS_TAP"); break; |
| 877 | case ACT_USAGE: debug("ACT_USAGE"); break; | 965 | case ACT_USAGE: debug("ACT_USAGE"); break; |
| 878 | case ACT_MOUSEKEY: debug("ACT_MOUSEKEY"); break; | 966 | case ACT_MOUSEKEY: debug("ACT_MOUSEKEY"); break; |
| 879 | case ACT_LAYER: debug("ACT_LAYER"); break; | 967 | case ACT_LAYER: debug("ACT_LAYER"); break; |
| 880 | case ACT_LAYER_BIT: debug("ACT_LAYER_BIT"); break; | 968 | case ACT_LAYER_BIT: debug("ACT_LAYER_BIT"); break; |
| 969 | case ACT_LAYER_STACK: debug("ACT_LAYER_STACK"); break; | ||
| 881 | case ACT_MACRO: debug("ACT_MACRO"); break; | 970 | case ACT_MACRO: debug("ACT_MACRO"); break; |
| 882 | case ACT_COMMAND: debug("ACT_COMMAND"); break; | 971 | case ACT_COMMAND: debug("ACT_COMMAND"); break; |
| 883 | case ACT_FUNCTION: debug("ACT_FUNCTION"); break; | 972 | case ACT_FUNCTION: debug("ACT_FUNCTION"); break; |
diff --git a/common/action.h b/common/action.h index b9a6cb5b4..96b8ba2ed 100644 --- a/common/action.h +++ b/common/action.h | |||
| @@ -162,25 +162,34 @@ bool waiting_buffer_has_anykey_pressed(void); | |||
| 162 | * | 162 | * |
| 163 | * Layer Actions | 163 | * Layer Actions |
| 164 | * ------------- | 164 | * ------------- |
| 165 | * ACT_LAYER(1000): Set layer | 165 | * ACT_LAYER(1000): Set layer |
| 166 | * ACT_LAYER_BIT(1001): Bit-op layer | 166 | * ACT_LAYER_BIT(1001): Bit-op layer |
| 167 | * ACT_LAYER_STACK: Layer stack | ||
| 167 | * | 168 | * |
| 168 | * 1000|LLLL|0000 0000 set L to layer on press and set default on release(momentary) | 169 | * 1000|LLLL|0000 0000 set current layer on press and return to default on release(momentary) |
| 169 | * 1000|LLLL|0000 0001 set L to layer on press | 170 | * 1000|LLLL|0000 0001 set current layer on press |
| 170 | * 1000|LLLL|0000 0010 set L to layer on release | 171 | * 1000|LLLL|0000 0010 set current layer on release |
| 171 | * 1000|----|0000 0011 set default to layer on both(return to default layer) | 172 | * 1000|LLLL|0000 0011 set current layer on both |
| 172 | * 1000|LLLL| keycode set L to layer while hold and send key on tap | 173 | * 1000|LLLL| keycode set current layer on hold and send key on tap |
| 173 | * 1000|LLLL|1111 0000 set L to layer while hold and toggle on several taps | 174 | * 1000|LLLL|1111 0000 set current layer on hold and toggle on several taps |
| 174 | * 1000|LLLL|1111 1111 set L to default and layer(on press) | 175 | * 1000|DDDD|1111 1111 set default layer on press |
| 176 | * L: 0 means default layer | ||
| 175 | * | 177 | * |
| 176 | * 1001|BBBB|0000 0000 (not used) | 178 | * 1001|BBBB|0000 0000 bit-on current layer on press and bit-off on release(momentary) |
| 177 | * 1001|BBBB|0000 0001 bit-xor layer with B on press | 179 | * 1001|BBBB|0000 0001 bit-xor current layer on press |
| 178 | * 1001|BBBB|0000 0010 bit-xor layer with B on release | 180 | * 1001|BBBB|0000 0010 bit-xor current layer on release |
| 179 | * 1001|BBBB|0000 0011 bit-xor layer with B on both(momentary) | 181 | * 1001|BBBB|0000 0011 bit-xor current layer on both |
| 180 | * 1001|BBBB| keycode bit-xor layer with B while hold and send key on tap | 182 | * 1001|BBBB| keycode bit-xor current layer on hold and send key on tap |
| 181 | * 1001|BBBB|1111 0000 bit-xor layer with B while hold and toggle on several taps | 183 | * 1001|BBBB|1111 0000 bit-xor current layer on hold and toggle on several taps |
| 182 | * 1001|BBBB|1111 1111 bit-xor default with B and set layer(on press) | 184 | * 1001|BBBB|1111 1111 bit-xor default layer on both |
| 183 | * | 185 | * |
| 186 | * 1011|LLLL|0000 0000 push on press and remove on release(momentary) | ||
| 187 | * 1011|LLLL|0000 0001 push or remove on press | ||
| 188 | * 1011|LLLL|0000 0010 push or remove on release | ||
| 189 | * 1011|LLLL|0000 0011 push or remove on both | ||
| 190 | * 1011|LLLL| keycode push or remove on hold and send key on tap | ||
| 191 | * 1011|LLLL|1111 0000 push or remove on hold and toggle on several taps | ||
| 192 | * 1011|LLLL|1111 1111 (not used) | ||
| 184 | * | 193 | * |
| 185 | * | 194 | * |
| 186 | * Extensions(11XX) | 195 | * Extensions(11XX) |
| @@ -210,6 +219,7 @@ enum action_kind_id { | |||
| 210 | 219 | ||
| 211 | ACT_LAYER = 0b1000, | 220 | ACT_LAYER = 0b1000, |
| 212 | ACT_LAYER_BIT = 0b1001, | 221 | ACT_LAYER_BIT = 0b1001, |
| 222 | ACT_LAYER_STACK = 0b1011, | ||
| 213 | 223 | ||
| 214 | ACT_MACRO = 0b1100, | 224 | ACT_MACRO = 0b1100, |
| 215 | ACT_COMMAND = 0b1110, | 225 | ACT_COMMAND = 0b1110, |
| @@ -223,20 +233,20 @@ enum action_kind_id { | |||
| 223 | #define ACTION(kind, param) ((kind)<<12 | (param)) | 233 | #define ACTION(kind, param) ((kind)<<12 | (param)) |
| 224 | #define MODS4(mods) (((mods)>>4 | (mods)) & 0x0F) | 234 | #define MODS4(mods) (((mods)>>4 | (mods)) & 0x0F) |
| 225 | 235 | ||
| 226 | /* Key */ | 236 | /* |
| 237 | * Key | ||
| 238 | */ | ||
| 227 | #define ACTION_KEY(key) ACTION(ACT_LMODS, key) | 239 | #define ACTION_KEY(key) ACTION(ACT_LMODS, key) |
| 228 | /* Mods & key */ | 240 | /* Mods & key */ |
| 229 | #define ACTION_LMODS(mods) ACTION(ACT_LMODS, MODS4(mods)<<8 | 0x00) | 241 | #define ACTION_LMODS(mods) ACTION(ACT_LMODS, MODS4(mods)<<8 | 0x00) |
| 230 | #define ACTION_LMODS_KEY(mods, key) ACTION(ACT_LMODS, MODS4(mods)<<8 | (key)) | 242 | #define ACTION_LMODS_KEY(mods, key) ACTION(ACT_LMODS, MODS4(mods)<<8 | (key)) |
| 231 | #define ACTION_RMODS(mods) ACTION(ACT_RMODS, MODS4(mods)<<8 | 0x00) | 243 | #define ACTION_RMODS(mods) ACTION(ACT_RMODS, MODS4(mods)<<8 | 0x00) |
| 232 | #define ACTION_RMODS_KEY(mods, key) ACTION(ACT_RMODS, MODS4(mods)<<8 | (key)) | 244 | #define ACTION_RMODS_KEY(mods, key) ACTION(ACT_RMODS, MODS4(mods)<<8 | (key)) |
| 233 | /* Mod & key */ | ||
| 234 | #define ACTION_LMOD(mod) ACTION(ACT_LMODS, MODS4(MOD_BIT(mod))<<8 | 0x00) | 245 | #define ACTION_LMOD(mod) ACTION(ACT_LMODS, MODS4(MOD_BIT(mod))<<8 | 0x00) |
| 235 | #define ACTION_LMOD_KEY(mod, key) ACTION(ACT_LMODS, MODS4(MOD_BIT(mod))<<8 | (key)) | 246 | #define ACTION_LMOD_KEY(mod, key) ACTION(ACT_LMODS, MODS4(MOD_BIT(mod))<<8 | (key)) |
| 236 | #define ACTION_RMOD(mod) ACTION(ACT_RMODS, MODS4(MOD_BIT(mod))<<8 | 0x00) | 247 | #define ACTION_RMOD(mod) ACTION(ACT_RMODS, MODS4(MOD_BIT(mod))<<8 | 0x00) |
| 237 | #define ACTION_RMOD_KEY(mod, key) ACTION(ACT_RMODS, MODS4(MOD_BIT(mod))<<8 | (key)) | 248 | #define ACTION_RMOD_KEY(mod, key) ACTION(ACT_RMODS, MODS4(MOD_BIT(mod))<<8 | (key)) |
| 238 | 249 | /* Tap key */ | |
| 239 | /* Mods + Tap key */ | ||
| 240 | enum mods_codes { | 250 | enum mods_codes { |
| 241 | MODS_ONESHOT = 0x00, | 251 | MODS_ONESHOT = 0x00, |
| 242 | }; | 252 | }; |
| @@ -244,7 +254,6 @@ enum mods_codes { | |||
| 244 | #define ACTION_LMODS_ONESHOT(mods) ACTION(ACT_LMODS_TAP, MODS4(mods)<<8 | MODS_ONESHOT) | 254 | #define ACTION_LMODS_ONESHOT(mods) ACTION(ACT_LMODS_TAP, MODS4(mods)<<8 | MODS_ONESHOT) |
| 245 | #define ACTION_RMODS_TAP_KEY(mods, key) ACTION(ACT_RMODS_TAP, MODS4(mods)<<8 | (key)) | 255 | #define ACTION_RMODS_TAP_KEY(mods, key) ACTION(ACT_RMODS_TAP, MODS4(mods)<<8 | (key)) |
| 246 | #define ACTION_RMODS_ONESHOT(mods) ACTION(ACT_RMODS_TAP, MODS4(mods)<<8 | MODS_ONESHOT) | 256 | #define ACTION_RMODS_ONESHOT(mods) ACTION(ACT_RMODS_TAP, MODS4(mods)<<8 | MODS_ONESHOT) |
| 247 | /* Mod + Tap key */ | ||
| 248 | #define ACTION_LMOD_TAP_KEY(mod, key) ACTION(ACT_LMODS_TAP, MODS4(MOD_BIT(mod))<<8 | (key)) | 257 | #define ACTION_LMOD_TAP_KEY(mod, key) ACTION(ACT_LMODS_TAP, MODS4(MOD_BIT(mod))<<8 | (key)) |
| 249 | #define ACTION_LMOD_ONESHOT(mod) ACTION(ACT_LMODS_TAP, MODS4(MOD_BIT(mod))<<8 | MODS_ONESHOT) | 258 | #define ACTION_LMOD_ONESHOT(mod) ACTION(ACT_LMODS_TAP, MODS4(MOD_BIT(mod))<<8 | MODS_ONESHOT) |
| 250 | #define ACTION_RMOD_TAP_KEY(mod, key) ACTION(ACT_RMODS_TAP, MODS4(MOD_BIT(mod))<<8 | (key)) | 259 | #define ACTION_RMOD_TAP_KEY(mod, key) ACTION(ACT_RMODS_TAP, MODS4(MOD_BIT(mod))<<8 | (key)) |
| @@ -252,73 +261,77 @@ enum mods_codes { | |||
| 252 | 261 | ||
| 253 | 262 | ||
| 254 | /* | 263 | /* |
| 255 | * Switch layer | 264 | * Layer switching |
| 256 | */ | 265 | */ |
| 257 | enum layer_codes { | 266 | enum layer_codes { |
| 258 | LAYER_MOMENTARY = 0, | 267 | LAYER_MOMENTARY = 0, |
| 259 | LAYER_ON_PRESS = 1, | 268 | LAYER_ON_PRESS = 1, |
| 260 | LAYER_ON_RELEASE = 2, | 269 | LAYER_ON_RELEASE = 2, |
| 261 | LAYER_DEFAULT =3, | 270 | LAYER_ON_BOTH =3, |
| 262 | LAYER_TAP_TOGGLE = 0xF0, | 271 | LAYER_TAP_TOGGLE = 0xF0, |
| 263 | LAYER_CHANGE_DEFAULT = 0xFF | 272 | LAYER_SET_DEFAULT_ON_PRESS = 0xFD, |
| 273 | LAYER_SET_DEFAULT_ON_RELEASE = 0xFE, | ||
| 274 | LAYER_SET_DEFAULT_ON_BOTH = 0xFF | ||
| 264 | }; | 275 | }; |
| 265 | enum layer_vals_default { | ||
| 266 | DEFAULT_ON_PRESS = 1, | ||
| 267 | DEFAULT_ON_RELEASE = 2, | ||
| 268 | DEFAULT_ON_BOTH = 3, | ||
| 269 | }; | ||
| 270 | |||
| 271 | /* | 276 | /* |
| 272 | * return to default layer | 277 | * Default layer |
| 278 | */ | ||
| 279 | /* set default layer */ | ||
| 280 | #define ACTION_LAYER_SET_DEFAULT(layer) ACTION_LAYER_SET_DEFAULT_R(layer) | ||
| 281 | #define ACTION_LAYER_SET_DEFAULT_P(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_SET_DEFAULT_ON_PRESS) | ||
| 282 | #define ACTION_LAYER_SET_DEFAULT_R(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_SET_DEFAULT_ON_RELEASE) | ||
| 283 | #define ACTION_LAYER_SET_DEFAULT_B(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_SET_DEFAULT_ON_BOTH) | ||
| 284 | /* bit-xor default layer */ | ||
| 285 | #define ACTION_LAYER_BIT_DEFAULT(bits) ACTION_LAYER_BIT_DEFAULT_R(bits) | ||
| 286 | #define ACTION_LAYER_BIT_DEFAULT_P(bits) ACTION(ACT_LAYER, (bits)<<8 | LAYER_SET_DEFAULT_ON_PRESS) | ||
| 287 | #define ACTION_LAYER_BIT_DEFAULT_R(bits) ACTION(ACT_LAYER, (bits)<<8 | LAYER_SET_DEFAULT_ON_RELEASE) | ||
| 288 | #define ACTION_LAYER_BIT_DEFAULT_B(bits) ACTION(ACT_LAYER, (bits)<<8 | LAYER_SET_DEFAULT_ON_BOTH) | ||
| 289 | /* | ||
| 290 | * Current layer: Return to default layer | ||
| 273 | */ | 291 | */ |
| 274 | #define ACTION_LAYER_DEFAULT ACTION_LAYER_DEFAULT_R | 292 | #define ACTION_LAYER_DEFAULT ACTION_LAYER_DEFAULT_R |
| 275 | /* set default layer on press */ | 293 | #define ACTION_LAYER_DEFAULT_P ACTION_LAYER_SET_P(0) |
| 276 | #define ACTION_LAYER_DEFAULT_P ACTION(ACT_LAYER, DEFAULT_ON_PRESS<<8 | LAYER_DEFAULT) | 294 | #define ACTION_LAYER_DEFAULT_R ACTION_LAYER_SET_R(0) |
| 277 | /* set default layer on release */ | 295 | #define ACTION_LAYER_DEFAULT_B ACTION_LAYER_SET_B(0) |
| 278 | #define ACTION_LAYER_DEFAULT_R ACTION(ACT_LAYER, DEFAULT_ON_RELEASE<<8 | LAYER_DEFAULT) | ||
| 279 | /* change default layer and set layer */ | ||
| 280 | |||
| 281 | /* | 296 | /* |
| 282 | * Set layer | 297 | * Current layer: Set |
| 283 | */ | 298 | */ |
| 284 | /* set layer on press and none on release */ | ||
| 285 | #define ACTION_LAYER_SET(layer) ACTION_LAYER_SET_P(layer) | 299 | #define ACTION_LAYER_SET(layer) ACTION_LAYER_SET_P(layer) |
| 286 | /* set layer on press and set default on release (This is needed by legacy keymap support.) */ | ||
| 287 | #define ACTION_LAYER_SET_MOMENTARY(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_MOMENTARY) | 300 | #define ACTION_LAYER_SET_MOMENTARY(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_MOMENTARY) |
| 288 | /* set layer on press and none on release */ | ||
| 289 | #define ACTION_LAYER_SET_TOGGLE(layer) ACTION_LAYER_SET_R(layer) | 301 | #define ACTION_LAYER_SET_TOGGLE(layer) ACTION_LAYER_SET_R(layer) |
| 290 | /* set layer while hold and send key on tap */ | ||
| 291 | #define ACTION_LAYER_SET_TAP_KEY(layer, key) ACTION(ACT_LAYER, (layer)<<8 | (key)) | ||
| 292 | /* set layer on press */ | ||
| 293 | #define ACTION_LAYER_SET_P(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_ON_PRESS) | 302 | #define ACTION_LAYER_SET_P(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_ON_PRESS) |
| 294 | /* set layer on release */ | ||
| 295 | #define ACTION_LAYER_SET_R(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_ON_RELEASE) | 303 | #define ACTION_LAYER_SET_R(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_ON_RELEASE) |
| 296 | /* set layer on hold and toggle on several taps */ | 304 | #define ACTION_LAYER_SET_B(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_ON_BOTH) |
| 297 | #define ACTION_LAYER_SET_TAP_TOGGLE(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_TAP_TOGGLE) | 305 | #define ACTION_LAYER_SET_TAP_TOGGLE(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_TAP_TOGGLE) |
| 298 | /* set default layer on both press and release */ | 306 | #define ACTION_LAYER_SET_TAP_KEY(layer, key) ACTION(ACT_LAYER, (layer)<<8 | (key)) |
| 299 | #define ACTION_LAYER_SET_DEFAULT(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_CHANGE_DEFAULT) | ||
| 300 | |||
| 301 | /* | 307 | /* |
| 302 | * Bit-op layer | 308 | * Current layer: Bit-op |
| 303 | */ | 309 | */ |
| 304 | /* bit-xor on both press and release */ | ||
| 305 | #define ACTION_LAYER_BIT(bits) ACTION_LAYER_BIT_MOMENTARY(bits) | 310 | #define ACTION_LAYER_BIT(bits) ACTION_LAYER_BIT_MOMENTARY(bits) |
| 306 | #define ACTION_LAYER_BIT_MOMENTARY(bits) ACTION(ACT_LAYER_BIT, (bits)<<8 | LAYER_MOMENTARY) | 311 | #define ACTION_LAYER_BIT_MOMENTARY(bits) ACTION(ACT_LAYER_BIT, (bits)<<8 | LAYER_MOMENTARY) |
| 307 | /* bit-xor on press */ | ||
| 308 | #define ACTION_LAYER_BIT_TOGGLE(bits) ACTION_LAYER_BIT_R(bits) | 312 | #define ACTION_LAYER_BIT_TOGGLE(bits) ACTION_LAYER_BIT_R(bits) |
| 309 | /* bit-xor while hold and send key on tap */ | ||
| 310 | #define ACTION_LAYER_BIT_TAP_KEY(bits, key) ACTION(ACT_LAYER_BIT, (bits)<<8 | (key)) | ||
| 311 | /* bit-xor on press */ | ||
| 312 | #define ACTION_LAYER_BIT_P(bits) ACTION(ACT_LAYER_BIT, (bits)<<8 | LAYER_ON_PRESS) | 313 | #define ACTION_LAYER_BIT_P(bits) ACTION(ACT_LAYER_BIT, (bits)<<8 | LAYER_ON_PRESS) |
| 313 | /* bit-xor on release */ | ||
| 314 | #define ACTION_LAYER_BIT_R(bits) ACTION(ACT_LAYER_BIT, (bits)<<8 | LAYER_ON_RELEASE) | 314 | #define ACTION_LAYER_BIT_R(bits) ACTION(ACT_LAYER_BIT, (bits)<<8 | LAYER_ON_RELEASE) |
| 315 | /* bit-xor while hold and toggle on several taps */ | 315 | #define ACTION_LAYER_BIT_B(bits) ACTION(ACT_LAYER_BIT, (bits)<<8 | LAYER_ON_BOTH) |
| 316 | #define ACTION_LAYER_BIT_TAP_TOGGLE(bits) ACTION(ACT_LAYER_BIT, (bits)<<8 | LAYER_TAP_TOGGLE) | 316 | #define ACTION_LAYER_BIT_TAP_TOGGLE(bits) ACTION(ACT_LAYER_BIT, (bits)<<8 | LAYER_TAP_TOGGLE) |
| 317 | /* bit-xor default layer and set layer */ | 317 | #define ACTION_LAYER_BIT_TAP_KEY(bits, key) ACTION(ACT_LAYER_BIT, (bits)<<8 | (key)) |
| 318 | #define ACTION_LAYER_BIT_DEFAULT(bits) ACTION(ACT_LAYER, (bits)<<8 | LAYER_CHANGE_DEFAULT) | 318 | /* |
| 319 | * Layer Stack | ||
| 320 | */ | ||
| 321 | /* momentary */ | ||
| 322 | #define ACTION_LAYER_STACK(layer) ACTION_LAYER_STACK_MOMENTARY(layer) | ||
| 323 | #define ACTION_LAYER_STACK_MOMENTARY(layer) ACTION(ACT_LAYER_STACK, (layer)<<8 | LAYER_MOMENTARY) | ||
| 324 | #define ACTION_LAYER_STACK_TOGGLE(layer) ACTION_LAYER_STACK_R(layer) | ||
| 325 | #define ACTION_LAYER_STACK_P(layer) ACTION(ACT_LAYER_STACK, (layer)<<8 | LAYER_ON_PRESS) | ||
| 326 | #define ACTION_LAYER_STACK_R(layer) ACTION(ACT_LAYER_STACK, (layer)<<8 | LAYER_ON_RELEASE) | ||
| 327 | #define ACTION_LAYER_STACK_B(layer) ACTION(ACT_LAYER_STACK, (layer)<<8 | LAYER_ON_BOTH) | ||
| 328 | #define ACTION_LAYER_STACK_TAP_TOGGLE(layer) ACTION(ACT_LAYER_STACK, (layer)<<8 | LAYER_TAP_TOGGLE) | ||
| 329 | #define ACTION_LAYER_STACK_TAP_KEY(layer, key) ACTION(ACT_LAYER_STACK, (layer)<<8 | (key)) | ||
| 319 | 330 | ||
| 320 | 331 | ||
| 321 | /* HID Usage */ | 332 | /* |
| 333 | * HID Usage | ||
| 334 | */ | ||
| 322 | enum usage_pages { | 335 | enum usage_pages { |
| 323 | PAGE_SYSTEM, | 336 | PAGE_SYSTEM, |
| 324 | PAGE_CONSUMER | 337 | PAGE_CONSUMER |
diff --git a/common/command.c b/common/command.c index 7bb2a23f1..c5b9f0431 100644 --- a/common/command.c +++ b/common/command.c | |||
| @@ -27,6 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 27 | #include "keyboard.h" | 27 | #include "keyboard.h" |
| 28 | #include "bootloader.h" | 28 | #include "bootloader.h" |
| 29 | #include "command.h" | 29 | #include "command.h" |
| 30 | #include "layer_stack.h" | ||
| 31 | |||
| 30 | #ifdef MOUSEKEY_ENABLE | 32 | #ifdef MOUSEKEY_ENABLE |
| 31 | #include "mousekey.h" | 33 | #include "mousekey.h" |
| 32 | #endif | 34 | #endif |
| @@ -53,7 +55,7 @@ static void mousekey_console_help(void); | |||
| 53 | #endif | 55 | #endif |
| 54 | 56 | ||
| 55 | static uint8_t numkey2num(uint8_t code); | 57 | static uint8_t numkey2num(uint8_t code); |
| 56 | static void switch_layer(uint8_t layer); | 58 | static void switch_default_layer(uint8_t layer); |
| 57 | 59 | ||
| 58 | 60 | ||
| 59 | typedef enum { ONESHOT, CONSOLE, MOUSEKEY } cmdstate_t; | 61 | typedef enum { ONESHOT, CONSOLE, MOUSEKEY } cmdstate_t; |
| @@ -261,18 +263,16 @@ static bool command_common(uint8_t code) | |||
| 261 | #endif | 263 | #endif |
| 262 | break; | 264 | break; |
| 263 | #endif | 265 | #endif |
| 266 | case KC_ESC: | ||
| 267 | case KC_GRV: | ||
| 264 | case KC_0: | 268 | case KC_0: |
| 265 | case KC_F10: | 269 | switch_default_layer(0); |
| 266 | clear_keyboard(); | ||
| 267 | switch_layer(0); | ||
| 268 | break; | 270 | break; |
| 269 | case KC_1 ... KC_9: | 271 | case KC_1 ... KC_9: |
| 270 | clear_keyboard(); | 272 | switch_default_layer((code - KC_1) + 1); |
| 271 | switch_layer((code - KC_1) + 1); | ||
| 272 | break; | 273 | break; |
| 273 | case KC_F1 ... KC_F9: | 274 | case KC_F1 ... KC_F12: |
| 274 | clear_keyboard(); | 275 | switch_default_layer((code - KC_F1) + 1); |
| 275 | switch_layer((code - KC_F1) + 1); | ||
| 276 | break; | 276 | break; |
| 277 | default: | 277 | default: |
| 278 | print("?"); | 278 | print("?"); |
| @@ -541,11 +541,14 @@ static uint8_t numkey2num(uint8_t code) | |||
| 541 | return 0; | 541 | return 0; |
| 542 | } | 542 | } |
| 543 | 543 | ||
| 544 | static void switch_layer(uint8_t layer) | 544 | static void switch_default_layer(uint8_t layer) |
| 545 | { | 545 | { |
| 546 | print_val_hex8(current_layer); | 546 | print_val_hex8(current_layer); |
| 547 | print_val_hex8(default_layer); | 547 | print_val_hex8(default_layer); |
| 548 | current_layer = layer; | ||
| 549 | default_layer = layer; | ||
| 550 | print("switch to "); print_val_hex8(layer); | 548 | print("switch to "); print_val_hex8(layer); |
| 549 | |||
| 550 | default_layer = layer; | ||
| 551 | current_layer = 0; /* 0 means default_layer */ | ||
| 552 | layer_stack_clear(); | ||
| 553 | clear_keyboard(); | ||
| 551 | } | 554 | } |
diff --git a/common/layer_stack.c b/common/layer_stack.c new file mode 100644 index 000000000..0076bf779 --- /dev/null +++ b/common/layer_stack.c | |||
| @@ -0,0 +1,108 @@ | |||
| 1 | #include <stdint.h> | ||
| 2 | #include "keyboard.h" | ||
| 3 | #include "layer_stack.h" | ||
| 4 | #include "debug.h" | ||
| 5 | |||
| 6 | |||
| 7 | static uint8_t top_layer = 0; | ||
| 8 | |||
| 9 | /* [0] always works as sentinel and not used for store.*/ | ||
| 10 | static layer_item_t layer_stack[LAYER_STACK_SIZE] = {}; | ||
| 11 | |||
| 12 | |||
| 13 | void layer_stack_clear(void) | ||
| 14 | { | ||
| 15 | for (uint8_t i = 0; i < LAYER_STACK_SIZE; i++) { | ||
| 16 | layer_stack[i] = (layer_item_t){ .layer = 0, | ||
| 17 | .next = 0, | ||
| 18 | .used = false }; | ||
| 19 | } | ||
| 20 | } | ||
| 21 | |||
| 22 | bool layer_stack_push(uint8_t layer) | ||
| 23 | { | ||
| 24 | for (uint8_t i = 1; i < LAYER_STACK_SIZE; i++) { | ||
| 25 | if (!layer_stack[i].used) { | ||
| 26 | layer_stack[i] = (layer_item_t){ .layer = layer, | ||
| 27 | .next = top_layer, | ||
| 28 | .used = true }; | ||
| 29 | top_layer = i; | ||
| 30 | return true; | ||
| 31 | } | ||
| 32 | } | ||
| 33 | return false; | ||
| 34 | } | ||
| 35 | |||
| 36 | bool layer_stack_pop(void) | ||
| 37 | { | ||
| 38 | if (layer_stack[top_layer].used) { | ||
| 39 | uint8_t popped = top_layer; | ||
| 40 | top_layer = layer_stack[popped].next; | ||
| 41 | layer_stack[popped] = (layer_item_t){}; | ||
| 42 | return true; | ||
| 43 | } | ||
| 44 | return false; | ||
| 45 | } | ||
| 46 | |||
| 47 | bool layer_stack_remove(uint8_t layer) | ||
| 48 | { | ||
| 49 | if (layer_stack[top_layer].used && layer_stack[top_layer].layer == layer) { | ||
| 50 | layer_stack_pop(); | ||
| 51 | debug("layer_stack_remove: top_layer\n"); | ||
| 52 | return true; | ||
| 53 | } | ||
| 54 | |||
| 55 | for (uint8_t i = top_layer; layer_stack[i].used; i = layer_stack[i].next) { | ||
| 56 | debug("layer_stack_remove: ["); debug_dec(i); debug("]"); | ||
| 57 | debug_dec(layer_stack[i].layer); debug("\n"); | ||
| 58 | uint8_t removed = layer_stack[i].next; | ||
| 59 | if (layer_stack[removed].used && layer_stack[removed].layer == layer) { | ||
| 60 | layer_stack[i].next = layer_stack[removed].next; | ||
| 61 | layer_stack[removed] = (layer_item_t){}; | ||
| 62 | debug("layer_stack_remove: removed.\n"); | ||
| 63 | return true; | ||
| 64 | } | ||
| 65 | } | ||
| 66 | return false; | ||
| 67 | } | ||
| 68 | |||
| 69 | bool layer_stack_remove_then_push(uint8_t layer) | ||
| 70 | { | ||
| 71 | layer_stack_remove(layer); | ||
| 72 | return layer_stack_push(layer); | ||
| 73 | } | ||
| 74 | |||
| 75 | bool layer_stack_remove_or_push(uint8_t layer) | ||
| 76 | { | ||
| 77 | return (layer_stack_remove(layer)) || layer_stack_push(layer); | ||
| 78 | } | ||
| 79 | |||
| 80 | void layer_stack_debug(void) | ||
| 81 | { | ||
| 82 | debug("layer_stack: "); | ||
| 83 | layer_item_t item = layer_stack[top_layer]; | ||
| 84 | while (item.used) { | ||
| 85 | debug_dec(item.layer); | ||
| 86 | debug("["); debug_dec(item.next); debug("] "); | ||
| 87 | item = layer_stack[item.next]; | ||
| 88 | } | ||
| 89 | debug("\n"); | ||
| 90 | } | ||
| 91 | |||
| 92 | action_t layer_stack_get_action(key_t key) | ||
| 93 | { | ||
| 94 | action_t action; | ||
| 95 | action.code = ACTION_TRANSPARENT; | ||
| 96 | |||
| 97 | /* layer stack */ | ||
| 98 | for (layer_item_t i = layer_stack[top_layer]; i.used; i = layer_stack[i.next]) { | ||
| 99 | action = action_for_key(i.layer, key); | ||
| 100 | if (action.code != ACTION_TRANSPARENT) { | ||
| 101 | layer_stack_debug(); | ||
| 102 | debug("layer_stack: used. "); debug_dec(i.layer); debug("\n"); | ||
| 103 | return action; | ||
| 104 | } | ||
| 105 | debug("layer_stack: through. "); debug_dec(i.layer); debug("\n"); | ||
| 106 | } | ||
| 107 | return action; | ||
| 108 | } | ||
diff --git a/common/layer_stack.h b/common/layer_stack.h new file mode 100644 index 000000000..25bf37a5b --- /dev/null +++ b/common/layer_stack.h | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2013 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | #ifndef LAYER_STACK_H | ||
| 18 | #define LAYER_STACK_H | ||
| 19 | |||
| 20 | #include <stdint.h> | ||
| 21 | #include "action.h" | ||
| 22 | |||
| 23 | |||
| 24 | /* | ||
| 25 | * Layer stack | ||
| 26 | */ | ||
| 27 | #define LAYER_STACK_SIZE 8 | ||
| 28 | typedef struct { | ||
| 29 | uint8_t layer:4; | ||
| 30 | uint8_t next:3; | ||
| 31 | bool used; | ||
| 32 | } layer_item_t; | ||
| 33 | |||
| 34 | |||
| 35 | void layer_stack_clear(void); | ||
| 36 | bool layer_stack_push(uint8_t layer); | ||
| 37 | bool layer_stack_pop(void); | ||
| 38 | bool layer_stack_remove(uint8_t layer); | ||
| 39 | bool layer_stack_remove_then_push(uint8_t layer); | ||
| 40 | bool layer_stack_remove_or_push(uint8_t layer); | ||
| 41 | void layer_stack_debug(void); | ||
| 42 | action_t layer_stack_get_action(key_t key); | ||
| 43 | |||
| 44 | #endif | ||
| 45 | |||
diff --git a/keyboard/gh60/Makefile.lufa b/keyboard/gh60/Makefile.lufa index c8d3fa494..7548d4785 100644 --- a/keyboard/gh60/Makefile.lufa +++ b/keyboard/gh60/Makefile.lufa | |||
| @@ -124,3 +124,6 @@ plain: all | |||
| 124 | 124 | ||
| 125 | poker: OPT_DEFS += -DKEYMAP_POKER | 125 | poker: OPT_DEFS += -DKEYMAP_POKER |
| 126 | poker: all | 126 | poker: all |
| 127 | |||
| 128 | poker_stack: OPT_DEFS += -DKEYMAP_POKER_STACK | ||
| 129 | poker_stack: all | ||
diff --git a/keyboard/gh60/Makefile.pjrc b/keyboard/gh60/Makefile.pjrc index f253704fa..8bca1659b 100644 --- a/keyboard/gh60/Makefile.pjrc +++ b/keyboard/gh60/Makefile.pjrc | |||
| @@ -94,3 +94,6 @@ plain: all | |||
| 94 | 94 | ||
| 95 | poker: OPT_DEFS += -DKEYMAP_POKER | 95 | poker: OPT_DEFS += -DKEYMAP_POKER |
| 96 | poker: all | 96 | poker: all |
| 97 | |||
| 98 | poker_stack: OPT_DEFS += -DKEYMAP_POKER_STACK | ||
| 99 | poker_stack: all | ||
diff --git a/keyboard/gh60/keymap.c b/keyboard/gh60/keymap.c index a17c11fc3..9438782f2 100644 --- a/keyboard/gh60/keymap.c +++ b/keyboard/gh60/keymap.c | |||
| @@ -64,6 +64,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 64 | #include "keymap_plain.h" | 64 | #include "keymap_plain.h" |
| 65 | #elif defined(KEYMAP_POKER) | 65 | #elif defined(KEYMAP_POKER) |
| 66 | #include "keymap_poker.h" | 66 | #include "keymap_poker.h" |
| 67 | #elif defined(KEYMAP_POKER_STACK) | ||
| 68 | #include "keymap_poker_stack.h" | ||
| 67 | #else | 69 | #else |
| 68 | static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 70 | static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 69 | /* | 71 | /* |
diff --git a/keyboard/gh60/keymap_poker.h b/keyboard/gh60/keymap_poker.h index 186020b3b..7dc4efe01 100644 --- a/keyboard/gh60/keymap_poker.h +++ b/keyboard/gh60/keymap_poker.h | |||
| @@ -48,31 +48,52 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 48 | /* Layer x100: Poker Default + Fn'd */ | 48 | /* Layer x100: Poker Default + Fn'd */ |
| 49 | KEYMAP_ANSI( | 49 | KEYMAP_ANSI( |
| 50 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ | 50 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ |
| 51 | TRNS,FN1, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ | 51 | CAPS,FN1, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ |
| 52 | TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \ | 52 | TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \ |
| 53 | TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, TRNS, \ | 53 | TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, TRNS, \ |
| 54 | TRNS,TRNS,TRNS, FN0, FN2, TRNS,TRNS,TRNS), | 54 | TRNS,TRNS,TRNS, FN0, FN2, TRNS,TRNS,TRNS), |
| 55 | /* Layer x101: Poker with Arrow + Fn'd */ | 55 | /* Layer x101: Poker with Arrow + Fn'd */ |
| 56 | KEYMAP_ANSI( | 56 | KEYMAP_ANSI( |
| 57 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ | 57 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ |
| 58 | TRNS,FN1, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ | 58 | CAPS,FN1, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ |
| 59 | TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \ | 59 | TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \ |
| 60 | TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, UP, \ | 60 | TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, PGUP, \ |
| 61 | TRNS,TRNS,TRNS, FN0, FN2, LEFT,DOWN,RGHT), | 61 | TRNS,TRNS,TRNS, FN0, FN2, HOME,PGDN,END), |
| 62 | /* Layer x110: Poker with Esc + Fn'd */ | 62 | /* Layer x110: Poker with Esc + Fn'd */ |
| 63 | KEYMAP_ANSI( | 63 | KEYMAP_ANSI( |
| 64 | GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ | 64 | GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ |
| 65 | TRNS,FN1, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ | 65 | CAPS,FN1, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ |
| 66 | TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \ | 66 | TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \ |
| 67 | TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, TRNS, \ | 67 | TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, TRNS, \ |
| 68 | TRNS,TRNS,TRNS, FN0, FN2, TRNS,TRNS,TRNS), | 68 | TRNS,TRNS,TRNS, FN0, FN2, TRNS,TRNS,TRNS), |
| 69 | /* Layer x111: Poker with Arrow and Esc + Fn'd */ | 69 | /* Layer x111: Poker with Arrow and Esc + Fn'd */ |
| 70 | KEYMAP_ANSI( | 70 | KEYMAP_ANSI( |
| 71 | GRV, F9, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ | 71 | GRV, F9, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ |
| 72 | TRNS,FN1, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ | 72 | CAPS,FN1, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ |
| 73 | TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \ | 73 | TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \ |
| 74 | TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, UP, \ | 74 | TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, PGUP, \ |
| 75 | TRNS,TRNS,TRNS, FN0, FN2, LEFT,DOWN,RGHT), | 75 | TRNS,TRNS,TRNS, FN0, FN2, HOME,PGDN,END), |
| 76 | /* colemak */ | ||
| 77 | [8] = KEYMAP_ANSI( | ||
| 78 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ | ||
| 79 | TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC,BSLS, \ | ||
| 80 | BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, ENT, \ | ||
| 81 | LSFT,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RSFT, \ | ||
| 82 | LCTL,LGUI,LALT, SPC, FN2, RGUI,APP, RCTL), | ||
| 83 | /* dvorak */ | ||
| 84 | KEYMAP_ANSI( | ||
| 85 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,BSPC, \ | ||
| 86 | TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, \ | ||
| 87 | LCTL,A, O, E, U, I, D, H, T, N, S, MINS, ENT, \ | ||
| 88 | LSFT,SCLN,Q, J, K, X, B, M, W, V, Z, RSFT, \ | ||
| 89 | LCTL,LGUI,LALT, SPC, FN2, RGUI,APP, RCTL), | ||
| 90 | /* workman */ | ||
| 91 | KEYMAP_ANSI( | ||
| 92 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ | ||
| 93 | TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC,BSLS, \ | ||
| 94 | BSPC,A, S, H, T, G, Y, N, E, O, I, QUOT, ENT, \ | ||
| 95 | LSFT,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RSFT, \ | ||
| 96 | LCTL,LGUI,LALT, SPC, FN2, RGUI,APP, RCTL), | ||
| 76 | }; | 97 | }; |
| 77 | 98 | ||
| 78 | /* | 99 | /* |
diff --git a/keyboard/gh60/keymap_poker_stack.h b/keyboard/gh60/keymap_poker_stack.h new file mode 100644 index 000000000..4c1019352 --- /dev/null +++ b/keyboard/gh60/keymap_poker_stack.h | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 2 | /* | ||
| 3 | * Poker Layer | ||
| 4 | */ | ||
| 5 | /* Layer x000: Poker Default Layer | ||
| 6 | * ,-----------------------------------------------------------. | ||
| 7 | * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | | ||
| 8 | * |-----------------------------------------------------------| | ||
| 9 | * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | ||
| 10 | * |-----------------------------------------------------------| | ||
| 11 | * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | | ||
| 12 | * |-----------------------------------------------------------| | ||
| 13 | * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | | ||
| 14 | * |-----------------------------------------------------------| | ||
| 15 | * |Ctrl|Gui |Alt | Space |Fn |Gui |App |Ctrl| | ||
| 16 | * `-----------------------------------------------------------' | ||
| 17 | */ | ||
| 18 | KEYMAP_ANSI( | ||
| 19 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ | ||
| 20 | TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ | ||
| 21 | LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \ | ||
| 22 | LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, \ | ||
| 23 | LCTL,LGUI,LALT, SPC, FN2, RGUI,APP, RCTL), | ||
| 24 | /* Layer 1: Poker with Arrow */ | ||
| 25 | KEYMAP_ANSI( | ||
| 26 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ | ||
| 27 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ | ||
| 28 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ | ||
| 29 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \ | ||
| 30 | TRNS,TRNS,TRNS, TRNS, TRNS,LEFT,DOWN,RGHT), | ||
| 31 | /* Layer 2: Poker with Esc */ | ||
| 32 | KEYMAP_ANSI( | ||
| 33 | ESC, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ | ||
| 34 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ | ||
| 35 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ | ||
| 36 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ | ||
| 37 | TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), | ||
| 38 | /* Layer 3: Poker Fn'd */ | ||
| 39 | KEYMAP_ANSI( | ||
| 40 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ | ||
| 41 | TRNS,FN1, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ | ||
| 42 | TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \ | ||
| 43 | TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, TRNS, \ | ||
| 44 | TRNS,TRNS,TRNS, FN0, TRNS,TRNS,TRNS,TRNS), | ||
| 45 | /* colemak */ | ||
| 46 | [4] = KEYMAP_ANSI( | ||
| 47 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ | ||
| 48 | TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC,BSLS, \ | ||
| 49 | BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, ENT, \ | ||
| 50 | LSFT,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RSFT, \ | ||
| 51 | LCTL,LGUI,LALT, SPC, FN2, RGUI,APP, RCTL), | ||
| 52 | /* dvorak */ | ||
| 53 | KEYMAP_ANSI( | ||
| 54 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,BSPC, \ | ||
| 55 | TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, \ | ||
| 56 | CAPS,A, O, E, U, I, D, H, T, N, S, MINS, ENT, \ | ||
| 57 | LSFT,SCLN,Q, J, K, X, B, M, W, V, Z, RSFT, \ | ||
| 58 | LCTL,LGUI,LALT, SPC, FN2, RGUI,APP, RCTL), | ||
| 59 | /* workman */ | ||
| 60 | KEYMAP_ANSI( | ||
| 61 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ | ||
| 62 | TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC,BSLS, \ | ||
| 63 | BSPC,A, S, H, T, G, Y, N, E, O, I, QUOT, ENT, \ | ||
| 64 | LSFT,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RSFT, \ | ||
| 65 | LCTL,LGUI,LALT, SPC, FN2, RGUI,APP, RCTL), | ||
| 66 | }; | ||
| 67 | |||
| 68 | /* | ||
| 69 | * Fn action definition | ||
| 70 | */ | ||
| 71 | static const uint16_t PROGMEM fn_actions[] = { | ||
| 72 | /* Poker Layout */ | ||
| 73 | [0] = ACTION_LAYER_STACK_TOGGLE(1), // FN0 Poker Arrow toggle(Space) | ||
| 74 | [1] = ACTION_LAYER_STACK_TOGGLE(2), // FN1 Poker Esc toggle(Q) | ||
| 75 | [2] = ACTION_LAYER_STACK(3), // FN2 Poker Fn | ||
| 76 | [3] = ACTION_RMODS_KEY(MOD_BIT(KC_RCTL)|MOD_BIT(KC_RSFT), KC_ESC), // FN3 Task(RControl,RShift+Esc) | ||
| 77 | }; | ||
| @@ -340,7 +340,8 @@ LST = $(patsubst %.c,$(OBJDIR)/%.lst,$(patsubst %.cpp,$(OBJDIR)/%.lst,$(patsubst | |||
| 340 | 340 | ||
| 341 | 341 | ||
| 342 | # Compiler flags to generate dependency files. | 342 | # Compiler flags to generate dependency files. |
| 343 | GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d | 343 | #GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d |
| 344 | GENDEPFLAGS = -MMD -MP -MF .dep/$(subst /,_,$@).d | ||
| 344 | 345 | ||
| 345 | 346 | ||
| 346 | # Combine all necessary flags and optional flags. | 347 | # Combine all necessary flags and optional flags. |
