67#if defined(ARDUINO_ARCH_ESP32) || defined(ESP_PLATFORM)
71 return esp_timer_get_time()/1000ULL;
83#define N2kScheduler64Disabled 0xffffffffffffffffULL
96inline bool N2kIsTimeBefore(uint32_t T1, uint32_t T2) {
return (T2-T1)<INT32_MAX; }
112 return Now-(Start+Elapsed)<INT32_MAX;
262#if defined(ARDUINO_ARCH_ESP32) || defined(ESP_PLATFORM) || defined(__linux__) || defined(__linux) || defined(linux)
264 #define N2kUse64bitSchedulerTime 1
266 #define N2kSchedulerDisabled 0xffffffffffffffffULL
271 #define N2kSchedulerDisabled 0xffffffffUL
291 #if !defined(N2kUse64bitSchedulerTime)
333 #if defined(N2kUse64bitSchedulerTime)
346 #if defined(N2kUse64bitSchedulerTime)
Type definitions and utility macros used in the NMEA2000 libraries.
#define N2kSchedulerDisabled
Defined Value for disabling the scheduler.
#define N2kScheduler64Disabled
bool N2kHasElapsed(uint32_t Start, uint32_t Elapsed, uint32_t Now=N2kMillis())
Has time elapsed since start.
bool N2kIsTimeBefore(uint32_t T1, uint32_t T2)
Comparing 2 values even after 32 bit time roll over situation.
uint32_t tN2kSchedulerTime
Un synchronized Scheduler which can roll over.
void Disable()
Disable the Scheduler.
bool IsDisabled() const
Check if the scheduler is disabled.
bool IsEnabled() const
Check if the scheduler is enabled.
tN2kSchedulerTime NextTime
Timestamp for next event.
tN2kScheduler(tN2kSchedulerTime _NextTime=N2kSchedulerDisabled)
Constructor.
void FromNow(uint32_t _Add)
Set Timestamp for next event relative to now.
bool IsTime() const
Is it time for the next event.
Synchronized Scheduler for timed message sending.
uint32_t Period
Period for scheduler.
static uint64_t SyncOffset
???
uint32_t Offset
Offset to synchronize with others.
uint64_t NextTime
Timestamp for next event.
static void SetSyncOffset()
Set the SyncOffset of the scheduler.
uint64_t GetNextTime() const
Get the Timestamp of the NextTime.
void SetOffset(uint32_t _Offset)
Set the Offset of the Scheduler.
bool IsDisabled() const
Checks if Scheduler is disabled.
uint64_t Remaining()
Calculate remaining time.
void SetPeriodAndOffset(uint32_t _Period, uint32_t _Offset)
Set the Period And Offset of the Scheduler.
bool IsTime()
Check if ít is time.
bool IsEnabled() const
Checks if Scheduler is enabled.
void SetPeriod(uint32_t _Period)
Set the Period of the Scheduler.
uint32_t GetOffset() const
Get the Offset of the Scheduler.
uint32_t GetPeriod() const
Get the Period of the Scheduler.
void UpdateNextTime()
Update the timestamp for NextTime.
tN2kSyncScheduler(bool Enable=false, uint32_t _Period=0, uint32_t _Offset=0)
Constructor for sync scheduler.
void Disable()
Disable Scheduler.