(address)
| 706 | return this.readRegister(EFUSE_REG_BASE + (index << 2)); |
| 707 | } |
| 708 | async readRegister(address) { |
| 709 | const payload = new ArrayBuffer(4); |
| 710 | const view = new DataView(payload); |
| 711 | view.setUint32(0, address, true); // little-endian |
| 712 | |
| 713 | for (let i = 0; i < 3; i++) { |
| 714 | await this.command(Bootloader.READ_REG, payload); |
| 715 | |
| 716 | let reply = await this.getReply(); |
| 717 | if (!reply) |
| 718 | continue; |
| 719 | |
| 720 | reply = this.parseReply(reply, Bootloader.READ_REG); |
| 721 | if (!reply) |
| 722 | continue; |
| 723 | |
| 724 | return reply.value; |
| 725 | } |
| 726 | |
| 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 |
no test coverage detected