]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
add better example
authorJack Humbert <jack.humb@gmail.com>
Fri, 26 Oct 2018 20:47:00 +0000 (16:47 -0400)
committerDrashna Jaelre <drashna@live.com>
Fri, 26 Oct 2018 21:24:13 +0000 (14:24 -0700)
docs/feature_encoders.md

index f482eefec8385a149e925140cbcf436bb8177f4d..036c6a1d8961485d59de2917b9a224e1a6b10672 100644 (file)
@@ -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.