-#ifndef NO_ACTION_KEYMAP
- case ACT_KEYMAP:
- switch (action.layer.code) {
- /* Keymap clear */
- case OP_RESET:
- switch (action.layer.val & 0x03) {
- case 0:
- // NOTE: reserved
- overlay_clear();
- keymap_clear();
- break;
- case ON_PRESS:
- if (event.pressed) {
- overlay_clear();
- keymap_clear();
- }
- break;
- case ON_RELEASE:
- if (!event.pressed) {
- overlay_clear();
- keymap_clear();
- }
- break;
- case ON_BOTH:
- overlay_clear();
- keymap_clear();
- break;
- /* NOTE: 4-7 rserved */
- }
- break;
- /* Keymap Reset default layer */
- case (OP_RESET | ON_PRESS):
- if (event.pressed) {
- default_layer_set(action.layer.val);
- }
- break;
- case (OP_RESET | ON_RELEASE):
- if (!event.pressed) {
- default_layer_set(action.layer.val);
- }
- break;
- case (OP_RESET | ON_BOTH):
- default_layer_set(action.layer.val);
- break;
-
- /* Keymap Bit invert */
- case OP_INV:
- /* with tap toggle */
- if (event.pressed) {
- if (tap_count < TAPPING_TOGGLE) {
- debug("KEYMAP_INV: tap toggle(press).\n");
- keymap_invert(action.layer.val);
- }
- } else {
- if (tap_count <= TAPPING_TOGGLE) {
- debug("KEYMAP_INV: tap toggle(release).\n");
- keymap_invert(action.layer.val);
- }
- }
- break;
- case (OP_INV | ON_PRESS):
- if (event.pressed) {
- keymap_invert(action.layer.val);
- }
- break;
- case (OP_INV | ON_RELEASE):
- if (!event.pressed) {
- keymap_invert(action.layer.val);
- }
- break;
- case (OP_INV | ON_BOTH):
- keymap_invert(action.layer.val);
- break;
-
- /* Keymap Bit on */
- case OP_ON:
- if (event.pressed) {
- keymap_on(action.layer.val);
- } else {
- keymap_off(action.layer.val);
- }
- break;
- case (OP_ON | ON_PRESS):
- if (event.pressed) {
- keymap_on(action.layer.val);
- }
- break;
- case (OP_ON | ON_RELEASE):
- if (!event.pressed) {
- keymap_on(action.layer.val);
+#ifndef NO_ACTION_LAYER
+ case ACT_LAYER:
+ if (action.layer_bitop.on == 0) {
+ /* Default Layer Bitwise Operation */
+ if (!event.pressed) {
+ uint8_t shift = action.layer_bitop.part*4;
+ uint32_t bits = ((uint32_t)action.layer_bitop.bits)<<shift;
+ uint32_t mask = (action.layer_bitop.xbit) ? ~(((uint32_t)0xf)<<shift) : 0;
+ switch (action.layer_bitop.op) {
+ case OP_BIT_AND: default_layer_and(bits | mask); break;
+ case OP_BIT_OR: default_layer_or(bits | mask); break;
+ case OP_BIT_XOR: default_layer_xor(bits | mask); break;
+ case OP_BIT_SET: default_layer_and(mask); default_layer_or(bits); break;