stm32dfu
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

stm32dfu.js

A library of host USB DFU drivers in Javascript utilizing the WebUSB draft standard to implement USB firmware updates from the browser.

Base: webdfu

Used

npm install stm32dfu
// init and conn
import stm32dfu from 'stm32dfu'
let deviceSettings = stm32dfu.findAllStm32Device(0x0483)  //修改0x0483为对应的vendorId
stm32dfu.getDfu(deviceSettings[0].device, deviceSettings[0])

// load dfu and flash
let dfuFile = stm32dfu.parseDfuImage([Blob])
let flashSetting = {
  logger : {
    debug: (...data) => {console.log(data)},
    info: (...data) => {console.log(data)},
    warn: (...data) => {console.log(data)},
    error: (...data) => {console.log(data)},
  },
  handler: (done, total) => {
    console.log(`${done} / ${total}`)
  }
}
stm32dfu.flash(deviceSettings[0], dfuFile, flashSetting).then()

TODO

  • [ ] demo
  • [ ] Rewrite using TypeScript

Demos

stm32dfu

https://kischang.github.io/stm32dfu/example/

dfu-util

A demo re-implementing dfu-util functionality in the browser:

https://devanlai.github.io/webdfu/dfu-util/

Readme

Keywords

Package Sidebar

Install

npm i stm32dfu

Weekly Downloads

2

Version

0.2.0

License

MIT

Unpacked Size

45.9 kB

Total Files

8

Last publish

Collaborators

  • kischang