Encoders
This document contains information about how to add EC11-compatible encoders to your device.
Setup
Required code
To set up your keyboard for use with encoders, you must add encoders
to your #[keyboard]
macro invocation,
and your keyboard must implement the DeviceWithEncoders
trait.
This can be done easily by using the setup_encoders!
macro:
The sw_pin
corresponds to the pin connected to the encoder’s push button. output_a_pin
and output_b_pin
correspond to the pins that pulse as the encoder rotates.
Encoders work by mapping their outputs to a position on your layout.
type Layout = Self
tells rumcake to redirect encoder events to the implemented KeyboardLayout
for MyKeyboard
.
In the example above, here are the following mappings:
- Encoder 1 Button:
A
key (orG
on the second layer) - Encoder 1 Clockwise rotation:
B
key (orH
on the second layer) - Encoder 1 Counter-clockwise rotation:
C
key (orI
on the second layer) - Encoder 2 Button:
D
key (orJ
on the second layer) - Encoder 2 Clockwise rotation:
H
key (orK
on the second layer) - Encoder 2 Counter-clockwise rotation:
I
key (orL
on the second layer)
To-do List
- Via(l) support