PtTimer

Hi all,

I’m currently using a widget “PtTimer” because I need to draw something each
50 ms.
It means that I need the drawing function of my PtRaw widget to be activated
each 50 ms.

But apparently, this PtTimer is not accurate enough for my purpose (this is
also said in the doc).
So I created a timer with the function “timer_create” as it is usually done
for real-time application.
What is the best way to make my timer interact with my PhAB application ?

Thanks,
Jeff.

Hey Jeff

Look up the function “RtTimerCreate” It provides a thin layer on top of
the timer_create function and sets up all of the Photon interaction stuff for
you.

Thanks
Rodney


Jeff Hoffmeyer <jean-francois.hoffmeyer@schiller.fr> wrote:

Hi all,

I’m currently using a widget “PtTimer” because I need to draw something each
50 ms.
It means that I need the drawing function of my PtRaw widget to be activated
each 50 ms.

But apparently, this PtTimer is not accurate enough for my purpose (this is
also said in the doc).
So I created a timer with the function “timer_create” as it is usually done
for real-time application.
What is the best way to make my timer interact with my PhAB application ?

Thanks,
Jeff.

Hi Rodney

Could you please explain me how to create and set an RtTimer ?
Because I tried and he always says “storage size of `base_rttimer’ isn’t
known”.

Thanks,
Jeff.


“Gui Group” <gui@qnx.com> a écrit dans le message news:
a1n142$bip$1@nntp.qnx.com

Hey Jeff

Look up the function “RtTimerCreate” It provides a thin layer on top of
the timer_create function and sets up all of the Photon interaction stuff
for
you.

Thanks
Rodney


Jeff Hoffmeyer <> jean-francois.hoffmeyer@schiller.fr> > wrote:
Hi all,

I’m currently using a widget “PtTimer” because I need to draw something
each
50 ms.
It means that I need the drawing function of my PtRaw widget to be
activated
each 50 ms.

But apparently, this PtTimer is not accurate enough for my purpose (this
is
also said in the doc).
So I created a timer with the function “timer_create” as it is usually
done
for real-time application.
What is the best way to make my timer interact with my PhAB application
?

Thanks,
Jeff.

Hi Jeff,

Here is a small example for setting the RtTimer in a non PhAB
application this should show you how to set the values for a PhAB
application. Sorry for the late response…

#include <Pt.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <photon/realtime/RtTimer.h>

RtTimer_t *ti;

int RtTimer_function(RtTimer_t *timer,void data)
{
/
Put your timer code here */
printf(“timer events!\n”);
return 0;
}

int main(void)
{
struct itimerspec val = {0};
int ret;
if(PtInit(NULL)== -1)
PtExit(EXIT_FAILURE);
if (ti = RtTimerCreate(CLOCK_REALTIME,-1,&RtTimer_function,NULL))
{
val.it_value.tv_sec = 1;
val.it_interval.tv_sec = 1;
if (RtTimerSetTime(ti,0,&val,NULL)== -1)
PtExit(EXIT_FAILURE);
PtMainLoop();
return (EXIT_SUCCESS);
}
}

Hope this helps
Regards
Brenda


Jeff Hoffmeyer wrote:

Hi Rodney

Could you please explain me how to create and set an RtTimer ?
Because I tried and he always says “storage size of `base_rttimer’ isn’t
known”.

Thanks,
Jeff.


“Gui Group” <> gui@qnx.com> > a écrit dans le message news:
a1n142$bip$> 1@nntp.qnx.com> …

Hey Jeff

Look up the function “RtTimerCreate” It provides a thin layer on top of
the timer_create function and sets up all of the Photon interaction stuff

for

you.

Thanks
Rodney


Jeff Hoffmeyer <> jean-francois.hoffmeyer@schiller.fr> > wrote:

Hi all,

I’m currently using a widget “PtTimer” because I need to draw something

each

50 ms.
It means that I need the drawing function of my PtRaw widget to be

activated

each 50 ms.

But apparently, this PtTimer is not accurate enough for my purpose (this

is

also said in the doc).
So I created a timer with the function “timer_create” as it is usually

done

for real-time application.
What is the best way to make my timer interact with my PhAB application

?

Thanks,
Jeff.

\