397 for child in element["children"]: |
397 for child in element["children"]: |
398 if child["name"] == "CAN_Driver": |
398 if child["name"] == "CAN_Driver": |
399 child["type"] = local_canfestival_config.DLL_LIST |
399 child["type"] = local_canfestival_config.DLL_LIST |
400 return infos |
400 return infos |
401 |
401 |
|
402 def GetCanDriver(self): |
|
403 res = self.CanFestivalInstance.getCAN_Driver() |
|
404 if not res : |
|
405 return "" |
|
406 return res |
|
407 |
402 def CTNGenerate_C(self, buildpath, locations): |
408 def CTNGenerate_C(self, buildpath, locations): |
403 can_driver = self.CanFestivalInstance.getCAN_Driver() |
409 can_driver = self.GetCanDriver() |
404 if not can_driver : |
410 if can_driver is not None: |
405 can_driver = local_canfestival_config.DLL_LIST[0] |
411 can_drivers = local_canfestival_config.DLL_LIST |
406 can_drv_ext = self.GetCTRoot().GetBuilder().extension |
412 if can_driver not in can_drivers : |
407 can_driver_name = "libcanfestival_" + can_driver + can_drv_ext |
413 can_driver = can_drivers[0] |
|
414 can_drv_ext = self.GetCTRoot().GetBuilder().extension |
|
415 can_driver_name = "libcanfestival_" + can_driver + can_drv_ext |
|
416 else: |
|
417 can_driver_name = "" |
|
418 |
408 |
419 |
409 format_dict = {"locstr" : "_".join(map(str,self.GetCurrentLocation())), |
420 format_dict = {"locstr" : "_".join(map(str,self.GetCurrentLocation())), |
410 "candriver" : can_driver_name, |
421 "candriver" : can_driver_name, |
411 "nodes_includes" : "", |
422 "nodes_includes" : "", |
412 "board_decls" : "", |
423 "board_decls" : "", |
498 f = open(cf_main_path,'w') |
509 f = open(cf_main_path,'w') |
499 f.write(cf_main) |
510 f.write(cf_main) |
500 f.close() |
511 f.close() |
501 |
512 |
502 res = [(cf_main_path, local_canfestival_config.getCFLAGS(CanFestivalPath))],local_canfestival_config.getLDFLAGS(CanFestivalPath), True |
513 res = [(cf_main_path, local_canfestival_config.getCFLAGS(CanFestivalPath))],local_canfestival_config.getLDFLAGS(CanFestivalPath), True |
503 |
514 |
504 can_driver_path = os.path.join(CanFestivalPath,"drivers",can_driver,can_driver_name) |
515 if can_driver is not None: |
505 if os.path.exists(can_driver_path): |
516 can_driver_path = os.path.join(CanFestivalPath,"drivers",can_driver,can_driver_name) |
506 res += ((can_driver_name, file(can_driver_path,"rb")),) |
517 if os.path.exists(can_driver_path): |
|
518 res += ((can_driver_name, file(can_driver_path,"rb")),) |
507 |
519 |
508 return res |
520 return res |
509 |
521 |