chEvtWaitAnyTimeout Question

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

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
logan54
Posts: 22
Joined: Tue Apr 01, 2014 5:59 am

chEvtWaitAnyTimeout Question

Post by logan54 »

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: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: chEvtWaitAnyTimeout Question

Post by Giovanni »

Yes, it is meant for that.

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

Re: chEvtWaitAnyTimeout Question

Post by logan54 »

Hello,

thank you for confirmation

regards,

logan54
Post Reply