* BIG refactor: 'board' and 'radio' objects now defined in 'target.h/.cpp'

* mesh::RTCClock class moved to MeshCore.h
This commit is contained in:
Scott Powell 2025-03-21 18:57:12 +11:00
parent 0a5a115875
commit bfb4b1c496
48 changed files with 726 additions and 407 deletions

View file

@ -45,4 +45,32 @@ public:
virtual bool startOTAUpdate() { return false; } // not supported
};
/**
* An abstraction of the device's Realtime Clock.
*/
class RTCClock {
uint32_t last_unique;
protected:
RTCClock() { last_unique = 0; }
public:
/**
* \returns the current time. in UNIX epoch seconds.
*/
virtual uint32_t getCurrentTime() = 0;
/**
* \param time current time in UNIX epoch seconds.
*/
virtual void setCurrentTime(uint32_t time) = 0;
uint32_t getCurrentTimeUnique() {
uint32_t t = getCurrentTime();
if (t <= last_unique) {
return ++last_unique;
}
return last_unique = t;
}
};
}