nicolap8
Posts: 326
Joined: Mon Mar 13, 2017 9:45 pm

[Solved] Free Pascal: read input events

Mon Apr 08, 2019 10:23 pm

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
Last edited by nicolap8 on Sat Apr 27, 2019 12:55 pm, edited 2 times in total.

nicolap8
Posts: 326
Joined: Mon Mar 13, 2017 9:45 pm

Re: Free Pascal: read input events

Wed Apr 24, 2019 11:19 pm

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

nicolap8
Posts: 326
Joined: Mon Mar 13, 2017 9:45 pm

Re: [Solved] Free Pascal: read input events

Sat Apr 27, 2019 12:55 pm

I added a class to use Rotary Encoders and a small test program.

Return to “Other programming languages”