Minor changes, mostly PCAN/windows related.
authoretisserant
Sun, 09 Dec 2007 15:43:39 +0100
changeset 331 da55aa2f9e64
parent 330 04b92f78d7bb
child 332 97a7a0538dd1
Minor changes, mostly PCAN/windows related.
configure
drivers/timers_win32/.cvsignore
drivers/win32/.cvsignore
examples/DS401_Slave_Gui/TestSlaveGui.cpp
examples/DS401_Slave_Gui/main.cpp
examples/TestMasterMicroMod/TestMasterMicroMod.c
examples/TestMasterSlave/TestMasterSlave.c
--- a/configure	Sun Dec 09 15:38:30 2007 +0100
+++ b/configure	Sun Dec 09 15:43:39 2007 +0100
@@ -443,6 +443,7 @@
    	SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -liberty\ \'$PCAN_LIB\'
 	echo "Converting PcanLib header files for gcc -> $PW32DIR/cancfg.h"
 	cat $PW32DIR/cancfg.h.head $PCAN_INCLUDE/$PCAN_HEADER > $PW32DIR/cancfg.h
+	echo >> $PW32DIR/cancfg.h
 	# second port handling
 	if [ "$PCAN2_HEADER" != "" ]; then
 		echo "Stripping down second Pcan Light header "
@@ -458,6 +459,14 @@
 		echo "	PCANHwType PCANIO_Port PCANInterupt"
 		echo '#define extra_PCAN_init_params' >> $PW32DIR/cancfg.h
 	fi
+	if ! grep -q CAN_Init $PW32DIR/cancfg.h ; then
+		echo "Pcan Light header/lib is for second port of device only"
+		echo "CAN_* calls redefined to CAN2_* "
+		echo '#define CAN_Init CAN2_Init' >> $PW32DIR/cancfg.h
+		echo '#define CAN_Read CAN2_Read' >> $PW32DIR/cancfg.h
+		echo '#define CAN_Write CAN2_Write' >> $PW32DIR/cancfg.h
+		echo '#define CAN_Close CAN2_Close' >> $PW32DIR/cancfg.h
+	fi
 	cat $PW32DIR/cancfg.h.tail >> $PW32DIR/cancfg.h
 fi
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/drivers/timers_win32/.cvsignore	Sun Dec 09 15:43:39 2007 +0100
@@ -0,0 +1,1 @@
+Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/drivers/win32/.cvsignore	Sun Dec 09 15:43:39 2007 +0100
@@ -0,0 +1,1 @@
+Makefile
--- a/examples/DS401_Slave_Gui/TestSlaveGui.cpp	Sun Dec 09 15:38:30 2007 +0100
+++ b/examples/DS401_Slave_Gui/TestSlaveGui.cpp	Sun Dec 09 15:43:39 2007 +0100
@@ -67,7 +67,8 @@
   printf("Bus name: %s        Freq: %s       Driver: %s\n", SlaveBoard.busname, SlaveBoard.baudrate, LibraryPath);
 
   #ifndef NOT_USE_DYNAMIC_LOADING
-	LoadCanDriver(LibraryPath);
+	if (LoadCanDriver(LibraryPath) == NULL)
+		*textLog << wxT("Unable to load library\n");
   #endif		
 	// Open CAN devices
 
--- a/examples/DS401_Slave_Gui/main.cpp	Sun Dec 09 15:38:30 2007 +0100
+++ b/examples/DS401_Slave_Gui/main.cpp	Sun Dec 09 15:43:39 2007 +0100
@@ -57,6 +57,12 @@
 double			old_max = 5;
 double			old_min = -5;
 
+#if defined(WIN32)
+#define LIB_EXTENT wxT("*.dll")
+#else
+#define LIB_EXTENT wxT("*.so")
+#endif
+
 // Declare some IDs. These are arbitrary.
 const int BOOKCTRL = 100;
 const int FILE_QUIT = wxID_EXIT;
@@ -129,7 +135,7 @@
  EVT_MENU(FILE_QUIT, MyFrame::OnQuit)
  EVT_BUTTON(QUIT, MyFrame::OnQuit)
  EVT_MENU(HELP_ABOUT, MyFrame::OnAbout)
- EVT_PAINT(MyFrame::OnPaint)
+ //EVT_PAINT(MyFrame::OnPaint)
  
  EVT_TIMER(TIMER_ID, MyFrame::OnTimer)
 END_EVENT_TABLE()
@@ -416,9 +422,10 @@
   _T("Bool Input 5"), _T("Bool Input 6"), 
   _T("Bool Input 7"), _T("Bool Input 8"), };
  panel = new wxPanel(book); 
- book->AddPage(panel, wxT("Graphic"), true); 
+ //book->AddPage(panel, wxT("Graphic"), true); 
  mysizer = new wxBoxSizer( wxVERTICAL ); 
- panel->SetSizer(mysizer); 
+ panel->SetSizer(mysizer);
+ panel->Hide();
  myhsizer = new wxStaticBoxSizer( new wxStaticBox(panel, wxID_ANY, _T("Graphic")), wxVERTICAL ); 
  mysizer->Add(myhsizer, 0, wxEXPAND | wxALL, 10); 
  mygraphpan = new wxPanel(panel, wxID_ANY, wxDefaultPosition, wxSize(0, 350), wxTAB_TRAVERSAL, wxT("Graphic")); 
@@ -512,7 +519,7 @@
 
 void MyFrame::OnLoad(wxCommandEvent& WXUNUSED(event))
 {
-    wxFileDialog fd(this, wxT("Choose a node configuration file"), wxT(""), wxT("Slave.od"), wxT("*.so"));
+    wxFileDialog fd(this, wxT("Choose a can driver library"), wxT(""), wxT(""), LIB_EXTENT);
 
     if(fd.ShowModal() == wxID_OK)
     {
--- a/examples/TestMasterMicroMod/TestMasterMicroMod.c	Sun Dec 09 15:38:30 2007 +0100
+++ b/examples/TestMasterMicroMod/TestMasterMicroMod.c	Sun Dec 09 15:43:39 2007 +0100
@@ -38,7 +38,7 @@
 #include "canfestival.h"
 #include "TestMasterMicroMod.h"
 #include "TestMaster.h"
-UNS8 slavenodeid;
+UNS8 slavenodeid = 0x40;
 
 
 /*****************************************************************************/
@@ -333,7 +333,7 @@
 }
 
 //s_BOARD SlaveBoard = {"0", "500K"};
-s_BOARD MasterBoard = {"32", "125K"};
+s_BOARD MasterBoard = {"0", "125K"};
 
 #if !defined(WIN32) || defined(__CYGWIN__)
 void catch_signal(int sig)
--- a/examples/TestMasterSlave/TestMasterSlave.c	Sun Dec 09 15:38:30 2007 +0100
+++ b/examples/TestMasterSlave/TestMasterSlave.c	Sun Dec 09 15:43:39 2007 +0100
@@ -180,7 +180,8 @@
 #endif
 
 #ifndef NOT_USE_DYNAMIC_LOADING
-	LoadCanDriver(LibraryPath);
+	if (LoadCanDriver(LibraryPath) == NULL)
+	    printf("Unable to load library: %s\n",LibraryPath);
 #endif		
 	// Open CAN devices