2017-11-19 17:02:03 +00:00
|
|
|
// Copyright 2017 David Conran
|
|
|
|
|
|
|
|
#ifndef IRTIMER_H_
|
|
|
|
#define IRTIMER_H_
|
|
|
|
|
|
|
|
#define __STDC_LIMIT_MACROS
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
// Classes
|
|
|
|
class IRtimer {
|
|
|
|
public:
|
|
|
|
IRtimer();
|
|
|
|
void reset();
|
|
|
|
uint32_t elapsed();
|
2018-11-20 14:53:56 +00:00
|
|
|
#ifdef UNIT_TEST
|
|
|
|
static void add(uint32_t usecs);
|
|
|
|
#endif // UNIT_TEST
|
2017-11-19 17:02:03 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
uint32_t start;
|
|
|
|
};
|
|
|
|
|
2019-05-27 13:11:01 +01:00
|
|
|
class TimerMs {
|
|
|
|
public:
|
|
|
|
TimerMs();
|
|
|
|
void reset();
|
|
|
|
uint32_t elapsed();
|
|
|
|
#ifdef UNIT_TEST
|
|
|
|
static void add(uint32_t msecs);
|
|
|
|
#endif // UNIT_TEST
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint32_t start;
|
|
|
|
};
|
2017-11-19 17:02:03 +00:00
|
|
|
#endif // IRTIMER_H_
|