chEvtWaitAnyTimeout Question

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess

logan54
Posts: 22
Joined: Tue Apr 01, 2014 5:59 am
Location: Austria

chEvtWaitAnyTimeout Question

Postby logan54 » Sun Sep 21, 2014 11:10 am

Hello,

I've a question about the chEvtWaitAnyTimeout Function in ChibiOS 2.6. Does the Timeout be fired regularly, or is it postponed every received event.
I want to use to command to drive a protocol stack, so I need also a reset condition when the communication fails.
I’am followed your example for waking up a thread from an interrupt, and my code look now a given below:

Code: Select all

    for(;;)
    {
        /* Warte auf Dateneingang via ONLINE Interface */
        u16EvMask = chEvtWaitAnyTimeout(EVENT_MASK(1), MS2ST(RESYNC_TIMEOUT));
       
        if (u16EvMask & EVENT_MASK(1))
        {
            /* Processing Data */
        }
        else
              /* Reset Interface State */


I want to achieve that the else branch (/* Reset Interface State */) will be called *after* MS2ST(RESYNC_TIMEOUT) ms after the last received character. Is this the correct approach?

regards

logan54

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: chEvtWaitAnyTimeout Question

Postby Giovanni » Sun Sep 21, 2014 11:16 am

Yes, it is meant for that.

Giovanni

logan54
Posts: 22
Joined: Tue Apr 01, 2014 5:59 am
Location: Austria

Re: chEvtWaitAnyTimeout Question

Postby logan54 » Sun Sep 21, 2014 12:03 pm

Hello,

thank you for confirmation

regards,

logan54


Return to “General Support”

Who is online

Users browsing this forum: No registered users and 12 guests