]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - docs/feature_encoders.md
Fixed the build break of helix/rev1:OLED_sample caused by PR #4462. (#4874)
[qmk_firmware.git] / docs / feature_encoders.md
index f482eefec8385a149e925140cbcf436bb8177f4d..208d6db13cddcce222a18a7d1c459b214b20d962 100644 (file)
@@ -13,7 +13,7 @@ and this to your `config.h`:
 Each PAD_A/B variable defines an array so multiple encoders can be defined, e.g.:
 
     #define ENCODERS_PAD_A { encoder1a, encoder2a }
-    #define ENCODERS_PAD_B { encoder1a, encoder2b }
+    #define ENCODERS_PAD_B { encoder1b, encoder2b }
 
 If your encoder's clockwise directions are incorrect, you can swap the A & B pad definitions.
 
@@ -32,10 +32,17 @@ The callback functions can be inserted into your `<keyboard>.c`:
 or `keymap.c`:
 
     void encoder_update_user(uint8_t index, bool clockwise) {
-        
+        if (index == 0) {
+            if (clockwise) {
+                register_code(KC_PGDN);
+                unregister_code(KC_PGDN);
+            } else {
+                register_code(KC_PGUP);
+                unregister_code(KC_PGUP);
+            }
+        }
     }
 
-
 ## Hardware
 
 The A an B lines of the encoders should be wired directly to the MCU, and the C/common lines should be wired to ground.