print "Converting bitmap..." picturebitmap = [] # BW GIF pixels have a 0 value for white and 1 value for black. for col in range(0, im.size[0]): for row in range(0, im.size[1] // 8): pixblock = 0 for subrow in range(0, 8): pixblock = pixblock | (im.getpixel((col, row * 8 + subrow)) << (7 - subrow)) picturebitmap.append(pixblock) # Now initialize the display: we want to display a full screen picture, so # we will clear the screen, place the cursor home. uart = UART("COM4", 115200) print "Entering binmode: ", if uart.BBmode(): print "OK." else: print "failed." sys.exit() print "Entering binary UART mode: ", if uart.enter_UART(): print "OK." else: print "failed." sys.exit() print "Reset display (toggle AUX): ", uart.cfg_pins(0x00) uart.cfg_pins(PinCfg.POWER | PinCfg.AUX | PinCfg.PULLUPS)
DEFAULT_TIME_DIV = 1 DEFAULT_TRIGGER_LEV = 1.0 DEFAULT_TRIGGER_MODE = 0 DATA_RATE = 5720.0 #measures/second (estimated experimenticaly) DEFAULT_TIME_SCALE = RES_X / DATA_RATE #default time in seconds to make one window fill pygame.init() bp = UART(BUS_PIRATE_DEV,115200) print "Entering binmode: ", if bp.BBmode(): print "OK." else: print "failed." sys.exit() window = pygame.display.set_mode((RES_X, RES_Y)) background = (0,0,0) line = (0,255,0) trig_color = (100,100,0) time_div = DEFAULT_TIME_DIV trigger_level = DEFAULT_TRIGGER_LEV trig_mode = DEFAULT_TRIGGER_MODE bp.port.write("\x15")