diff --git a/app/dts/behaviors/key_press.dtsi b/app/dts/behaviors/key_press.dtsi index 5a01953c..a9e8d8b5 100644 --- a/app/dts/behaviors/key_press.dtsi +++ b/app/dts/behaviors/key_press.dtsi @@ -1,18 +1,19 @@ -#include + +#include / { behaviors { kp: behavior_key_press { compatible = "zmk,behavior-key-press"; label = "KEY_PRESS"; - usage_page = ; + usage_page = ; #binding-cells = <1>; }; cp: behavior_consumer_press { compatible = "zmk,behavior-key-press"; label = "CONSUMER_PRESS"; - usage_page = ; + usage_page = ; #binding-cells = <1>; }; }; diff --git a/app/dts/behaviors/sensor_rotate_key_press.dtsi b/app/dts/behaviors/sensor_rotate_key_press.dtsi index b094be58..fa410f19 100644 --- a/app/dts/behaviors/sensor_rotate_key_press.dtsi +++ b/app/dts/behaviors/sensor_rotate_key_press.dtsi @@ -1,18 +1,19 @@ -#include + +#include / { behaviors { inc_dec_kp: behavior_sensor_rotate_key_press { compatible = "zmk,behavior-sensor-rotate-key-press"; label = "ENC_KEY_PRESS"; - usage_page = ; + usage_page = ; #sensor-binding-cells = <2>; }; inc_dec_cp: behavior_sensor_rotate_consumer_press { compatible = "zmk,behavior-sensor-rotate-key-press"; label = "ENC_CONSUMER_PRESS"; - usage_page = ; + usage_page = ; #sensor-binding-cells = <2>; }; }; diff --git a/app/include/dt-bindings/zmk/hid_usage_pages.h b/app/include/dt-bindings/zmk/hid_usage_pages.h index a551087d..701a100c 100644 --- a/app/include/dt-bindings/zmk/hid_usage_pages.h +++ b/app/include/dt-bindings/zmk/hid_usage_pages.h @@ -10,6 +10,10 @@ #pragma once +/* WARNING: DEPRECATED from dt-bindings/zmk/keys.h */ +#define USAGE_KEYPAD (0x07) // WARNING: DEPRECATED (DO NOT USE) +#define USAGE_CONSUMER (0x0C) // WARNING: DEPRECATED (DO NOT USE) + #define HID_USAGE_GD (0x01) // Generic Desktop #define HID_USAGE_SIM (0x02) // Simulation Controls #define HID_USAGE_VR (0x03) // VR Controls diff --git a/app/include/dt-bindings/zmk/keys.h b/app/include/dt-bindings/zmk/keys.h index 5a52753e..815f86b6 100644 --- a/app/include/dt-bindings/zmk/keys.h +++ b/app/include/dt-bindings/zmk/keys.h @@ -6,10 +6,6 @@ #pragma once #include - -#define USAGE_KEYPAD 0x07 -#define USAGE_CONSUMER 0x0C - #define A 0x04 #define B 0x05 #define C 0x06 diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index ac91e7de..d1901489 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -428,7 +429,7 @@ static int position_state_changed_listener(const struct zmk_event_header *eh) { } static inline bool only_mods(struct keycode_state_changed *ev) { - return ev->usage_page == USAGE_KEYPAD && ev->keycode >= LCTL && ev->keycode <= RGUI; + return ev->usage_page == HID_USAGE_KEY && ev->keycode >= LCTL && ev->keycode <= RGUI; } static int keycode_state_changed_listener(const struct zmk_event_header *eh) { diff --git a/app/src/endpoints.c b/app/src/endpoints.c index 0c795890..9a6967c6 100644 --- a/app/src/endpoints.c +++ b/app/src/endpoints.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -116,9 +117,9 @@ int zmk_endpoints_send_report(u8_t usage_page) { LOG_DBG("usage page 0x%02X", usage_page); switch (usage_page) { - case USAGE_KEYPAD: + case HID_USAGE_KEY: return send_keypad_report(); - case USAGE_CONSUMER: + case HID_USAGE_CONSUMER: return send_consumer_report(); default: LOG_ERR("Unsupported usage page %d", usage_page); @@ -209,8 +210,8 @@ static void disconnect_current_endpoint() { zmk_hid_keypad_clear(); zmk_hid_consumer_clear(); - zmk_endpoints_send_report(USAGE_KEYPAD); - zmk_endpoints_send_report(USAGE_CONSUMER); + zmk_endpoints_send_report(HID_USAGE_KEY); + zmk_endpoints_send_report(HID_USAGE_CONSUMER); } static void update_current_endpoint() { diff --git a/app/src/hid_listener.c b/app/src/hid_listener.c index 32e9d97b..5efb7987 100644 --- a/app/src/hid_listener.c +++ b/app/src/hid_listener.c @@ -13,6 +13,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include #include +#include #include static int hid_listener_keycode_pressed(u8_t usage_page, u32_t keycode, @@ -21,14 +22,14 @@ static int hid_listener_keycode_pressed(u8_t usage_page, u32_t keycode, LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode, implicit_modifiers); switch (usage_page) { - case USAGE_KEYPAD: + case HID_USAGE_KEY: err = zmk_hid_keypad_press(keycode); if (err) { LOG_ERR("Unable to press keycode"); return err; } break; - case USAGE_CONSUMER: + case HID_USAGE_CONSUMER: err = zmk_hid_consumer_press(keycode); if (err) { LOG_ERR("Unable to press keycode"); @@ -46,14 +47,14 @@ static int hid_listener_keycode_released(u8_t usage_page, u32_t keycode, LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode, implicit_modifiers); switch (usage_page) { - case USAGE_KEYPAD: + case HID_USAGE_KEY: err = zmk_hid_keypad_release(keycode); if (err) { LOG_ERR("Unable to release keycode"); return err; } break; - case USAGE_CONSUMER: + case HID_USAGE_CONSUMER: err = zmk_hid_consumer_release(keycode); if (err) { LOG_ERR("Unable to release keycode");