aboutsummaryrefslogtreecommitdiffstats
path: root/docs/feature_encoders.md
diff options
context:
space:
mode:
authorJames Young <xxiinophobia@yahoo.com>2020-02-29 12:00:00 -0800
committerJames Young <xxiinophobia@yahoo.com>2020-02-29 11:59:30 -0800
commit26eef35f07698d23aafae90e1c230b52e100a334 (patch)
treeeb8e43fc58ca55788e6e89430af0db55ea79e324 /docs/feature_encoders.md
parent85041ff05bf0e5f4ff4535caf6e638491a5614c8 (diff)
downloadfirmware-26eef35f07698d23aafae90e1c230b52e100a334.tar.gz
firmware-26eef35f07698d23aafae90e1c230b52e100a334.tar.bz2
firmware-26eef35f07698d23aafae90e1c230b52e100a334.zip
2020 February 29 Breaking Changes Update (#8064)
Diffstat (limited to 'docs/feature_encoders.md')
-rw-r--r--docs/feature_encoders.md52
1 files changed, 34 insertions, 18 deletions
diff --git a/docs/feature_encoders.md b/docs/feature_encoders.md
index cbf72914e..4a0ae60c3 100644
--- a/docs/feature_encoders.md
+++ b/docs/feature_encoders.md
@@ -2,23 +2,35 @@
Basic encoders are supported by adding this to your `rules.mk`:
- ENCODER_ENABLE = yes
+```make
+ENCODER_ENABLE = yes
+```
and this to your `config.h`:
- #define ENCODERS_PAD_A { B12 }
- #define ENCODERS_PAD_B { B13 }
+```c
+#define ENCODERS_PAD_A { B12 }
+#define ENCODERS_PAD_B { B13 }
+```
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 { encoder1b, encoder2b }
+```c
+#define ENCODERS_PAD_A { encoder1a, encoder2a }
+#define ENCODERS_PAD_B { encoder1b, encoder2b }
+```
+
+If your encoder's clockwise directions are incorrect, you can swap the A & B pad definitions. They can also be flipped with a define:
-If your encoder's clockwise directions are incorrect, you can swap the A & B pad definitions.
+```c
+#define ENCODER_DIRECTION_FLIP
+```
Additionally, the resolution can be specified in the same file (the default & suggested is 4):
- #define ENCODER_RESOLUTION 4
+```c
+#define ENCODER_RESOLUTION 4
+```
## Split Keyboards
@@ -33,27 +45,31 @@ If you are using different pinouts for the encoders on each half of a split keyb
The callback functions can be inserted into your `<keyboard>.c`:
- void encoder_update_kb(uint8_t index, bool clockwise) {
- encoder_update_user(index, clockwise);
- }
+```c
+void encoder_update_kb(uint8_t index, bool clockwise) {
+ encoder_update_user(index, clockwise);
+}
+```
or `keymap.c`:
- void encoder_update_user(uint8_t index, bool clockwise) {
- if (index == 0) { /* First encoder */
+```c
+void encoder_update_user(uint8_t index, bool clockwise) {
+ if (index == 0) { /* First encoder */
if (clockwise) {
- tap_code(KC_PGDN);
+ tap_code(KC_PGDN);
} else {
- tap_code(KC_PGUP);
+ tap_code(KC_PGUP);
}
- } else if (index == 1) { /* Second encoder */
+ } else if (index == 1) { /* Second encoder */
if (clockwise) {
- tap_code(KC_UP);
+ tap_code(KC_DOWN);
} else {
- tap_code(KC_DOWN);
+ tap_code(KC_UP);
}
- }
}
+}
+```
## Hardware