diff --git a/include/timer.h b/include/timer.h index 2a5b7c9..021ceb1 100644 --- a/include/timer.h +++ b/include/timer.h @@ -8,4 +8,6 @@ unsigned long int start_timer(unsigned long int start); unsigned long int stop_timer(unsigned long int start); +void wait(int sec); + #endif \ No newline at end of file diff --git a/src/timer.c b/src/timer.c index 08cd261..29cc0a5 100644 --- a/src/timer.c +++ b/src/timer.c @@ -30,4 +30,9 @@ unsigned long int start_timer(unsigned long int start) { unsigned long int stop_timer(unsigned long int start) { return Microsecondes() - start; +} + +void wait(int sec) { + unsigned long int end = Microsecondes() + (sec * DELTA); + while (Microsecondes() <= end); } \ No newline at end of file