]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - docs/feature_encoders.md
Usbasploader bootloader option addition (#6304)
[qmk_firmware.git] / docs / feature_encoders.md
index f482eefec8385a149e925140cbcf436bb8177f4d..9ac97a9a160bfc170ea0819e8c600bd29a2d651a 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,21 @@ 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) { /* First encoder */
+        if (clockwise) {
+          tap_code(KC_PGDN);
+        } else {
+          tap_code(KC_PGUP);
+        }
+      } else if (index == 1) { /* Second encoder */  
+        if (clockwise) {
+          tap_code(KC_UP);
+        } else {
+          tap_code(KC_DOWN);
+        }
+      }
     }
 
-
 ## 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.