Skip to main content

Encoder Configuration

See the Encoders feature page for more details, including instructions for adding encoder support to a board.

See Configuration Overview for instructions on how to change these settings.

EC11 Encoders

Kconfig

Definition file: zmk/app/module/drivers/sensor/ec11/Kconfig

ConfigTypeDescriptionDefault
CONFIG_EC11boolEnable EC11 encodersn
CONFIG_EC11_THREAD_PRIORITYintPriority of the encoder thread10
CONFIG_EC11_THREAD_STACK_SIZEintStack size of the encoder thread1024

If CONFIG_EC11 is enabled, exactly one of the following options must be set to y:

ConfigTypeDescription
CONFIG_EC11_TRIGGER_NONEboolNo trigger (encoders are disabled)
CONFIG_EC11_TRIGGER_GLOBAL_THREADboolProcess encoder interrupts on the global thread
CONFIG_EC11_TRIGGER_OWN_THREADboolProcess encoder interrupts on their own thread

Devicetree

Keymap Sensor Config

For shields/boards that export a sensors node configuration label, both global and per-sensor settings can be set by overriding the properties there.

To override the general settings, update them on the exported sensors node, e.g.:

&sensors {
triggers-per-rotation = <18>;
};

Per sensor overrides can be added with ordered nested nodes with the correct overrides, e.g.:

&sensors {
left_config {
triggers-per-rotation = <18>;
};

right_config {
triggers-per-rotation = <24>;
};
};
note

The names of the child nodes are not important, and are applied in order to the sensors listed in the sensors property of the sensors node.

Applies to the node and child nodes of: compatible = "zmk,keymap-sensors"

Definition file: zmk/app/drivers/zephyr/dts/bindings/zmk,keymap-sensors.yaml

PropertyTypeDescriptionDefault
triggers-per-rotationintNumber of times to trigger the bound behavior per full rotation

EC11 Nodes

Applies to: compatible = "alps,ec11"

Definition file: zmk/app/module/dts/bindings/sensor/alps,ec11.yaml

PropertyTypeDescriptionDefault
a-gpiosGPIO arrayGPIO connected to the encoder's A pin
b-gpiosGPIO arrayGPIO connected to the encoder's B pin
stepsintNumber of encoder pulses per complete rotation