summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authora-chol <a-chol@users.noreply.github.com>2021-08-17 20:52:44 +0200
committerGitHub <noreply@github.com>2021-08-18 04:52:44 +1000
commit75b49aff56436c57a424e622c91f6d80e1d0ecc2 (patch)
tree1968a4e939efef6aec0451d4bc991f4494292e22 /docs
parent7794e97f32fb9dcb07e7fa928cde08691b257fbe (diff)
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>
Diffstat (limited to 'docs')
-rw-r--r--docs/_summary.md1
-rw-r--r--docs/feature_digitizer.md35
2 files changed, 36 insertions, 0 deletions
diff --git a/docs/_summary.md b/docs/_summary.md
index 48115cef46..2f6309e41d 100644
--- a/docs/_summary.md
+++ b/docs/_summary.md
@@ -108,6 +108,7 @@
* [Bluetooth](feature_bluetooth.md)
* [Bootmagic Lite](feature_bootmagic.md)
* [Custom Matrix](custom_matrix.md)
+ * [Digitizer](feature_digitizer.md)
* [DIP Switch](feature_dip_switch.md)
* [Encoders](feature_encoders.md)
* [Haptic Feedback](feature_haptic_feedback.md)
diff --git a/docs/feature_digitizer.md b/docs/feature_digitizer.md
new file mode 100644
index 0000000000..9b6aeddbaa
--- /dev/null
+++ b/docs/feature_digitizer.md
@@ -0,0 +1,35 @@
+## Digitizer
+
+The digitizer HID interface allows setting the mouse cursor position at absolute coordinates, unlike the Pointing Device feature that applies relative displacements.
+
+To enable the digitizer interface, add the following line to your rules.mk:
+
+```makefile
+DIGITIZER_ENABLE = yes
+```
+
+In order to change the mouse cursor position from your keymap.c file, include the digitizer header :
+
+```c
+#include "digitizer.h"
+```
+
+This gives you access to the `digitizer` structure which members allow you to change the cursor position.
+
+The coordinates are normalized, meaning there value must be set between 0 and 1. For the `x` coordinate, the value `0` is the leftmost position, whereas the value `1` is the rightmost position.
+For the `y` coordinate, `0` is at the top and `1` at the bottom.
+
+Here is an example setting the cursor in the middle of the screen:
+
+```c
+digitizer_t digitizer;
+digitizer.x = 0.5;
+digitizer.y = 0.5;
+digitizer.tipswitch = 0;
+digitizer.inrange = 1;
+digitizer_set_report(digitizer);
+```
+
+The `tipswitch` member triggers what equates to a click when set to `1`. The `inrange` member is required for the change in coordinates to be taken. It can then be set to `0` in a new report to signal the end of the digitizer interaction, but it is not strictly required.
+
+Once all members are set to the desired value, the `status` member needs its bitmask `DZ_UPDATED` to be set so the report is sent during the next main loop iteration.