summaryrefslogtreecommitdiff
path: root/app/include/zmk
diff options
context:
space:
mode:
authorPete Johanson <peter@peterjohanson.com>2020-06-22 11:06:01 -0400
committerPete Johanson <peter@peterjohanson.com>2020-06-22 11:06:01 -0400
commit55cf9db564e66e2804f2d3f2201c55c3c86a90d7 (patch)
tree5b3ae3a9631f8e9271a435ed4b3064b1d43f6b71 /app/include/zmk
parent8027be106eef7671604695a1a0f0e2828839ceb3 (diff)
Fix consumer keys w/ refactored behaviors.
Diffstat (limited to 'app/include/zmk')
-rw-r--r--app/include/zmk/endpoints.h3
-rw-r--r--app/include/zmk/events.h4
-rw-r--r--app/include/zmk/hid.h55
-rw-r--r--app/include/zmk/keymap.h4
4 files changed, 21 insertions, 45 deletions
diff --git a/app/include/zmk/endpoints.h b/app/include/zmk/endpoints.h
index 255ca54..624bb4e 100644
--- a/app/include/zmk/endpoints.h
+++ b/app/include/zmk/endpoints.h
@@ -4,5 +4,4 @@
#include <zmk/hid.h>
int zmk_endpoints_init();
-int zmk_endpoints_send_report(enum zmk_hid_report_changes changes);
-int zmk_endpoints_send_key_event(struct zmk_key_event key_event);
+int zmk_endpoints_send_report(u8_t usage_report);
diff --git a/app/include/zmk/events.h b/app/include/zmk/events.h
index 8d1ae6a..5be2beb 100644
--- a/app/include/zmk/events.h
+++ b/app/include/zmk/events.h
@@ -4,8 +4,8 @@
int zmk_events_position_pressed(u32_t position);
int zmk_events_position_released(u32_t position);
-int zmk_events_keycode_pressed(u32_t keycode);
-int zmk_events_keycode_released(u32_t keycode);
+int zmk_events_keycode_pressed(u8_t usage_page, u32_t keycode);
+int zmk_events_keycode_released(u8_t usage_page, u32_t keycode);
int zmk_events_modifiers_pressed(zmk_mod_flags modifiers);
int zmk_events_modifiers_released(zmk_mod_flags modifiers);
int zmk_events_consumer_key_pressed(u32_t usage);
diff --git a/app/include/zmk/hid.h b/app/include/zmk/hid.h
index e14a51a..138606a 100644
--- a/app/include/zmk/hid.h
+++ b/app/include/zmk/hid.h
@@ -108,40 +108,21 @@ static const u8_t zmk_hid_report_desc[] = {
0x00,
/* LOGICAL_MAXIMUM (1) */
HID_GI_LOGICAL_MAX(1),
- 0x01,
- /* USAGE (Scan Next Track) */
- HID_LI_USAGE,
- 0xB5,
- /* USAGE (Scan Previous Track) */
- HID_LI_USAGE,
- 0xB6,
- /* USAGE (Stop) */
- HID_LI_USAGE,
- 0xB7,
- /* USAGE (Eject) */
- HID_LI_USAGE,
- 0xB8,
- /* USAGE (Media Play/Pause) */
- HID_LI_USAGE,
- 0xCD,
- /* USAGE (Mute) */
- HID_LI_USAGE,
- 0xE2,
- /* USAGE (Volume Increment) */
- HID_LI_USAGE,
- 0xE9,
- /* USAGE (Volume Decrement) */
- HID_LI_USAGE,
- 0xEA,
+ 0xFF,
+ HID_LI_USAGE_MIN(1),
+ 0x00,
+ /* USAGE_MAXIMUM (Keyboard Application) */
+ HID_LI_USAGE_MAX(1),
+ 0xFF,
/* INPUT (Data,Ary,Abs) */
- /* REPORT_SIZE (1) */
+ /* REPORT_SIZE (8) */
HID_GI_REPORT_SIZE,
- 0x01,
+ 0x08,
/* REPORT_COUNT (8) */
HID_GI_REPORT_COUNT,
- 0x08,
+ 0x06,
HID_MI_INPUT,
- 0x02,
+ 0x00,
/* END COLLECTION */
HID_MI_COLLECTION_END,
};
@@ -167,7 +148,7 @@ struct zmk_hid_keypad_report
struct zmk_hid_consumer_report_body
{
- u8_t keys;
+ u8_t keys[6];
} __packed;
struct zmk_hid_consumer_report
@@ -176,19 +157,15 @@ struct zmk_hid_consumer_report
struct zmk_hid_consumer_report_body body;
} __packed;
-enum zmk_hid_report_changes
-{
- None = 0x00,
- Keypad = (0x01 << 0x00),
- Consumer = (0x01 << 0x01)
-};
-
int zmk_hid_register_mod(zmk_mod modifier);
int zmk_hid_unregister_mod(zmk_mod modifier);
int zmk_hid_register_mods(zmk_mod_flags modifiers);
int zmk_hid_unregister_mods(zmk_mod_flags modifiers);
-enum zmk_hid_report_changes zmk_hid_press_key(zmk_key key);
-enum zmk_hid_report_changes zmk_hid_release_key(zmk_key key);
+int zmk_hid_keypad_press(zmk_key key);
+int zmk_hid_keypad_release(zmk_key key);
+
+int zmk_hid_consumer_press(zmk_key key);
+int zmk_hid_consumer_release(zmk_key key);
struct zmk_hid_keypad_report *zmk_hid_get_keypad_report();
struct zmk_hid_consumer_report *zmk_hid_get_consumer_report();
diff --git a/app/include/zmk/keymap.h b/app/include/zmk/keymap.h
index 38c1249..4a6bb37 100644
--- a/app/include/zmk/keymap.h
+++ b/app/include/zmk/keymap.h
@@ -1,6 +1,6 @@
#pragma once
-bool zmk_keymap_layer_activate(u8_t layer);
-bool zmk_keymap_layer_deactivate(u8_t layer);
+int zmk_keymap_layer_activate(u8_t layer);
+int zmk_keymap_layer_deactivate(u8_t layer);
int zmk_keymap_position_state_changed(u32_t position, bool pressed);