| 1 |
#ifndef _CTIMEDEVENT_ |
| 2 |
#define _CTIMEDEVENT_ |
| 3 |
|
| 4 |
#include "CSequencedEvent.h" |
| 5 |
#include "CTimer.h" |
| 6 |
|
| 7 |
class CTimedEvent : public CSequencedEvent |
| 8 |
{ |
| 9 |
public: |
| 10 |
CTimedEvent(int period, bool c) : CSequencedEvent(c), timer(0), period(period) {} |
| 11 |
|
| 12 |
bool updateTime() { return timer.isRinging(); } |
| 13 |
unsigned int ticksElapsed() { return timer.getElapsed(); } |
| 14 |
|
| 15 |
void initialize() { CSequencedEvent::initialize(); timer.setPeriod(period); timer.reset(); } |
| 16 |
protected: |
| 17 |
CTimer timer; |
| 18 |
int period; |
| 19 |
}; |
| 20 |
|
| 21 |
#endif |