aboutsummaryrefslogtreecommitdiff
path: root/Source/Timer.h
blob: 323221d8c4d217d7963eb381727ccef863392b9d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef TIMER_HEADER__
#define TIMER_HEADER__

/* **************************************
 * 	Includes							*
 * **************************************/

#include "Global_Inc.h"
#include "GameStructures.h"

/* **************************************
 * 	Defines								*
 * **************************************/

/* **************************************
 * 	Global Prototypes					*
 * **************************************/

// Creates a timer instance wiht a determined value and associates it to a callback
// Once time expires, callback is automatically called right after GfxDrawScene().
// Time is expressed so that t = 100 ms e.g.: 2 seconds = 20.
TYPE_TIMER* TimerCreate(uint32_t t, bool rf, void (*timer_callback)(void) );

// Reportedly, sets all timer data to zero.
void TimerReset(void);

// To be called every cycle (i.e.: inside GfxDrawScene() ).
void TimerHandler(void);

// Sets timer remaining time to its initial value.
void TimerRestart(TYPE_TIMER* timer);

// Flushes a timer pointed to by timer.
void TimerRemove(TYPE_TIMER* timer);

#endif // TIMER_HEADER__