diff options
Diffstat (limited to 'docs/feature_programmable_button.md')
-rw-r--r-- | docs/feature_programmable_button.md | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/docs/feature_programmable_button.md b/docs/feature_programmable_button.md new file mode 100644 index 000000000..b1ef555d1 --- /dev/null +++ b/docs/feature_programmable_button.md | |||
@@ -0,0 +1,74 @@ | |||
1 | ## Programmable Button | ||
2 | |||
3 | Programmable button is a feature that can be used to send keys that have no | ||
4 | predefined meaning. | ||
5 | This means they can be processed on the host side by custom software without | ||
6 | colliding without the operating system trying to interpret these keys. | ||
7 | |||
8 | The keycodes are emitted according to the HID usage | ||
9 | "Telephony Device Page" (0x0B), "Programmable button usage" (0x07). | ||
10 | On Linux (> 5.14) they are handled automatically and translated to `KEY_MACRO#` | ||
11 | keycodes. | ||
12 | (Up to `KEY_MACRO30`) | ||
13 | |||
14 | ### Enabling Programmable Button support | ||
15 | |||
16 | To enable Programmable Button, add the following line to your keymap’s `rules.mk`: | ||
17 | |||
18 | ```c | ||
19 | PROGRAMMABLE_BUTTON_ENABLE = yes | ||
20 | ``` | ||
21 | |||
22 | ### Mapping | ||
23 | |||
24 | In your keymap you can use the following keycodes to map key presses to Programmable Buttons: | ||
25 | |||
26 | |Key |Description | | ||
27 | |------------------------|----------------------| | ||
28 | |`PROGRAMMABLE_BUTTON_1` |Programmable button 1 | | ||
29 | |`PROGRAMMABLE_BUTTON_2` |Programmable button 2 | | ||
30 | |`PROGRAMMABLE_BUTTON_3` |Programmable button 3 | | ||
31 | |`PROGRAMMABLE_BUTTON_4` |Programmable button 4 | | ||
32 | |`PROGRAMMABLE_BUTTON_5` |Programmable button 5 | | ||
33 | |`PROGRAMMABLE_BUTTON_6` |Programmable button 6 | | ||
34 | |`PROGRAMMABLE_BUTTON_7` |Programmable button 7 | | ||
35 | |`PROGRAMMABLE_BUTTON_8` |Programmable button 8 | | ||
36 | |`PROGRAMMABLE_BUTTON_9` |Programmable button 9 | | ||
37 | |`PROGRAMMABLE_BUTTON_10`|Programmable button 10| | ||
38 | |`PROGRAMMABLE_BUTTON_11`|Programmable button 11| | ||
39 | |`PROGRAMMABLE_BUTTON_12`|Programmable button 12| | ||
40 | |`PROGRAMMABLE_BUTTON_13`|Programmable button 13| | ||
41 | |`PROGRAMMABLE_BUTTON_14`|Programmable button 14| | ||
42 | |`PROGRAMMABLE_BUTTON_15`|Programmable button 15| | ||
43 | |`PROGRAMMABLE_BUTTON_16`|Programmable button 16| | ||
44 | |`PROGRAMMABLE_BUTTON_17`|Programmable button 17| | ||
45 | |`PROGRAMMABLE_BUTTON_18`|Programmable button 18| | ||
46 | |`PROGRAMMABLE_BUTTON_19`|Programmable button 19| | ||
47 | |`PROGRAMMABLE_BUTTON_20`|Programmable button 20| | ||
48 | |`PROGRAMMABLE_BUTTON_21`|Programmable button 21| | ||
49 | |`PROGRAMMABLE_BUTTON_22`|Programmable button 22| | ||
50 | |`PROGRAMMABLE_BUTTON_23`|Programmable button 23| | ||
51 | |`PROGRAMMABLE_BUTTON_24`|Programmable button 24| | ||
52 | |`PROGRAMMABLE_BUTTON_25`|Programmable button 25| | ||
53 | |`PROGRAMMABLE_BUTTON_26`|Programmable button 26| | ||
54 | |`PROGRAMMABLE_BUTTON_27`|Programmable button 27| | ||
55 | |`PROGRAMMABLE_BUTTON_28`|Programmable button 28| | ||
56 | |`PROGRAMMABLE_BUTTON_29`|Programmable button 29| | ||
57 | |`PROGRAMMABLE_BUTTON_30`|Programmable button 30| | ||
58 | |`PROGRAMMABLE_BUTTON_31`|Programmable button 31| | ||
59 | |`PROGRAMMABLE_BUTTON_32`|Programmable button 32| | ||
60 | |`PB_1` to `PB_32` |Aliases for keymaps | | ||
61 | |||
62 | ### API | ||
63 | |||
64 | You can also use a dedicated API defined in `programmable_button.h` to interact with this feature: | ||
65 | |||
66 | ``` | ||
67 | void programmable_button_clear(void); | ||
68 | void programmable_button_send(void); | ||
69 | void programmable_button_on(uint8_t code); | ||
70 | void programmable_button_off(uint8_t code); | ||
71 | bool programmable_button_is_on(uint8_t code); | ||
72 | uint32_t programmable_button_get_report(void); | ||
73 | void programmable_button_set_report(uint32_t report); | ||
74 | ``` | ||