diff --git a/cores/epoxy/Esp.h b/cores/epoxy/Esp.h index a70f71b..1745301 100644 --- a/cores/epoxy/Esp.h +++ b/cores/epoxy/Esp.h @@ -8,35 +8,35 @@ class EspClass { - public: - EspClass() { + public: + EspClass() { gettimeofday(&start, NULL); } - void reset() {}; + void reset() {} - void restart() {}; + void restart() {} - // Very ugly approximation, this is freeStack - unsigned long getFreeHeap() { + // Very ugly approximation, this is freeStack + unsigned long getFreeHeap() { int i; static int* h=40000+&i; return h-&i; } - uint32_t getCpuFreqMHZ() { return 80; } + uint32_t getCpuFreqMHZ() { return 80; } - uint32_t getChipId() { return 0; } + uint32_t getChipId() { return 0; } - uint32_t getCycleCount() { - struct timeval now; - gettimeofday(&now, NULL); - return getCpuFreqMHZ() + uint32_t getCycleCount() { + struct timeval now; + gettimeofday(&now, NULL); + return getCpuFreqMHZ() * ((now.tv_sec-start.tv_sec)*1000000+(now.tv_usec-start.tv_usec)); - } + } - private: - struct timeval start; + private: + struct timeval start; }; class Serial_ : public Stream