DS401 Slave GUI : Added command line interface, cleaned up parts of code, added EDS.
--- a/examples/DS401_Slave_Gui/CallBack.cpp Sun Sep 30 22:38:58 2007 +0200
+++ b/examples/DS401_Slave_Gui/CallBack.cpp Sun Sep 30 22:41:12 2007 +0200
@@ -62,7 +62,7 @@
void Call_post_sync()
{
- *textLog << wxT("Post_sync\n");
+ //*textLog << wxT("Post_sync\n");
printf("POST SYNC:\n");
printf(" Write_Outputs: %x \n Analogue_Output1: %d \n Analogue_Output2: %d \n", Write_Outputs_8_Bit[0], Write_Analogue_Output_16_Bit[0], Write_Analogue_Output_16_Bit[1]);
printf(" Read_Input: %x \n Analogue_Input1: %d \n Analogue_Input2: %d \n", Read_Inputs_8_Bit[0], Read_Analogue_Input_16_Bit[0], Read_Analogue_Input_16_Bit[1]);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/DS401_Slave_Gui/DS401_Slave_Gui.eds Sun Sep 30 22:41:12 2007 +0200
@@ -0,0 +1,1278 @@
+[FileInfo]
+FileName=DS401_Slave_Gui.eds
+FileVersion=1
+FileRevision=1
+EDSVersion=4.0
+Description=
+CreationTime=06:00PM
+CreationDate=09-27-2007
+CreatedBy=CANFestival
+ModificationTime=06:00PM
+ModificationDate=09-27-2007
+ModifiedBy=CANFestival
+
+[DeviceInfo]
+VendorName=CANFestival
+VendorNumber=0x00000175
+ProductName=ObjDict
+ProductNumber=0x00100000
+RevisionNumber=0x00010001
+BaudRate_10=1
+BaudRate_20=1
+BaudRate_50=1
+BaudRate_125=1
+BaudRate_250=1
+BaudRate_500=1
+BaudRate_800=1
+BaudRate_1000=1
+SimpleBootUpMaster=0
+SimpleBootUpSlave=1
+Granularity=8
+DynamicChannelsSupported=0
+CompactPDO=0
+GroupMessaging=0
+NrOfRXPDO=4
+NrOfTXPDO=4
+LSS_Supported=0
+
+[DummyUsage]
+Dummy0001=0
+Dummy0002=1
+Dummy0003=1
+Dummy0004=1
+Dummy0005=1
+Dummy0006=1
+Dummy0007=1
+
+[Comments]
+Lines=0
+
+[MandatoryObjects]
+SupportedObjects=3
+1=0x1000
+2=0x1001
+3=0x1018
+
+[1000]
+ParameterName=Device Type
+ObjectType=0x7
+DataType=0x0007
+AccessType=ro
+DefaultValue=983441
+PDOMapping=0
+
+[1001]
+ParameterName=Error Register
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=0
+PDOMapping=1
+
+[1018]
+ParameterName=Identity
+ObjectType=0x8
+SubNumber=4
+
+[1018sub0]
+ParameterName=Number of Entries
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=3
+PDOMapping=0
+
+[1018sub1]
+ParameterName=Vendor ID
+ObjectType=0x7
+DataType=0x0007
+AccessType=ro
+DefaultValue=373
+PDOMapping=0
+
+[1018sub2]
+ParameterName=Product Code
+ObjectType=0x7
+DataType=0x0007
+AccessType=ro
+DefaultValue=1048576
+PDOMapping=0
+
+[1018sub3]
+ParameterName=Revision Number
+ObjectType=0x7
+DataType=0x0007
+AccessType=ro
+DefaultValue=65537
+PDOMapping=0
+
+[OptionalObjects]
+SupportedObjects=39
+1=0x1002
+2=0x1005
+3=0x1008
+4=0x1009
+5=0x100A
+6=0x100C
+7=0x100D
+8=0x1010
+9=0x1011
+10=0x1016
+11=0x1017
+12=0x1020
+13=0x1200
+14=0x1400
+15=0x1401
+16=0x1402
+17=0x1403
+18=0x1600
+19=0x1601
+20=0x1800
+21=0x1801
+22=0x1802
+23=0x1803
+24=0x1A00
+25=0x1A01
+26=0x1A02
+27=0x1F50
+28=0x6000
+29=0x6002
+30=0x6200
+31=0x6202
+32=0x6206
+33=0x6207
+34=0x6401
+35=0x6411
+36=0x6423
+37=0x6426
+38=0x6443
+39=0x6444
+
+[1002]
+ParameterName=Manufacturer Status Register
+ObjectType=0x7
+DataType=0x0007
+AccessType=ro
+DefaultValue=0
+PDOMapping=1
+
+[1005]
+ParameterName=SYNC COB ID
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=128
+PDOMapping=0
+
+[1008]
+ParameterName=Manufacturer Device Name
+ObjectType=0x7
+DataType=0x0009
+AccessType=ro
+DefaultValue=
+PDOMapping=0
+
+[1009]
+ParameterName=Manufacturer Hardware Version
+ObjectType=0x7
+DataType=0x0009
+AccessType=ro
+DefaultValue=
+PDOMapping=0
+
+[100A]
+ParameterName=Manufacturer Software Version
+ObjectType=0x7
+DataType=0x0009
+AccessType=ro
+DefaultValue=
+PDOMapping=0
+
+[100C]
+ParameterName=Guard Time
+ObjectType=0x7
+DataType=0x0006
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[100D]
+ParameterName=Life Time Factor
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1010]
+ParameterName=Store parameters
+ObjectType=0x8
+SubNumber=2
+
+[1010sub0]
+ParameterName=Number of Entries
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=1
+PDOMapping=0
+
+[1010sub1]
+ParameterName=Save All Parameters
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1011]
+ParameterName=Restore Default Parameters
+ObjectType=0x8
+SubNumber=2
+
+[1011sub0]
+ParameterName=Number of Entries
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=1
+PDOMapping=0
+
+[1011sub1]
+ParameterName=Restore All Default Parameters
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1016]
+ParameterName=Consumer Heartbeat Time
+ObjectType=0x9
+SubNumber=4
+
+[1016sub0]
+ParameterName=Number of Entries
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=3
+PDOMapping=0
+
+[1016sub1]
+ParameterName=Consumer Heartbeat Time
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1016sub2]
+ParameterName=Consumer Heartbeat Time
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1016sub3]
+ParameterName=Consumer Heartbeat Time
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1017]
+ParameterName=Producer Heartbeat Time
+ObjectType=0x7
+DataType=0x0006
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1020]
+ParameterName=Verify Configuration
+ObjectType=0x8
+SubNumber=3
+
+[1020sub0]
+ParameterName=Number of Entries
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=2
+PDOMapping=0
+
+[1020sub1]
+ParameterName=Configuration Date
+ObjectType=0x7
+DataType=0x0007
+AccessType=ro
+DefaultValue=0
+PDOMapping=0
+
+[1020sub2]
+ParameterName=Configuration Time
+ObjectType=0x7
+DataType=0x0007
+AccessType=ro
+DefaultValue=0
+PDOMapping=0
+
+[1200]
+ParameterName=Server SDO Parameter
+ObjectType=0x8
+SubNumber=3
+
+[1200sub0]
+ParameterName=Number of Entries
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=2
+PDOMapping=0
+
+[1200sub1]
+ParameterName=COB ID Client to Server (Receive SDO)
+ObjectType=0x7
+DataType=0x0007
+AccessType=ro
+DefaultValue=1600
+PDOMapping=0
+
+[1200sub2]
+ParameterName=COB ID Server to Client (Transmit SDO)
+ObjectType=0x7
+DataType=0x0007
+AccessType=ro
+DefaultValue=1472
+PDOMapping=0
+
+[1400]
+ParameterName=Receive PDO 1 Parameter
+ObjectType=0x8
+SubNumber=3
+
+[1400sub0]
+ParameterName=Highest SubIndex Supported
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=2
+PDOMapping=0
+
+[1400sub1]
+ParameterName=COB ID used by PDO
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=576
+PDOMapping=0
+
+[1400sub2]
+ParameterName=Transmission Type
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=1
+PDOMapping=0
+
+[1401]
+ParameterName=Receive PDO 2 Parameter
+ObjectType=0x8
+SubNumber=3
+
+[1401sub0]
+ParameterName=Highest SubIndex Supported
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=2
+PDOMapping=0
+
+[1401sub1]
+ParameterName=COB ID used by PDO
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=832
+PDOMapping=0
+
+[1401sub2]
+ParameterName=Transmission Type
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=1
+PDOMapping=0
+
+[1402]
+ParameterName=Receive PDO 3 Parameter
+ObjectType=0x8
+SubNumber=3
+
+[1402sub0]
+ParameterName=Highest SubIndex Supported
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=2
+PDOMapping=0
+
+[1402sub1]
+ParameterName=COB ID used by PDO
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=2147484736
+PDOMapping=0
+
+[1402sub2]
+ParameterName=Transmission Type
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=1
+PDOMapping=0
+
+[1403]
+ParameterName=Receive PDO 4 Parameter
+ObjectType=0x8
+SubNumber=3
+
+[1403sub0]
+ParameterName=Highest SubIndex Supported
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=2
+PDOMapping=0
+
+[1403sub1]
+ParameterName=COB ID used by PDO
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=2147484992
+PDOMapping=0
+
+[1403sub2]
+ParameterName=Transmission Type
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=1
+PDOMapping=0
+
+[1600]
+ParameterName=Receive PDO 1 Mapping
+ObjectType=0x9
+SubNumber=2
+
+[1600sub0]
+ParameterName=Number of Entries
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=1
+PDOMapping=0
+
+[1600sub1]
+ParameterName=PDO 1 Mapping for an application object 1
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=1644167432
+PDOMapping=0
+
+[1601]
+ParameterName=Receive PDO 2 Mapping
+ObjectType=0x9
+SubNumber=5
+
+[1601sub0]
+ParameterName=Number of Entries
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=4
+PDOMapping=0
+
+[1601sub1]
+ParameterName=PDO 2 Mapping for an application object 1
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=1678835984
+PDOMapping=0
+
+[1601sub2]
+ParameterName=PDO 2 Mapping for an application object 2
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=1678836240
+PDOMapping=0
+
+[1601sub3]
+ParameterName=PDO 2 Mapping for an application object 3
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=1678836496
+PDOMapping=0
+
+[1601sub4]
+ParameterName=PDO 2 Mapping for an application object 4
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=1678836752
+PDOMapping=0
+
+[1800]
+ParameterName=Transmit PDO 1 Parameter
+ObjectType=0x8
+SubNumber=5
+
+[1800sub0]
+ParameterName=Highest SubIndex Supported
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=5
+PDOMapping=0
+
+[1800sub1]
+ParameterName=COB ID used by PDO
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=448
+PDOMapping=0
+
+[1800sub2]
+ParameterName=Transmission Type
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=1
+PDOMapping=0
+
+[1800sub3]
+ParameterName=Inhibit Time
+ObjectType=0x7
+DataType=0x0006
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1800sub5]
+ParameterName=Event Timer
+ObjectType=0x7
+DataType=0x0006
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1801]
+ParameterName=Transmit PDO 2 Parameter
+ObjectType=0x8
+SubNumber=5
+
+[1801sub0]
+ParameterName=Highest SubIndex Supported
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=5
+PDOMapping=0
+
+[1801sub1]
+ParameterName=COB ID used by PDO
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=704
+PDOMapping=0
+
+[1801sub2]
+ParameterName=Transmission Type
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=1
+PDOMapping=0
+
+[1801sub3]
+ParameterName=Inhibit Time
+ObjectType=0x7
+DataType=0x0006
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1801sub5]
+ParameterName=Event Timer
+ObjectType=0x7
+DataType=0x0006
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1802]
+ParameterName=Transmit PDO 3 Parameter
+ObjectType=0x8
+SubNumber=5
+
+[1802sub0]
+ParameterName=Highest SubIndex Supported
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=5
+PDOMapping=0
+
+[1802sub1]
+ParameterName=COB ID used by PDO
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=960
+PDOMapping=0
+
+[1802sub2]
+ParameterName=Transmission Type
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=1
+PDOMapping=0
+
+[1802sub3]
+ParameterName=Inhibit Time
+ObjectType=0x7
+DataType=0x0006
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1802sub5]
+ParameterName=Event Timer
+ObjectType=0x7
+DataType=0x0006
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1803]
+ParameterName=Transmit PDO 4 Parameter
+ObjectType=0x8
+SubNumber=5
+
+[1803sub0]
+ParameterName=Highest SubIndex Supported
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=5
+PDOMapping=0
+
+[1803sub1]
+ParameterName=COB ID used by PDO
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=2147484864
+PDOMapping=0
+
+[1803sub2]
+ParameterName=Transmission Type
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=1
+PDOMapping=0
+
+[1803sub3]
+ParameterName=Inhibit Time
+ObjectType=0x7
+DataType=0x0006
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1803sub5]
+ParameterName=Event Timer
+ObjectType=0x7
+DataType=0x0006
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1A00]
+ParameterName=Transmit PDO 1 Mapping
+ObjectType=0x9
+SubNumber=2
+
+[1A00sub0]
+ParameterName=Number of Entries
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=1
+PDOMapping=0
+
+[1A00sub1]
+ParameterName=PDO 1 Mapping for a process data variable 1
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=1610613000
+PDOMapping=0
+
+[1A01]
+ParameterName=Transmit PDO 2 Mapping
+ObjectType=0x9
+SubNumber=5
+
+[1A01sub0]
+ParameterName=Number of Entries
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=4
+PDOMapping=0
+
+[1A01sub1]
+ParameterName=PDO 2 Mapping for a process data variable 1
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=1677787408
+PDOMapping=0
+
+[1A01sub2]
+ParameterName=PDO 2 Mapping for a process data variable 2
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=1677787664
+PDOMapping=0
+
+[1A01sub3]
+ParameterName=PDO 2 Mapping for a process data variable 3
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=1677787920
+PDOMapping=0
+
+[1A01sub4]
+ParameterName=PDO 2 Mapping for a process data variable 4
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=1677788176
+PDOMapping=0
+
+[1A02]
+ParameterName=Transmit PDO 3 Mapping
+ObjectType=0x9
+SubNumber=5
+
+[1A02sub0]
+ParameterName=Number of Entries
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=4
+PDOMapping=0
+
+[1A02sub1]
+ParameterName=PDO 3 Mapping for a process data variable 1
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=1677788432
+PDOMapping=0
+
+[1A02sub2]
+ParameterName=PDO 3 Mapping for a process data variable 2
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=1677788688
+PDOMapping=0
+
+[1A02sub3]
+ParameterName=PDO 3 Mapping for a process data variable 3
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=1677788944
+PDOMapping=0
+
+[1A02sub4]
+ParameterName=PDO 3 Mapping for a process data variable 4
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=1677789200
+PDOMapping=0
+
+[1F50]
+ParameterName=Download Program Data
+ObjectType=0x8
+SubNumber=3
+
+[1F50sub0]
+ParameterName=Number of Entries
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=3
+PDOMapping=0
+
+[1F50sub2]
+ParameterName=Compatibility
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=0
+PDOMapping=0
+
+[1F50sub3]
+ParameterName=Download Program Data - HW Settings
+ObjectType=0x7
+DataType=0x000F
+AccessType=rw
+DefaultValue=
+PDOMapping=0
+
+[6000]
+ParameterName=Read Inputs 8 Bit
+ObjectType=0x9
+SubNumber=2
+
+[6000sub0]
+ParameterName=Number of Input 8 bit
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=1
+PDOMapping=0
+
+[6000sub1]
+ParameterName=Read Inputs 0x1 to 0x8
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=0
+PDOMapping=1
+
+[6002]
+ParameterName=Polarity Input 8 Bit
+ObjectType=0x9
+SubNumber=2
+
+[6002sub0]
+ParameterName=Number of Input 8 bit
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=1
+PDOMapping=0
+
+[6002sub1]
+ParameterName=Polarity Input 0x1 to 0x8
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6200]
+ParameterName=Write Outputs 8 Bit
+ObjectType=0x9
+SubNumber=2
+
+[6200sub0]
+ParameterName=Number of Output 8 Bit
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=1
+PDOMapping=0
+
+[6200sub1]
+ParameterName=Write Outputs 0x1 to 0x8
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6202]
+ParameterName=Change Polarity Outputs 8 Bit
+ObjectType=0x9
+SubNumber=2
+
+[6202sub0]
+ParameterName=Number of Output 8 Bit
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=1
+PDOMapping=0
+
+[6202sub1]
+ParameterName=Change Polarity Outputs 0x1 to 0x8
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6206]
+ParameterName=Error Mode Outputs 8 Bit
+ObjectType=0x9
+SubNumber=2
+
+[6206sub0]
+ParameterName=Number of Output 8 Bit
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=1
+PDOMapping=0
+
+[6206sub1]
+ParameterName=Error Mode Outputs 0x1 to 0x8
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6207]
+ParameterName=Error Value Outputs 8 Bit
+ObjectType=0x9
+SubNumber=2
+
+[6207sub0]
+ParameterName=Number of Output 8 Bit
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=1
+PDOMapping=0
+
+[6207sub1]
+ParameterName=Error Value Outputs 0x1 to 0x8
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6401]
+ParameterName=Read Analogue Input 16 Bit
+ObjectType=0x9
+SubNumber=9
+
+[6401sub0]
+ParameterName=Number of Analogue Input 16 Bit
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=8
+PDOMapping=0
+
+[6401sub1]
+ParameterName=Analogue Input 1
+ObjectType=0x7
+DataType=0x0003
+AccessType=ro
+DefaultValue=0
+PDOMapping=1
+
+[6401sub2]
+ParameterName=Analogue Input 2
+ObjectType=0x7
+DataType=0x0003
+AccessType=ro
+DefaultValue=0
+PDOMapping=1
+
+[6401sub3]
+ParameterName=Analogue Input 3
+ObjectType=0x7
+DataType=0x0003
+AccessType=ro
+DefaultValue=0
+PDOMapping=1
+
+[6401sub4]
+ParameterName=Analogue Input 4
+ObjectType=0x7
+DataType=0x0003
+AccessType=ro
+DefaultValue=0
+PDOMapping=1
+
+[6401sub5]
+ParameterName=Analogue Input 5
+ObjectType=0x7
+DataType=0x0003
+AccessType=ro
+DefaultValue=0
+PDOMapping=1
+
+[6401sub6]
+ParameterName=Analogue Input 6
+ObjectType=0x7
+DataType=0x0003
+AccessType=ro
+DefaultValue=0
+PDOMapping=1
+
+[6401sub7]
+ParameterName=Analogue Input 7
+ObjectType=0x7
+DataType=0x0003
+AccessType=ro
+DefaultValue=0
+PDOMapping=1
+
+[6401sub8]
+ParameterName=Analogue Input 8
+ObjectType=0x7
+DataType=0x0003
+AccessType=ro
+DefaultValue=0
+PDOMapping=1
+
+[6411]
+ParameterName=Write Analogue Output 16 Bit
+ObjectType=0x9
+SubNumber=5
+
+[6411sub0]
+ParameterName=Number of Analogue Input 16 Bit
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=4
+PDOMapping=0
+
+[6411sub1]
+ParameterName=Analogue Output 1
+ObjectType=0x7
+DataType=0x0003
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6411sub2]
+ParameterName=Analogue Output 2
+ObjectType=0x7
+DataType=0x0003
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6411sub3]
+ParameterName=Analogue Output 3
+ObjectType=0x7
+DataType=0x0003
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6411sub4]
+ParameterName=Analogue Output 4
+ObjectType=0x7
+DataType=0x0003
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6423]
+ParameterName=Analogue Input Global Interrupt Enable
+ObjectType=0x7
+DataType=0x0001
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6426]
+ParameterName=Analogue Input Interrupt Delta Unsigned
+ObjectType=0x9
+SubNumber=9
+
+[6426sub0]
+ParameterName=Number of Analogue Inputs
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=8
+PDOMapping=0
+
+[6426sub1]
+ParameterName=Analogue Input 1
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6426sub2]
+ParameterName=Analogue Input 2
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6426sub3]
+ParameterName=Analogue Input 3
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6426sub4]
+ParameterName=Analogue Input 4
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6426sub5]
+ParameterName=Analogue Input 5
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6426sub6]
+ParameterName=Analogue Input 6
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6426sub7]
+ParameterName=Analogue Input 7
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6426sub8]
+ParameterName=Analogue Input 8
+ObjectType=0x7
+DataType=0x0007
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6443]
+ParameterName=Analogue Output Error Mode
+ObjectType=0x9
+SubNumber=5
+
+[6443sub0]
+ParameterName=Number of Analogue Outputs
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=4
+PDOMapping=0
+
+[6443sub1]
+ParameterName=Error Mode Analogue Output 1
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6443sub2]
+ParameterName=Error Mode Analogue Output 2
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6443sub3]
+ParameterName=Error Mode Analogue Output 3
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6443sub4]
+ParameterName=Error Mode Analogue Output 4
+ObjectType=0x7
+DataType=0x0005
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6444]
+ParameterName=Analogue Output Error Value Integer
+ObjectType=0x9
+SubNumber=5
+
+[6444sub0]
+ParameterName=Number of Analogue Outputs
+ObjectType=0x7
+DataType=0x0005
+AccessType=ro
+DefaultValue=4
+PDOMapping=0
+
+[6444sub1]
+ParameterName=Analogue Output 1
+ObjectType=0x7
+DataType=0x0004
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6444sub2]
+ParameterName=Analogue Output 2
+ObjectType=0x7
+DataType=0x0004
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6444sub3]
+ParameterName=Analogue Output 3
+ObjectType=0x7
+DataType=0x0004
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[6444sub4]
+ParameterName=Analogue Output 4
+ObjectType=0x7
+DataType=0x0004
+AccessType=rw
+DefaultValue=0
+PDOMapping=1
+
+[ManufacturerObjects]
+SupportedObjects=0
--- a/examples/DS401_Slave_Gui/ObjDict.c Sun Sep 30 22:38:58 2007 +0200
+++ b/examples/DS401_Slave_Gui/ObjDict.c Sun Sep 30 22:41:12 2007 +0200
@@ -79,9 +79,13 @@
/* Declaration of the value range types */
/**************************************************************************/
+#define valueRange_EMC 0x9F /* Type for index 0x1003 subindex 0x00 (only set of value 0 is possible) */
UNS32 ObjDict_valueRangeTest (UNS8 typeValue, void * value)
{
switch (typeValue) {
+ case valueRange_EMC:
+ if (*(UNS8*)value > (UNS8)0) return OD_VALUE_TOO_HIGH;
+ break;
}
return 0;
}
@@ -128,6 +132,23 @@
{ RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1002 }
};
+/* index 0x1003 : Pre-defined Error Field */
+ UNS8 ObjDict_highestSubIndex_obj1003 = 0; /* number of subindex - 1*/
+ UNS32 ObjDict_obj1003[] =
+ {
+ 0x0 /* 0 */
+ };
+ ODCallback_t ObjDict_Index1003_callbacks[] =
+ {
+ NULL,
+ NULL,
+ };
+ subindex ObjDict_Index1003[] =
+ {
+ { RW, valueRange_EMC, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1003 },
+ { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1003[0] }
+ };
+
/* index 0x1005 : SYNC COB ID. */
UNS32 ObjDict_obj1005 = 0x80; /* 128 */
ODCallback_t ObjDict_Index1005_callbacks[] =
@@ -338,6 +359,15 @@
UNS16 ObjDict_obj1800_Inhibit_Time = 0x0; /* 0 */
UNS8 ObjDict_obj1800_Compatibility_Entry = 0x0; /* 0 */
UNS16 ObjDict_obj1800_Event_Timer = 0x0; /* 0 */
+ ODCallback_t ObjDict_Index1800_callbacks[] =
+ {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ };
subindex ObjDict_Index1800[] =
{
{ RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1800 },
@@ -355,6 +385,15 @@
UNS16 ObjDict_obj1801_Inhibit_Time = 0x0; /* 0 */
UNS8 ObjDict_obj1801_Compatibility_Entry = 0x0; /* 0 */
UNS16 ObjDict_obj1801_Event_Timer = 0x0; /* 0 */
+ ODCallback_t ObjDict_Index1801_callbacks[] =
+ {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ };
subindex ObjDict_Index1801[] =
{
{ RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1801 },
@@ -372,6 +411,15 @@
UNS16 ObjDict_obj1802_Inhibit_Time = 0x0; /* 0 */
UNS8 ObjDict_obj1802_Compatibility_Entry = 0x0; /* 0 */
UNS16 ObjDict_obj1802_Event_Timer = 0x0; /* 0 */
+ ODCallback_t ObjDict_Index1802_callbacks[] =
+ {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ };
subindex ObjDict_Index1802[] =
{
{ RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1802 },
@@ -389,6 +437,15 @@
UNS16 ObjDict_obj1803_Inhibit_Time = 0x0; /* 0 */
UNS8 ObjDict_obj1803_Compatibility_Entry = 0x0; /* 0 */
UNS16 ObjDict_obj1803_Event_Timer = 0x0; /* 0 */
+ ODCallback_t ObjDict_Index1803_callbacks[] =
+ {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ };
subindex ObjDict_Index1803[] =
{
{ RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1803 },
@@ -650,10 +707,10 @@
case 0x1403: i = 19;break;
case 0x1600: i = 20;break;
case 0x1601: i = 21;break;
- case 0x1800: i = 22;break;
- case 0x1801: i = 23;break;
- case 0x1802: i = 24;break;
- case 0x1803: i = 25;break;
+ case 0x1800: i = 22;*callbacks = ObjDict_Index1800_callbacks; break;
+ case 0x1801: i = 23;*callbacks = ObjDict_Index1801_callbacks; break;
+ case 0x1802: i = 24;*callbacks = ObjDict_Index1802_callbacks; break;
+ case 0x1803: i = 25;*callbacks = ObjDict_Index1803_callbacks; break;
case 0x1A00: i = 26;break;
case 0x1A01: i = 27;break;
case 0x1A02: i = 28;break;
--- a/examples/DS401_Slave_Gui/ObjDict.h Sun Sep 30 22:38:58 2007 +0200
+++ b/examples/DS401_Slave_Gui/ObjDict.h Sun Sep 30 22:41:12 2007 +0200
@@ -12,6 +12,10 @@
/* Master node data struct */
extern CO_Data ObjDict_Data;
+extern ODCallback_t Transmit_PDO_1_Parameter_callbacks[]; /* Callbacks of index0x1800 */
+extern ODCallback_t Transmit_PDO_2_Parameter_callbacks[]; /* Callbacks of index0x1801 */
+extern ODCallback_t Transmit_PDO_3_Parameter_callbacks[]; /* Callbacks of index0x1802 */
+extern ODCallback_t Transmit_PDO_4_Parameter_callbacks[]; /* Callbacks of index0x1803 */
extern UNS8 Read_Inputs_8_Bit[1]; /* Mapped at index 0x6000, subindex 0x01 - 0x01 */
extern UNS8 Polarity_Input_8_Bit[1]; /* Mapped at index 0x6002, subindex 0x01 - 0x01 */
extern UNS8 Write_Outputs_8_Bit[1]; /* Mapped at index 0x6200, subindex 0x01 - 0x01 */
--- a/examples/DS401_Slave_Gui/TestSlaveGui.cpp Sun Sep 30 22:38:58 2007 +0200
+++ b/examples/DS401_Slave_Gui/TestSlaveGui.cpp Sun Sep 30 22:41:12 2007 +0200
@@ -58,22 +58,6 @@
extern wxTextCtrl *textLog;
extern int node_id_ext;
-UNS32 OnMasterMap1Update(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex)
-{
- return 0;
-}
-
-s_BOARD MasterBoard = {"1", "125K"};
-
-#if !defined(WIN32) || defined(__CYGWIN__)
-void catch_signal(int sig)
-{
- signal(SIGTERM, catch_signal);
- signal(SIGINT, catch_signal);
- printf("Got Signal %d\n",sig);
-}
-#endif
-
//*************************** INIT *****************************************
void InitNodes(CO_Data* d, UNS32 id)
{
@@ -91,11 +75,6 @@
{
printf("Bus name: %s Freq: %s Driver: %s\n", SlaveBoard.busname, SlaveBoard.baudrate, LibraryPath);
- #if !defined(WIN32) || defined(__CYGWIN__)
- signal(SIGTERM, catch_signal);
- signal(SIGINT, catch_signal);
- #endif
-
#ifndef NOT_USE_DYNAMIC_LOADING
LoadCanDriver(LibraryPath);
#endif
@@ -115,19 +94,21 @@
printf("Cannot open Slave Board (%s,%s)\n",SlaveBoard.busname, SlaveBoard.baudrate);
return (1);
}
- // Start timer thread
- //printf("nodeid slave=%x\n",node_id_ext);
+
StartTimerLoop(&InitNodes);
+
return 0;
}
void stop_slave()
{
- StopTimerLoop();
- // Close CAN devices (and can threads)
- // Stop master
+ EnterMutex();
+
setState(&ObjDict_Data, Stopped);
- //canClose(&ObjDict_Data);
- //canClose(&TestMaster_Data);
+ StopTimerLoop();
+ canClose(&ObjDict_Data);
+
+ LeaveMutex();
+
return;
}
--- a/examples/DS401_Slave_Gui/main.cpp Sun Sep 30 22:38:58 2007 +0200
+++ b/examples/DS401_Slave_Gui/main.cpp Sun Sep 30 22:41:12 2007 +0200
@@ -7,16 +7,16 @@
#include <iostream>
#include <wx/brush.h>
#include <sstream>
+#include <string.h>
#include <wx/listbox.h>
#include <wx/dynarray.h>
#include <wx/dcclient.h>
#include <wx/gauge.h>
#include <wx/spinctrl.h>
-#include "monicone.xpm"
+//#include "monicone.xpm"
#include "main.h"
-#include "tools.h"
#include "TestSlaveGui.h"
extern "C" {
#include "canfestival.h"
@@ -35,9 +35,15 @@
wxTextCtrl *textLog;
int node_id_ext;
+int to_start = 0;
MyFrame *frame;
-s_BOARD SlaveBoard = {NULL, NULL};
-char* LibraryPath = NULL;
+#define MAXLENGTH_BUSNAME 32
+#define MAXLENGTH_BAUDRATE 8
+char _busname[MAXLENGTH_BUSNAME] = "vcan0";
+char _baudrate[MAXLENGTH_BAUDRATE] = "500K";
+s_BOARD SlaveBoard = {_busname, _baudrate};
+#define MAXLENGTH_LIBPATH 1024
+char LibraryPath[MAXLENGTH_LIBPATH] = "libcanfestival_can_virtual.so";
double Gtime = 0;
double y[28][45];
double hdelta = 0;
@@ -121,7 +127,85 @@
EVT_TIMER(TIMER_ID, MyFrame::OnTimer)
END_EVENT_TABLE()
-IMPLEMENT_APP(MyApp)
+IMPLEMENT_APP_NO_MAIN(MyApp);
+IMPLEMENT_WX_THEME_SUPPORT;
+
+void help()
+{
+ printf("**************************************************************\n");
+ printf("* DS-401 Slave GUI *\n");
+ printf("* *\n");
+ printf("* Usage: *\n");
+ printf("* ./DS401_Slave_Gui [OPTIONS] *\n");
+ printf("* *\n");
+ printf("* OPTIONS: *\n");
+ printf("* -l : Can library [\"libcanfestival_can_virtual.so\"] *\n");
+ printf("* *\n");
+ printf("* Slave: *\n");
+ printf("* -i : Node id format [0x01 , 0x7F] *\n");
+ printf("* *\n");
+ printf("* CAN bus: *\n");
+ printf("* -b : bus name [\"1\"] *\n");
+ printf("* -B : 1M,500K,250K,125K,100K,50K,20K,10K *\n");
+ printf("* *\n");
+ printf("**************************************************************\n");
+}
+
+
+int main(int argc,char **argv)
+{
+
+ int c;
+ extern char *optarg;
+ char *snodeid;
+ while ((c = getopt(argc, argv, "-b:B:l:i:s")) != EOF)
+ {
+ switch(c)
+ {
+ case 'b' :
+ if (optarg[0] == 0)
+ {
+ help();
+ exit(1);
+ }
+ SlaveBoard.busname = optarg;
+ break;
+ case 'B' :
+ if (optarg[0] == 0)
+ {
+ help();
+ exit(1);
+ }
+ SlaveBoard.baudrate = optarg;
+ break;
+ case 'l' :
+ if (optarg[0] == 0)
+ {
+ help();
+ exit(1);
+ }
+ strncpy(LibraryPath, optarg, MAXLENGTH_LIBPATH);
+ break;
+ case 'i' :
+ if (optarg[0] == 0)
+ {
+ help();
+ exit(1);
+ }
+ snodeid = optarg;
+ sscanf(snodeid,"%x",&node_id_ext);
+ break;
+ case 's' :
+ to_start = 1;
+ break;
+ default:
+ help();
+ exit(1);
+ }
+ }
+ wxEntry(argc,argv);
+}
+
bool MyApp::OnInit()
{
@@ -148,7 +232,7 @@
wxStaticBox *namebox;
wxStaticBox *freqbox;
- SetIcon(wxICON(monicone));
+// SetIcon(wxICON(monicone));
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
helpMenu->Append(HELP_ABOUT, _T("&About...\tF1"),
_T("Show about dialog"));
@@ -178,17 +262,17 @@
mysizer->Add(myhsizer, 0, wxEXPAND | wxALL, 5);
load = new wxButton( panel, LOAD, _T("Load can driver"));
myhsizer->Add(load, 0, wxLEFT, 5);
- drivername = new wxTextCtrl(panel, wxID_ANY, _T("No driver loaded!!"));
+ drivername = new wxTextCtrl(panel, wxID_ANY, wxString((const char*)LibraryPath,wxConvLocal));
myhsizer->Add(drivername, 1, wxEXPAND | wxALL, 5);
myentrysizer = new wxBoxSizer( wxHORIZONTAL );
mysizer->Add(myentrysizer, 0, wxEXPAND | wxALL, 5);
myhsizer = new wxStaticBoxSizer( new wxStaticBox(panel, wxID_ANY, _T("Bus name")), wxHORIZONTAL );
myentrysizer->Add(myhsizer, 0, wxEXPAND | wxALL, 5);
- busname = new wxTextCtrl(panel, wxID_ANY, _T("0"));
+ busname = new wxTextCtrl(panel, wxID_ANY, wxString((const char*)SlaveBoard.busname, wxConvLocal));
myhsizer->Add(busname, 0, wxLEFT, 5);
myhsizer = new wxStaticBoxSizer( new wxStaticBox(panel, wxID_ANY, _T("Node ID (Hexa)")), wxHORIZONTAL );
myentrysizer->Add(myhsizer, 0, wxEXPAND | wxALL, 5);
- node_id = new wxSpinCtrl(panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 127, 1, _T("wxSpinCtrl"));
+ node_id = new wxSpinCtrl(panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 127, node_id_ext, _T("wxSpinCtrl"));
myhsizer->Add(node_id, 0, wxRIGHT, 5);
myhsizer = new wxStaticBoxSizer( new wxStaticBox(panel, wxID_ANY, _T("Baudrate")), wxHORIZONTAL );
mysizer->Add(myhsizer, wxEXPAND | wxALL, wxEXPAND | wxALL, 5);
@@ -370,6 +454,10 @@
for (int j = 0; j < 44; j++)
y[i][j] = 0;
m_timer.Start(100);
+ if(to_start)
+ {
+ Start();
+ }
}
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
@@ -377,40 +465,34 @@
Close(true);
}
+void MyFrame::Start()
+{
+ if (main_can(SlaveBoard, LibraryPath))
+ {
+ printf("[KO]\n");
+ *textLog << wxT("----------------------------------------------------Initialization [KO]\n");
+ }
+ else
+ {
+ printf("[OK]\n");
+ *textLog << wxT("----------------------------------------------------Initialization [OK]\n");
+ stop->Enable(true);
+ start->Enable(false);
+ }
+}
+
void MyFrame::OnStart(wxCommandEvent& WXUNUSED(event))
{
wxString s;
- if (LibraryPath == NULL)
- {
- *textLog << wxT("No driver found!! ----------------------------------Initialization [KO]\n");
- return;
- }
- if (SlaveBoard.baudrate == NULL)
- {
- *textLog << wxT("No baudrate found!! ----------------------------------Initialization [KO]\n");
- return;
- }
-
node_id_ext = node_id->GetValue();
s = busname->GetValue();
- SlaveBoard.busname = wxstr_to_charbuf(s);
+ strncpy(SlaveBoard.busname, s.mb_str(), MAXLENGTH_BUSNAME);
*textLog << wxT("-- Bus name: ------> ") << s << wxT("\n");
*textLog << wxT("-- Node ID: -------> ") << node_id->GetValue() << wxT("\n");
-
- if (main_can(SlaveBoard, LibraryPath))
- {
- printf("[KO]\n");
- *textLog << wxT("----------------------------------------------------Initialization [KO]\n");
- }
- else
- {
- printf("[OK]\n");
- *textLog << wxT("----------------------------------------------------Initialization [OK]\n");
- stop->Enable(true);
- start->Enable(false);
- }
-}
+ Start();
+}
+
void MyFrame::OnStop(wxCommandEvent& WXUNUSED(event))
{
@@ -419,7 +501,6 @@
stop_slave();
stop->Enable(false);
start->Enable(true);
- charbuf_free(SlaveBoard.busname);
}
void MyFrame::OnLoad(wxCommandEvent& WXUNUSED(event))
@@ -431,9 +512,7 @@
drivername->Clear();
drivername->AppendText(fd.GetPath());
*textLog << wxT("LibraryPath: ") << fd.GetPath() << wxT("\n");
- if (LibraryPath != NULL)
- charbuf_free(LibraryPath);
- LibraryPath = wxstr_to_charbuf(fd.GetPath());
+ strncpy(LibraryPath, fd.GetPath().mb_str(), MAXLENGTH_LIBPATH);
printf("path=%s",LibraryPath);
}
}
@@ -572,9 +651,7 @@
wxString wxstr;
wxstr = event.GetString();
- if (SlaveBoard.baudrate != NULL)
- charbuf_free(SlaveBoard.baudrate);
- SlaveBoard.baudrate = wxstr_to_charbuf(wxstr);
+ strncpy(SlaveBoard.baudrate, wxstr.mb_str(),MAXLENGTH_BAUDRATE);
*textLog << wxT("Baudrate:") << event.GetString() << wxT("\n");
}
@@ -595,23 +672,7 @@
static int get_bit(UNS8 input, int bit)
{
- if (bit == 1)
- return ((input & 0x1) ? 1 : 0);
- if (bit == 2)
- return ((input & 0x2) ? 1 : 0);
- if (bit == 3)
- return ((input & 0x4) ? 1 : 0);
- if (bit == 4)
- return ((input & 0x8) ? 1 : 0);
- if (bit == 5)
- return ((input & 0x10) ? 1 : 0);
- if (bit == 6)
- return ((input & 0x20) ? 1 : 0);
- if (bit == 7)
- return ((input & 0x40) ? 1 : 0);
- if (bit == 8)
- return ((input & 0x80) ? 1 : 0);
- return 0;
+ return input & (((UNS8)1) << bit) ? 1 : 0;
}
void MyFrame::Paint()
--- a/examples/DS401_Slave_Gui/main.h Sun Sep 30 22:38:58 2007 +0200
+++ b/examples/DS401_Slave_Gui/main.h Sun Sep 30 22:41:12 2007 +0200
@@ -86,6 +86,7 @@
void OnRemove(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnStart(wxCommandEvent& WXUNUSED(event));
+ void Start();
void OnStop(wxCommandEvent& WXUNUSED(event));
void OnFreqBoxClick(wxCommandEvent& WXUNUSED(event));
void OnLoad(wxCommandEvent& WXUNUSED(event));
--- a/examples/DS401_Slave_Gui/tools.cpp Sun Sep 30 22:38:58 2007 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#include <iostream>
-#include <wx/wxprec.h>
-#include <wx/wx.h>
-#include <wx/textctrl.h>
-#include <iostream>
-#include "tools.h"
-
- void IntToString( int i, char* in_pszbuffer )
-{
- // permet de copier un int dans la chaƮne buffer
- sprintf( in_pszbuffer, "%d", i);
-}
-
-char *wxstr_to_charbuf(wxString s)
-{
- int i = 0;
- char *str = NULL;
-
- str = (char*) malloc((s.Length() + 1) * sizeof(char));
- for(i=0; i<s.Length(); i++)
- {
- str[i] = s.GetChar(i);
- }
- str[s.Length()] = '\0';
- return(str);
-}
-
-void charbuf_free(char *s)
-{
- free(s);
-}
--- a/examples/DS401_Slave_Gui/tools.h Sun Sep 30 22:38:58 2007 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-#ifndef TOOLS_H_
-#define TOOLS_H_
-
- #include <wx/wxprec.h>
- #include <wx/wx.h>
- #include <wx/textctrl.h>
- #include <iostream>
-
- void IntToString( int i, char* in_pszbuffer );
- char *wxstr_to_charbuf(wxString s);
- void charbuf_free(char *s);
-
-#endif /*TOOLS_H_*/