unsigned ctl_events_wait(CTL_EVENT_WAIT_TYPE_t waitType, CTL_EVENT_SET_t *eventSet, CTL_EVENT_SET_t events, CTL_TIMEOUT_t timeoutType, CTL_TIME_t timeout);
ctl_events_wait waits for events to be set (value 1) in the event set pointed to by eventSet with an optional timeout applied if timeoutType is non-zero.
The waitType can be one of:
ctl_events_wait returns the value pointed to by eventSet before any auto-clearing occurred or zero if the timeout occurred.
ctl_events_wait must not be called from an interrupt service routine.