Initial commit

Dependencies:   MODSERIAL Terminal TextLCD mbed

Committer:
anmar
Date:
Fri Dec 05 10:26:12 2014 +0000
Revision:
0:0903545c0460
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
anmar 0:0903545c0460 1 #include "mytimer.h"
anmar 0:0903545c0460 2
anmar 0:0903545c0460 3 mytimer::mytimer()
anmar 0:0903545c0460 4 {
anmar 0:0903545c0460 5 running = 0;
anmar 0:0903545c0460 6 timer = 0;
anmar 0:0903545c0460 7
anmar 0:0903545c0460 8 tick = new Ticker();
anmar 0:0903545c0460 9 tick->attach(this, &mytimer::update, 1);
anmar 0:0903545c0460 10 }
anmar 0:0903545c0460 11
anmar 0:0903545c0460 12 void mytimer::start()
anmar 0:0903545c0460 13 {
anmar 0:0903545c0460 14 running = 1;
anmar 0:0903545c0460 15 }
anmar 0:0903545c0460 16
anmar 0:0903545c0460 17
anmar 0:0903545c0460 18 void mytimer::stop()
anmar 0:0903545c0460 19 {
anmar 0:0903545c0460 20 running = 0;
anmar 0:0903545c0460 21 }
anmar 0:0903545c0460 22
anmar 0:0903545c0460 23
anmar 0:0903545c0460 24 void mytimer::reset()
anmar 0:0903545c0460 25 {
anmar 0:0903545c0460 26 timer = 0;
anmar 0:0903545c0460 27 }
anmar 0:0903545c0460 28
anmar 0:0903545c0460 29 uint32_t mytimer::read()
anmar 0:0903545c0460 30 {
anmar 0:0903545c0460 31 return timer;
anmar 0:0903545c0460 32 }
anmar 0:0903545c0460 33
anmar 0:0903545c0460 34 void mytimer::update()
anmar 0:0903545c0460 35 {
anmar 0:0903545c0460 36 if ( running )
anmar 0:0903545c0460 37 timer++;
anmar 0:0903545c0460 38 }
anmar 0:0903545c0460 39
anmar 0:0903545c0460 40
anmar 0:0903545c0460 41
anmar 0:0903545c0460 42
anmar 0:0903545c0460 43