Bradley Kohler
/
FRDM_Pacemaker
a pacemaker
clock.cpp@0:9e97accb2a4c, 2016-10-26 (annotated)
- Committer:
- kohlerba
- Date:
- Wed Oct 26 02:06:02 2016 +0000
- Revision:
- 0:9e97accb2a4c
- Child:
- 1:446bd28a1f19
You took my pencil!!!!!!!!!!!!!!!!!!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kohlerba | 0:9e97accb2a4c | 1 | #include "clock.h" |
kohlerba | 0:9e97accb2a4c | 2 | |
kohlerba | 0:9e97accb2a4c | 3 | Ticker tick; |
kohlerba | 0:9e97accb2a4c | 4 | double counter = 0; |
kohlerba | 0:9e97accb2a4c | 5 | |
kohlerba | 0:9e97accb2a4c | 6 | void start_clock(void){ |
kohlerba | 0:9e97accb2a4c | 7 | tick.attach(&count_time, 0.0001); |
kohlerba | 0:9e97accb2a4c | 8 | } |
kohlerba | 0:9e97accb2a4c | 9 | |
kohlerba | 0:9e97accb2a4c | 10 | void count_time(void){ |
kohlerba | 0:9e97accb2a4c | 11 | counter += 0.0001; |
kohlerba | 0:9e97accb2a4c | 12 | } |
kohlerba | 0:9e97accb2a4c | 13 | |
kohlerba | 0:9e97accb2a4c | 14 | double get_time(void){ |
kohlerba | 0:9e97accb2a4c | 15 | return counter; |
kohlerba | 0:9e97accb2a4c | 16 | } |
kohlerba | 0:9e97accb2a4c | 17 |