author | Christian Taedcke <hacking@taedcke.com> |
Mon, 23 Jan 2012 21:35:32 +0100 | |
changeset 707 | 4c52690c53fb |
parent 670 | e37511baf56b |
permissions | -rw-r--r-- |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
1 |
/* |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
2 |
This file is part of CanFestival, a library implementing CanOpen Stack. |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
3 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
4 |
Copyright (C): Edouard TISSERANT and Francis DUPIN |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
5 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
6 |
See COPYING file for copyrights details. |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
7 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
8 |
This library is free software; you can redistribute it and/or |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
9 |
modify it under the terms of the GNU Lesser General Public |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
10 |
License as published by the Free Software Foundation; either |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
11 |
version 2.1 of the License, or (at your option) any later version. |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
12 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
13 |
This library is distributed in the hope that it will be useful, |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
16 |
Lesser General Public License for more details. |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
17 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
18 |
You should have received a copy of the GNU Lesser General Public |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
19 |
License along with this library; if not, write to the Free Software |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
21 |
*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
22 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
23 |
#if defined(WIN32) && !defined(__CYGWIN__) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
24 |
#include <windows.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
25 |
#include "getopt.h" |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
26 |
void pause(void) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
27 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
28 |
system("PAUSE"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
29 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
30 |
#else |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
31 |
#include <unistd.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
32 |
#include <stdio.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
33 |
#include <string.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
34 |
#include <stdlib.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
35 |
#include <signal.h> |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
36 |
#endif |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
37 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
38 |
#include "canfestival.h" |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
39 |
#include "TestMasterMicroMod.h" |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
40 |
#include "TestMaster.h" |
540 | 41 |
unsigned int slavenodeid; |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
42 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
43 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
44 |
/*****************************************************************************/ |
378
d2abf6c8c27b
As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents:
246
diff
changeset
|
45 |
void TestMaster_heartbeatError(CO_Data* d, UNS8 heartbeatID) |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
46 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
47 |
eprintf("TestMaster_heartbeatError %d\n", heartbeatID); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
48 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
49 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
50 |
/******************************************************** |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
51 |
* ConfigureSlaveNode is responsible to |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
52 |
* - setup master RPDO 1 to receive TPDO 1 from id 0x40 |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
53 |
* - setup master TPDO 1 to send RPDO 1 to id 0x40 |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
54 |
********************************************************/ |
378
d2abf6c8c27b
As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents:
246
diff
changeset
|
55 |
void TestMaster_initialisation(CO_Data* d) |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
56 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
57 |
UNS32 PDO1_COBID = 0x0180 + slavenodeid; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
58 |
UNS32 PDO2_COBID = 0x0200 + slavenodeid; |
540 | 59 |
UNS32 size = sizeof(UNS32); |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
60 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
61 |
eprintf("TestMaster_initialisation\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
62 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
63 |
/***************************************** |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
64 |
* Define RPDOs to match slave ID=0x40 TPDOs* |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
65 |
*****************************************/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
66 |
writeLocalDict( &TestMaster_Data, /*CO_Data* d*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
67 |
0x1400, /*UNS16 index*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
68 |
0x01, /*UNS8 subind*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
69 |
&PDO1_COBID, /*void * pSourceData,*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
70 |
&size, /* UNS8 * pExpectedSize*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
71 |
RW); /* UNS8 checkAccess */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
72 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
73 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
74 |
/***************************************** |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
75 |
* Define TPDOs to match slave ID=0x40 RPDOs* |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
76 |
*****************************************/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
77 |
writeLocalDict( &TestMaster_Data, /*CO_Data* d*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
78 |
0x1800, /*UNS16 index*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
79 |
0x01, /*UNS8 subind*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
80 |
&PDO2_COBID, /*void * pSourceData,*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
81 |
&size, /* UNS8 * pExpectedSize*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
82 |
RW); /* UNS8 checkAccess */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
83 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
84 |
|
454 | 85 |
static int init_step = 0; |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
86 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
87 |
/*Froward declaration*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
88 |
static void ConfigureSlaveNode(CO_Data* d, UNS8 nodeId); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
89 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
90 |
/**/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
91 |
static void CheckSDOAndContinue(CO_Data* d, UNS8 nodeId) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
92 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
93 |
UNS32 abortCode; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
94 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
95 |
if(getWriteResultNetworkDict (d, nodeId, &abortCode) != SDO_FINISHED) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
96 |
eprintf("Master : Failed in initializing slave %2.2x, step %d, AbortCode :%4.4x \n", nodeId, init_step, abortCode); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
97 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
98 |
/* Finalise last SDO transfer with this node */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
99 |
closeSDOtransfer(&TestMaster_Data, nodeId, SDO_CLIENT); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
100 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
101 |
ConfigureSlaveNode(d, nodeId); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
102 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
103 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
104 |
/******************************************************** |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
105 |
* ConfigureSlaveNode is responsible to |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
106 |
* - setup slave TPDO 1 transmit time |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
107 |
* - setup slave TPDO 2 transmit time |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
108 |
* - setup slave Heartbeat Producer time |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
109 |
* - switch to operational mode |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
110 |
* - send NMT to slave |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
111 |
******************************************************** |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
112 |
* This an example of : |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
113 |
* Network Dictionary Access (SDO) with Callback |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
114 |
* Slave node state change request (NMT) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
115 |
******************************************************** |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
116 |
* This is called first by TestMaster_preOperational |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
117 |
* then it called again each time a SDO exchange is |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
118 |
* finished. |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
119 |
********************************************************/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
120 |
static void ConfigureSlaveNode(CO_Data* d, UNS8 nodeId) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
121 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
122 |
UNS8 res; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
123 |
eprintf("Master : ConfigureSlaveNode %2.2x\n", nodeId); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
124 |
printf("nodeid slave=%x\n",nodeId); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
125 |
switch(++init_step){ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
126 |
case 1: |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
127 |
{ /*disable Slave's TPDO 1 */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
128 |
UNS32 TPDO_COBId = 0x80000180 + nodeId; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
129 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
130 |
eprintf("Master : disable slave %2.2x TPDO 1 \n", nodeId); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
131 |
res = writeNetworkDictCallBack (d, /*CO_Data* d*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
132 |
/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
133 |
nodeId, /*UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
134 |
0x1800, /*UNS16 index*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
135 |
0x01, /*UNS8 subindex*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
136 |
4, /*UNS8 count*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
137 |
0, /*UNS8 dataType*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
138 |
&TPDO_COBId,/*void *data*/ |
670
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
139 |
CheckSDOAndContinue, /*SDOCallback_t Callback*/ |
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
140 |
0); /* use block mode */ |
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
141 |
} |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
142 |
break; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
143 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
144 |
case 2: |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
145 |
{ /*setup Slave's TPDO 1 to be transmitted on SYNC*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
146 |
UNS8 Transmission_Type = 0x01; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
147 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
148 |
eprintf("Master : set slave %2.2x TPDO 1 transmit type\n", nodeId); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
149 |
res = writeNetworkDictCallBack (d, /*CO_Data* d*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
150 |
/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
151 |
nodeId, /*UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
152 |
0x1800, /*UNS16 index*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
153 |
0x02, /*UNS8 subindex*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
154 |
1, /*UNS8 count*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
155 |
0, /*UNS8 dataType*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
156 |
&Transmission_Type,/*void *data*/ |
670
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
157 |
CheckSDOAndContinue, /*SDOCallback_t Callback*/ |
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
158 |
0); /* use block mode */ |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
159 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
160 |
break; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
161 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
162 |
case 3: |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
163 |
{ /*re-enable Slave's TPDO 1 */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
164 |
UNS32 TPDO_COBId = 0x00000180 + nodeId; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
165 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
166 |
eprintf("Master : re-enable slave %2.2x TPDO 1\n", nodeId); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
167 |
res = writeNetworkDictCallBack (d, /*CO_Data* d*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
168 |
/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
169 |
nodeId, /*UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
170 |
0x1800, /*UNS16 index*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
171 |
0x01, /*UNS8 subindex*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
172 |
4, /*UNS8 count*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
173 |
0, /*UNS8 dataType*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
174 |
&TPDO_COBId,/*void *data*/ |
670
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
175 |
CheckSDOAndContinue, /*SDOCallback_t Callback*/ |
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
176 |
0); /* use block mode */ |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
177 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
178 |
break; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
179 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
180 |
case 4: |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
181 |
{ /*disable Slave's TPDO 2 */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
182 |
UNS32 TPDO_COBId = 0x80000200 + nodeId; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
183 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
184 |
eprintf("Master : disable slave %2.2x RPDO 1\n", nodeId); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
185 |
res = writeNetworkDictCallBack (d, /*CO_Data* d*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
186 |
/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
187 |
nodeId, /*UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
188 |
0x1400, /*UNS16 index*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
189 |
0x01, /*UNS8 subindex*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
190 |
4, /*UNS8 count*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
191 |
0, /*UNS8 dataType*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
192 |
&TPDO_COBId,/*void *data*/ |
670
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
193 |
CheckSDOAndContinue, /*SDOCallback_t Callback*/ |
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
194 |
0); /* use block mode */ |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
195 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
196 |
break; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
197 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
198 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
199 |
case 5: |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
200 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
201 |
UNS8 Transmission_Type = 0x01; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
202 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
203 |
eprintf("Master : set slave %2.2x RPDO 1 receive type\n", nodeId); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
204 |
res = writeNetworkDictCallBack (d, /*CO_Data* d*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
205 |
/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
206 |
nodeId, /*UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
207 |
0x1400, /*UNS16 index*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
208 |
0x02, /*UNS8 subindex*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
209 |
1, /*UNS8 count*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
210 |
0, /*UNS8 dataType*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
211 |
&Transmission_Type,/*void *data*/ |
670
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
212 |
CheckSDOAndContinue, /*SDOCallback_t Callback*/ |
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
213 |
0); /* use block mode */ |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
214 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
215 |
break; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
216 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
217 |
case 6: |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
218 |
{ /*re-enable Slave's TPDO 1 */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
219 |
UNS32 TPDO_COBId = 0x00000200 + nodeId; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
220 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
221 |
eprintf("Master : re-enable %2.2x RPDO 1\n", nodeId); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
222 |
res = writeNetworkDictCallBack (d, /*CO_Data* d*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
223 |
/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
224 |
nodeId, /*UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
225 |
0x1400, /*UNS16 index*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
226 |
0x01, /*UNS8 subindex*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
227 |
4, /*UNS8 count*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
228 |
0, /*UNS8 dataType*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
229 |
&TPDO_COBId,/*void *data*/ |
670
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
230 |
CheckSDOAndContinue, /*SDOCallback_t Callback*/ |
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
231 |
0); /* use block mode */ |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
232 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
233 |
break; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
234 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
235 |
case 7: |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
236 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
237 |
UNS16 Heartbeat_Producer_Time = 0x03E8; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
238 |
eprintf("Master : set slave %2.2x heartbeat producer time \n", nodeId); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
239 |
res = writeNetworkDictCallBack (d, /*CO_Data* d*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
240 |
/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
241 |
nodeId, /*UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
242 |
0x1017, /*UNS16 index*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
243 |
0x00, /*UNS8 subindex*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
244 |
2, /*UNS8 count*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
245 |
0, /*UNS8 dataType*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
246 |
&Heartbeat_Producer_Time,/*void *data*/ |
670
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
247 |
CheckSDOAndContinue, /*SDOCallback_t Callback*/ |
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
248 |
0); /* use block mode */ |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
249 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
250 |
break; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
251 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
252 |
case 8: |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
253 |
{ /*disable Slave's TPDO 2 */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
254 |
UNS32 TPDO_COBId = 0x80000280 + nodeId; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
255 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
256 |
eprintf("Master : disable slave %2.2x TPDO 2 \n", nodeId); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
257 |
res = writeNetworkDictCallBack (d, /*CO_Data* d*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
258 |
/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
259 |
nodeId, /*UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
260 |
0x1801, /*UNS16 index*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
261 |
0x01, /*UNS8 subindex*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
262 |
4, /*UNS8 count*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
263 |
0, /*UNS8 dataType*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
264 |
&TPDO_COBId,/*void *data*/ |
670
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
265 |
CheckSDOAndContinue, /*SDOCallback_t Callback*/ |
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
266 |
0); /* use block mode */ |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
267 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
268 |
break; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
269 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
270 |
case 9: |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
271 |
{ /*disable Slave's TPDO 3 */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
272 |
UNS32 TPDO_COBId = 0x80000380 + nodeId; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
273 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
274 |
eprintf("Master : disable slave %2.2x TPDO 3 \n", nodeId); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
275 |
res = writeNetworkDictCallBack (d, /*CO_Data* d*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
276 |
/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
277 |
nodeId, /*UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
278 |
0x1802, /*UNS16 index*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
279 |
0x01, /*UNS8 subindex*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
280 |
4, /*UNS8 count*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
281 |
0, /*UNS8 dataType*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
282 |
&TPDO_COBId,/*void *data*/ |
670
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
283 |
CheckSDOAndContinue, /*SDOCallback_t Callback*/ |
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
284 |
0); /* use block mode */ |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
285 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
286 |
break; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
287 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
288 |
case 10: |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
289 |
{ /*disable Slave's TPDO 2 */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
290 |
UNS32 TPDO_COBId = 0x80000480 + nodeId; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
291 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
292 |
eprintf("Master : disable slave %2.2x TPDO 4 \n", nodeId); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
293 |
res = writeNetworkDictCallBack (d, /*CO_Data* d*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
294 |
/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
295 |
nodeId, /*UNS8 nodeId*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
296 |
0x1803, /*UNS16 index*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
297 |
0x01, /*UNS8 subindex*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
298 |
4, /*UNS8 count*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
299 |
0, /*UNS8 dataType*/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
300 |
&TPDO_COBId,/*void *data*/ |
670
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
301 |
CheckSDOAndContinue, /*SDOCallback_t Callback*/ |
e37511baf56b
New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
Mongo
parents:
540
diff
changeset
|
302 |
0); /* use block mode */ |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
303 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
304 |
break; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
305 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
306 |
case 11: |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
307 |
/* Put the master in operational mode */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
308 |
setState(d, Operational); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
309 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
310 |
/* Ask slave node to go in operational mode */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
311 |
masterSendNMTstateChange (d, nodeId, NMT_Start_Node); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
312 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
313 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
314 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
315 |
|
378
d2abf6c8c27b
As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents:
246
diff
changeset
|
316 |
void TestMaster_preOperational(CO_Data* d) |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
317 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
318 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
319 |
eprintf("TestMaster_preOperational\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
320 |
ConfigureSlaveNode(&TestMaster_Data, slavenodeid); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
321 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
322 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
323 |
|
378
d2abf6c8c27b
As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents:
246
diff
changeset
|
324 |
void TestMaster_operational(CO_Data* d) |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
325 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
326 |
eprintf("TestMaster_operational\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
327 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
328 |
|
378
d2abf6c8c27b
As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents:
246
diff
changeset
|
329 |
void TestMaster_stopped(CO_Data* d) |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
330 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
331 |
eprintf("TestMaster_stopped\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
332 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
333 |
|
378
d2abf6c8c27b
As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents:
246
diff
changeset
|
334 |
void TestMaster_post_sync(CO_Data* d) |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
335 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
336 |
DO++; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
337 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
338 |
AO1 = AI1 / 2; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
339 |
AO2 = AI2 / 2; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
340 |
AO3 = AI3 / 2; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
341 |
AO4 = AI4 / 2; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
342 |
eprintf("MicroMod Digital Out: %2.2x\n",DO); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
343 |
eprintf("MicroMod Analogue Out1: %d\n",AO1); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
344 |
eprintf("MicroMod Analogue Out2: %d\n",AO2); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
345 |
eprintf("MicroMod Analogue Out3: %d\n",AO3); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
346 |
eprintf("MicroMod Analogue Out4: %d\n",AO4); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
347 |
eprintf("MicroMod Digital In (by bit): DI1: %2.2x DI2: %2.2x DI3: %2.2x DI4: %2.2x DI5: %2.2x DI6: %2.2x DI7: %2.2x DI8: %2.2x\n",DI1,DI2,DI3,DI4,DI5,DI6,DI7,DI8); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
348 |
eprintf("MicroMod Analogue In1: %d\n", AI1); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
349 |
eprintf("MicroMod Analogue In2: %d\n", AI2); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
350 |
eprintf("MicroMod Analogue In3: %d\n", AI3); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
351 |
eprintf("MicroMod Analogue In4: %d\n", AI4); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
352 |
eprintf("MicroMod Analogue In5: %d\n", AI5); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
353 |
eprintf("MicroMod Analogue In6: %d\n", AI6); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
354 |
eprintf("MicroMod Analogue In7: %d\n", AI7); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
355 |
eprintf("MicroMod Analogue In8: %d\n", AI8); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
356 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
357 |
|
378
d2abf6c8c27b
As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents:
246
diff
changeset
|
358 |
void TestMaster_post_TPDO(CO_Data* d) |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
359 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
360 |
// eprintf("TestMaster_post_TPDO\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
361 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
362 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
363 |
//s_BOARD SlaveBoard = {"0", "500K"}; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
364 |
s_BOARD MasterBoard = {"32", "125K"}; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
365 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
366 |
#if !defined(WIN32) || defined(__CYGWIN__) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
367 |
void catch_signal(int sig) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
368 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
369 |
signal(SIGTERM, catch_signal); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
370 |
signal(SIGINT, catch_signal); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
371 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
372 |
eprintf("Got Signal %d\n",sig); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
373 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
374 |
#endif |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
375 |
|
454 | 376 |
void help(void) |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
377 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
378 |
printf("**************************************************************\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
379 |
printf("* TestMasterMicroMod *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
380 |
printf("* *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
381 |
printf("* A simple example for PC. *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
382 |
printf("* A CanOpen master that control a MicroMod module: *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
383 |
printf("* - setup module TPDO 1 transmit type *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
384 |
printf("* - setup module RPDO 1 transmit type *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
385 |
printf("* - setup module hearbeatbeat period *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
386 |
printf("* - disable others TPDOs *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
387 |
printf("* - set state to operational *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
388 |
printf("* - send periodic SYNC *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
389 |
printf("* - send periodic RPDO 1 to Micromod (digital output) *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
390 |
printf("* - listen Micromod's TPDO 1 (digital input) *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
391 |
printf("* - Mapping RPDO 1 bit per bit (digital input) *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
392 |
printf("* *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
393 |
printf("* Usage: *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
394 |
printf("* ./TestMasterMicroMod [OPTIONS] *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
395 |
printf("* *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
396 |
printf("* OPTIONS: *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
397 |
printf("* -l : Can library [\"libcanfestival_can_virtual.so\"] *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
398 |
printf("* *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
399 |
printf("* Slave: *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
400 |
printf("* -i : Slave Node id format [0x01 , 0x7F] *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
401 |
printf("* *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
402 |
printf("* Master: *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
403 |
printf("* -m : bus name [\"1\"] *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
404 |
printf("* -M : 1M,500K,250K,125K,100K,50K,20K,10K *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
405 |
printf("* *\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
406 |
printf("**************************************************************\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
407 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
408 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
409 |
/*************************** INIT *****************************************/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
410 |
void InitNodes(CO_Data* d, UNS32 id) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
411 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
412 |
/****************************** INITIALISATION MASTER *******************************/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
413 |
if(MasterBoard.baudrate){ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
414 |
/* Defining the node Id */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
415 |
//setNodeId(&TestMaster_Data, 0x01); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
416 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
417 |
/* init */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
418 |
setState(&TestMaster_Data, Initialisation); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
419 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
420 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
421 |
|
454 | 422 |
/*************************** EXIT *****************************************/ |
423 |
void Exit(CO_Data* d, UNS32 id) |
|
424 |
{ |
|
425 |
masterSendNMTstateChange(&TestMaster_Data, 0x02, NMT_Reset_Node); |
|
426 |
||
427 |
//Stop master |
|
428 |
setState(&TestMaster_Data, Stopped); |
|
429 |
} |
|
430 |
||
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
431 |
/****************************************************************************/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
432 |
/*************************** MAIN *****************************************/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
433 |
/****************************************************************************/ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
434 |
int main(int argc,char **argv) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
435 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
436 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
437 |
int c; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
438 |
extern char *optarg; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
439 |
char* LibraryPath="libcanfestival_can_virtual.so"; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
440 |
char *snodeid; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
441 |
while ((c = getopt(argc, argv, "-m:s:M:S:l:i:")) != EOF) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
442 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
443 |
switch(c) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
444 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
445 |
case 'm' : |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
446 |
if (optarg[0] == 0) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
447 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
448 |
help(); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
449 |
exit(1); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
450 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
451 |
MasterBoard.busname = optarg; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
452 |
break; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
453 |
case 'M' : |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
454 |
if (optarg[0] == 0) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
455 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
456 |
help(); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
457 |
exit(1); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
458 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
459 |
MasterBoard.baudrate = optarg; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
460 |
break; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
461 |
case 'l' : |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
462 |
if (optarg[0] == 0) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
463 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
464 |
help(); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
465 |
exit(1); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
466 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
467 |
LibraryPath = optarg; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
468 |
break; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
469 |
case 'i' : |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
470 |
if (optarg[0] == 0) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
471 |
{ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
472 |
help(); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
473 |
exit(1); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
474 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
475 |
snodeid = optarg; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
476 |
sscanf(snodeid,"%x",&slavenodeid); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
477 |
break; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
478 |
default: |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
479 |
help(); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
480 |
exit(1); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
481 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
482 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
483 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
484 |
#if !defined(WIN32) || defined(__CYGWIN__) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
485 |
/* install signal handler for manual break */ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
486 |
signal(SIGTERM, catch_signal); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
487 |
signal(SIGINT, catch_signal); |
454 | 488 |
TimerInit(); |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
489 |
#endif |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
490 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
491 |
#ifndef NOT_USE_DYNAMIC_LOADING |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
492 |
LoadCanDriver(LibraryPath); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
493 |
#endif |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
494 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
495 |
TestMaster_Data.heartbeatError = TestMaster_heartbeatError; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
496 |
TestMaster_Data.initialisation = TestMaster_initialisation; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
497 |
TestMaster_Data.preOperational = TestMaster_preOperational; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
498 |
TestMaster_Data.operational = TestMaster_operational; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
499 |
TestMaster_Data.stopped = TestMaster_stopped; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
500 |
TestMaster_Data.post_sync = TestMaster_post_sync; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
501 |
TestMaster_Data.post_TPDO = TestMaster_post_TPDO; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
502 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
503 |
if(!canOpen(&MasterBoard,&TestMaster_Data)){ |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
504 |
eprintf("Cannot open Master Board\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
505 |
goto fail_master; |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
506 |
} |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
507 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
508 |
// Start timer thread |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
509 |
StartTimerLoop(&InitNodes); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
510 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
511 |
// wait Ctrl-C |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
512 |
pause(); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
513 |
eprintf("Finishing.\n"); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
514 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
515 |
// Reset the slave node for next use (will stop emitting heartbeat) |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
516 |
masterSendNMTstateChange (&TestMaster_Data, slavenodeid, NMT_Reset_Node); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
517 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
518 |
// Stop master |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
519 |
setState(&TestMaster_Data, Stopped); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
520 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
521 |
// Stop timer thread |
454 | 522 |
StopTimerLoop(&Exit); |
246
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
523 |
|
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
524 |
fail_master: |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
525 |
if(MasterBoard.baudrate) canClose(&TestMaster_Data); |
d635cfc520ee
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff
changeset
|
526 |
|
454 | 527 |
TimerCleanup(); |
528 |
return 0; |
|
529 |
} |
|
530 |
||
531 |