Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sys.stdout.flush()
if bl.start_bootloader(warm_boot=False):
print(" done!")
else:
print("Cannot connect the bootloader!")
bl.close()
sys.exit(-1)
print("Connected to bootloader on {} (version=0x{:X})".format(
BootVersion.to_ver_string(bl.protocol_version),
bl.protocol_version))
if bl.protocol_version == BootVersion.CF2_PROTO_VER:
targets += (bl.get_target(TargetTypes.NRF51),)
targets += (bl.get_target(TargetTypes.STM32),)
######################################
# Doing something (hopefully) useful
######################################
# Print information about the targets
for target in targets:
print(target)
if action == "info":
None # Already done ...
elif action == "reset":
print
print("Reset in firmware mode ...")
bl.reset_to_firmware()
elif action == "flash":
bl.flash(filename, targetnames)
print(" 10 seconds ..."),
sys.stdout.flush()
if bl.start_bootloader(warm_boot=False):
print(" done!")
else:
print("Cannot connect the bootloader!")
bl.close()
sys.exit(-1)
print("Connected to bootloader on {} (version=0x{:X})".format(
BootVersion.to_ver_string(bl.protocol_version),
bl.protocol_version))
if bl.protocol_version == BootVersion.CF2_PROTO_VER:
targets += (bl.get_target(TargetTypes.NRF51),)
targets += (bl.get_target(TargetTypes.STM32),)
######################################
# Doing something (hopefully) useful
######################################
# Print information about the targets
for target in targets:
print(target)
if action == "info":
None # Already done ...
elif action == "reset":
print
print("Reset in firmware mode ...")
bl.reset_to_firmware()
elif action == "flash":