Two Guards for One Case Topic is solved

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
ChrisDev
Member
Posts: 13
Joined: Tue Jan 31, 2017 8:45 am

Two Guards for One Case

Post by ChrisDev »

Hello everybody,

I was working on some inter-task communication with interfaces and such things.
At some point it seemed to be pretty useful to check two conditions or flags before entering a case.
But my intents weren't very successful.

Is this possible? Or do i have to work around it ?

A little example of what i was thinking about:

Code: Select all

int rx_if1 = 0;
int rx_if2 = 0;

select
{
case              //some other cases
rx_if1 = 1; 
break;

case			// some other cases
rx_if2 = 1;
break;

case (rx_if1 && rx_if2) => tx.f():

break;
}
cheers,
Chris


View Solution
Gothmag
XCore Addict
Posts: 129
Joined: Wed May 11, 2016 3:50 pm

Post by Gothmag »

Code: Select all

case !car.manual.val && sync => AUTOTIMER when timerafter(AUTO) :> void: { 
Here is an example of one I use. It works just fine since it evaluates to a single boolean value.
Just to be clear you have to make sure you define the interface call as guarded also. In my example there is no need since it's not an interface call.
Post Reply