Time (seconds) counter based on TimerSubscriber

Committer:
Waldek
Date:
Fri Jun 06 09:04:55 2014 +0000
Revision:
1:49c28e93d358
Parent:
0:b72c7c2ee5f3
Time dependent on TimerSubscriber

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Waldek 0:b72c7c2ee5f3 1 #include "TimeCounter.h"
Waldek 0:b72c7c2ee5f3 2 /*-------------------------------------------------------------
Waldek 0:b72c7c2ee5f3 3
Waldek 0:b72c7c2ee5f3 4 (c) W.D. 2014
Waldek 0:b72c7c2ee5f3 5
Waldek 0:b72c7c2ee5f3 6 -------------------------------------------------------------*/
Waldek 0:b72c7c2ee5f3 7
Waldek 0:b72c7c2ee5f3 8 TimeCounter::TimeCounter()
Waldek 0:b72c7c2ee5f3 9 {
Waldek 0:b72c7c2ee5f3 10 ticks = 0;
Waldek 0:b72c7c2ee5f3 11 TicksPerSecond = timer_user.TickerPeriod_rd();
Waldek 0:b72c7c2ee5f3 12 timer_user.Subscribe (this, 1);
Waldek 0:b72c7c2ee5f3 13 }
Waldek 0:b72c7c2ee5f3 14
Waldek 0:b72c7c2ee5f3 15 TimeCounter::~TimeCounter()
Waldek 0:b72c7c2ee5f3 16 {
Waldek 0:b72c7c2ee5f3 17 timer_user.UnSubscribe(this);
Waldek 0:b72c7c2ee5f3 18 }
Waldek 0:b72c7c2ee5f3 19
Waldek 0:b72c7c2ee5f3 20 void TimeCounter::TimerEvent(void)
Waldek 0:b72c7c2ee5f3 21 {
Waldek 0:b72c7c2ee5f3 22 this->ticks++;
Waldek 0:b72c7c2ee5f3 23 }