ADDED: - pause() for win32
authorChristian Taedcke <Christian.Taedcke@ica-traffic.de>
Tue, 23 Feb 2010 08:12:19 +0100
changeset 642 f77ad188c2b1
parent 641 404a51700f40
child 643 8b67ee3f5363
ADDED: - pause() for win32
* * *
CHANGED: - moved pause implementation to main.cpp
- default driver to ixxat, baudrate to 125K and slaveid to 0x40
* * *
FIXED: - append "K" to baudrate
- added TimerInit()
examples/SillySlave/main.c
examples/SillySlave/main.h
examples/SillySlave/slave.c
--- a/examples/SillySlave/main.c	Tue Feb 23 08:09:57 2010 +0100
+++ b/examples/SillySlave/main.c	Tue Feb 23 08:12:19 2010 +0100
@@ -43,6 +43,13 @@
 }
 #endif
 
+#if defined(WIN32) && !defined(__CYGWIN__)
+void pause(void)
+{
+	system("PAUSE");
+}
+#endif
+
 
 /**
  * Please edit main.h defines before compiling
--- a/examples/SillySlave/main.h	Tue Feb 23 08:09:57 2010 +0100
+++ b/examples/SillySlave/main.h	Tue Feb 23 08:12:19 2010 +0100
@@ -37,10 +37,7 @@
 #if defined(WIN32) && !defined(__CYGWIN__)
 #include <windows.h>
 #include "getopt.h"
-void pause(void)
-{
-	system("PAUSE");
-}
+void pause(void);
 #else
 #include <unistd.h>
 #include <stdio.h>
@@ -55,11 +52,10 @@
  * Please tune the following defines to suit your needs:
  */
 #define NODE_MASTER 0x1        
-#define NODE_SLAVE  0x12        
-#define DRIVER_LIBRARY "libcanfestival_can_kvaser.so"
-#define BAUDRATE 250000
+#define NODE_SLAVE  0x40      
+#define DRIVER_LIBRARY "can_ixxat_win32.dll"
+#define BAUDRATE 125
 #define BUS 0
 
 #endif /* _MAIN_H */
 
-
--- a/examples/SillySlave/slave.c	Tue Feb 23 08:09:57 2010 +0100
+++ b/examples/SillySlave/slave.c	Tue Feb 23 08:12:19 2010 +0100
@@ -57,7 +57,7 @@
 s_BOARD board;
 
     sprintf(busName, "%u", bus);
-    sprintf(baudRate, "%u", baudrate);
+    sprintf(baudRate, "%uK", baudrate);
     board.busname = busName;
     board.baudrate = baudRate;
 
@@ -73,6 +73,8 @@
     SillySlave_Data.storeODSubIndex = SillySlave_storeODSubIndex;
     SillySlave_Data.post_emcy = SillySlave_post_emcy;
     
+	TimerInit();
+
     if(!canOpen(&board, &SillySlave_Data))
     {
         printf("\n\aInitCANdevice() CAN bus %s opening error, baudrate=%s\n",board.busname, board.baudrate);
@@ -82,7 +84,7 @@
 
     printf("\nInitCANdevice(), canOpen() OK, starting timer loop...\n");
 
-    /* Start timer thread */
+	/* Start timer thread */
     StartTimerLoop(&InitNode); 
     
 	/* wait Ctrl-C */