mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-09-29 21:38:47 +02:00
Initial potentiometer support
This commit is contained in:
@@ -123,6 +123,7 @@
|
||||
* [LED Indicators](feature_led_indicators.md)
|
||||
* [MIDI](feature_midi.md)
|
||||
* [Pointing Device](feature_pointing_device.md)
|
||||
* [Potentiometer](feature_potentiometers.md)
|
||||
* [PS/2 Mouse](feature_ps2_mouse.md)
|
||||
* [Split Keyboard](feature_split_keyboard.md)
|
||||
* [Stenography](feature_stenography.md)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Potentiometers
|
||||
|
||||
Add this to your `rules.mk`:
|
||||
|
||||
```make
|
||||
POTENTIOMETER_ENABLE = yes
|
||||
```
|
||||
|
||||
and this to your `config.h`:
|
||||
|
||||
```c
|
||||
#define POTENTIOMETER_PINS { B0 }
|
||||
```
|
||||
|
||||
## Callbacks
|
||||
|
||||
The callback functions can be inserted into your `<keyboard>.c`:
|
||||
|
||||
```c
|
||||
bool potentiometer_update_kb(uint8_t index, uint16_t value) {
|
||||
if (!potentiometer_update_user(index, value)) {
|
||||
midi_send_cc(&midi_device, 2, 0x3E, 0x7F + value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
or `keymap.c`:
|
||||
|
||||
```c
|
||||
bool potentiometer_update_user(uint8_t index, uint16_t value) {
|
||||
midi_send_cc(&midi_device, 2, 0x3E, 0x7F + value);
|
||||
return false;
|
||||
}
|
||||
```
|
||||
@@ -480,6 +480,17 @@ Configures [One Shot keys](one_shot_keys.md).
|
||||
* `timeout`
|
||||
* The amount of time before the key is released in milliseconds.
|
||||
|
||||
## Potentiometer :id=potentiometer
|
||||
|
||||
Configures the [Potentiometer](feature_Potentiometers.md) feature.
|
||||
|
||||
* `potentiometer`
|
||||
* `enabled`
|
||||
* Enable the Potentiometer feature.
|
||||
* Default: `false`
|
||||
* `pins` (Required)
|
||||
* The GPIO pin(s) connected to the Potentiometer(s).
|
||||
|
||||
## PS/2 :id=ps2
|
||||
|
||||
Configures the [PS/2](feature_ps2_mouse.md) feature.
|
||||
|
||||
Reference in New Issue
Block a user