Andrew Boyson / clock

Dependents:   oldheating gps motorhome heating

Revision:
25:81014a201736
Parent:
24:6c9833e2a049
Child:
26:0421132e6eaf
--- a/tick.c	Mon Jan 22 18:35:11 2018 +0000
+++ b/tick.c	Mon Jan 22 18:54:23 2018 +0000
@@ -47,9 +47,9 @@
 void TickSet(int64_t extClock)
 {
     uint32_t       tc = TimerNowCount();
-    uint32_t  seconds =       tc / TICK_COUNT_PER_SECOND; //0 to 44
-    uint32_t     base =  seconds * TICK_COUNT_PER_SECOND; //0 to 2^32
-    uint32_t fraction =       tc % TICK_COUNT_PER_SECOND; //0 to 96,000,000
+    uint32_t  seconds =       tc / TIMER_COUNT_PER_SECOND; //0 to 44
+    uint32_t     base =  seconds * TIMER_COUNT_PER_SECOND; //0 to 2^32
+    uint32_t fraction =       tc % TIMER_COUNT_PER_SECOND; //0 to 96,000,000
     uint32_t fractionNs = fraction / 96 * 1000;           //0 to 1,000,000,000 which fits into 32 bits
      int64_t       ns = extClock - fractionNs;
      
@@ -66,21 +66,21 @@
     uint32_t sinceSecondsBaseCount = TimerSinceCount(secondsBaseCount);
     
     //Update the times whenever there has been a system second
-    if (sinceSecondsBaseCount > TICK_COUNT_PER_SECOND)
+    if (sinceSecondsBaseCount > TIMER_COUNT_PER_SECOND)
     { 
         __disable_irq();
-        secondsBaseCount += TICK_COUNT_PER_SECOND;
+        secondsBaseCount += TIMER_COUNT_PER_SECOND;
              nsTickCount += ONE_BILLION + ppb;
              nsSlewCount += slew;
                     slew  = 0;
         __enable_irq();
-        sinceSecondsBaseCount -= TICK_COUNT_PER_SECOND;
+        sinceSecondsBaseCount -= TIMER_COUNT_PER_SECOND;
     }
     
     //Update TickTime
     int64_t   fraction = sinceSecondsBaseCount;
               fraction <<= 32;
-              fraction /= TICK_COUNT_PER_SECOND;
+              fraction /= TIMER_COUNT_PER_SECOND;
     
     int64_t nsBase     = nsTickCount + nsSlewCount;
     int64_t nsPerTick  = ONE_BILLION + ppb + slew;
@@ -108,7 +108,7 @@
 {
     int64_t   fraction = timerCount;
               fraction <<= 32;
-              fraction /= TICK_COUNT_PER_SECOND;
+              fraction /= TIMER_COUNT_PER_SECOND;
 
     int64_t nsFraction;