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: tick.c
- Revision:
- 30:212ca42b8779
- Parent:
- 29:9332cf906aad
- Child:
- 31:f6ff7fdb9c67
--- 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