Esempio n. 1
0
void EVNT_ClearEvent(EVNT_Handle event) {
  CS1_CriticalVariable()

  CS1_EnterCritical();
  CLR_EVENT(event);
  CS1_ExitCritical();
}
bool EVENT_EventIsSetAutoClear(EVENT_Handle event) {
  bool res;

  res = GET_EVENT(event);
  if (res) {
    CLR_EVENT(event); /* automatically clear event */
  }
  return res;
}
Esempio n. 3
0
bool EVNT_EventIsSetAutoClear(EVNT_Handle event) {
	bool res;
	CS1_EnterCritical();
	res = GET_EVENT(event);
	if (res) {
		CLR_EVENT(event); /* automatically clear event */
	}
	CS1_ExitCritical();
	return res;
}
void EVENT_HandleEvent(void (*callback)(EVENT_Handle)) {
  /* Handle the one with the highest priority. Zero is the event with the highest priority. */
   EVENT_Handle event;
   CS1_CriticalVariable();

   CS1_EnterCritical();
   for (event=(EVENT_Handle)0; event<EVENT_NOF_EVENTS; event++) { /* does a test on every event */
     if (GET_EVENT(event)) { /* event present? */
       CLR_EVENT(event); /* clear event */
       break; /* get out of loop */
     }
   }
   CS1_ExitCritical();
   if (event != EVENT_NOF_EVENTS) {
     callback(event);
     /* Note: if the callback sets the event, we will get out of the loop.
      * We will catch it by the next iteration.
      */
   }
}