def a_ver_esa_lectura(pics): for line in fileinput.input(): if not fileinput.isfirstline(): #a tomar viento la primera linea # print(line) separada = line[:len(line) - 1].split(' ') # Separamos por ' ' # print(separada) fila = fileinput.lineno() # n de fila picLeido = Pic(fila - 1, separada) # construyo el leido... pics.append(picLeido) # y lo anado a la lista
def estoTeSacaUnaListaDeSlides(slides): picsVerticales = [] for line in fileinput.input(): if not fileinput.isfirstline(): #a tomar viento la primera linea separada = line[:len(line) - 1].split(' ') # Separamos por ' ' fila = fileinput.lineno() # n de fila picLeido = Pic(fila - 2, separada) # construyo el leido... if (picLeido.orientation()): picsVerticales.append(picLeido) else: slides.append(Slide(picLeido)) # y lo anado a la lista unirVerticales(slides, picsVerticales)
def estoTeSacaUnaListaDeSlides(slides): picsVerticales = [] for line in fileinput.input(): if not fileinput.isfirstline(): #a tomar viento la primera linea separada = line[:len(line) - 1].split(' ') # Separamos por ' ' fila = fileinput.lineno() # n de fila picLeido = Pic(fila - 2, separada) # construyo el leido... if (picLeido.orientation() ): # es vertical, pa la lista de verticales picsVerticales.append(picLeido) else: # no lo es, a los slides directo slides.append(Slide(picLeido)) # unimos lo verticales a los slides, maximizando tags unirVerticales(slides, picsVerticales)
def create_pic(filenames): for filename in filenames: pic = Pic(filename) yield pic
# The hex filename is just the passed filename hfilename = filename # If it's not HEX or ASM, what is it? else: raise Exception("Unknown file extension") # If a serial port has not been passed, use the first available one if len(sys.argv) < 3: sport = glob.glob('/dev/ttyUSB*')[0] # Otherwise used the passed one else: sport = sys.argv[2] # Init new HexFile and PIC instances hf = HexFile(hfilename) prog = Pic(sport, 9600, 0x03FF) # Write and verify the hex file to the pic prog.write_file(hf) prog.verify_file(hf) # Write and verify the config word from the hex file to the pic prog.write_verify_config_file(hf) # Run the program on the pic prog.execute() # Close the connection with the pic prog.close()