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: timer/timer.c
- Revision:
- 39:5b594b1b6a0a
- Parent:
- 38:25b2a3c494aa
--- a/timer/timer.c Sun Dec 02 18:38:22 2018 +0000
+++ b/timer/timer.c Mon Dec 03 12:50:10 2018 +0000
@@ -9,42 +9,42 @@
#define MCR (*((volatile unsigned *) 0x40004014))
#define CTCR (*((volatile unsigned *) 0x40004070))
-uint32_t TimerNowCount()
+uint32_t TimerCount()
{
return TC;
}
-uint32_t TimerIntervalCount(uint32_t* pLastCount)
+uint32_t TimerSinceRepetitive(uint32_t* pLastCount)
{
uint32_t thisCount = TC;
uint32_t period = thisCount - *pLastCount;
*pLastCount = thisCount;
return period;
}
-uint32_t TimerSinceCount(uint32_t startCount)
+uint32_t TimerSinceCount(uint32_t lastCount)
{
- return TC - startCount;
+ return TC - lastCount;
}
-uint32_t TimerSinceMs(uint32_t startCount)
+uint32_t TimerSinceMs(uint32_t lastCount)
{
- uint32_t count = TC - startCount;
+ uint32_t count = TC - lastCount;
return count / TIMER_COUNT_PER_MS;
}
-bool TimerIntervalHasElapsed(uint32_t* pBaseCount, uint32_t intervalCount)
+bool TimerRepetitiveTick(uint32_t* pLastCount, uint32_t interval)
{
- if (TC - *pBaseCount >= intervalCount) //All unsigned wrap around arithmetic
+ if (TC - *pLastCount >= interval) //All unsigned wrap around arithmetic
{
- *pBaseCount += intervalCount;
+ *pLastCount += interval;
return true;
}
return false;
}
-int32_t TimerMultiplyFractionalPart(int32_t value, uint32_t timerCountSinceStart, uint32_t interval)
+int32_t TimerMultiplyFractionalPart(int32_t value, uint32_t countSinceLast, uint32_t interval)
{
int64_t fraction;
- fraction = timerCountSinceStart;
+ fraction = countSinceLast;
fraction <<= 32;
fraction /= interval;