Recent

Author Topic: GPIO interrupt code  (Read 6339 times)

pascalbythree

  • Jr. Member
  • **
  • Posts: 71
GPIO interrupt code
« on: April 06, 2017, 12:22:34 pm »
Does anbode have Interrupt example code, to use for my GPIO Raspberry. To trigger some buttons. So u do not need a Timer.

bobihot

  • New Member
  • *
  • Posts: 25
Re: GPIO interrupt code
« Reply #1 on: April 06, 2017, 01:10:07 pm »
I so interested.
May be need to write a OS driver, or use them. And to assign a function to handle this?

Carlos Liñan

  • Newbie
  • Posts: 1
Re: GPIO interrupt code
« Reply #2 on: April 14, 2018, 01:13:00 pm »
I am interested in this matter, but I can not find information, can anyone show an example?

Me interesa este asunto, pero no encuentro informacion, alguien puede mostrar algún ejemplo?

Tz

  • Jr. Member
  • **
  • Posts: 54
  • Tz with FPC Pen Cil
Re: GPIO interrupt code
« Reply #3 on: September 02, 2019, 09:09:32 am »
if you are using linux try using epoll  :D

avra

  • Hero Member
  • *****
  • Posts: 2162
    • Additional info
« Last Edit: September 02, 2019, 10:16:47 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Swirl

  • New Member
  • *
  • Posts: 24
Re: GPIO interrupt code
« Reply #5 on: April 30, 2020, 06:11:29 pm »
Maybe it's my misunderstanding but in the examples I always see a "waiting for interrupt".
In my understanding an interrupt is something you do not have to wait(loop) for. E.g. Like a TTimer event. I would like to have a procedure that is called without including a "polling loop".
Is there a way like NMIs I used on the good old Zilog Z80.

Code: Pascal  [Select][+][-]
  1. InterruptProc(Sender: Foo);
  2. begin
  3.   dosomething;
  4. end;

Please tell me how to do that or tell me that I am misunderstanding the examples.

Regards,
Mike

Update
As I read here...
https://www.raspberrypi.org/forums/viewtopic.php?t=9207
...a "real" Interrupt would be a part of the kernel and thus it's not available on the pi.
The best way to perform an "interrupt" is a thread. This will be adequate for me.
« Last Edit: April 30, 2020, 07:19:25 pm by Swirl »
Working with Lazarus 2.0.6 - FPC 3.0.4 on Win/Mint/elementaryOS
Playing with Lazarus on macOS 10.14 (Mojave)

 

TinyPortal © 2005-2018