diff --git a/app/include/dt-bindings/zmk/keys.h b/app/include/dt-bindings/zmk/keys.h index 5f59055e..bd3d217a 100644 --- a/app/include/dt-bindings/zmk/keys.h +++ b/app/include/dt-bindings/zmk/keys.h @@ -5,6 +5,8 @@ */ #pragma once +#include + #define USAGE_KEYPAD 0x07 #define USAGE_CONSUMER 0x0C @@ -143,24 +145,3 @@ #define M_VOLU 0xE9 #define M_VOLD 0xEA -#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) diff --git a/app/include/dt-bindings/zmk/modifiers.h b/app/include/dt-bindings/zmk/modifiers.h new file mode 100644 index 00000000..b49849d0 --- /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/zmk/events/keycode-state-changed.h b/app/include/zmk/events/keycode-state-changed.h index 4ded4e61..26d07ec4 100644 --- a/app/include/zmk/events/keycode-state-changed.h +++ b/app/include/zmk/events/keycode-state-changed.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #include struct keycode_state_changed { diff --git a/app/include/zmk/handlers.h b/app/include/zmk/handlers.h index 7ce1d27e..92bd7e05 100644 --- a/app/include/zmk/handlers.h +++ b/app/include/zmk/handlers.h @@ -6,8 +6,6 @@ #pragma once -#include - #include #include diff --git a/app/src/hid.c b/app/src/hid.c index 001d7d31..1925765c 100644 --- a/app/src/hid.c +++ b/app/src/hid.c @@ -8,7 +8,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include -#include +#include static struct zmk_hid_keypad_report kp_report = { .report_id = 1, .body = {.modifiers = 0, ._reserved = 0, .keys = {0}}}; diff --git a/app/src/usb.c b/app/src/usb.c index d4bc2e41..79d03c7b 100644 --- a/app/src/usb.c +++ b/app/src/usb.c @@ -9,7 +9,6 @@ #include #include -#include #include #include