123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #ifndef MBED_TIMER_H
- #define MBED_TIMER_H
- #include "platform/platform.h"
- #include "hal/ticker_api.h"
- #include "platform/NonCopyable.h"
- #include "platform/mbed_power_mgmt.h"
- namespace mbed {
- class Timer : private NonCopyable<Timer> {
- public:
- Timer();
- Timer(const ticker_data_t *data);
- ~Timer();
-
- void start();
-
- void stop();
-
- void reset();
-
- float read();
-
- int read_ms();
-
- int read_us();
-
- operator float();
-
- us_timestamp_t read_high_resolution_us();
- protected:
- us_timestamp_t slicetime();
- int _running;
- us_timestamp_t _start;
- us_timestamp_t _time;
- const ticker_data_t *_ticker_data;
- bool _lock_deepsleep;
- };
- }
- #endif
|