MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / changeBaud

Method changeBaud

tools/xsbug/esptool.js:729–740  ·  view source on GitHub ↗
(baud, previous = 0)

Source from the content-addressed store, hash-verified

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;

Callers 1

beginProgrammingMethod · 0.95

Calls 4

commandMethod · 0.95
parseReplyMethod · 0.95
getReplyMethod · 0.95
buildSerialMethod · 0.95

Tested by

no test coverage detected