aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/src/endpoints.c
diff options
context:
space:
mode:
authorPete Johanson <[email protected]>2020-06-22 11:06:01 -0400
committerPete Johanson <[email protected]>2020-06-22 11:06:01 -0400
commit55cf9db564e66e2804f2d3f2201c55c3c86a90d7 (patch)
tree5b3ae3a9631f8e9271a435ed4b3064b1d43f6b71 /app/src/endpoints.c
parent8027be106eef7671604695a1a0f0e2828839ceb3 (diff)
downloadzmk-55cf9db564e66e2804f2d3f2201c55c3c86a90d7.tar.gz
zmk-55cf9db564e66e2804f2d3f2201c55c3c86a90d7.zip
Fix consumer keys w/ refactored behaviors.
Diffstat (limited to 'app/src/endpoints.c')
-rw-r--r--app/src/endpoints.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/app/src/endpoints.c b/app/src/endpoints.c
index 2f31e10981..7823e954ae 100644
--- a/app/src/endpoints.c
+++ b/app/src/endpoints.c
@@ -3,6 +3,7 @@
#include <zmk/hid.h>
#include <zmk/usb_hid.h>
#include <zmk/hog.h>
+#
#include <logging/log.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
@@ -35,15 +36,15 @@ int zmk_endpoints_init()
return 0;
}
-int zmk_endpoints_send_report(enum zmk_hid_report_changes report_type)
+int zmk_endpoints_send_report(u8_t usage_page)
{
int err;
struct zmk_hid_keypad_report *keypad_report;
struct zmk_hid_consumer_report *consumer_report;
- LOG_DBG("");
- switch (report_type)
+ LOG_DBG("usage page 0x%02X", usage_page);
+ switch (usage_page)
{
- case Keypad:
+ case USAGE_KEYPAD:
keypad_report = zmk_hid_get_keypad_report();
#ifdef CONFIG_ZMK_USB
if (zmk_usb_hid_send_report((u8_t *)keypad_report, sizeof(struct zmk_hid_keypad_report)) != 0)
@@ -61,7 +62,7 @@ int zmk_endpoints_send_report(enum zmk_hid_report_changes report_type)
#endif /* CONFIG_ZMK_BLE */
break;
- case Consumer:
+ case USAGE_CONSUMER:
consumer_report = zmk_hid_get_consumer_report();
#ifdef CONFIG_ZMK_USB
if (zmk_usb_hid_send_report((u8_t *)consumer_report, sizeof(struct zmk_hid_consumer_report)) != 0)
@@ -80,27 +81,10 @@ int zmk_endpoints_send_report(enum zmk_hid_report_changes report_type)
break;
default:
- LOG_ERR("Unknown report change type %d", report_type);
- return -EINVAL;
+ LOG_ERR("Unsupported usage page %d", usage_page);
+ return -ENOTSUP;
}
return 0;
}
-int zmk_endpoints_send_key_event(struct zmk_key_event key_event)
-{
- enum zmk_hid_report_changes changes;
-
- LOG_DBG("key %d, state %d\n", key_event.key, key_event.pressed);
-
- if (key_event.pressed)
- {
- changes = zmk_hid_press_key(key_event.key);
- }
- else
- {
- changes = zmk_hid_release_key(key_event.key);
- }
-
- return zmk_endpoints_send_report(changes);
-}