examples/DS401_Master/TestMasterMicroMod.c
changeset 454 bc000083297a
parent 378 d2abf6c8c27b
child 540 6857b6ffb7a7
--- a/examples/DS401_Master/TestMasterMicroMod.c	Tue Apr 29 13:54:23 2008 +0200
+++ b/examples/DS401_Master/TestMasterMicroMod.c	Fri May 02 17:30:37 2008 +0200
@@ -82,7 +82,7 @@
 			RW);  /* UNS8 checkAccess */
 }
 
-static init_step = 0;
+static int init_step = 0;
 
 /*Froward declaration*/
 static void ConfigureSlaveNode(CO_Data* d, UNS8 nodeId);
@@ -363,7 +363,7 @@
 }
 #endif
 
-void help()
+void help(void)
 {
   printf("**************************************************************\n");
   printf("*  TestMasterMicroMod                                        *\n");
@@ -409,6 +409,15 @@
 	}
 }
 
+/***************************  EXIT  *****************************************/
+void Exit(CO_Data* d, UNS32 id)
+{
+	masterSendNMTstateChange(&TestMaster_Data, 0x02, NMT_Reset_Node);
+
+    //Stop master
+	setState(&TestMaster_Data, Stopped);
+}
+
 /****************************************************************************/
 /***************************  MAIN  *****************************************/
 /****************************************************************************/
@@ -466,6 +475,7 @@
   /* install signal handler for manual break */
 	signal(SIGTERM, catch_signal);
 	signal(SIGINT, catch_signal);
+	TimerInit();
 #endif
 
 #ifndef NOT_USE_DYNAMIC_LOADING
@@ -499,12 +509,13 @@
 	setState(&TestMaster_Data, Stopped);
 	
 	// Stop timer thread
-	StopTimerLoop();
+	StopTimerLoop(&Exit);
 	
 fail_master:
 	if(MasterBoard.baudrate) canClose(&TestMaster_Data);	
 
-  return 0;
-}
-
-
+	TimerCleanup();
+  	return 0;
+}
+
+