How to use the cflib.bootloader.boottypes.BootVersion function in cflib

To help you get started, we’ve selected a few cflib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitcraze / crazyflie-clients-python / src / cfloader / __init__.py View on Github external
print("Restart the Crazyflie you want to bootload in the next"),
            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()