summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjack <0x6A73@pm.me>2023-04-03 10:18:17 -0600
committerGitHub <noreply@github.com>2023-04-03 10:18:17 -0600
commit36ab0c0aaa613fe0946e10133315b071c0d87012 (patch)
treeac87fe394264e2b265ad3db376bb88a91d084898
parent7e48a4e80f4c3975cf0aae68986c7ead2576dcf3 (diff)
Add core/fallback encoder behaviour (#20320)
-rw-r--r--docs/feature_encoders.md14
-rw-r--r--keyboards/acheron/shark/beta/beta.c11
-rw-r--r--keyboards/adafruit/macropad/macropad.c14
-rw-r--r--keyboards/aidansmithdotdev/fine40/fine40.c15
-rw-r--r--keyboards/anavi/knob1/knob1.c12
-rw-r--r--keyboards/anavi/macropad10/macropad10.c16
-rw-r--r--keyboards/ano/ano.c24
-rw-r--r--keyboards/atlantis/ps17/ps17.c17
-rw-r--r--keyboards/bolsa/damapad/damapad.c14
-rw-r--r--keyboards/cannonkeys/balance/balance.c10
-rw-r--r--keyboards/cannonkeys/ortho60v2/ortho60v2.c14
-rw-r--r--keyboards/checkerboards/phoenix45_ortho/phoenix45_ortho.c29
-rw-r--r--keyboards/checkerboards/quark/quark.c29
-rw-r--r--keyboards/checkerboards/quark_squared/quark_squared.c12
-rw-r--r--keyboards/chocofly/chocofly.c16
-rw-r--r--keyboards/ck60i/ck60i.c12
-rw-r--r--keyboards/coban/pad3a/pad3a.c29
-rw-r--r--keyboards/crbn/crbn.c27
-rw-r--r--keyboards/custommk/genesis/rev1/rev1.c38
-rw-r--r--keyboards/custommk/genesis/rev2/rev2.c39
-rw-r--r--keyboards/drhigsby/packrat/packrat.c12
-rw-r--r--keyboards/drop/sense75/sense75.c13
-rw-r--r--keyboards/dumbpad/v3x/v3x.c19
-rw-r--r--keyboards/evolv/evolv.c10
-rw-r--r--keyboards/eyeohdesigns/sprh/sprh.c14
-rw-r--r--keyboards/eyeohdesigns/theboulevard/theboulevard.c14
-rw-r--r--keyboards/ffkeebs/puca/puca.c11
-rw-r--r--keyboards/geistmaschine/geist/geist.c21
-rw-r--r--keyboards/geistmaschine/macropod/macropod.c21
-rw-r--r--keyboards/gmmk/numpad/numpad.c14
-rw-r--r--keyboards/gmmk/pro/pro.c30
-rw-r--r--keyboards/gorthage_truck/gorthage_truck.c12
-rw-r--r--keyboards/handwired/daskeyboard/daskeyboard4/daskeyboard4.c19
-rw-r--r--keyboards/handwired/maverick0197/keydeck8/keydeck8.c33
-rw-r--r--keyboards/handwired/swiftrax/bumblebee/bumblebee.c11
-rw-r--r--keyboards/handwired/swiftrax/digicarp65/digicarp65.c14
-rw-r--r--keyboards/handwired/tsubasa/tsubasa.c14
-rw-r--r--keyboards/io_mini1800/io_mini1800.c14
-rw-r--r--keyboards/jagdpietr/drakon/drakon.c10
-rw-r--r--keyboards/jkeys_design/gentleman65/gentleman65.c12
-rw-r--r--keyboards/jkeys_design/gentleman65_se_s/gentleman65_se_s.c14
-rw-r--r--keyboards/kapcave/arya/arya.c10
-rw-r--r--keyboards/keebio/dsp40/rev1/rev1.c12
-rw-r--r--keyboards/keebsforall/coarse60/coarse60.c12
-rw-r--r--keyboards/keebsforall/freebirdnp/pro/pro.c28
-rw-r--r--keyboards/keychron/v10/v10.c14
-rw-r--r--keyboards/keychron/v6/v6.c14
-rw-r--r--keyboards/keyprez/rhino/rhino.c6
-rw-r--r--keyboards/keyprez/unicorn/unicorn.c14
-rw-r--r--keyboards/keystonecaps/gameroyadvance/gameroyadvance.c28
-rw-r--r--keyboards/kiwikeebs/macro/macro.c12
-rw-r--r--keyboards/kiwikeebs/macro_v2/macro_v2.c12
-rw-r--r--keyboards/kiwikey/borderland/borderland.c14
-rw-r--r--keyboards/kprepublic/bm60hsrgb_ec/rev1/rev1.c14
-rw-r--r--keyboards/kprepublic/bm60hsrgb_ec/rev2/rev2.c14
-rw-r--r--keyboards/latincompass/latinpadble/latinpadble.c10
-rw-r--r--keyboards/ll3macorn/bongopad/bongopad.c16
-rw-r--r--keyboards/lpad/lpad.c18
-rw-r--r--keyboards/lw67/lw67.c13
-rw-r--r--keyboards/lw75/lw75.c15
-rw-r--r--keyboards/lyso1/lck75/lck75.c12
-rw-r--r--keyboards/macro1/macro1.c15
-rw-r--r--keyboards/mechwild/bde/rev2/rev2.c16
-rwxr-xr-xkeyboards/mechwild/mercutio/mercutio.c19
-rw-r--r--keyboards/mechwild/obe/obe.c16
-rw-r--r--keyboards/mechwild/waka60/waka60.c16
-rw-r--r--keyboards/meletrix/zoom65/zoom65.c6
-rw-r--r--keyboards/meletrix/zoom65_lite/zoom65_lite.c8
-rw-r--r--keyboards/metamechs/timberwolf/timberwolf.c10
-rw-r--r--keyboards/mini_elixivy/mini_elixivy.c11
-rw-r--r--keyboards/mk65/mk65.c31
-rw-r--r--keyboards/mwstudio/alicekk/alicekk.c14
-rw-r--r--keyboards/mwstudio/mw80/mw80.c31
-rw-r--r--keyboards/nullbitsco/snap/snap.c14
-rw-r--r--keyboards/onekeyco/dango40/dango40.c10
-rw-r--r--keyboards/orthocode/orthocode.c13
-rw-r--r--keyboards/pauperboards/brick/brick.c31
-rw-r--r--keyboards/pearlboards/atlas/atlas.c14
-rw-r--r--keyboards/pearlboards/pandora/pandora.c18
-rw-r--r--keyboards/pearlboards/zeus/zeus.c17
-rw-r--r--keyboards/pearlboards/zeuspad/zeuspad.c18
-rw-r--r--keyboards/pica40/rev1/rev1.c12
-rw-r--r--keyboards/program_yoink/program_yoink.c29
-rw-r--r--keyboards/rart/rart75hs/rart75hs.c16
-rw-r--r--keyboards/rart/rart75m/rart75m.c16
-rw-r--r--keyboards/rart/rartland/rartland.c16
-rw-r--r--keyboards/reedskeebs/alish40/alish40.c22
-rw-r--r--keyboards/ristretto/ristretto.c12
-rw-r--r--keyboards/rmkeebs/rm_numpad/rm_numpad.c31
-rw-r--r--keyboards/rotr/rotr.c10
-rw-r--r--keyboards/rubi/rubi.c5
-rw-r--r--keyboards/sawnsprojects/krush/krush65/hotswap/hotswap.c14
-rw-r--r--keyboards/sneakbox/aliceclonergb/aliceclonergb.c14
-rw-r--r--keyboards/spacey/spacey.c12
-rw-r--r--keyboards/sthlmkb/litl/litl.c14
-rw-r--r--keyboards/taleguers/taleguers75/taleguers75.c11
-rw-r--r--keyboards/tau4/tau4.c14
-rw-r--r--keyboards/thepanduuh/degenpad/degenpad.c31
-rw-r--r--keyboards/tkc/portico75/portico75.c16
-rwxr-xr-xkeyboards/tominabox1/bigboy/bigboy.c31
-rw-r--r--keyboards/ungodly/nines/nines.c34
-rw-r--r--keyboards/viendi8l/viendi8l.c11
-rw-r--r--keyboards/work_louder/work_board/work_board.c14
-rw-r--r--keyboards/wuque/mammoth75x/mammoth75x.c6
-rw-r--r--keyboards/wuque/serneity65/serneity65.c11
-rw-r--r--keyboards/z12/z12.c23
-rw-r--r--quantum/encoder.c24
107 files changed, 30 insertions, 1759 deletions
diff --git a/docs/feature_encoders.md b/docs/feature_encoders.md
index 1c521a4eff..74857c265d 100644
--- a/docs/feature_encoders.md
+++ b/docs/feature_encoders.md
@@ -102,9 +102,9 @@ Using encoder mapping pumps events through the normal QMK keycode processing pip
## Callbacks
-When not using `ENCODER_MAP_ENABLE = yes`, the callback functions can be inserted into your `<keyboard>.c`:
+?> [**Default Behaviour**](https://github.com/qmk/qmk_firmware/blob/master/quantum/encoder.c#L79-#L98): all encoders installed will function as volume up (`KC_VOLU`) on clockwise rotation and volume down (`KC_VOLD`) on counter-clockwise rotation. If you do not wish to override this, no further configuration is necessary.
-?> Those who are adding new keyboard support where encoders are enabled at the keyboard level should include basic encoder functionality at the keyboard level (`<keyboard>.c`) using the `encoder_update_kb()` function, that way it works for QMK Configuator users and exists in general.
+If you would like the alter the default behaviour, and are not using `ENCODER_MAP_ENABLE = yes`, the callback functions can be inserted into your `<keyboard>.c`:
```c
bool encoder_update_kb(uint8_t index, bool clockwise) {
@@ -113,9 +113,9 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
}
if (index == 0) { /* First encoder */
if (clockwise) {
- tap_code_delay(KC_VOLU, 10);
+ tap_code(KC_PGDN);
} else {
- tap_code_delay(KC_VOLD, 10);
+ tap_code(KC_PGUP);
}
} else if (index == 1) { /* Second encoder */
if (clockwise) {
@@ -134,9 +134,9 @@ or `keymap.c`:
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { /* First encoder */
if (clockwise) {
- tap_code_delay(KC_VOLU, 10);
+ tap_code(KC_PGDN);
} else {
- tap_code_delay(KC_VOLD, 10);
+ tap_code(KC_PGUP);
}
} else if (index == 1) { /* Second encoder */
if (clockwise) {
@@ -149,7 +149,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
}
```
-!> If you return `true` in the keymap level `_user` function, it will allow the keyboard level encoder code to run on top of your own. Returning `false` will override the keyboard level function, if setup correctly. This is generally the safest option to avoid confusion.
+!> If you return `true` in the keymap level `_user` function, it will allow the keyboard/core level encoder code to run on top of your own. Returning `false` will override the keyboard level function, if setup correctly. This is generally the safest option to avoid confusion.
## Hardware
diff --git a/keyboards/acheron/shark/beta/beta.c b/keyboards/acheron/shark/beta/beta.c
index 06fd36f797..5592353ad7 100644
--- a/keyboards/acheron/shark/beta/beta.c
+++ b/keyboards/acheron/shark/beta/beta.c
@@ -20,14 +20,3 @@ void board_init(void) {
setPinInput(B6);
setPinInput(B7);
}
-
-#ifdef ENCODER_ENABLE
-bool encoder_update_kb(uint8_t index, bool clockwise) {
- if(!encoder_update_user(index, clockwise)) return false;
- if (index == 0) {
- if (clockwise) tap_code_delay(KC_VOLU, 10);
- else tap_code_delay(KC_VOLD, 10);
- }
- return true;
-}
-#endif
diff --git a/keyboards/adafruit/macropad/macropad.c b/keyboards/adafruit/macropad/macropad.c
index 5cffdc6c97..819b5067d8 100644
--- a/keyboards/adafruit/macropad/macropad.c
+++ b/keyboards/adafruit/macropad/macropad.c
@@ -40,17 +40,3 @@ led_config_t g_led_config = { {
} };
#endif
-
-#ifdef ENCODER_ENABLE
-bool encoder_update_kb(uint8_t index, bool clockwise) {
- if (!encoder_update_user(index, clockwise)) { return false; }
- if (index == 0) {
- if (clockwise) {
- tap_code_delay(KC_VOLU, 10);
- } else {
- tap_code_delay(KC_VOLD, 10);
- }
- }
- return true;
-}
-#endif
diff --git a/keyboards/aidansmithdotdev/fine40/fine40.c b/keyboards/aidansmithdotdev/fine40/fine40.c
index 0bd190321a..2e60e7c921 100644
--- a/keyboards/aidansmithdotdev/fine40/fine40.c
+++ b/keyboards/aidansmithdotdev/fine40/fine40.c
@@ -68,18 +68,3 @@ bool oled_task_kb(void) {
return(true);
}
#endif
-
-#ifdef ENCODER_ENABLE
-bool encoder_update_kb(uint8_t index, bool clockwise) {
- if (!encoder_update_user(index, clockwise)) {
- return false;
- }
- // Volume control
- if (clockwise) {
- tap_code(KC_VOLU);
- } else {
- tap_code(KC_VOLD);
- }
- return true;
-}
-#endif \ No newline at end of file
diff --git a/keyboards/anavi/knob1/knob1.c b/keyboards/anavi/knob1/knob1.c
index c1ed7b7726..bb6f1e38bf 100644
--- a/keyboards/anavi/knob1/knob1.c
+++ b/keyboards/anavi/knob1/knob1.c
@@ -14,18 +14,6 @@ void keyboard_post_init_kb(void) {
keyboard_post_init_user();
}
-#ifdef ENCODER_ENABLE
-bool encoder_update_kb(uint8_t index, bool clockwise) {
- if (!encoder_update_user(index, clockwise)) { return false; }
- if (clockwise) {
- tap_code(KC_VOLU);
- } else {
- tap_code(KC_VOLD);
- }
- return true;
-}
-#endif
-
#ifdef OLED_ENABLE
bool oled_task_kb(void) {
diff --git a/keyboards/anavi/macropad10/macropad10.c b/keyboards/anavi/macropad10/macropad10.c
deleted file mode 100644
index bebefd0da9..0000000000
--- a/keyboards/anavi/macropad10/macropad10.c
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2022 Leon Anavi <leon@anavi.org>
-// SPDX-License-Identifier: GPL-2.0-or-later
-#include "encoder.h"
-
-#ifdef ENCODER_ENABLE
-bool encoder_update_kb(uint8_t index, bool clockwise) {
- if (!encoder_update_user(index, clockwise)) { return false; }
- if (clockwise) {
- tap_code(KC_VOLU);
- } else {
- tap_code(KC_VOLD);
- }
- return true;
-}
-#endif
-
diff --git a/keyboards/ano/ano.c b/keyboards/ano/ano.c
index 0b6926deaf..925a24fbf6 100644
--- a/keyboards/ano/ano.c
+++ b/keyboards/ano/ano.c
@@ -15,27 +15,3 @@
*/
#include "ano.h"
-
-/* The encoder_update_user is a function.
- * It'll be called by QMK every time you turn the encoder.
- *
- * The index parameter tells you which encoder was turned. If you only have
- * one encoder, the index will always be zero.
- *
- * The clockwise parameter tells you the direction of the encoder. It'll be
- * true when you turned the encoder clockwise, and false otherwise.
- */
-
-#ifdef ENCODER_ENABLE
-bool encoder_update_kb(uint8_t index, bool clockwise) {
- if (!encoder_update_user(index, clockwise)) { return false; }
- if (index == 0) {
- if (clockwise) {
- tap_code(KC_AUDIO_VOL_UP);
- } else {
- tap_code(KC_AUDIO_VOL_DOWN);
- }
- }
- return true;
-}
-#endif \ No newline at end of file
diff --git a/keyboards/atlantis/ps17/ps17.c b/keyboards/atlantis/ps17/ps17.c
index ccac1ce923..d660bdee6a 100644
--- a/keyboards/atlantis/ps17/ps17.c
+++ b/keyboards/atlantis/ps17/ps17.c
@@ -19,23 +19,6 @@ void keyboard_pre_init_kb(void) {
keyboard_pre_init_user();
}
-#if defined(ENCODER_ENABLE)
-bool encoder_update_kb(uint8_t index, bool clockwise) {
- if (!encoder_update_user(index, clockwise)) {
- /* Don't process further events if user function exists and returns false */
- return false;
- }
-
- /* Ignore index - only one encoder on this board */
- if (clockwise) {
- tap_code_delay(KC_VOLU, 10);
- } else {
- tap_code_delay(KC_VOLD, 10);
- }
- return false;
-}
-#endif
-
#ifdef RGB_MATRIX_ENABLE
void suspend_power_down_kb(void) {
/* Disable indicator LEDs when going to sleep */
diff --git a/keyboards/bolsa/damapad/damapad.c b/keyboards/bolsa/damapad/damapad.c
index d57a60c