utils.h 670 Bytes
Newer Older
Poseidon's avatar
Poseidon committed
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
38
39
40
41
#ifndef UTILS
#define UTILS

#if (ARDUINO >= 100)
 #include "Arduino.h"
#else
 #include "WProgram.h"
#endif

class Polling{
    private:
        unsigned long time_last;
        int period;
    
    public:
        Polling();
        Polling(int);
        bool test();
        void executed();
        void setPeriod(int);
        int getPeriod();
};

class Interface{
    private:
        bool state;
        void (*callback)(void);
        Polling _interval; 

    public:
        Interface(void (*)(), int);
        
        bool running();
        void setState();
        void setPeriod(int period);
        void run();
        int getPeriod();
        
};

#endif