]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - tmk_core/common/action_code.h
Ergodox EZ and Atreus 42 key dvorak layout updates (#1964)
[qmk_firmware.git] / tmk_core / common / action_code.h
index 95d2cbf3e460bdaa2f413b16bf7a640d6bac1134..b15aaa0eb34afb952c4aa5fa517b9e18a48d0b8b 100644 (file)
@@ -47,10 +47,15 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  * 0100|10| usage(10)     (reserved)
  * 0100|11| usage(10)     (reserved)
  *
- * ACT_MOUSEKEY(0110): TODO: Not needed?
+ *
+ * ACT_MOUSEKEY(0101): TODO: Merge these two actions to conserve space?
  * 0101|xxxx| keycode     Mouse key
  *
- * 011x|xxxx xxxx xxxx    (reseved)
+ * ACT_SWAP_HANDS(0110):
+ * 0110|xxxx| keycode     Swap hands (keycode on tap, or options)
+ *
+ *
+ * 0111|xxxx xxxx xxxx    (reserved)
  *
  *
  * Layer Actions(10xx)
@@ -67,7 +72,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *   ee:    on event(01:press, 10:release, 11:both)
  *
  * 1001|xxxx|xxxx xxxx   (reserved)
- * 1001|oopp|BBBB BBBB   8-bit Bitwise Operation???
  *
  * ACT_LAYER_TAP(101x):
  * 101E|LLLL| keycode    On/Off with tap key    (0x00-DF)[TAP]
@@ -108,6 +112,8 @@ enum action_kind_id {
     /* Other Keys */
     ACT_USAGE           = 0b0100,
     ACT_MOUSEKEY        = 0b0101,
+    /* One-hand Support */
+    ACT_SWAP_HANDS      = 0b0110,
     /* Layer Actions */
     ACT_LAYER           = 0b1000,
     ACT_LAYER_TAP       = 0b1010, /* Layer  0-15 */
@@ -178,6 +184,11 @@ typedef union {
         uint8_t  opt    :4;
         uint8_t  kind   :4;
     } func;
+    struct action_swap {
+        uint8_t  code   :8;
+        uint8_t  opt   :4;
+        uint8_t  kind   :4;
+    } swap;
 } action_t;
 
 
@@ -296,9 +307,6 @@ enum backlight_opt {
     BACKLIGHT_LEVEL    = 4,
 };
 
-enum command_id {
-    CMD_SWAP_HANDS = 0x14,
-};
 /* Macro */
 #define ACTION_MACRO(id)                ACTION(ACT_MACRO, (id))
 #define ACTION_MACRO_TAP(id)            ACTION(ACT_MACRO, FUNC_TAP<<8 | (id))
@@ -319,6 +327,22 @@ enum function_opts {
 #define ACTION_FUNCTION_TAP(id)         ACTION(ACT_FUNCTION, FUNC_TAP<<8 | (id))
 #define ACTION_FUNCTION_OPT(id, opt)    ACTION(ACT_FUNCTION, (opt)<<8 | (id))
 /* OneHand Support */
-#define ACTION_SWAP_HANDS()             ACTION_COMMAND(CMD_SWAP_HANDS, 0)
+enum swap_hands_pram_tap_op {
+    OP_SH_TOGGLE = 0xF0,
+    OP_SH_TAP_TOGGLE,
+    OP_SH_ON_OFF,
+    OP_SH_OFF_ON,
+    OP_SH_OFF,
+    OP_SH_ON,
+};
+
+#define ACTION_SWAP_HANDS()             ACTION_SWAP_HANDS_ON_OFF()
+#define ACTION_SWAP_HANDS_TOGGLE()      ACTION(ACT_SWAP_HANDS, OP_SH_TOGGLE)
+#define ACTION_SWAP_HANDS_TAP_TOGGLE()  ACTION(ACT_SWAP_HANDS, OP_SH_TAP_TOGGLE)
+#define ACTION_SWAP_HANDS_TAP_KEY(key)  ACTION(ACT_SWAP_HANDS, key)
+#define ACTION_SWAP_HANDS_ON_OFF()      ACTION(ACT_SWAP_HANDS, OP_SH_ON_OFF)
+#define ACTION_SWAP_HANDS_OFF_ON()      ACTION(ACT_SWAP_HANDS, OP_SH_OFF_ON)
+#define ACTION_SWAP_HANDS_ON()          ACTION(ACT_SWAP_HANDS, OP_SH_ON)
+#define ACTION_SWAP_HANDS_OFF()         ACTION(ACT_SWAP_HANDS, OP_SH_OFF)
 
 #endif /* ACTION_CODE_H */