diff options
Diffstat (limited to 'docs/feature_digitizer.md')
-rw-r--r-- | docs/feature_digitizer.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/feature_digitizer.md b/docs/feature_digitizer.md new file mode 100644 index 000000000..9b6aeddba --- /dev/null +++ b/docs/feature_digitizer.md | |||
@@ -0,0 +1,35 @@ | |||
1 | ## Digitizer | ||
2 | |||
3 | The digitizer HID interface allows setting the mouse cursor position at absolute coordinates, unlike the Pointing Device feature that applies relative displacements. | ||
4 | |||
5 | To enable the digitizer interface, add the following line to your rules.mk: | ||
6 | |||
7 | ```makefile | ||
8 | DIGITIZER_ENABLE = yes | ||
9 | ``` | ||
10 | |||
11 | In order to change the mouse cursor position from your keymap.c file, include the digitizer header : | ||
12 | |||
13 | ```c | ||
14 | #include "digitizer.h" | ||
15 | ``` | ||
16 | |||
17 | This gives you access to the `digitizer` structure which members allow you to change the cursor position. | ||
18 | |||
19 | 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. | ||
20 | For the `y` coordinate, `0` is at the top and `1` at the bottom. | ||
21 | |||
22 | Here is an example setting the cursor in the middle of the screen: | ||
23 | |||
24 | ```c | ||
25 | digitizer_t digitizer; | ||
26 | digitizer.x = 0.5; | ||
27 | digitizer.y = 0.5; | ||
28 | digitizer.tipswitch = 0; | ||
29 | digitizer.inrange = 1; | ||
30 | digitizer_set_report(digitizer); | ||
31 | ``` | ||
32 | |||
33 | 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. | ||
34 | |||
35 | 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. | ||