瀏覽代碼

add better example

Jack Humbert 6 年之前
父節點
當前提交
24b3556e84
共有 1 個文件被更改,包括 9 次插入2 次删除
  1. 9 2
      docs/feature_encoders.md

+ 9 - 2
docs/feature_encoders.md

@@ -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.