summaryrefslogtreecommitdiff
path: root/app/include/dt-bindings
diff options
context:
space:
mode:
Diffstat (limited to 'app/include/dt-bindings')
-rw-r--r--app/include/dt-bindings/zmk/keys.h12
-rw-r--r--app/include/dt-bindings/zmk/modifiers.h28
-rw-r--r--app/include/dt-bindings/zmk/outputs.h9
3 files changed, 39 insertions, 10 deletions
diff --git a/app/include/dt-bindings/zmk/keys.h b/app/include/dt-bindings/zmk/keys.h
index a3b2229..5a52753 100644
--- a/app/include/dt-bindings/zmk/keys.h
+++ b/app/include/dt-bindings/zmk/keys.h
@@ -3,9 +3,10 @@
*
* SPDX-License-Identifier: MIT
*/
-
#pragma once
+#include <dt-bindings/zmk/modifiers.h>
+
#define USAGE_KEYPAD 0x07
#define USAGE_CONSUMER 0x0C
@@ -143,12 +144,3 @@
#define M_MUTE 0xE2
#define M_VOLU 0xE9
#define M_VOLD 0xEA
-
-#define MOD_LCTL (1 << 0x00)
-#define MOD_LSFT (1 << 0x01)
-#define MOD_LALT (1 << 0x02)
-#define MOD_LGUI (1 << 0x03)
-#define MOD_RCTL (1 << 0x04)
-#define MOD_RSFT (1 << 0x05)
-#define MOD_RALT (1 << 0x06)
-#define MOD_RGUI (1 << 0x07) \ No newline at end of file
diff --git a/app/include/dt-bindings/zmk/modifiers.h b/app/include/dt-bindings/zmk/modifiers.h
new file mode 100644
index 0000000..b49849d
--- /dev/null
+++ b/app/include/dt-bindings/zmk/modifiers.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2020 The ZMK Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+#pragma once
+
+#define MOD_LCTL 0x01
+#define MOD_LSFT 0x02
+#define MOD_LALT 0x04
+#define MOD_LGUI 0x08
+#define MOD_RCTL 0x10
+#define MOD_RSFT 0x20
+#define MOD_RALT 0x40
+#define MOD_RGUI 0x80
+
+#define SELECT_MODS(keycode) (keycode >> 24)
+#define STRIP_MODS(keycode) (keycode & ~(0xFF << 24))
+#define APPLY_MODS(mods, keycode) (mods << 24 | keycode)
+
+#define LC(keycode) APPLY_MODS(MOD_LCTL, keycode)
+#define LS(keycode) APPLY_MODS(MOD_LSFT, keycode)
+#define LA(keycode) APPLY_MODS(MOD_LALT, keycode)
+#define LG(keycode) APPLY_MODS(MOD_LGUI, keycode)
+#define RC(keycode) APPLY_MODS(MOD_RCTL, keycode)
+#define RS(keycode) APPLY_MODS(MOD_RSFT, keycode)
+#define RA(keycode) APPLY_MODS(MOD_RALT, keycode)
+#define RG(keycode) APPLY_MODS(MOD_RGUI, keycode) \ No newline at end of file
diff --git a/app/include/dt-bindings/zmk/outputs.h b/app/include/dt-bindings/zmk/outputs.h
new file mode 100644
index 0000000..f24380f
--- /dev/null
+++ b/app/include/dt-bindings/zmk/outputs.h
@@ -0,0 +1,9 @@
+/*
+ * Copyright (c) 2020 The ZMK Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#define OUT_TOG 0
+#define OUT_USB 1
+#define OUT_BLE 2 \ No newline at end of file