(baud, previous = 0)
| 727 | throw new Error(`readRegister ${address.toString(16)} failed`); |
| 728 | } |
| 729 | async changeBaud(baud, previous = 0) { |
| 730 | const view = new DataView(new ArrayBuffer(8)); |
| 731 | view.setUint32(0, baud, true); // little-endian |
| 732 | view.setUint32(4, previous, true); // little-endian |
| 733 | await this.command(Bootloader.CHANGE_BAUDRATE, view.buffer); |
| 734 | if (!this.parseReply(await this.getReply(), Bootloader.CHANGE_BAUDRATE)) |
| 735 | throw new Error("change baud failed"); |
| 736 | |
| 737 | await this.buildSerial(baud); |
| 738 | await new Promise(resolve => setTimeout(resolve, 50)); |
| 739 | this.#baud = baud; |
| 740 | } |
| 741 | async downloadToFlash(data, offset, compress = false, progress) { |
| 742 | const uncompressedByteLength = data.byteLength; |
| 743 | const FLASH_WRITE_SIZE = 16 * 1024; |
no test coverage detected