36 lines
453 B
C
36 lines
453 B
C
#include <gint/timer.h>
|
|
#include <gint/clock.h>
|
|
|
|
static volatile int has_ticked = 0;
|
|
|
|
int callback(volatile void *arg)
|
|
{
|
|
volatile int *has_ticked = arg;
|
|
*has_ticked = 1;
|
|
|
|
return 0;
|
|
}
|
|
|
|
void init_refresh()
|
|
{
|
|
timer_setup(0, timer_delay(0, 50000), timer_Po_4, callback, &has_ticked);
|
|
timer_start(0);
|
|
}
|
|
|
|
void quit_refresh()
|
|
{
|
|
timer_stop(0);
|
|
}
|
|
|
|
void wait_next_frame()
|
|
{
|
|
while (1)
|
|
{
|
|
if (has_ticked)
|
|
{
|
|
has_ticked=0;
|
|
return;
|
|
}
|
|
sleep();
|
|
}
|
|
} |