Changeset 1727 for trunk/MagicSoft/Cosy/candrv/canopen.cc
- Timestamp:
- 01/23/03 13:32:58 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/candrv/canopen.cc
r1275 r1727 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz <mailto:tbretz@ uni-sw.gwdg.de>, 200119 ! 20 ! Copyright: MAGIC Software Development, 2000-200 118 ! Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>, 2003 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2003 21 21 ! 22 22 ! … … 84 84 { 85 85 const WORD_t fcode = cobid >> 7; 86 const BYTE_t node = cobid & 0x1f; 86 87 87 88 switch (fcode) … … 94 95 return; 95 96 96 case kSYNC: 97 cout << "Sync" << endl; 97 case kEMERGENCY: // also case kSYNC: 98 if (cobid==0) 99 cout << "Sync" << endl; 100 else 101 { 102 cout << "EMERGENCY Node #" << dec << (int)data[1] << endl; 103 HandleEmergency(node, tv); 104 } 105 return; 106 107 case kNodeguard: 108 //cout << "Nodeguard Node #" << dec << (int)node << endl; 109 HandleNodeguard(node, tv); 98 110 return; 99 111 100 112 case kSDO_RX: 101 113 { 102 const BYTE_t node = cobid & 0x1f;103 114 const BYTE_t cmd = data[0]; 104 115 const LWORD_t dat = data[4] | (data[5]<<8) | (data[6]<<16) | (data[7]<<24); … … 114 125 case kPDO1_TX: 115 126 { 116 const BYTE_t node = cobid & 0x1f;117 127 HandlePDO1(node, data, tv); 118 128 pthread_cond_broadcast(&fPdoCond[node-1][0]); … … 122 132 case kPDO2_TX: 123 133 { 124 const BYTE_t node = cobid & 0x1f;125 134 HandlePDO2(node, data, tv); 126 135 pthread_cond_broadcast(&fPdoCond[node-1][1]); … … 130 139 case kPDO3_TX: 131 140 { 132 const BYTE_t node = cobid & 0x1f;133 141 HandlePDO3(node, data, tv); 134 142 pthread_cond_broadcast(&fPdoCond[node-1][2]); … … 138 146 case kPDO4_TX: 139 147 { 140 const BYTE_t node = cobid & 0x1f;141 148 HandlePDO4(node, data, tv); 142 149 pthread_cond_broadcast(&fPdoCond[node-1][3]); … … 145 152 } 146 153 147 const BYTE_t node = cobid & 0x1f; 148 cout << "Function Code: 0x" << hex << fcode << " Node: " << dec << (int)node << endl; 154 cout << "CanOpen::HandleCanMessage - Unhandled Message: Function Code=0x" << hex << fcode << " Node #" << dec << (int)node << endl; 149 155 } 150 156 … … 168 174 { 169 175 EnableCanMsg(node, kEMERGENCY); 176 } 177 178 // -------------------------------------------------------------------------- 179 // 180 // Enables Nodeguard messages for a given node 181 // 182 void CanOpen::EnableNodeguard(BYTE_t node) 183 { 184 EnableCanMsg(node, kNodeguard); 170 185 } 171 186 … … 372 387 // -------------------------------------------------------------------------- 373 388 // 374 // Send a nNMT Message to the given node with command cmd389 // Send a NMT Message to the given node with command cmd 375 390 // 376 391 void CanOpen::SendNMT(BYTE_t node, BYTE_t cmd) … … 381 396 // -------------------------------------------------------------------------- 382 397 // 398 // Send a Nodeguard Message to the given node with command cmd 399 // 400 void CanOpen::SendNodeguard(BYTE_t node) 401 { 402 BYTE_t msg[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; 403 SendCanFrame(CobId(node, kNodeguard), msg, 1); 404 } 405 406 // -------------------------------------------------------------------------- 407 // 383 408 // Decodes node and function code into a CobId 384 409 //
Note:
See TracChangeset
for help on using the changeset viewer.