Page 1 of 1

[Solved] Free Pascal: read input events

Posted: Mon Apr 08, 2019 10:23 pm
by nicolap8
Hi all,
I want to read the event generated by a rotary encoder connected to GPIO.
I configured the Kernel driver in config.txt:

Code: Select all

dtoverlay = rotary-encoder, pin_a=7, pin_b=17, steps-per-period=4, relative_axis
With program evtest I'm able to see that it's working correctly.
What I'm not able to do, yet, is to read the events with a code in Pascal. I've not found any relevant example or docs.
Some help is welcome, before I read all the BIG docs for Kernel drivers and C source :-(
N

Re: Free Pascal: read input events

Posted: Wed Apr 24, 2019 11:19 pm
by nicolap8
Hi all,
I converted the necessary files from Linux Kernel and I'm now able to read my rotary encoder and also other input events, eg. a push button configured with overlay gpio-key.

The source is available here: fpc_linux_events
Please use GitHub to report issues, here we can discuss in general.
N

Re: [Solved] Free Pascal: read input events

Posted: Sat Apr 27, 2019 12:55 pm
by nicolap8
I added a class to use Rotary Encoders and a small test program.