feat(core): 支持通过web usb烧录固件

This commit is contained in:
王立帮
2025-10-24 16:07:57 +08:00
parent 42acf014f0
commit ed9a91afdc
10 changed files with 307 additions and 438 deletions

View File

@@ -117,6 +117,7 @@ class USB extends Serial {
#stringTemp_ = '';
constructor(port) {
super(port);
this.#device_ = USB.getPort(port);
}
#addEventsListener_() {
@@ -223,6 +224,14 @@ class USB extends Serial {
return this.setDTRAndRTS(this.getDTR(), rts);
}
getVID() {
return this.#device_.vendorId;
}
getPID() {
return this.#device_.productId;
}
onBuffer(buffer) {
super.onBuffer(buffer);
for (let i = 0; i < buffer.length; i++) {