if len(sys.argv) != 4: print("ERROR, USAGE: build_pininfo.py BOARD_NAME jspininfo.c jspininfo.h") exit(1) boardname = sys.argv[1] pininfoSourceFilename = sys.argv[2] pininfoHeaderFilename = sys.argv[3] print("PININFO_SOURCE_FILENAME" + pininfoSourceFilename) print("PININFO_HEADER_FILENAME" + pininfoHeaderFilename) print("BOARD " + boardname) # import the board def board = importlib.import_module(boardname) # Call the included board_specific file - it sets up 'pins' and 'fill_gaps' pins = board.get_pins() pins = pinutils.remove_used_pinfunctions(pins, board) #print(json.dumps(pins, sort_keys=True, indent=2)) # ----------------------------------------------------------------------------------------- pininfoSourceFile = open(pininfoSourceFilename, 'w') pininfoHeaderFile = open(pininfoHeaderFilename, 'w') def writesource(s): pininfoSourceFile.write(s + "\n") def writeheader(s): pininfoHeaderFile.write(s + "\n")
exit(1) print("BOARD "+boardname) #htmlFilename = sys.argv[2] htmlFilename = "boards/"+boardname+".html" print("HTML_FILENAME "+htmlFilename) htmlFile = open(htmlFilename, 'w') def writeHTML(s): htmlFile.write(s+"\n"); # import the board def board = importlib.import_module(boardname) # Call the included board_specific file - it sets up 'pins' and 'fill_gaps' pins = board.get_pins() pins = pinutils.append_devices_to_pin_list(pins, board) pins = pinutils.remove_used_pinfunctions(pins, board) #if not embeddable and "link" in board.info and board.info["link"][0].startswith("http://www.espruino.com"): # writeHTML('<html><head><meta http-equiv="refresh" content="0; url="'+board.info["link"][0]+'"></head><body>Please wait. redirecting...</body></html>'); # exit(0); # ----------------------------------------------------------------------------------------- functionsOnBoard = []; for pin in pins: if pin["name"][0] == 'P': pin["name"] = pin["name"][1:]; for func in pin["functions"]: if func in pinutils.CLASSES: if not pinutils.CLASSES[func] in functionsOnBoard: functionsOnBoard.append(pinutils.CLASSES[func])