IRremoteESP8266
IRtimer.h
Go to the documentation of this file.
1 // Copyright 2017 David Conran
2 
3 #ifndef IRTIMER_H_
4 #define IRTIMER_H_
5 
6 #define __STDC_LIMIT_MACROS
7 #include <stdint.h>
8 
9 // Classes
10 
13 class IRtimer {
14  public:
15  IRtimer();
16  void reset();
17  uint32_t elapsed();
18 #ifdef UNIT_TEST
19  static void add(uint32_t usecs);
20 #endif // UNIT_TEST
21 
22  private:
23  uint32_t start;
24 };
25 
28 class TimerMs {
29  public:
30  TimerMs();
31  void reset();
32  uint32_t elapsed();
33 #ifdef UNIT_TEST
34  static void add(uint32_t msecs);
35 #endif // UNIT_TEST
36 
37  private:
38  uint32_t start;
39 };
40 #endif // IRTIMER_H_
TimerMs::start
uint32_t start
Time in mSeconds when the class was instantiated/reset.
Definition: IRtimer.h:38
IRtimer
This class offers a simple counter in micro-seconds since instantiated.
Definition: IRtimer.h:13
IRtimer::add
static void add(uint32_t usecs)
Add time to the timer to simulate elapsed time.
Definition: IRtimer.cpp:44
IRtimer::reset
void reset()
Resets the IRtimer object. I.e. The counter starts again from now.
Definition: IRtimer.cpp:18
IRtimer::IRtimer
IRtimer()
Class constructor.
Definition: IRtimer.cpp:15
IRtimer::elapsed
uint32_t elapsed()
Calculate how many microseconds have elapsed since the timer was started.
Definition: IRtimer.cpp:28
TimerMs::elapsed
uint32_t elapsed()
Calculate how many milliseconds have elapsed since the timer was started.
Definition: IRtimer.cpp:61
TimerMs::reset
void reset()
Resets the TimerMs object. I.e. The counter starts again from now.
Definition: IRtimer.cpp:51
TimerMs::TimerMs
TimerMs()
Class constructor.
Definition: IRtimer.cpp:48
IRtimer::start
uint32_t start
Time in uSeconds when the class was instantiated/reset.
Definition: IRtimer.h:23
TimerMs::add
static void add(uint32_t msecs)
Add time to the timer to simulate elapsed time.
Definition: IRtimer.cpp:77
TimerMs
This class offers a simple counter in milli-seconds since instantiated.
Definition: IRtimer.h:28