-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtm.h
37 lines (31 loc) · 1.13 KB
/
tm.h
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
37
/*
========================================================================
- HEADER -
Module to implement a millisecond TIMER in C.
@author : Velorek
@version : 1.0
Last modified: 15/09/2021 + New technique + init timer
========================================================================
*/
#ifndef _TM_H_
#define _TM_H_
/*====================================================================*/
/* COMPILER DIRECTIVES AND INCLUDES */
/*====================================================================*/
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
/*====================================================================*/
/* FUNCTION PROTOTYPES */
/*====================================================================*/
typedef struct nTimer {
int ms; //milliseconds
long oldtime; //to calculate increment in time
long ticks; //how many ticks have been made
} NTIMER;
/* Miliseconds timer */
int timerC(NTIMER * mytimer1);
void init_timer(NTIMER * mytimer, int ms);
void stop_timer(NTIMER * mytimer);
void resume_timer(NTIMER * mytimer);
#endif