Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: oldheating gps motorhome heating
Diff: sync.c
- Revision:
- 18:207dd1474cd9
- Parent:
- 17:927fc1eceb9d
- Child:
- 22:df0b906bda26
--- a/sync.c Thu Jan 11 17:39:36 2018 +0000
+++ b/sync.c Tue Jan 16 17:38:12 2018 +0000
@@ -1,4 +1,5 @@
#include <stdlib.h>
+#include <stdbool.h>
#include "log.h"
#include "tick.h"
@@ -8,21 +9,18 @@
#define ONE_BILLION 1000000000LL //Make sure ONE_BILLION is 64 bit by putting LL on the end
#define ONE_MILLION 1000000
-#define TRUE 1
-#define FALSE 0
+bool SyncTrace = false;
-int SyncTrace = FALSE;
-
-int SyncedTime = FALSE;
-int SyncedRate = FALSE;
+bool SyncedTime = false;
+bool SyncedRate = false;
static void setSyncedTime(int64_t diff)
{
int64_t absDiff = llabs(diff);
int64_t limit = ClockSyncedLimitNs;
int64_t hysterisis = ClockSyncedHysterisNs;
- if (absDiff < limit - hysterisis) SyncedTime = TRUE;
- if (absDiff > limit + hysterisis) SyncedTime = FALSE;
+ if (absDiff < limit - hysterisis) SyncedTime = true;
+ if (absDiff > limit + hysterisis) SyncedTime = false;
}
static void setSyncedRate(int64_t diff)
{
@@ -31,8 +29,8 @@
int64_t limit = ClockSyncedLimitPpb;
int64_t hysterisis = ClockSyncedHysterisPpb;
- if (absDiff < limit - hysterisis) SyncedRate = TRUE;
- if (absDiff > limit + hysterisis) SyncedRate = FALSE;
+ if (absDiff < limit - hysterisis) SyncedRate = true;
+ if (absDiff > limit + hysterisis) SyncedRate = false;
}
static void setSlew(int64_t diff)