sleep_milliseconds(delay);
}
-boolean FrameReached(unsigned int *frame_counter_var,
- unsigned int frame_delay)
+boolean DelayReachedExt(unsigned int *counter_var, unsigned int delay,
+ unsigned int actual_counter)
{
- unsigned int actual_frame_counter = FrameCounter;
-
- if (actual_frame_counter >= *frame_counter_var &&
- actual_frame_counter < *frame_counter_var + frame_delay)
+ if (actual_counter >= *counter_var &&
+ actual_counter < *counter_var + delay)
return FALSE;
- *frame_counter_var = actual_frame_counter;
+ *counter_var = actual_counter;
return TRUE;
}
-boolean DelayReached(unsigned int *counter_var,
- unsigned int delay)
+boolean FrameReached(unsigned int *frame_counter_var, unsigned int frame_delay)
{
- unsigned int actual_counter = Counter();
+ return DelayReachedExt(frame_counter_var, frame_delay, FrameCounter);
+}
- if (actual_counter >= *counter_var &&
- actual_counter < *counter_var + delay)
- return FALSE;
+boolean DelayReached(unsigned int *counter_var, unsigned int delay)
+{
+ return DelayReachedExt(counter_var, delay, Counter());
+}
- *counter_var = actual_counter;
+void ResetDelayCounterExt(unsigned int *counter_var,
+ unsigned int actual_counter)
+{
+ DelayReachedExt(counter_var, 0, actual_counter);
+}
- return TRUE;
+void ResetFrameCounter(unsigned int *frame_counter_var)
+{
+ FrameReached(frame_counter_var, 0);
+}
+
+void ResetDelayCounter(unsigned int *counter_var)
+{
+ DelayReached(counter_var, 0);
}
int WaitUntilDelayReached(unsigned int *counter_var, unsigned int delay)
void InitCounter(void);
unsigned int Counter(void);
void Delay(unsigned int);
+boolean DelayReachedExt(unsigned int *, unsigned int, unsigned int);
boolean FrameReached(unsigned int *, unsigned int);
boolean DelayReached(unsigned int *, unsigned int);
+void ResetDelayCounterExt(unsigned int *, unsigned int);
+void ResetFrameCounter(unsigned int *);
+void ResetDelayCounter(unsigned int *);
int WaitUntilDelayReached(unsigned int *, unsigned int);
void SkipUntilDelayReached(unsigned int *, unsigned int, int *, int);