examples/DS401_Slave_Gui/TestSlaveGui.cpp
changeset 454 bc000083297a
parent 382 860e858685d3
child 458 a3906286b09b
--- a/examples/DS401_Slave_Gui/TestSlaveGui.cpp	Tue Apr 29 13:54:23 2008 +0200
+++ b/examples/DS401_Slave_Gui/TestSlaveGui.cpp	Fri May 02 17:30:37 2008 +0200
@@ -60,6 +60,12 @@
   setState (&ObjDict_Data, Initialisation);
 }
 
+/***************************  EXIT  *****************************************/
+void Exit(CO_Data* d, UNS32 id)
+{
+  	setState (&ObjDict_Data, Stopped);
+	canClose (&ObjDict_Data);
+}
 //****************************************************************************
 //***************************  MAIN  *****************************************
 //****************************************************************************
@@ -69,6 +75,7 @@
   printf ("Bus name: %s        Freq: %s       Driver: %s\n",
 	  SlaveBoard.busname, SlaveBoard.baudrate, LibraryPath);
 
+  TimerInit();
 #ifndef NOT_USE_DYNAMIC_LOADING
   if (LoadCanDriver (LibraryPath) == NULL)
     *textLog << wxT ("Unable to load library\n");
@@ -99,12 +106,7 @@
 void
 stop_slave ()
 {
-  EnterMutex ();
-  setState (&ObjDict_Data, Stopped);
-  LeaveMutex ();
-
-  StopTimerLoop ();
-  canClose (&ObjDict_Data);
-
+  StopTimerLoop (&Exit);
+  TimerCleanup();
   return;
 }