summaryrefslogtreecommitdiff
path: root/comm/TimeOut.cc
diff options
context:
space:
mode:
authorchatty1993-04-07 11:50:31 +0000
committerchatty1993-04-07 11:50:31 +0000
commitba066c34dde204aa192d03a23a81356374d93731 (patch)
tree39391f6235d2cf8a59a0634ac5ea430cdd21f5d4 /comm/TimeOut.cc
parent05ab076e1c2a9ca16472f9a6b47b8d22914b3783 (diff)
downloadivy-league-ba066c34dde204aa192d03a23a81356374d93731.zip
ivy-league-ba066c34dde204aa192d03a23a81356374d93731.tar.gz
ivy-league-ba066c34dde204aa192d03a23a81356374d93731.tar.bz2
ivy-league-ba066c34dde204aa192d03a23a81356374d93731.tar.xz
Initial revision
Diffstat (limited to 'comm/TimeOut.cc')
-rw-r--r--comm/TimeOut.cc69
1 files changed, 69 insertions, 0 deletions
diff --git a/comm/TimeOut.cc b/comm/TimeOut.cc
new file mode 100644
index 0000000..18fb3ec
--- /dev/null
+++ b/comm/TimeOut.cc
@@ -0,0 +1,69 @@
+#include "TimeOut.h"
+#include "ccu/Signal.h"
+#include "Multiplexer.h"
+
+UchBaseTimeOut :: UchBaseTimeOut (UchMultiplexer& m, Millisecond period, int pulses)
+: CcuCoreTimer (period, pulses, m.GetTimerSet ()),
+ MyMpx (m)
+{
+ CcuSignalBlocker b (SigAlrm);
+
+ if (PulsesLeft != 0)
+ Activate ();
+}
+
+/*?hidden?*/
+UchBaseTimeOut :: ~UchBaseTimeOut ()
+{
+ /* stop it */
+ if (StatusFlag == Active)
+ Stop ();
+}
+
+/*?hidden?*/
+void
+UchBaseTimeOut :: StopAlarm ()
+{
+ MyMpx.SuppressTimeOut ();
+}
+
+/*?hidden?*/
+void
+UchBaseTimeOut :: SetAlarm (Millisecond when)
+{
+ MyMpx.SetTimeOut (when);
+}
+
+
+
+
+/*?class UchTimeOut
+The class \typ{UchTimeOut} is a derived class of \typ{UchBaseTimeOut} that
+can be used without deriving a new class.
+Each \typ{UchTimeOut} holds a pointer to a function which is called when the timer
+expires. This function, which is passed to the constructor, must
+take a \typ{Millisecond} argument and return \typ{void}.
+?*/
+
+/*?
+Create a timer associated to the multiplexer \var{m}, that will expire every \var{period} milliseconds and call
+the function \var{handler}.
+?*/
+UchTimeOut :: UchTimeOut (UchMultiplexer& m, Millisecond period, void (*handler) (Millisecond), int pulses)
+: UchBaseTimeOut (m, period, pulses),
+ Handler (handler)
+{
+}
+
+/*?nodoc?*/
+UchTimeOut :: ~UchTimeOut ()
+{
+}
+
+/*?nodoc?*/
+void
+UchTimeOut :: Handle (Millisecond ref)
+{
+ (*Handler) (ref);
+}
+