def startFlash(self, disk): processed_disk_name = self.preprocessDeviceName(disk) print("Processed File Name: " + processed_disk_name) flashing_operation = Flash(processed_disk_name, self.disk_image_path, disk) flashing_operation.start() self.flashing_operations.append(flashing_operation)
def erasePage(self, flashPtr): if flashPtr < 0x10000: erase_size = 0x1000 else: erase_size = 0x8000 for i in range(0, 0x8000 / erase_size): Flash.erasePage(self, flashPtr + i * erase_size)
def programPage(self, flashPtr, bytes): if flashPtr < LARGE_PAGE_START_ADDR: assert len(bytes) <= SMALL_PAGE_SIZE else: assert len(bytes) <= LARGE_PAGE_SIZE pages = (len(bytes) + WRITE_SIZE - 1) // WRITE_SIZE for i in range(0, pages): data = bytes[i * WRITE_SIZE : (i + 1) * WRITE_SIZE] Flash.programPage(self, flashPtr + i * WRITE_SIZE, data)
def programPage(self, flashPtr, bytes): if flashPtr < LARGE_PAGE_START_ADDR: assert len(bytes) <= SMALL_PAGE_SIZE else: assert len(bytes) <= LARGE_PAGE_SIZE pages = (len(bytes) + WRITE_SIZE - 1) // WRITE_SIZE for i in range(0, pages): data = bytes[i * WRITE_SIZE: (i + 1) * WRITE_SIZE] Flash.programPage(self, flashPtr + i * WRITE_SIZE, data)
def thread_body(queue): pixels = NeoPixel(DATA_PIN, N_PIXELS, brightness=BRIGHTNESS, auto_write=False) updates = {'RAINBOW': Rainbow(pixels), 'ANT': Ant(pixels), 'OCD': Ocd(pixels), 'FLASH': Flash(pixels), 'IMPLODE': Implode(pixels), 'ERROR': Error(pixels), 'QUIT': Quit(pixels)} assert set(updates.keys()) == MODES mode = "OCD" while True: try: new_mode = queue.get_nowait() assert new_mode in MODES, "unknown mode %s" % mode if new_mode != mode: updates[new_mode].setup() mode = new_mode except: pass sleep = updates[mode].exec_update() if mode == "QUIT": break time.sleep(sleep)
def flash(drawing, data, width, height, reflect, opts=None): opts = opts or {} flash = Flash(width=width, height=height) flashes = [flash] nodes = len(data) // 2 for i in range(nodes): if flash.current_point().within_perimeter(flash.end, 10): flash = Flash(width=width, height=height) flashes.append(flash) else: flash.random_walk(data[i] * random.randrange(1, 7)**e, data[nodes - i - 1], mix=0.0) for flash in flashes: drawing = flash.render(drawing, opts.get('thickness')) return drawing
for i in range(4): backgrounds[i] = pygame.image.load( os.path.join('images', f'background_{i}.png')) points = Points() with open('river_system.txt') as input_file: points.read(input_file) levels = Levels('levels.txt') power_towers = PowerTowers(screen) vehicles = Vehicles(screen, points) destinations = Destinations(screen) hotels = Hotels(screen) travellers = Travellers(screen) flash = Flash(screen) map = Map( screen=screen, power_towers=power_towers, vehicles=vehicles, destinations=destinations, hotels=hotels, travellers=travellers, ) timer = Timer(screen) level = 0 background_index = 0 done = False
def erasePage(self, flashPtr): Flash.erasePage(self, flashPtr)
def programPage(self, flashPtr, bytes): write_size = 512 for i in range(0, 2): data = bytes[i * write_size:(i + 1) * write_size] Flash.programPage(self, flashPtr + i * write_size, data)
def programPage(self, flashPtr, bytes): pages = (len(bytes) + WRITE_SIZE - 1) // WRITE_SIZE for i in range(0, pages): data = bytes[i * WRITE_SIZE : (i + 1) * WRITE_SIZE] Flash.programPage(self, flashPtr + i * WRITE_SIZE, data)
def programPage(self, flashPtr, bytes): if SPIFI_START <= flashPtr < SPIFI_START + SPIFI_SIZE: assert len(bytes) <= SPIFI_SECTOR_SIZE Flash.programPage(self, flashPtr, bytes) else: super(Flash_lpc4088qsb_dm, self).programPage(flashPtr, bytes)
address = int(args.address, 0) if args.block_size == '4': bsize = 12 elif args.block_size == '32': bsize = 15 elif args.block_size == '64': bsize = 16 else: print('Block size value \'{}\' is wrong. Expected 4, 32 or 64'.format( args.block_size)) exit() from flash import Flash flash = Flash() flash.debug = args.debug flash.open(port) chip_info = {} chip_info = flash.get_device_info() for key in chip_info: print('{}: {} (0x{:02X})'.format(key, chip_info[key][0], chip_info[key][1])) if input is None: print('No input file. Skip write operation.') else: print('Write operation') if args.full_erase: flash.erase_chip()
def programPage(self, flashPtr, bytes): pages = (len(bytes) + WRITE_SIZE - 1) // WRITE_SIZE for i in range(0, pages): data = bytes[i * WRITE_SIZE:(i + 1) * WRITE_SIZE] Flash.programPage(self, flashPtr + i * WRITE_SIZE, data)
import argparse import os parser = argparse.ArgumentParser() parser.add_argument('-p', dest='portname', default=None) parser.add_argument('-d', dest='debug', action='store_true') args = parser.parse_args() port = args.portname if port == None: print('No port specified.') exit() from flash import Flash flash = Flash() flash.debug = args.debug flash.open(port) try: flash.release_rst() finally: flash.close()
import argparse import os parser = argparse.ArgumentParser() parser.add_argument('-p', dest='portname', default=None) parser.add_argument('-d', dest='debug', action='store_true') parser.add_argument('-a', dest='address', default=None) parser.add_argument('-s', dest='size', default=None, type=int) args = parser.parse_args() port = args.portname if port == None: print('No port specified.') exit() from flash import Flash flash = Flash() flash.debug = args.debug flash.open(port) try: input("waiting") print(flash.read(int(args.address, 0), args.size)) finally: flash.close()
from flash import Flash from redis import Redis import os app = Flash(__name__) redis = Redis(host='redis', port=6379) @app.route('/') def hello(): redis.incr('hits') return 'Hello World! I have beennseen %s times. ' % redis.get('hits') if __name__ =="__main__": app.run(host='0.0.0.0',debug=True)
def __init__(self, target): Flash.__init__(self, target, flash_algo, memoryMapXML)
import argparse import os parser = argparse.ArgumentParser() parser.add_argument('-p', dest='portname', default=None) parser.add_argument('-d', dest='debug', action='store_true') parser.add_argument('-a', dest='address', default=None) parser.add_argument('-v', dest='value', default=None) args = parser.parse_args() port = args.portname if port == None: print('No port specified.') exit() from flash import Flash flash = Flash() flash.debug = args.debug flash.open(port) try: flash.write_int(int(args.address, 0), int(args.value, 0)) finally: flash.close()
import argparse import os parser = argparse.ArgumentParser() parser.add_argument('-p', dest='portname', default=None) parser.add_argument('-d', dest='debug', action='store_true') args = parser.parse_args() port = args.portname if port == None: print('No port specified.') exit() from flash import Flash flash = Flash() flash.debug = True flash.open(port) try: input('Waiting rvl ready') data = [] data.append(0x03) flash._write(data, 259, True) finally: flash.close()
def programPage(self, flashPtr, bytes): pages = (len(bytes) + FLASH_16K_PAGE_SIZE - 1) // FLASH_16K_PAGE_SIZE for i in range(0, pages): data = bytes[i * FLASH_16K_PAGE_SIZE : (i + 1) * FLASH_16K_PAGE_SIZE] Flash.programPage(self, flashPtr + i * FLASH_16K_PAGE_SIZE, data)
if port == None: print('No port specified.') exit() if args.bsize == '64K': bsize = 64 * 1024 elif args.bsize == '4K': bsize = 4 * 1024 else: print('Block size {} is wrong. Supported 4K or 64K value') exit() from flash import Flash flash = Flash() flash.debug = args.debug flash.open(port) address = int(args.address, 0) size = int(args.size, 0) try: if address == 0 and size == 0: flash.erase_chip() else: chip_size = flash.get_chip_size() if size == 0: end_address = chip_size - 1 else: if address + size > chip_size:
def programPage(self, flashPtr, bytes): write_size = 1024 for i in range(0, 4): data = bytes[i * write_size : (i + 1) * write_size] Flash.programPage(self, flashPtr + i * write_size, data)
#Author Name - Imaya Bharathi #Date - 11-10-2019 - 12-10-2019 #purpose - sample flask app to keep the container running from flash import Flash app = Flash(__name__) @app.route("/") def honeypot(): return ('Hi from honeypot!') if __name__ == "main": app.run(debug=True, port=2222)
[Plasma(strip2D), 30], [Fire(strip2D), 30], [Fire2(strip2D), 30], [Night(strip2D), 30], [Fade1(strip2D), 3], [Fade2(strip2D), 3], [Stars1(strip2D), 15], [Stars2(strip2D), 10], [Hourglass(strip2D), 30], [Matrix(strip2D), 20], [Power(strip2D), 12], [Weird1(strip2D), 12], [Weird2(strip2D), 12], [Weird3(strip2D), 20], [Lighthouse(strip2D), 10], [Flash(strip2D), 10], ] def globalStop(self): print( "globalStop" ) self.artnet.clear() self.send() strip2D.strip.globalStop = globalStop #count = 0 count = random.randint(0, len(effects) - 1) dowait = False