summaryrefslogtreecommitdiff
path: root/docs/feature_programmable_button.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/feature_programmable_button.md')
-rw-r--r--docs/feature_programmable_button.md46
1 files changed, 24 insertions, 22 deletions
diff --git a/docs/feature_programmable_button.md b/docs/feature_programmable_button.md
index 091464e19c..1fdf44c29e 100644
--- a/docs/feature_programmable_button.md
+++ b/docs/feature_programmable_button.md
@@ -1,12 +1,14 @@
1# Programmable Button :id=programmable-button 1# Programmable Button {#programmable-button}
2 2
3Programmable Buttons are keys that have no predefined meaning. This means they can be processed on the host side by custom software without the operating system trying to interpret them. 3Programmable Buttons are keys that have no predefined meaning. This means they can be processed on the host side by custom software without the operating system trying to interpret them.
4 4
5The keycodes are emitted according to the HID Telephony Device page (`0x0B`), Programmable Button usage (`0x09`). On Linux (> 5.14) they are handled automatically and translated to `KEY_MACRO#` keycodes (up to `KEY_MACRO30`). 5The keycodes are emitted according to the HID Telephony Device page (`0x0B`), Programmable Button usage (`0x09`). On Linux (> 5.14) they are handled automatically and translated to `KEY_MACRO#` keycodes (up to `KEY_MACRO30`).
6 6
7?> Currently there is no known support in Windows or macOS. It may be possible to write a custom HID driver to receive these usages, but this is out of the scope of the QMK documentation. 7::: tip
8Currently there is no known support in Windows or macOS. It may be possible to write a custom HID driver to receive these usages, but this is out of the scope of the QMK documentation.
9:::
8 10
9## Usage :id=usage 11## Usage {#usage}
10 12
11Add the following to your `rules.mk`: 13Add the following to your `rules.mk`:
12 14
@@ -14,7 +16,7 @@ Add the following to your `rules.mk`:
14PROGRAMMABLE_BUTTON_ENABLE = yes 16PROGRAMMABLE_BUTTON_ENABLE = yes
15``` 17```
16 18
17## Keycodes :id=keycodes 19## Keycodes {#keycodes}
18 20
19|Key |Aliases|Description | 21|Key |Aliases|Description |
20|---------------------------|-------|----------------------| 22|---------------------------|-------|----------------------|
@@ -51,94 +53,94 @@ PROGRAMMABLE_BUTTON_ENABLE = yes
51|`QK_PROGRAMMABLE_BUTTON_31`|`PB_31`|Programmable button 31| 53|`QK_PROGRAMMABLE_BUTTON_31`|`PB_31`|Programmable button 31|
52|`QK_PROGRAMMABLE_BUTTON_32`|`PB_32`|Programmable button 32| 54|`QK_PROGRAMMABLE_BUTTON_32`|`PB_32`|Programmable button 32|
53 55
54## API :id=api 56## API {#api}
55 57
56### `void programmable_button_clear(void)` :id=api-programmable-button-clear 58### `void programmable_button_clear(void)` {#api-programmable-button-clear}
57 59
58Clear the programmable button report. 60Clear the programmable button report.
59 61
60--- 62---
61 63
62### `void programmable_button_add(uint8_t index)` :id=api-programmable-button-add 64### `void programmable_button_add(uint8_t index)` {#api-programmable-button-add}
63 65
64Set the state of a button. 66Set the state of a button.
65 67
66#### Arguments :id=api-programmable-button-add-arguments 68#### Arguments {#api-programmable-button-add-arguments}
67 69
68 - `uint8_t index` 70 - `uint8_t index`
69 The index of the button to press, from 0 to 31. 71 The index of the button to press, from 0 to 31.
70 72
71--- 73---
72 74
73### `void programmable_button_remove(uint8_t index)` :id=api-programmable-button-remove 75### `void programmable_button_remove(uint8_t index)` {#api-programmable-button-remove}
74 76
75Reset the state of a button. 77Reset the state of a button.
76 78
77#### Arguments :id=api-programmable-button-remove-arguments 79#### Arguments {#api-programmable-button-remove-arguments}
78 80
79 - `uint8_t index` 81 - `uint8_t index`
80 The index of the button to release, from 0 to 31. 82 The index of the button to release, from 0 to 31.
81 83
82--- 84---
83 85
84### `void programmable_button_register(uint8_t index)` :id=api-programmable-button-register 86### `void programmable_button_register(uint8_t index)` {#api-programmable-button-register}
85 87
86Set the state of a button, and flush the report. 88Set the state of a button, and flush the report.
87 89
88#### Arguments :id=api-programmable-button-register-arguments 90#### Arguments {#api-programmable-button-register-arguments}
89 91
90 - `uint8_t index` 92 - `uint8_t index`
91 The index of the button to press, from 0 to 31. 93 The index of the button to press, from 0 to 31.
92 94
93--- 95---
94 96
95### `void programmable_button_unregister(uint8_t index)` :id=api-programmable-button-unregister 97### `void programmable_button_unregister(uint8_t index)` {#api-programmable-button-unregister}
96 98
97Reset the state of a button, and flush the report. 99Reset the state of a button, and flush the report.
98 100
99#### Arguments :id=api-programmable-button-unregister-arguments 101#### Arguments {#api-programmable-button-unregister-arguments}
100 102
101 - `uint8_t index` 103 - `uint8_t index`
102 The index of the button to release, from 0 to 31. 104 The index of the button to release, from 0 to 31.
103 105
104--- 106---
105 107
106### `bool programmable_button_is_on(uint8_t index)` :id=api-programmable-button-is-on 108### `bool programmable_button_is_on(uint8_t index)` {#api-programmable-button-is-on}
107 109
108Get the state of a button. 110Get the state of a button.
109 111
110#### Arguments :id=api-programmable-button-is-on-arguments 112#### Arguments {#api-programmable-button-is-on-arguments}
111 113
112 - `uint8_t index` 114 - `uint8_t index`
113 The index of the button to check, from 0 to 31. 115 The index of the button to check, from 0 to 31.
114 116
115#### Return Value :id=api-programmable-button-is-on-return 117#### Return Value {#api-programmable-button-is-on-return}
116 118
117`true` if the button is pressed. 119`true` if the button is pressed.
118 120
119--- 121---
120 122
121### `void programmable_button_flush(void)` :id=api-programmable-button-flush 123### `void programmable_button_flush(void)` {#api-programmable-button-flush}
122 124
123Send the programmable button report to the host. 125Send the programmable button report to the host.
124 126
125--- 127---
126 128
127### `uint32_t programmable_button_get_report(void)` :id=api-programmable-button-get-report 129### `uint32_t programmable_button_get_report(void)` {#api-programmable-button-get-report}
128 130
129Get the programmable button report. 131Get the programmable button report.
130 132
131#### Return Value :id=api-programmable-button-get-report-return 133#### Return Value {#api-programmable-button-get-report-return}
132 134
133The bitmask of programmable button states. 135The bitmask of programmable button states.
134 136
135--- 137---
136 138
137### `void programmable_button_set_report(uint32_t report)` :id=api-programmable-button-set-report 139### `void programmable_button_set_report(uint32_t report)` {#api-programmable-button-set-report}
138 140
139Set the programmable button report. 141Set the programmable button report.
140 142
141#### Arguments :id=api-programmable-button-set-report-arguments 143#### Arguments {#api-programmable-button-set-report-arguments}
142 144
143 - `uint32_t report` 145 - `uint32_t report`
144 A bitmask of programmable button states. 146 A bitmask of programmable button states.