src/pdo.c
changeset 587 c175351a6994
parent 539 187058b4a4b8
child 611 3e0c776da33b
equal deleted inserted replaced
586:05ba6b57ff2b 587:c175351a6994
    50 {
    50 {
    51   const indextable *TPDO_com = d->objdict + d->firstIndex->PDO_TRS + numPdo;
    51   const indextable *TPDO_com = d->objdict + d->firstIndex->PDO_TRS + numPdo;
    52   const indextable *TPDO_map = d->objdict + d->firstIndex->PDO_TRS_MAP + numPdo;
    52   const indextable *TPDO_map = d->objdict + d->firstIndex->PDO_TRS_MAP + numPdo;
    53 
    53 
    54   UNS8 prp_j = 0x00;
    54   UNS8 prp_j = 0x00;
    55   UNS8 offset = 0x00;
    55   UNS32 offset = 0x00000000;
    56   const UNS8 *pMappingCount = (UNS8 *) TPDO_map->pSubindex[0].pObject;
    56   const UNS8 *pMappingCount = (UNS8 *) TPDO_map->pSubindex[0].pObject;
    57 
    57 
    58   pdo->cob_id = UNS16_LE(*(UNS32*)TPDO_com->pSubindex[1].pObject & 0x7FF);
    58   pdo->cob_id = UNS16_LE(*(UNS32*)TPDO_com->pSubindex[1].pObject & 0x7FF);
    59   pdo->rtr = NOT_A_REQUEST;
    59   pdo->rtr = NOT_A_REQUEST;
    60 
    60 
    91                        " Couldn't find mapped variable at index-subindex-size : ",
    91                        " Couldn't find mapped variable at index-subindex-size : ",
    92                        (UNS16) (*pMappingParameter));
    92                        (UNS16) (*pMappingParameter));
    93               return 0xFF;
    93               return 0xFF;
    94             }
    94             }
    95           /* copy bit per bit in little endian */
    95           /* copy bit per bit in little endian */
    96           CopyBits (Size, ((UNS8 *) tmp), 0, 0,
    96           CopyBits ((UNS8) Size, ((UNS8 *) tmp), 0, 0,
    97                     (UNS8 *) & pdo->data[offset >> 3], offset % 8, 0);
    97                     (UNS8 *) & pdo->data[offset >> 3], (UNS8)(offset % 8), 0);
    98 
    98 
    99           offset += Size;
    99           offset += Size;
   100         }
   100         }
   101       prp_j++;
   101       prp_j++;
   102     }
   102     }
   103   while (prp_j < *pMappingCount);
   103   while (prp_j < *pMappingCount);
   104 
   104 
   105   pdo->len = 1 + ((offset - 1) >> 3);
   105   pdo->len = (UNS8)(1 + ((offset - 1) >> 3));
   106 
   106 
   107   MSG_WAR (0x3015, "  End scan mapped variable", 0);
   107   MSG_WAR (0x3015, "  End scan mapped variable", 0);
   108 
   108 
   109   return 0;
   109   return 0;
   110 }
   110 }
   139           pwCobId = d->objdict[offset].pSubindex[1].pObject;
   139           pwCobId = d->objdict[offset].pSubindex[1].pObject;
   140 
   140 
   141           MSG_WAR (0x3930, "sendPDOrequest cobId is : ", *pwCobId);
   141           MSG_WAR (0x3930, "sendPDOrequest cobId is : ", *pwCobId);
   142           {
   142           {
   143             Message pdo;
   143             Message pdo;
   144             pdo.cob_id = UNS16_LE(*pwCobId);
   144             pdo.cob_id = (UNS16)UNS16_LE(*pwCobId);
   145             pdo.rtr = REQUEST;
   145             pdo.rtr = REQUEST;
   146             pdo.len = 0;
   146             pdo.len = 0;
   147             return canSend (d->canHandle, &pdo);
   147             return canSend (d->canHandle, &pdo);
   148           }
   148           }
   149         }
   149         }