Digitizer HID interface : absolute coordinates for mouse cursor (#12851)

* Add digitizer HID interface for setting the mouse cursor position at
absolute screen coordinates. Tested on Pro Micro, Proton C and
Blackpill.

* Update docs/feature_digitizer.md

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update tmk_core/protocol/usb_descriptor.c

Co-authored-by: Ryan <fauxpark@gmail.com>

* Add missing copyrights
Add V-USB support

* Add support for digitizer dedicated endpoint for lufa and chibios.
Fix formatting issues
Move digitizer_task definition to the feature's base implementation file

* Run cformat on modified files

* Change digitizer report usage to Digitizer instead of Pen to avoid
pointer disappearing on Windows.

* Update tmk_core/protocol/vusb/vusb.c

Co-authored-by: Ryan <fauxpark@gmail.com>

* Run cformat from docker image

* Remove send_digitizer from host_driver_t and instead rely on the
declaration being the interface to the implementation in each
HW-specific usb implementation.

* Fix build : send_digitizer shouldn't be static in vusb and add
weak-linkage implementation for tests without usb implementation

* Change digitizer user interface to match pointing device's

* Update documentation with new API

Co-authored-by: a-chol <nothing@none.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
a-chol
2021-08-17 20:52:44 +02:00
committed by GitHub
parent 7794e97f32
commit 75b49aff56
18 changed files with 435 additions and 6 deletions

View File

@ -135,6 +135,13 @@ typedef struct {
USB_HID_Descriptor_HID_t Joystick_HID;
USB_Descriptor_Endpoint_t Joystick_INEndpoint;
#endif
#if defined(DIGITIZER_ENABLE) && !defined(DIGITIZER_SHARED_EP)
// Digitizer HID Interface
USB_Descriptor_Interface_t Digitizer_Interface;
USB_HID_Descriptor_HID_t Digitizer_HID;
USB_Descriptor_Endpoint_t Digitizer_INEndpoint;
#endif
} USB_Descriptor_Configuration_t;
/*
@ -180,6 +187,10 @@ enum usb_interfaces {
#if defined(JOYSTICK_ENABLE)
JOYSTICK_INTERFACE,
#endif
#if defined(DIGITIZER_ENABLE) && !defined(DIGITIZER_SHARED_EP)
DIGITIZER_INTERFACE,
#endif
TOTAL_INTERFACES
};
@ -226,7 +237,7 @@ enum usb_endpoints {
# if STM32_USB_USE_OTG1
# define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM
# else
CONSOLE_OUT_EPNUM = NEXT_EPNUM,
CONSOLE_OUT_EPNUM = NEXT_EPNUM,
# endif
# else
# define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM
@ -259,6 +270,19 @@ enum usb_endpoints {
JOYSTICK_OUT_EPNUM = NEXT_EPNUM,
# endif
#endif
#ifdef DIGITIZER_ENABLE
# if !defined(DIGITIZER_SHARED_EP)
DIGITIZER_IN_EPNUM = NEXT_EPNUM,
# if STM32_USB_USE_OTG1
DIGITIZER_OUT_EPNUM = DIGITIZER_IN_EPNUM,
# else
DIGITIZER_OUT_EPNUM = NEXT_EPNUM,
# endif
# else
# define DIGITIZER_IN_EPNUM SHARED_IN_EPNUM
# endif
#endif
};
#ifdef PROTOCOL_LUFA
@ -284,5 +308,6 @@ enum usb_endpoints {
#define CDC_NOTIFICATION_EPSIZE 8
#define CDC_EPSIZE 16
#define JOYSTICK_EPSIZE 8
#define DIGITIZER_EPSIZE 8
uint16_t get_usb_descriptor(const uint16_t wValue, const uint16_t wIndex, const void** const DescriptorAddress);