144 while(newState != d->nodeState){ |
144 while(newState != d->nodeState){ |
145 switch( newState ){ |
145 switch( newState ){ |
146 case Initialisation: |
146 case Initialisation: |
147 { |
147 { |
148 s_state_communication newCommunicationState = {1, 0, 0, 0, 0, 0}; |
148 s_state_communication newCommunicationState = {1, 0, 0, 0, 0, 0}; |
149 /** This will force a second loop for the state switch */ |
149 /* This will force a second loop for the state switch */ |
150 d->nodeState = Initialisation; |
150 d->nodeState = Initialisation; |
151 newState = Pre_operational; |
151 newState = Pre_operational; |
152 switchCommunicationState(d, &newCommunicationState); |
152 switchCommunicationState(d, &newCommunicationState); |
153 /** call user app related state func. */ |
153 /* call user app related state func. */ |
154 (*d->initialisation)(); |
154 (*d->initialisation)(); |
155 |
155 |
156 } |
156 } |
157 break; |
157 break; |
158 |
158 |
234 **/ |
234 **/ |
235 void setNodeId(CO_Data* d, UNS8 nodeId) |
235 void setNodeId(CO_Data* d, UNS8 nodeId) |
236 { |
236 { |
237 UNS16 offset = d->firstIndex->SDO_SVR; |
237 UNS16 offset = d->firstIndex->SDO_SVR; |
238 if(offset){ |
238 if(offset){ |
239 /** cob_id_client = 0x600 + nodeId; */ |
239 /* cob_id_client = 0x600 + nodeId; */ |
240 *(UNS32*)d->objdict[offset].pSubindex[1].pObject = 0x600 + nodeId; |
240 *(UNS32*)d->objdict[offset].pSubindex[1].pObject = 0x600 + nodeId; |
241 /** cob_id_server = 0x580 + nodeId; */ |
241 /* cob_id_server = 0x580 + nodeId; */ |
242 *(UNS32*)d->objdict[offset].pSubindex[2].pObject = 0x580 + nodeId; |
242 *(UNS32*)d->objdict[offset].pSubindex[2].pObject = 0x580 + nodeId; |
243 /** node Id client. As we do not know the value, we put the node Id Server */ |
243 /* node Id client. As we do not know the value, we put the node Id Server */ |
244 /** *(UNS8*)d->objdict[offset].pSubindex[3].pObject = nodeId; */ |
244 /* *(UNS8*)d->objdict[offset].pSubindex[3].pObject = nodeId; */ |
245 } |
245 } |
246 |
246 |
247 /** |
247 /* |
248 Initialize the server(s) SDO parameters |
248 Initialize the server(s) SDO parameters |
249 Remember that only one SDO server is allowed, defined at index 0x1200 |
249 Remember that only one SDO server is allowed, defined at index 0x1200 |
250 |
250 |
251 Initialize the client(s) SDO parameters |
251 Initialize the client(s) SDO parameters |
252 Nothing to initialize (no default values required by the DS 401) |
252 Nothing to initialize (no default values required by the DS 401) |
276 *(UNS32*)d->objdict[offset].pSubindex[1].pObject = cobID[i] + nodeId; |
276 *(UNS32*)d->objdict[offset].pSubindex[1].pObject = cobID[i] + nodeId; |
277 i ++; |
277 i ++; |
278 offset ++; |
278 offset ++; |
279 } |
279 } |
280 } |
280 } |
281 /** bDeviceNodeId is defined in the object dictionary. */ |
281 /* bDeviceNodeId is defined in the object dictionary. */ |
282 *d->bDeviceNodeId = nodeId; |
282 *d->bDeviceNodeId = nodeId; |
283 } |
283 } |
284 |
284 |
285 void _initialisation(){} |
285 void _initialisation(){} |
286 void _preOperational(){} |
286 void _preOperational(){} |