Andrew Boyson / clock

Dependents:   oldheating gps motorhome heating

Revision:
30:212ca42b8779
Parent:
29:9332cf906aad
Child:
31:f6ff7fdb9c67
diff -r 9332cf906aad -r 212ca42b8779 tick.c
--- a/tick.c	Sat Jan 27 12:17:09 2018 +0000
+++ b/tick.c	Fri Feb 16 17:30:46 2018 +0000
@@ -1,7 +1,6 @@
 #include <stdint.h>
 #include <stdbool.h>
 
-#include "defs.h"
 #include "rtc.h"
 #include "time.h"
 #include "tick.h"
@@ -9,6 +8,8 @@
 #include "led.h"
 #include "log.h"
 
+#define GPREG0 (*((volatile unsigned *) 0x40024044))
+
 static int64_t     tickCount = 0;
 static int64_t     slewCount = 0;
 static bool       countIsSet = false;
@@ -25,8 +26,8 @@
 void    TickSetSlew(int32_t value) { slew = value; }
 
 int32_t TickGetPpb () { return ppb;  }
-void    TickSetPpb (int32_t value) { ppb  = value; LPC_RTC->GPREG0 = ppb; }
-void    TickAddPpb (int32_t value) { ppb += value; LPC_RTC->GPREG0 = ppb; }
+void    TickSetPpb (int32_t value) { ppb  = value; GPREG0 = ppb; }
+void    TickAddPpb (int32_t value) { ppb += value; GPREG0 = ppb; }
 
 void    TicksToTmUtc  (int64_t ticks, struct tm* ptm)
 {
@@ -114,5 +115,5 @@
 }
 void TickInit(void)
 {
-    ppb  = LPC_RTC->GPREG0; //This is saved each time Tickppb is updated
+    ppb  = GPREG0; //This is saved each time Tickppb is updated
 }
\ No newline at end of file