etherlab/CommonEtherCATFunction.py
changeset 2367 0fb54172a18b
parent 2366 d635680e4c2c
child 2370 e40f3914e55f
equal deleted inserted replaced
2366:d635680e4c2c 2367:0fb54172a18b
   785             data = 0
   785             data = 0
   786             mb = device.getMailbox()
   786             mb = device.getMailbox()
   787             if mb is not None :
   787             if mb is not None :
   788                 for bit, mbprot in enumerate(mailbox_protocols):
   788                 for bit, mbprot in enumerate(mailbox_protocols):
   789                     if getattr(mb, "get%s" % mbprot)() is not None:
   789                     if getattr(mb, "get%s" % mbprot)() is not None:
   790                         data += 1<<bit
   790                         data += 1 << bit
   791             data = "{:0>4x}".format(data)
   791             data = "{:0>4x}".format(data)
   792             eeprom.append(data[2:4])
   792             eeprom.append(data[2:4])
   793             eeprom.append(data[0:2])
   793             eeprom.append(data[0:2])
   794 
   794 
   795             # resereved for EEPROM offset 0x003a-0x007b;
   795             # resereved for EEPROM offset 0x003a-0x007b;
  1182             coe = mb.getCoE()
  1182             coe = mb.getCoE()
  1183             if coe is not None:
  1183             if coe is not None:
  1184                 for bit, flag in enumerate(["SdoInfo", "PdoAssign", "PdoConfig",
  1184                 for bit, flag in enumerate(["SdoInfo", "PdoAssign", "PdoConfig",
  1185                                            "PdoUpload", "CompleteAccess"]):
  1185                                            "PdoUpload", "CompleteAccess"]):
  1186                     if getattr(coe, "get%s" % flag)() is not None:
  1186                     if getattr(coe, "get%s" % flag)() is not None:
  1187                         coe_details += 1<<bit
  1187                         coe_details += 1 << bit
  1188         eeprom.append("{:0>2x}".format(coe_details))
  1188         eeprom.append("{:0>2x}".format(coe_details))
  1189 
  1189 
  1190         # word 4 : FoE Details and EoE Details
  1190         # word 4 : FoE Details and EoE Details
  1191         #  FoE Details; <EtherCATInfo>-<Descriptions>-<Devices>-<Device>-<Mailbox>-<FoE>
  1191         #  FoE Details; <EtherCATInfo>-<Descriptions>-<Devices>-<Device>-<Mailbox>-<FoE>
  1192         if mb is not None and mb.getFoE() is not None:
  1192         if mb is not None and mb.getFoE() is not None: