]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - common/action.c
Added backlight.h, backlight.c
[qmk_firmware.git] / common / action.c
index f7ae85b94182c06b251ab82230a36ad37782ced5..220de0f8a003b65c6530f60ad0997ec0ce9d11f7 100644 (file)
@@ -128,6 +128,17 @@ void process_action(keyrecord_t *record)
                         }
                         break;
     #endif
+                    case MODS_TAP_TOGGLE:
+                        if (event.pressed) {
+                            if (tap_count <= TAPPING_TOGGLE) {
+                                register_mods(mods);
+                            }
+                        } else {
+                            if (tap_count < TAPPING_TOGGLE) {
+                                unregister_mods(mods);
+                            }
+                        }
+                        break;
                     default:
                         if (event.pressed) {
                             if (tap_count > 0) {
@@ -226,6 +237,16 @@ void process_action(keyrecord_t *record)
         case ACT_LAYER_TAP:
         case ACT_LAYER_TAP_EXT:
             switch (action.layer_tap.code) {
+                case 0xe0 ... 0xef:
+                    /* layer On/Off with modifiers(left only) */
+                    if (event.pressed) {
+                        layer_on(action.layer_tap.val);
+                        register_mods(action.layer_tap.code & 0x0f);
+                    } else {
+                        layer_off(action.layer_tap.val);
+                        unregister_mods(action.layer_tap.code & 0x0f);
+                    }
+                    break;
                 case OP_TAP_TOGGLE:
                     /* tap toggle */
                     if (event.pressed) {
@@ -283,7 +304,7 @@ void process_action(keyrecord_t *record)
 #ifdef BACKLIGHT_ENABLE
         case ACT_BACKLIGHT:
             if (!event.pressed) {
-                switch (action.backlight.id) {
+                switch (action.backlight.opt) {
                     case BACKLIGHT_INCREASE:
                         backlight_increase();
                         break;
@@ -296,6 +317,9 @@ void process_action(keyrecord_t *record)
                     case BACKLIGHT_STEP:
                         backlight_step();
                         break;
+                    case BACKLIGHT_LEVEL:
+                        backlight_level(action.backlight.level);
+                        break;
                 }
             }
             break;
@@ -324,7 +348,7 @@ void register_code(uint8_t code)
         return;
     }
 
-#ifdef LOCKING_SUPPORT_ENABLE
+#ifdef LOCKING_SUPPORT_ENABLE    
     else if (KC_LOCKING_CAPS == code) {
 #ifdef LOCKING_RESYNC_ENABLE
         // Resync: ignore if caps lock already is on
@@ -485,13 +509,7 @@ void clear_keyboard_but_mods(void)
 #endif
 }
 
-bool sending_anykey(void)
-{
-    return (has_anykey() || host_mouse_in_use() ||
-            host_last_sysytem_report() || host_last_consumer_report());
-}
-
-bool is_tap_key(key_t key)
+bool is_tap_key(keypos_t key)
 {
     action_t action = layer_switch_get_action(key);