summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchatty1993-12-22 12:24:41 +0000
committerchatty1993-12-22 12:24:41 +0000
commit6467209d75c96a4a959177b562f408f1b59f4125 (patch)
tree7f6e57c6124bb0c06d981e716725f5d6de90656c
parentcdf8de1c026efbe1f1b521c7fae5b9b284e1ba50 (diff)
downloadivy-league-6467209d75c96a4a959177b562f408f1b59f4125.zip
ivy-league-6467209d75c96a4a959177b562f408f1b59f4125.tar.gz
ivy-league-6467209d75c96a4a959177b562f408f1b59f4125.tar.bz2
ivy-league-6467209d75c96a4a959177b562f408f1b59f4125.tar.xz
Added ChangeNbPulses
-rw-r--r--utils/Timer.cc14
-rw-r--r--utils/Timer.h3
2 files changed, 15 insertions, 2 deletions
diff --git a/utils/Timer.cc b/utils/Timer.cc
index 0d63bcc..def04c1 100644
--- a/utils/Timer.cc
+++ b/utils/Timer.cc
@@ -183,7 +183,7 @@ timing scheme.}
CcuCoreTimer :: CcuCoreTimer (Millisecond period, int pulses, CcuTimerSet* s)
: MySet (s),
StatusFlag (Active),
- Period (period),
+ Period (period > 0 ? period : 10),
PulsesLeft (pulses)
{
}
@@ -210,6 +210,18 @@ CcuCoreTimer :: ChangePeriod (Millisecond period)
}
/*?
+Change the number of times a timer will go off before stopping. If
+the timer is stopped, it is not restarted.
+?*/
+void
+CcuCoreTimer :: ChangeNbPulses (int nb)
+{
+ CcuSignalBlocker b (SigAlrm);
+ PulsesLeft = nb;
+}
+
+
+/*?
Stop this timer if it was running, then start it with its current period.
This function can be used to reset a timer to the beginning of a period.
?*/
diff --git a/utils/Timer.h b/utils/Timer.h
index 55a4c17..3e5969d 100644
--- a/utils/Timer.h
+++ b/utils/Timer.h
@@ -68,7 +68,8 @@ static int IsInactive (CcuCoreTimer*);
virtual ~CcuCoreTimer ();
public:
- void ChangePeriod (Millisecond first);
+ void ChangePeriod (Millisecond);
+ void ChangeNbPulses (int);
void Stop ();
void Restart ();
void Wait ();