Browse Source

fix hid deprication warnings with crides 6ca7298730859ef2ebab1c970cac7f9550bef14b, add missing method declaration to hog.h

xmkb
Shawn Meier 3 years ago committed by Julia Luna
parent
commit
a6909e8d75
Signed by: xenua
GPG Key ID: 6A0C04FA9A7D7582
  1. 115
      app/include/zmk/hid.h
  2. 1
      app/include/zmk/hog.h
  3. 5
      app/src/mouse/main.c

115
app/include/zmk/hid.h

@ -7,7 +7,8 @@
#pragma once #pragma once
#include <usb/usb_device.h> #include <usb/usb_device.h>
#include <usb/class/usb_hid.h> //#include <usb/class/usb_hid.h>
#include <usb/class/hid.h>
#include <zmk/keys.h> #include <zmk/keys.h>
#include <zmk/mouse.h> #include <zmk/mouse.h>
@ -85,122 +86,86 @@ static const uint8_t zmk_hid_report_desc[] = {
#error "A proper consumer HID report usage range must be selected" #error "A proper consumer HID report usage range must be selected"
#endif #endif
/* REPORT_COUNT (CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE) */ /* REPORT_COUNT (CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE) */
HID_GI_REPORT_COUNT, HID_REPORT_COUNT(CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE),
CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE, HID_INPUT(0x00),
HID_MI_INPUT,
0x00, 0x00,
/* END COLLECTION */ /* END COLLECTION */
HID_MI_COLLECTION_END, HID_END_COLLECTION,
/* USAGE_PAGE (Generic Desktop) */ /* USAGE_PAGE (Generic Desktop) */
HID_GI_USAGE_PAGE, HID_USAGE_PAGE(HID_USAGE_GD),
HID_USAGE_GD,
/* USAGE (Mouse) */ /* USAGE (Mouse) */
HID_LI_USAGE, HID_USAGE(HID_USAGE_GD_MOUSE),
HID_USAGE_GD_MOUSE,
/* COLLECTION (Application) */ /* COLLECTION (Application) */
HID_MI_COLLECTION, HID_COLLECTION(HID_COLLECTION_APPLICATION),
COLLECTION_APPLICATION,
/* REPORT ID (4) */ /* REPORT ID (4) */
HID_GI_REPORT_ID, HID_REPORT_ID(0x04),
0x04,
/* USAGE (Pointer) */ /* USAGE (Pointer) */
HID_LI_USAGE, HID_USAGE(HID_USAGE_GD_POINTER),
HID_USAGE_GD_POINTER,
/* COLLECTION (Physical) */ /* COLLECTION (Physical) */
HID_MI_COLLECTION, HID_COLLECTION(HID_COLLECTION_PHYSICAL),
COLLECTION_PHYSICAL,
/* USAGE_PAGE (Button) */ /* USAGE_PAGE (Button) */
HID_GI_USAGE_PAGE, HID_USAGE_PAGE(HID_USAGE_BUTTON),
HID_USAGE_BUTTON,
/* USAGE_MINIMUM (0x1) (button 1?) */ /* USAGE_MINIMUM (0x1) (button 1?) */
HID_LI_USAGE_MIN(1), HID_USAGE_MIN8(0x01),
0x1,
/* USAGE_MAXIMUM (0x10) (button 5? Buttons up to 8 still work) */ /* USAGE_MAXIMUM (0x10) (button 5? Buttons up to 8 still work) */
HID_LI_USAGE_MAX(1), HID_USAGE_MAX8(0x10),
0x10,
/* LOGICAL_MINIMUM (0) */ /* LOGICAL_MINIMUM (0) */
HID_GI_LOGICAL_MIN(1), HID_LOGICAL_MIN8(0x00),
0x00,
/* LOGICAL_MAXIMUM (1) */ /* LOGICAL_MAXIMUM (1) */
HID_GI_LOGICAL_MAX(1), HID_LOGICAL_MAX8(0x01),
0x01,
/* REPORT_SIZE (1) */ /* REPORT_SIZE (1) */
HID_GI_REPORT_SIZE, HID_REPORT_SIZE(0x01),
0x01,
/* REPORT_COUNT (16) */ /* REPORT_COUNT (16) */
HID_GI_REPORT_COUNT, HID_REPORT_COUNT(0x10),
0x10,
/* INPUT (Data,Var,Abs) */ /* INPUT (Data,Var,Abs) */
HID_MI_INPUT, HID_INPUT(0x02),
0x02,
/* USAGE_PAGE (Generic Desktop) */ /* USAGE_PAGE (Generic Desktop) */
HID_GI_USAGE_PAGE, HID_USAGE_PAGE(HID_USAGE_GD),
HID_USAGE_GD,
/* LOGICAL_MINIMUM (-32767) */ /* LOGICAL_MINIMUM (-32767) */
HID_GI_LOGICAL_MIN(2), HID_LOGICAL_MIN16(0x01, 0x80),
0x01,
0x80,
/* LOGICAL_MAXIMUM (32767) */ /* LOGICAL_MAXIMUM (32767) */
HID_GI_LOGICAL_MAX(2), HID_LOGICAL_MAX16(0xFF, 0x7F),
0xFF,
0x7F,
/* REPORT_SIZE (16) */ /* REPORT_SIZE (16) */
HID_GI_REPORT_SIZE, HID_REPORT_SIZE(0x10),
0x10,
/* REPORT_COUNT (2) */ /* REPORT_COUNT (2) */
HID_GI_REPORT_COUNT, HID_REPORT_COUNT(0x02),
0x02,
/* USAGE (X) */ // Vertical scroll /* USAGE (X) */ // Vertical scroll
HID_LI_USAGE, HID_USAGE(HID_USAGE_GD_X),
HID_USAGE_GD_X,
/* USAGE (Y) */ /* USAGE (Y) */
HID_LI_USAGE, HID_USAGE(HID_USAGE_GD_Y),
HID_USAGE_GD_Y,
/* Input (Data,Var,Rel) */ /* Input (Data,Var,Rel) */
HID_MI_INPUT, HID_INPUT(0x06),
0x06,
/* LOGICAL_MINIMUM (-127) */ /* LOGICAL_MINIMUM (-127) */
HID_GI_LOGICAL_MIN(1), HID_LOGICAL_MIN8(0x81),
0x81,
/* LOGICAL_MAXIMUM (127) */ /* LOGICAL_MAXIMUM (127) */
HID_GI_LOGICAL_MAX(1), HID_LOGICAL_MAX8(0x7F),
0x7F,
/* REPORT_SIZE (8) */ /* REPORT_SIZE (8) */
HID_GI_REPORT_SIZE, HID_REPORT_SIZE(0x08),
0x08,
/* REPORT_COUNT (1) */ /* REPORT_COUNT (1) */
HID_GI_REPORT_COUNT, HID_REPORT_COUNT(0x01),
0x01,
/* USAGE (Wheel) */ /* USAGE (Wheel) */
HID_LI_USAGE, HID_USAGE(HID_USAGE_GD_WHEEL),
HID_USAGE_GD_WHEEL,
/* Input (Data,Var,Rel) */ /* Input (Data,Var,Rel) */
HID_MI_INPUT, HID_INPUT(0x06),
0x06,
/* USAGE_PAGE (Consumer) */ // Horizontal scroll /* USAGE_PAGE (Consumer) */ // Horizontal scroll
HID_GI_USAGE_PAGE, HID_USAGE_PAGE(HID_USAGE_CONSUMER),
HID_USAGE_CONSUMER,
/* USAGE (AC Pan) */ /* USAGE (AC Pan) */
0x0A, 0x0A,
0x38, 0x38,
0x02, 0x02,
/* LOGICAL_MINIMUM (-127) */ /* LOGICAL_MINIMUM (-127) */
HID_GI_LOGICAL_MIN(1), HID_LOGICAL_MIN8(0x81),
0x81,
/* LOGICAL_MAXIMUM (127) */ /* LOGICAL_MAXIMUM (127) */
HID_GI_LOGICAL_MAX(1), HID_LOGICAL_MAX8(0x7F),
0x7F,
/* REPORT_COUNT (1) */ /* REPORT_COUNT (1) */
HID_GI_REPORT_COUNT, HID_REPORT_COUNT(0x01),
0x01,
/* Input (Data,Var,Rel) */ /* Input (Data,Var,Rel) */
HID_MI_INPUT, HID_INPUT(0x06),
0x06,
/* END COLLECTION */ /* END COLLECTION */
HID_MI_COLLECTION_END, HID_END_COLLECTION,
/* END COLLECTION */ /* END COLLECTION */
HID_MI_COLLECTION_END, HID_END_COLLECTION,
}; };
// struct zmk_hid_boot_report // struct zmk_hid_boot_report

1
app/include/zmk/hog.h

@ -14,3 +14,4 @@ int zmk_hog_init();
int zmk_hog_send_keyboard_report(struct zmk_hid_keyboard_report_body *body); int zmk_hog_send_keyboard_report(struct zmk_hid_keyboard_report_body *body);
int zmk_hog_send_consumer_report(struct zmk_hid_consumer_report_body *body); int zmk_hog_send_consumer_report(struct zmk_hid_consumer_report_body *body);
int zmk_hog_send_mouse_report(struct zmk_hid_mouse_report_body *body); int zmk_hog_send_mouse_report(struct zmk_hid_mouse_report_body *body);
int zmk_hog_send_mouse_report_direct(struct zmk_hid_mouse_report_body *body);

5
app/src/mouse/main.c

@ -22,9 +22,10 @@ struct k_work_q *zmk_mouse_work_q() {
int zmk_mouse_init() { int zmk_mouse_init() {
#if IS_ENABLED(CONFIG_ZMK_MOUSE_WORK_QUEUE_DEDICATED) #if IS_ENABLED(CONFIG_ZMK_MOUSE_WORK_QUEUE_DEDICATED)
k_work_q_start(&mouse_work_q, mouse_work_stack_area, k_work_queue_start(&mouse_work_q, mouse_work_stack_area,
K_THREAD_STACK_SIZEOF(mouse_work_stack_area), K_THREAD_STACK_SIZEOF(mouse_work_stack_area),
CONFIG_ZMK_MOUSE_DEDICATED_THREAD_PRIORITY); CONFIG_ZMK_MOUSE_DEDICATED_THREAD_PRIORITY,
NULL);
#endif #endif
return 0; return 0;
} }
Loading…
Cancel
Save