-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterval.h
More file actions
30 lines (26 loc) · 724 Bytes
/
Interval.h
File metadata and controls
30 lines (26 loc) · 724 Bytes
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
#ifndef Interval_h
#define Interval_h
#include "callback.h"
/*
Basic interval timer that will execute a callback function every n milliseconds (interval)
Written by Killian Meersman <killian.meersman@gmail.com> 2018
*/
class Interval {
public:
Interval();
Interval(unsigned long interval, Callback callback);
void update(unsigned long delta);
void start();
void stop();
bool is_running();
unsigned long get_elapsed_time();
unsigned long get_remaining_time();
unsigned long get_interval();
void set_interval(unsigned long interval);
void set_callback(Callback callback);
private:
bool running = false;
unsigned long interval, t;
Callback callback;
};
#endif