* GPIO interrupt reading timeout
@ 2021-02-28 12:17 Gabriel Dinse
2021-02-28 13:08 ` Greg Gallagher
0 siblings, 1 reply; 3+ messages in thread
From: Gabriel Dinse @ 2021-02-28 12:17 UTC (permalink / raw)
To: xenomai
Hello,
I currently have a loop rt_task for reading interrupts on a GPIO pin of
my raspberry pi.
I'm using:
ret = read(pin, &value, sizeof(value));
but I don't want it to block forever, because my task should exit when
there are not more interrupts to read. Can I use "select" for
introducing a reading timeout on my loop and yet being "real-time"?
Thank you,
Gabriel Dinse
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: GPIO interrupt reading timeout
2021-02-28 12:17 GPIO interrupt reading timeout Gabriel Dinse
@ 2021-02-28 13:08 ` Greg Gallagher
2021-02-28 13:16 ` Gabriel Dinse
0 siblings, 1 reply; 3+ messages in thread
From: Greg Gallagher @ 2021-02-28 13:08 UTC (permalink / raw)
To: Gabriel Dinse; +Cc: xenomai
On Sun, Feb 28, 2021 at 7:18 AM Gabriel Dinse via Xenomai <
xenomai@xenomai.org> wrote:
> Hello,
>
> I currently have a loop rt_task for reading interrupts on a GPIO pin of
> my raspberry pi.
>
> I'm using:
> ret = read(pin, &value, sizeof(value));
>
> but I don't want it to block forever, because my task should exit when
> there are not more interrupts to read. Can I use "select" for
> introducing a reading timeout on my loop and yet being "real-time"?
>
> Thank you,
> Gabriel Dinse
>
If you are using the posix skin ( which I believe you are) then yes, using
select will translate into using the RT version of select, and you can use
a timeout.
Thanks
Greg
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: GPIO interrupt reading timeout
2021-02-28 13:08 ` Greg Gallagher
@ 2021-02-28 13:16 ` Gabriel Dinse
0 siblings, 0 replies; 3+ messages in thread
From: Gabriel Dinse @ 2021-02-28 13:16 UTC (permalink / raw)
To: Greg Gallagher; +Cc: xenomai
On Sun, Feb 28, 2021 at 8:08 am, Greg Gallagher <greg@embeddedgreg.com>
wrote:
>
>
> On Sun, Feb 28, 2021 at 7:18 AM Gabriel Dinse via Xenomai
> <xenomai@xenomai.org <mailto:xenomai@xenomai.org>> wrote:
>> Hello,
>>
>> I currently have a loop rt_task for reading interrupts on a GPIO
>> pin of
>> my raspberry pi.
>>
>> I'm using:
>> ret = read(pin, &value, sizeof(value));
>>
>> but I don't want it to block forever, because my task should exit
>> when
>> there are not more interrupts to read. Can I use "select" for
>> introducing a reading timeout on my loop and yet being "real-time"?
>>
>> Thank you,
>> Gabriel Dinse
>>
>
> If you are using the posix skin ( which I believe you are) then yes,
> using select will translate into using the RT version of select, and
> you can use a timeout.
>
> Thanks
>
> Greg
>>
Should I specify posix on compilation? I'm using alchemy as well right
now. my Makefile is like this:
0 STAGE=../../output/target/
1 XENO_CONFIG := ../../output/target/usr/xenomai/bin/xeno-config
2 CFLAGS := $(shell DESTDIR=$(STAGE) $(XENO_CONFIG) --rtdm
--skin=alchemy -- cflags)
3 LDFLAGS := $(shell DESTDIR=$(STAGE) $(XENO_CONFIG) --rtdm
--skin=alchemy -- ldflags)
4 CC := $(shell DESTDIR=$(STAGE) $(XENO_CONFIG) --cc)
5
6 EXECUTABLE := program
7
8
9 all: $(EXECUTABLE)
10
11 %: %.c
12 $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-28 13:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-28 12:17 GPIO interrupt reading timeout Gabriel Dinse
2021-02-28 13:08 ` Greg Gallagher
2021-02-28 13:16 ` Gabriel Dinse
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.