from /boot/overlays/README
just load the right overlay, and linux should do everything for you
i believe it will appear in /dev/input/ and you can read it like any other input device
Code:
Name: rotary-encoderInfo: Overlay for GPIO connected rotary encoder.Load: dtoverlay=rotary-encoder,<param>=<val>Params: pin_a GPIO connected to rotary encoder channel A (default 4). pin_b GPIO connected to rotary encoder channel B (default 17). relative_axis register a relative axis rather than an absolute one. Relative axis will only generate +1/-1 events on the input device, hence no steps need to be passed. linux_axis the input subsystem axis to map to this rotary encoder. Defaults to 0 (ABS_X / REL_X) rollover Automatic rollover when the rotary value becomes greater than the specified steps or smaller than 0. For absolute axis only. steps-per-period Number of steps (stable states) per period. The values have the following meaning: 1: Full-period mode (default) 2: Half-period mode 4: Quarter-period mode steps Number of steps in a full turnaround of the encoder. Only relevant for absolute axis. Defaults to 24 which is a typical value for such devices. wakeup Boolean, rotary encoder can wake up the system. encoding String, the method used to encode steps. Supported are "gray" (the default and more common) and "binary".
i believe it will appear in /dev/input/ and you can read it like any other input device
Statistics: Posted by cleverca22 — Mon Aug 12, 2024 4:19 pm