(self, warm_boot=False)
| 85 | in_boot_cb=self.in_bootloader_cb) |
| 86 | |
| 87 | def start_bootloader(self, warm_boot=False): |
| 88 | if warm_boot: |
| 89 | self._cload.open_bootloader_uri(self.clink) |
| 90 | started = self._cload.reset_to_bootloader(TargetTypes.NRF51) |
| 91 | if started: |
| 92 | started = self._cload.check_link_and_get_info() |
| 93 | else: |
| 94 | uri = self._cload.scan_for_bootloader() |
| 95 | |
| 96 | # Workaround for libusb on Windows (open/close too fast) |
| 97 | time.sleep(1) |
| 98 | |
| 99 | if uri: |
| 100 | self._cload.open_bootloader_uri(uri) |
| 101 | started = self._cload.check_link_and_get_info() |
| 102 | else: |
| 103 | started = False |
| 104 | |
| 105 | if started: |
| 106 | self.protocol_version = self._cload.protocol_version |
| 107 | |
| 108 | if (self.protocol_version == BootVersion.CF1_PROTO_VER_0 or |
| 109 | self.protocol_version == BootVersion.CF1_PROTO_VER_1): |
| 110 | # Nothing more to do |
| 111 | pass |
| 112 | elif self.protocol_version == BootVersion.CF2_PROTO_VER: |
| 113 | self._cload.request_info_update(TargetTypes.NRF51) |
| 114 | else: |
| 115 | print('Bootloader protocol 0x{:X} not ' |
| 116 | 'supported!'.self.protocol_version) |
| 117 | |
| 118 | return started |
| 119 | |
| 120 | def get_target(self, target_id): |
| 121 | return self._cload.request_info_update(target_id) |
nothing calls this directly
no test coverage detected