Andrew Boyson / clock

Dependents:   oldheating gps motorhome heating

timer.h

Committer:
andrewboyson
Date:
2018-11-29
Revision:
31:f6ff7fdb9c67
Parent:
26:0421132e6eaf
Child:
33:b9e3c06e7dab

File content as of revision 31:f6ff7fdb9c67:

#include <stdint.h>
#include <stdbool.h>

extern uint32_t TimerNowCount(void);
extern uint32_t TimerIntervalCount(uint32_t* pLastCount);
extern uint32_t TimerSinceCount(uint32_t startCount);
extern uint32_t TimerSinceMs(uint32_t startCount);

extern uint32_t TimerCountSinceLastSecond(void);
extern int32_t  TimerMultiplyFractionalPart(int32_t value, uint32_t timerCountSinceLastSecond);
extern bool     TimerHadSecond;
extern void     TimerMain(void);
extern void     TimerInit(void);

#define TIMER_COUNT_PER_SECOND 96000000UL
#define TIMER_COUNT_PER_MS     (TIMER_COUNT_PER_SECOND / 1000);
#define TIMER_COUNT_PER_US     (TIMER_COUNT_PER_MS     / 1000);
#define TIMER_TICKS_PER_SECOND 50