baseline build
Dependencies: FastPWM mbed-os mbed
MillisecondCounter.cpp@0:8a420ac6394e, 2017-06-19 (annotated)
- Committer:
- jrhodes5150
- Date:
- Mon Jun 19 15:55:51 2017 +0000
- Revision:
- 0:8a420ac6394e
initial build - baseline;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jrhodes5150 | 0:8a420ac6394e | 1 | #include "mbed.h" |
jrhodes5150 | 0:8a420ac6394e | 2 | //#include "RtosTimer.h" |
jrhodes5150 | 0:8a420ac6394e | 3 | #include "MillisecondCounter.h" |
jrhodes5150 | 0:8a420ac6394e | 4 | |
jrhodes5150 | 0:8a420ac6394e | 5 | static void CountMilliseconds(void const *arg); |
jrhodes5150 | 0:8a420ac6394e | 6 | static unsigned milliseconds = 0; |
jrhodes5150 | 0:8a420ac6394e | 7 | |
jrhodes5150 | 0:8a420ac6394e | 8 | static rtos::RtosTimer millisecondTimer(&CountMilliseconds, osTimerPeriodic); |
jrhodes5150 | 0:8a420ac6394e | 9 | |
jrhodes5150 | 0:8a420ac6394e | 10 | void StartTimer_ms(void) |
jrhodes5150 | 0:8a420ac6394e | 11 | { |
jrhodes5150 | 0:8a420ac6394e | 12 | millisecondTimer.start(1); |
jrhodes5150 | 0:8a420ac6394e | 13 | } |
jrhodes5150 | 0:8a420ac6394e | 14 | |
jrhodes5150 | 0:8a420ac6394e | 15 | unsigned GetTime_ms(void) |
jrhodes5150 | 0:8a420ac6394e | 16 | { |
jrhodes5150 | 0:8a420ac6394e | 17 | return( milliseconds ); |
jrhodes5150 | 0:8a420ac6394e | 18 | } |
jrhodes5150 | 0:8a420ac6394e | 19 | |
jrhodes5150 | 0:8a420ac6394e | 20 | static void CountMilliseconds(void const *arg) |
jrhodes5150 | 0:8a420ac6394e | 21 | { |
jrhodes5150 | 0:8a420ac6394e | 22 | milliseconds++; |
jrhodes5150 | 0:8a420ac6394e | 23 | } |
jrhodes5150 | 0:8a420ac6394e | 24 |