Andrew Boyson / clock

Dependents:   oldheating gps motorhome heating

Committer:
andrewboyson
Date:
Thu Jan 25 07:54:54 2018 +0000
Revision:
26:0421132e6eaf
Parent:
25:81014a201736
Child:
31:f6ff7fdb9c67
Changed ticks from a count of ns to a fixed fraction of 30bits. This makes it much easier to convert to and from NTP and time_t

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 24:6c9833e2a049 1 #include <stdint.h>
andrewboyson 26:0421132e6eaf 2 #include <stdbool.h>
andrewboyson 24:6c9833e2a049 3
andrewboyson 24:6c9833e2a049 4 extern uint32_t TimerNowCount(void);
andrewboyson 26:0421132e6eaf 5 extern uint32_t TimerIntervalCount(uint32_t* pLastCount);
andrewboyson 24:6c9833e2a049 6 extern uint32_t TimerSinceCount(uint32_t startCount);
andrewboyson 25:81014a201736 7 extern uint32_t TimerSinceMs(uint32_t startCount);
andrewboyson 25:81014a201736 8
andrewboyson 26:0421132e6eaf 9 extern uint32_t TimerCountSinceLastSecond(void);
andrewboyson 26:0421132e6eaf 10 extern int32_t TimerMultiplyFractionalPart(int32_t value, uint32_t timerCountSinceLastSecond);
andrewboyson 26:0421132e6eaf 11 extern bool TimerTicked;
andrewboyson 26:0421132e6eaf 12 extern void TimerMain(void);
andrewboyson 26:0421132e6eaf 13 extern void TimerInit(void);
andrewboyson 26:0421132e6eaf 14
andrewboyson 25:81014a201736 15 #define TIMER_COUNT_PER_SECOND 96000000UL
andrewboyson 25:81014a201736 16 #define TIMER_COUNT_PER_MS (TIMER_COUNT_PER_SECOND / 1000);
andrewboyson 25:81014a201736 17 #define TIMER_COUNT_PER_US (TIMER_COUNT_PER_MS / 1000);